changeset 3671:415aa4a73b95

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 18 Nov 2011 16:23:41 +0100
parents f198b24093f3 (current diff) bb3337727ab6 (diff)
children 5e331d5f760e
files
diffstat 7 files changed, 54 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputEdge.java	Fri Nov 18 16:23:26 2011 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputEdge.java	Fri Nov 18 16:23:41 2011 +0100
@@ -58,23 +58,29 @@
                 return o1.getToIndex() - o2.getToIndex();
             }
     };
-        
+
     private char toIndex;
     private char fromIndex;
     private int from;
     private int to;
     private State state;
-    
+    private String label;
+
     public InputEdge(char toIndex, int from, int to) {
-        this((char)0, toIndex, from, to);
+        this((char) 0, toIndex, from, to, null);
     }
 
     public InputEdge(char fromIndex, char toIndex, int from, int to) {
+        this(fromIndex, toIndex, from, to, null);
+    }
+
+    public InputEdge(char fromIndex, char toIndex, int from, int to, String label) {
         this.toIndex = toIndex;
         this.fromIndex = fromIndex;
         this.from = from;
         this.to = to;
         this.state = State.SAME;
+        this.label = label;
     }
 
     public State getState() {
@@ -105,6 +111,10 @@
         return to;
     }
 
+    public String getLabel() {
+        return label;
+    }
+
     @Override
     public boolean equals(Object o) {
         if (o == null || !(o instanceof InputEdge)) {
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java	Fri Nov 18 16:23:26 2011 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java	Fri Nov 18 16:23:41 2011 +0100
@@ -85,6 +85,7 @@
     public static final String FROM_INDEX_PROPERTY = "fromIndex";
     public static final String TO_INDEX_PROPERTY = "toIndex";
     public static final String TO_INDEX_ALT_PROPERTY = "index";
+    public static final String LABEL_PROPERTY = "label";
     public static final String METHOD_ELEMENT = "method";
     public static final String INLINE_ELEMENT = "inline";
     public static final String BYTECODES_ELEMENT = "bytecodes";
@@ -379,13 +380,14 @@
             int toIndex = 0;
             int from = -1;
             int to = -1;
+            String label = null;
 
             try {
                 String fromIndexString = readAttribute(FROM_INDEX_PROPERTY);
                 if (fromIndexString != null) {
                     fromIndex = Integer.parseInt(fromIndexString);
                 }
-                
+
                 String toIndexString = readAttribute(TO_INDEX_PROPERTY);
                 if (toIndexString == null) {
                     toIndexString = readAttribute(TO_INDEX_ALT_PROPERTY);
@@ -394,13 +396,15 @@
                     toIndex = Integer.parseInt(toIndexString);
                 }
 
+                label = readAttribute(LABEL_PROPERTY);
+
                 from = lookupID(readRequiredAttribute(FROM_PROPERTY));
                 to = lookupID(readRequiredAttribute(TO_PROPERTY));
             } catch (NumberFormatException e) {
                 throw new SAXException(e);
             }
 
-            InputEdge conn = new InputEdge((char) fromIndex, (char) toIndex, from, to);
+            InputEdge conn = new InputEdge((char) fromIndex, (char) toIndex, from, to, label);
             return start(conn);
         }
 
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/graphdocument.xsd	Fri Nov 18 16:23:26 2011 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/graphdocument.xsd	Fri Nov 18 16:23:41 2011 +0100
@@ -105,6 +105,7 @@
     <xsd:complexType name="edgeType">
         <xsd:attribute name="from" type="xsd:int" use="required" />
         <xsd:attribute name="to" type="xsd:int" use="required" />
+        <xsd:attribute name="label" type="xsd:string" use="optional" />
         <xsd:attribute name="fromIndex" type="xsd:int" use="optional" />
         
         <!-- These are aliases and should be mutually exclusive -->
--- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CombineFilter.java	Fri Nov 18 16:23:26 2011 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CombineFilter.java	Fri Nov 18 16:23:41 2011 +0100
@@ -30,7 +30,6 @@
 import com.sun.hotspot.igv.graph.OutputSlot;
 import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.data.Properties.PropertyMatcher;
-import java.awt.Color;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -100,7 +99,7 @@
 
                         for (InputSlot s : f.getInputSlots()) {
                             for (Connection c : s.getConnections()) {
-                                Connection newConn = diagram.createConnection(slot, c.getOutputSlot());
+                                Connection newConn = diagram.createConnection(slot, c.getOutputSlot(), c.getLabel());
                                 newConn.setColor(c.getColor());
                                 newConn.setStyle(c.getStyle());
                             }
@@ -157,7 +156,7 @@
                                     }
                                 }
                                 for (Connection c : nextSlot.getConnections()) {
-                                    Connection newConn = diagram.createConnection(c.getInputSlot(), slot);
+                                    Connection newConn = diagram.createConnection(c.getInputSlot(), slot, c.getLabel());
                                     newConn.setColor(c.getColor());
                                     newConn.setStyle(c.getStyle());
                                 }
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Connection.java	Fri Nov 18 16:23:26 2011 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Connection.java	Fri Nov 18 16:23:41 2011 +0100
@@ -49,10 +49,12 @@
     private Color color;
     private ConnectionStyle style;
     private List<Point> controlPoints;
+    private String label;
 
-    protected Connection(InputSlot inputSlot, OutputSlot outputSlot) {
+    protected Connection(InputSlot inputSlot, OutputSlot outputSlot, String label) {
         this.inputSlot = inputSlot;
         this.outputSlot = outputSlot;
+        this.label = label;
         this.inputSlot.connections.add(this);
         this.outputSlot.connections.add(this);
         controlPoints = new ArrayList<Point>();
@@ -94,6 +96,10 @@
         return source;
     }
 
+    public String getLabel() {
+        return label;
+    }
+
     public void remove() {
         inputSlot.getFigure().removePredecessor(outputSlot.getFigure());
         inputSlot.connections.remove(this);
@@ -102,12 +108,21 @@
     }
     
     public String getToolTipText() {
-        return "From " + this.getOutputSlot().getFigure().toString() + " to " + this.getInputSlot().getFigure();
+        StringBuilder builder = new StringBuilder();
+        if (label != null) {
+            builder.append(label).append(": from ");
+        } else {
+            builder.append("From ");
+        }
+        builder.append(getOutputSlot().getFigure());
+        builder.append(" to ");
+        builder.append(getInputSlot().getFigure());
+        return builder.toString();
     }
 
     @Override
     public String toString() {
-        return "Connection(" + getFrom().getVertex() + " to " + getTo().getVertex() + ")";
+        return "Connection('" + label + "', " + getFrom().getVertex() + " to " + getTo().getVertex() + ")";
     }
 
     public Port getFrom() {
--- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java	Fri Nov 18 16:23:26 2011 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java	Fri Nov 18 16:23:41 2011 +0100
@@ -112,10 +112,10 @@
         return f;
     }
 
-    public Connection createConnection(InputSlot inputSlot, OutputSlot outputSlot) {
+    public Connection createConnection(InputSlot inputSlot, OutputSlot outputSlot, String label) {
         assert inputSlot.getFigure().getDiagram() == this;
         assert outputSlot.getFigure().getDiagram() == this;
-        return new Connection(inputSlot, outputSlot);
+        return new Connection(inputSlot, outputSlot, label);
     }
     
     public Map<InputNode, Set<Figure>> calcSourceToFigureRelation() {
@@ -176,7 +176,7 @@
             }
             InputSlot inputSlot = toFigure.getInputSlots().get(toIndex);
 
-            Connection c = d.createConnection(inputSlot, outputSlot);
+            Connection c = d.createConnection(inputSlot, outputSlot, e.getLabel());
 
             if (e.getState() == InputEdge.State.NEW) {
                 c.setStyle(Connection.ConnectionStyle.BOLD);
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java	Fri Nov 18 16:23:26 2011 +0100
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java	Fri Nov 18 16:23:41 2011 +0100
@@ -58,6 +58,7 @@
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseWheelEvent;
 import java.awt.event.MouseWheelListener;
@@ -287,11 +288,13 @@
             setSelectedObjects(selectedObjects);
         }
     };
-    
+
     private MouseWheelListener mouseWheelListener = new MouseWheelListener() {
 
         public void mouseWheelMoved(MouseWheelEvent e) {
-            DiagramScene.this.relayoutWithoutLayout(null);
+            if (e.isControlDown()) {
+                DiagramScene.this.relayoutWithoutLayout(null);
+            }
         }
     };
 
@@ -409,17 +412,16 @@
 
         this.setCheckClipping(true);
 
-        this.getInputBindings().setZoomActionModifiers(0);
+        scrollPane = createScrollPane();
 
-        scrollPane = createScrollPane();
+        hoverAction = createObjectHoverAction();
 
         // This panAction handles the event only when the left mouse button is
         // pressed without any modifier keys, otherwise it will not consume it
-        // and the selection action will handle the event
+        // and the selection action (below) will handle the event
         panAction = new CustomizablePanAction(~0, MouseEvent.BUTTON1_DOWN_MASK);
         this.getActions().addAction(panAction);
 
-        hoverAction = createObjectHoverAction();
         selectAction = createSelectAction();
         this.getActions().addAction(selectAction);
 
@@ -445,10 +447,13 @@
 
         this.setLayout(LayoutFactory.createAbsoluteLayout());
 
+        this.getInputBindings().setZoomActionModifiers(KeyEvent.CTRL_MASK);
         zoomAction = ActionFactory.createMouseCenteredZoomAction(1.2);
         this.getActions().addAction(zoomAction);
         this.getView().addMouseWheelListener(mouseWheelListener);
         this.getActions().addAction(ActionFactory.createPopupMenuAction(popupMenuProvider));
+        
+        this.getActions().addAction(ActionFactory.createWheelPanAction());
 
         LayerWidget selectLayer = new LayerWidget(this);
         this.addChild(selectLayer);