Merge remote-tracking branch 'origin/patch'

This commit is contained in:
Ryan Kurtz 2024-06-24 13:59:30 -04:00
commit e9e4ee48ce
6 changed files with 21 additions and 42 deletions

View File

@ -93,34 +93,28 @@ public class ProgramOpener {
*/
public Program openProgram(ProgramLocator locator, TaskMonitor monitor) {
if (locator.isURL()) {
try {
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 openURL(locator, monitor);
}
return openProgram(locator, locator.getDomainFile(), monitor);
}
private Program openURL(ProgramLocator locator, TaskMonitor monitor)
throws CancelledException, IOException {
private Program openURL(ProgramLocator locator, TaskMonitor monitor) {
URL ghidraUrl = locator.getURL();
AtomicReference<Program> openedProgram = new AtomicReference<>();
GhidraURLQuery.queryUrl(ghidraUrl, new GhidraURLResultHandlerAdapter() {
@Override
public void processResult(DomainFile domainFile, URL url, TaskMonitor m) {
Program p = openProgram(locator, domainFile, m); // may return null
openedProgram.set(p);
}
}, monitor);
try {
GhidraURLQuery.queryUrl(ghidraUrl, new GhidraURLResultHandlerAdapter() {
@Override
public void processResult(DomainFile domainFile, URL url, TaskMonitor m) {
Program p = openProgram(locator, domainFile, m); // may return null
openedProgram.set(p);
}
}, monitor);
}
catch (IOException | CancelledException e) {
// IOException reported to user by GhidraURLResultHandlerAdapter
return null;
}
return openedProgram.get();
}

View File

@ -465,12 +465,6 @@ public class FakeSharedProject {
void refresh() {
DefaultProjectData projectData = getProjectData();
try {
projectData.refresh(true);
}
catch (IOException e) {
// shouldn't happen
throw new AssertionFailedError("Unable to refresh project " + this);
}
projectData.refresh(true);
}
}

View File

@ -742,7 +742,7 @@ public class DefaultProjectData implements ProjectData {
}
@Override
public void refresh(boolean force) throws IOException {
public void refresh(boolean force) {
try {
rootFolderData.refresh(true, true, projectDisposalMonitor);
}

View File

@ -17,14 +17,12 @@ package ghidra.framework.main.projectdata.actions;
import java.awt.Component;
import java.awt.event.KeyEvent;
import java.io.IOException;
import javax.swing.Icon;
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.ProjectDataContext;
import ghidra.framework.model.ProjectData;
import ghidra.util.HelpLocation;
import ghidra.util.task.*;
@ -53,13 +51,7 @@ public class ProjectDataRefreshAction extends FrontendProjectTreeAction {
TaskLauncher.launch(new Task("Refresh folders and files", false, false, true) {
@Override
public void run(TaskMonitor monitor) {
try {
projectData.refresh(false);
}
catch (IOException e) {
ClientUtil.handleException(projectData.getRepository(), e,
"Refresh Project Data", false, comp);
}
projectData.refresh(false);
}
});
}

View File

@ -143,9 +143,8 @@ public interface ProjectData {
* 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
* 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

View File

@ -119,7 +119,7 @@ public class TestDummyProjectData implements ProjectData {
}
@Override
public void refresh(boolean force) throws IOException {
public void refresh(boolean force) {
// stub
}