mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
GP-3648 - Add Function Graph to Function Comparison display
This commit is contained in:
parent
6773801f6e
commit
3c90216365
116 changed files with 4228 additions and 1350 deletions
|
@ -113,7 +113,7 @@ public class VgSatelliteFeaturette<V extends VisualVertex,
|
|||
providerName = provider.getName();
|
||||
windowGroup = provider.getWindowGroup();
|
||||
|
||||
view.setSatelliteListener(new SatelliteListener());
|
||||
view.addSatelliteListener(new SatelliteListener());
|
||||
|
||||
addActions(provider);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -126,6 +126,7 @@ public class GraphPerspectiveInfo<V extends VisualVertex, E extends VisualEdge<V
|
|||
/**
|
||||
* The offset of the transform from the world origin (which at the time of writing is
|
||||
* the (0,0) at the upper left-hand corner of the GUI. This is for the layout transformer.
|
||||
* @return the point
|
||||
*/
|
||||
public Point getLayoutTranslateCoordinates() {
|
||||
return layoutTranslateCoordinates;
|
||||
|
@ -135,6 +136,7 @@ public class GraphPerspectiveInfo<V extends VisualVertex, E extends VisualEdge<V
|
|||
* The offset of the transform from the world origin (which at the time of writing is
|
||||
* the (0,0) at the upper left-hand corner of the GUI. This is for the view transformer,
|
||||
* which also potentially has a scale applied to the transform.
|
||||
* @return the point
|
||||
*/
|
||||
public Point getViewTranslateCoordinates() {
|
||||
return viewTranslateCoordinates;
|
||||
|
|
|
@ -18,6 +18,7 @@ package ghidra.graph.viewer;
|
|||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -101,7 +102,7 @@ public class VisualGraphView<V extends VisualVertex,
|
|||
return result.get();
|
||||
};
|
||||
|
||||
private Optional<GraphSatelliteListener> clientSatelliteListener = Optional.empty();
|
||||
private List<GraphSatelliteListener> satelliteListeners = new ArrayList<>();
|
||||
|
||||
// this internal listener is the way we manage keeping our state in sync with the
|
||||
// graph component, as well as how we notify the client listener
|
||||
|
@ -110,7 +111,7 @@ public class VisualGraphView<V extends VisualVertex,
|
|||
// keep our internal state in-sync
|
||||
showSatellite = visible;
|
||||
satelliteDocked = docked;
|
||||
clientSatelliteListener.ifPresent(l -> l.satelliteVisibilityChanged(docked, visible));
|
||||
satelliteListeners.forEach(l -> l.satelliteVisibilityChanged(docked, visible));
|
||||
};
|
||||
|
||||
private boolean satelliteDocked = true;
|
||||
|
@ -186,8 +187,10 @@ public class VisualGraphView<V extends VisualVertex,
|
|||
installGraphViewer();
|
||||
}
|
||||
|
||||
public void setSatelliteListener(GraphSatelliteListener l) {
|
||||
clientSatelliteListener = Optional.ofNullable(l);
|
||||
public void addSatelliteListener(GraphSatelliteListener l) {
|
||||
if (l != null) {
|
||||
satelliteListeners.add(l);
|
||||
}
|
||||
}
|
||||
|
||||
public void setVertexFocusListener(VertexFocusListener<V> l) {
|
||||
|
@ -454,10 +457,14 @@ public class VisualGraphView<V extends VisualVertex,
|
|||
}
|
||||
}
|
||||
|
||||
public boolean arePopupsEnabled() {
|
||||
public boolean arePopupsVisible() {
|
||||
return showPopups;
|
||||
}
|
||||
|
||||
public boolean arePopupsEnabled() {
|
||||
return arePopupsVisible();
|
||||
}
|
||||
|
||||
public JComponent getUndockedSatelliteComponent() {
|
||||
return undockedSatelliteContentPanel;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class VisualGraphViewUpdater<V extends VisualVertex, E extends VisualEdge
|
|||
}
|
||||
|
||||
/**
|
||||
* Will schedule the fitting work to happen now if now work is being done, or later otherwis
|
||||
* Will schedule the fitting work to happen now if no work is being done, or later otherwise
|
||||
*/
|
||||
public void fitGraphToViewerLater() {
|
||||
jobRunner.setFinalJob(new FitGraphToViewJob<>(primaryViewer));
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -16,6 +16,7 @@
|
|||
package ghidra.graph.viewer;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.*;
|
||||
|
@ -37,7 +38,6 @@ import generic.test.TestUtils;
|
|||
import generic.util.WindowUtilities;
|
||||
import ghidra.graph.graphs.*;
|
||||
import ghidra.graph.support.*;
|
||||
import ghidra.util.Msg;
|
||||
import util.CollectionUtils;
|
||||
|
||||
public class GraphComponentTest extends AbstractVisualGraphTest {
|
||||
|
@ -198,21 +198,6 @@ public class GraphComponentTest extends AbstractVisualGraphTest {
|
|||
|
||||
twinkle(v);
|
||||
|
||||
// TODO debug
|
||||
if (v.hasBeenEmphasised()) {
|
||||
|
||||
// below, once we are zoomed-out, then the emphasis should happen
|
||||
Msg.debug(this, "No vertice should have been emphasized, since we are zoomed in " +
|
||||
" - twinkled vertex: " + v + "; all vertex states: ");
|
||||
vertices.forEach(vertex -> {
|
||||
Msg.debug(this, vertex + " - " + vertex.hasBeenEmphasised());
|
||||
});
|
||||
|
||||
// maybe the graph was scaled??
|
||||
Msg.debug(this, "graph scale (should be 1.0): " +
|
||||
GraphViewerUtils.getGraphScale(graphComponent.getPrimaryViewer()));
|
||||
}
|
||||
|
||||
assertFalse(v.hasBeenEmphasised());
|
||||
|
||||
scaleGraphPastInteractionThreshold();
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -58,7 +58,7 @@ public class VisualGraphViewTest extends AbstractSimpleVisualGraphTest {
|
|||
*/
|
||||
|
||||
SpySatelliteListener listener = new SpySatelliteListener();
|
||||
view.setSatelliteListener(listener);
|
||||
view.addSatelliteListener(listener);
|
||||
|
||||
assertTrue(view.isSatelliteVisible());
|
||||
assertTrue(view.isSatelliteDocked());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue