Test fixes

This commit is contained in:
dragonmacher 2023-05-11 17:10:45 -04:00
parent f546c8828c
commit 2f2a07c671
5 changed files with 35 additions and 8 deletions

View file

@ -111,6 +111,11 @@ class ExportAttributedGraphDisplay implements GraphDisplay {
// do nothing, actions are not supported by this display
}
@Override
public Collection<DockingActionIf> getActions() {
return Collections.emptyList();
}
@Override
public AttributedVertex getFocusedVertex() {
return null;

View file

@ -601,7 +601,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
display.setGraph(createSubGraph(), graphRenderer.getGraphDisplayOptions(),
title + " - Sub-graph", false, TaskMonitor.DUMMY);
display.setGraphDisplayListener(listener.cloneWith(display));
copyActionsToNewGraph((DefaultGraphDisplay) display);
copyActionsToNewGraph(display);
}
catch (CancelledException e) {
// using Dummy, so can't happen
@ -1277,10 +1277,11 @@ public class DefaultGraphDisplay implements GraphDisplay {
return vv;
}
private void copyActionsToNewGraph(DefaultGraphDisplay display) {
private void copyActionsToNewGraph(GraphDisplay display) {
Collection<DockingActionIf> defaultActions = display.getActions();
for (DockingActionIf action : addedActions) {
if (display.containsAction(action)) {
if (defaultActions.contains(action)) {
// ignore actions added by the graph itself and any actions that the end user may
// accidentally add more than once
continue;
@ -1288,7 +1289,6 @@ public class DefaultGraphDisplay implements GraphDisplay {
display.addAction(new DockingActionProxy(action));
}
}
private boolean containsAction(DockingActionIf action) {
@ -1314,6 +1314,11 @@ public class DefaultGraphDisplay implements GraphDisplay {
componentProvider.addLocalAction(action);
}
@Override
public Collection<DockingActionIf> getActions() {
return new ArrayList<>(addedActions);
}
@Override
public AttributedVertex getFocusedVertex() {
return focusedVertex;

View file

@ -15,6 +15,7 @@
*/
package ghidra.graph.visualization;
import java.util.Collection;
import java.util.Set;
import docking.action.DockingActionIf;
@ -108,6 +109,11 @@ public class DefaultGraphDisplayWrapper
Swing.runNow(() -> delegate.addAction(action));
}
@Override
public Collection<DockingActionIf> getActions() {
return Swing.runNow(() -> delegate.getActions());
}
@Override
public int compareTo(DefaultGraphDisplayWrapper other) {
// note: no need for call to Swing, assuming ID is immutable