Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/utils/IdealGraphVisualizer/Coordinator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
<artifactId>Util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.sun.hotspot.igv</groupId>
<artifactId>View</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
import com.sun.hotspot.igv.coordinator.actions.*;
import com.sun.hotspot.igv.data.GraphDocument;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.InputGraph;
import com.sun.hotspot.igv.data.services.GroupCallback;
import com.sun.hotspot.igv.data.services.InputGraphProvider;
import com.sun.hotspot.igv.util.LookupHistory;
import com.sun.hotspot.igv.view.EditorTopComponent;
import java.awt.BorderLayout;
import java.io.IOException;
import java.io.ObjectInput;
Expand Down Expand Up @@ -133,13 +135,22 @@ public void started(Group g) {
// Fetch and select the latest active graph.
private void updateGraphSelection() {
final InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class);
if (p == null) {
return;
}
try {
manager.setSelectedNodes(new GraphNode[]{FolderNode.getGraphNode(p.getGraph())});
} catch (Exception e) {
Exceptions.printStackTrace(e);
if (p != null) {
try {
InputGraph graph = p.getGraph();
if (graph.isDiffGraph()) {
EditorTopComponent editor = EditorTopComponent.getActive();
if (editor != null) {
InputGraph firstGraph = editor.getModel().getFirstGraph();
InputGraph secondGraph = editor.getModel().getSecondGraph();
manager.setSelectedNodes(new GraphNode[]{FolderNode.getGraphNode(firstGraph), FolderNode.getGraphNode(secondGraph)});
}
} else {
manager.setSelectedNodes(new GraphNode[]{FolderNode.getGraphNode(graph)});
}
} catch (Exception e) {
Exceptions.printStackTrace(e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public class InputGraph extends Properties.Entity implements FolderElement {
private Map<String, InputBlock> blocks;
private List<InputBlockEdge> blockEdges;
private Map<Integer, InputBlock> nodeToBlock;
private boolean isDiffGraph;

public InputGraph(String name, boolean isDiffGraph) {
this(name);
this.isDiffGraph = isDiffGraph;
}

public InputGraph(String name) {
setName(name);
Expand All @@ -46,6 +52,11 @@ public InputGraph(String name) {
blocks = new LinkedHashMap<>();
blockEdges = new ArrayList<>();
nodeToBlock = new LinkedHashMap<>();
isDiffGraph = false;
}

public boolean isDiffGraph() {
return this.isDiffGraph;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private static InputGraph createDiff(InputGraph a, InputGraph b, Set<NodePair> p
}
}
g.getProperties().setProperty("name", "Difference");
InputGraph graph = new InputGraph(a.getName() + ", " + b.getName());
InputGraph graph = new InputGraph(a.getName() + ", " + b.getName(), true);
g.addElement(graph);

Map<InputBlock, InputBlock> blocksMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public Diagram getDiagramToView() {
Settings.get().get(Settings.NODE_SHORT_TEXT, Settings.NODE_SHORT_TEXT_DEFAULT),
Settings.get().get(Settings.NODE_TINY_TEXT, Settings.NODE_TINY_TEXT_DEFAULT));
getFilterChain().apply(diagram, getSequenceFilterChain());
if (getFirstPosition() != getSecondPosition()) {
if (graph.isDiffGraph()) {
ColorFilter f = new ColorFilter("");
f.addRule(stateColorRule("same", Color.white));
f.addRule(stateColorRule("changed", Color.orange));
Expand Down