mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
e9e4ee48ce
6 changed files with 21 additions and 42 deletions
|
@ -93,26 +93,16 @@ public class ProgramOpener {
|
||||||
*/
|
*/
|
||||||
public Program openProgram(ProgramLocator locator, TaskMonitor monitor) {
|
public Program openProgram(ProgramLocator locator, TaskMonitor monitor) {
|
||||||
if (locator.isURL()) {
|
if (locator.isURL()) {
|
||||||
try {
|
|
||||||
return openURL(locator, monitor);
|
return openURL(locator, monitor);
|
||||||
}
|
}
|
||||||
catch (CancelledException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
Msg.showError(this, null, "Program Open Failed",
|
|
||||||
"Failed to open Ghidra URL: " + locator.getURL());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return openProgram(locator, locator.getDomainFile(), monitor);
|
return openProgram(locator, locator.getDomainFile(), monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Program openURL(ProgramLocator locator, TaskMonitor monitor)
|
private Program openURL(ProgramLocator locator, TaskMonitor monitor) {
|
||||||
throws CancelledException, IOException {
|
|
||||||
URL ghidraUrl = locator.getURL();
|
URL ghidraUrl = locator.getURL();
|
||||||
|
|
||||||
AtomicReference<Program> openedProgram = new AtomicReference<>();
|
AtomicReference<Program> openedProgram = new AtomicReference<>();
|
||||||
|
try {
|
||||||
GhidraURLQuery.queryUrl(ghidraUrl, new GhidraURLResultHandlerAdapter() {
|
GhidraURLQuery.queryUrl(ghidraUrl, new GhidraURLResultHandlerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void processResult(DomainFile domainFile, URL url, TaskMonitor m) {
|
public void processResult(DomainFile domainFile, URL url, TaskMonitor m) {
|
||||||
|
@ -120,7 +110,11 @@ public class ProgramOpener {
|
||||||
openedProgram.set(p);
|
openedProgram.set(p);
|
||||||
}
|
}
|
||||||
}, monitor);
|
}, monitor);
|
||||||
|
}
|
||||||
|
catch (IOException | CancelledException e) {
|
||||||
|
// IOException reported to user by GhidraURLResultHandlerAdapter
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return openedProgram.get();
|
return openedProgram.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -465,12 +465,6 @@ public class FakeSharedProject {
|
||||||
|
|
||||||
void refresh() {
|
void refresh() {
|
||||||
DefaultProjectData projectData = getProjectData();
|
DefaultProjectData projectData = getProjectData();
|
||||||
try {
|
|
||||||
projectData.refresh(true);
|
projectData.refresh(true);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
|
||||||
// shouldn't happen
|
|
||||||
throw new AssertionFailedError("Unable to refresh project " + this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -742,7 +742,7 @@ public class DefaultProjectData implements ProjectData {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refresh(boolean force) throws IOException {
|
public void refresh(boolean force) {
|
||||||
try {
|
try {
|
||||||
rootFolderData.refresh(true, true, projectDisposalMonitor);
|
rootFolderData.refresh(true, true, projectDisposalMonitor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,14 +17,12 @@ package ghidra.framework.main.projectdata.actions;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import ghidra.framework.client.ClientUtil;
|
|
||||||
import ghidra.framework.main.datatable.ProjectDataContext;
|
|
||||||
import ghidra.framework.main.datatable.FrontendProjectTreeAction;
|
import ghidra.framework.main.datatable.FrontendProjectTreeAction;
|
||||||
|
import ghidra.framework.main.datatable.ProjectDataContext;
|
||||||
import ghidra.framework.model.ProjectData;
|
import ghidra.framework.model.ProjectData;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
import ghidra.util.task.*;
|
import ghidra.util.task.*;
|
||||||
|
@ -53,14 +51,8 @@ public class ProjectDataRefreshAction extends FrontendProjectTreeAction {
|
||||||
TaskLauncher.launch(new Task("Refresh folders and files", false, false, true) {
|
TaskLauncher.launch(new Task("Refresh folders and files", false, false, true) {
|
||||||
@Override
|
@Override
|
||||||
public void run(TaskMonitor monitor) {
|
public void run(TaskMonitor monitor) {
|
||||||
try {
|
|
||||||
projectData.refresh(false);
|
projectData.refresh(false);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
|
||||||
ClientUtil.handleException(projectData.getRepository(), e,
|
|
||||||
"Refresh Project Data", false, comp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,9 +143,8 @@ public interface ProjectData {
|
||||||
* Sync the Domain folder/file structure with the underlying file structure.
|
* Sync the Domain folder/file structure with the underlying file structure.
|
||||||
* @param force if true all folders will be be visited and refreshed, if false
|
* @param force if true all folders will be be visited and refreshed, if false
|
||||||
* only those folders previously visited will be refreshed.
|
* only those folders previously visited will be refreshed.
|
||||||
* @throws IOException if an IO error occurs
|
|
||||||
*/
|
*/
|
||||||
public void refresh(boolean force) throws IOException;
|
public void refresh(boolean force);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns User object associated with remote repository or null if a remote repository
|
* Returns User object associated with remote repository or null if a remote repository
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class TestDummyProjectData implements ProjectData {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refresh(boolean force) throws IOException {
|
public void refresh(boolean force) {
|
||||||
// stub
|
// stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue