diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/pom.xml b/src/utils/IdealGraphVisualizer/ControlFlow/pom.xml deleted file mode 100644 index f44f08bec1f5f..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/pom.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - 4.0.0 - - IdealGraphVisualizer-parent - com.sun.hotspot.igv - 1.0-SNAPSHOT - - ControlFlow - 1.0-SNAPSHOT - nbm - ControlFlow - - 17 - UTF-8 - - - - com.sun.hotspot.igv - Data - ${project.version} - - - com.sun.hotspot.igv - Util - ${project.version} - - - com.sun.hotspot.igv - Layout - ${project.version} - - - com.sun.hotspot.igv - HierarchicalLayout - ${project.version} - - - org.netbeans.api - org-netbeans-api-visual - ${netbeans.version} - - - net.java.dev.swing-layout - swing-layout - ${swinglayouts.version} - - - org.netbeans.api - org-openide-util - ${netbeans.version} - - - org.netbeans.api - org-openide-util-lookup - ${netbeans.version} - - - org.netbeans.api - org-openide-util-ui - ${netbeans.version} - - - org.netbeans.api - org-openide-windows - ${netbeans.version} - - - - - - org.codehaus.mojo - nbm-maven-plugin - ${nbmmvnplugin.version} - true - - - org.apache.maven.plugins - maven-compiler-plugin - ${mvncompilerplugin.version} - - 17 - - - - org.apache.maven.plugins - maven-jar-plugin - ${mvnjarplugin.version} - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - - diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java deleted file mode 100644 index 4cf38780f976d..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.controlflow; - -import com.sun.hotspot.igv.data.InputBlockEdge; -import com.sun.hotspot.igv.layout.Cluster; -import com.sun.hotspot.igv.layout.Link; -import com.sun.hotspot.igv.layout.Port; -import java.awt.BasicStroke; -import java.awt.Point; -import java.awt.Stroke; -import java.util.ArrayList; -import java.util.List; -import org.netbeans.api.visual.widget.ConnectionWidget; - -/** - * - * @author Thomas Wuerthinger - */ -public class BlockConnectionWidget extends ConnectionWidget implements Link { - - private static final Stroke NORMAL_STROKE = new BasicStroke(1.0f); - private static final Stroke BOLD_STROKE = new BasicStroke(2.5f); - private static final Stroke DASHED_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, new float[]{5, 5}, 0); - private static final Stroke BOLD_DASHED_STROKE = new BasicStroke(2.5f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, new float[]{5, 5}, 0); - - private final BlockWidget from; - private final BlockWidget to; - private final Port inputSlot; - private final Port outputSlot; - private List points; - private boolean isDashed = false; - private boolean isBold = false; - - public BlockConnectionWidget(ControlFlowScene scene, InputBlockEdge edge) { - super(scene); - - this.from = (BlockWidget) scene.findWidget(edge.getFrom()); - this.to = (BlockWidget) scene.findWidget(edge.getTo()); - inputSlot = to.getInputSlot(); - outputSlot = from.getOutputSlot(); - points = new ArrayList<>(); - } - - public Port getTo() { - return inputSlot; - } - - public Port getFrom() { - return outputSlot; - } - - public Cluster getFromCluster() { - return null; - } - - public Cluster getToCluster() { - return null; - } - - public void setBold(boolean bold) { - this.isBold = bold; - updateStroke(); - } - - public void setDashed(boolean dashed) { - this.isDashed = dashed; - updateStroke(); - } - - private void updateStroke() { - Stroke stroke = NORMAL_STROKE; - if (isBold) { - if (isDashed) { - stroke = BOLD_DASHED_STROKE; - } else { - stroke = BOLD_STROKE; - } - } else if (isDashed) { - stroke = DASHED_STROKE; - } - setStroke(stroke); - } - - public void setControlPoints(List p) { - this.points = p; - } - - @Override - public List getControlPoints() { - return points; - } - - @Override - public String toString() { - return "Connection[ " + from.toString() + " - " + to.toString() + "]"; - } - - @Override - public boolean isVIP() { - return isBold; - } -} diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockWidget.java b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockWidget.java deleted file mode 100644 index 5c4a51463f0c2..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/BlockWidget.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.controlflow; - -import com.sun.hotspot.igv.data.InputBlock; -import com.sun.hotspot.igv.layout.Cluster; -import com.sun.hotspot.igv.layout.Port; -import com.sun.hotspot.igv.layout.Vertex; -import java.awt.*; -import org.netbeans.api.visual.border.BorderFactory; -import org.netbeans.api.visual.model.ObjectState; -import org.netbeans.api.visual.widget.LabelWidget; - -/** - * - * @author Thomas Wuerthinger - */ -public class BlockWidget extends LabelWidget implements Vertex { - - public static final Dimension MIN_SIZE = new Dimension(20, 20); - private final InputBlock block; - private final Port inputSlot; - private final Port outputSlot; - private Cluster cluster; - private static final Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 12); - private static final Font boldFont = font.deriveFont(Font.BOLD); - public static final Color NORMAL_FOREGROUND_COLOR = Color.BLACK; - public static final Color HOVER_FOREGROUND_COLOR = Color.BLUE; - - /** Creates a new instance of BlockWidget */ - public BlockWidget(ControlFlowScene scene, InputBlock block) { - super(scene); - this.block = block; - this.setLabel(block.getName()); - this.setForeground(NORMAL_FOREGROUND_COLOR); - this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); - this.setMinimumSize(MIN_SIZE); - - this.setFont(font); - this.setAlignment(Alignment.CENTER); - - final BlockWidget widget = this; - inputSlot = new Port() { - public Point getRelativePosition() { - return new Point((int) (getSize().getWidth() / 2), (int) (getSize().getHeight() / 2)); - } - public Vertex getVertex() { - return widget; - } - }; - outputSlot = new Port() { - public Point getRelativePosition() { - return new Point((int) (getSize().getWidth() / 2), (int) (getSize().getHeight() / 2)); - } - public Vertex getVertex() { - return widget; - } - }; - } - - public Port getInputSlot() { - return inputSlot; - } - - public Port getOutputSlot() { - return outputSlot; - } - - public InputBlock getBlock() { - return block; - } - - public Dimension getSize() { - Rectangle bounds = getBounds(); - if (bounds != null) { - return bounds.getSize(); - } else { - return MIN_SIZE; - } - } - - public void setPosition(Point p) { - this.setPreferredLocation(p); - } - - @Override - public String toString() { - return block.getName(); - } - - public Point getPosition() { - return this.getPreferredLocation(); - } - - public Cluster getCluster() { - return cluster; - } - - public boolean isRoot() { - return false; - } - - public int compareTo(Vertex o) { - return toString().compareTo(o.toString()); - } - - @Override - protected void notifyStateChanged(ObjectState previousState, ObjectState state) { - super.notifyStateChanged(previousState, state); - - if (previousState.isHovered() != state.isHovered()) { - if (state.isHovered()) { - this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR)); - } else { - this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR)); - } - } - - if (previousState.isSelected() != state.isSelected()) { - if (state.isSelected()) { - this.setFont(boldFont); - } else { - this.setFont(font); - } - } - } -} diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowAction.java b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowAction.java deleted file mode 100644 index 43b8fae8f584d..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowAction.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.controlflow; - -import java.awt.event.ActionEvent; -import javax.swing.AbstractAction; -import org.openide.util.NbBundle; -import org.openide.windows.TopComponent; - -/** - * - * @author Thomas Wuerthinger - */ -public class ControlFlowAction extends AbstractAction { - - public ControlFlowAction() { - super(NbBundle.getMessage(ControlFlowAction.class, "CTL_ControlFlowAction")); - } - - public void actionPerformed(ActionEvent evt) { - TopComponent win = ControlFlowTopComponent.findInstance(); - win.open(); - win.requestActive(); - } -} diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowScene.java b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowScene.java deleted file mode 100644 index d5da6ce2d4458..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowScene.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.controlflow; - -import com.sun.hotspot.igv.data.InputBlock; -import com.sun.hotspot.igv.data.InputBlockEdge; -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.InputNode; -import com.sun.hotspot.igv.data.services.InputGraphProvider; -import com.sun.hotspot.igv.util.LookupHistory; -import java.awt.Color; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; -import javax.swing.BorderFactory; -import org.netbeans.api.visual.action.*; -import org.netbeans.api.visual.anchor.AnchorFactory; -import org.netbeans.api.visual.anchor.AnchorShape; -import org.netbeans.api.visual.graph.GraphScene; -import org.netbeans.api.visual.graph.layout.GraphLayout; -import org.netbeans.api.visual.layout.LayoutFactory; -import org.netbeans.api.visual.layout.SceneLayout; -import org.netbeans.api.visual.router.RouterFactory; -import org.netbeans.api.visual.widget.ConnectionWidget; -import org.netbeans.api.visual.widget.LayerWidget; -import org.netbeans.api.visual.widget.Widget; - -/** - * - * @author Thomas Wuerthinger - */ -public class ControlFlowScene extends GraphScene implements SelectProvider, MoveProvider, RectangularSelectDecorator, RectangularSelectProvider { - - private final HashSet selection; - private InputGraph oldGraph; - private final LayerWidget edgeLayer; - private final LayerWidget mainLayer; - private final WidgetAction hoverAction = createWidgetHoverAction(); - private final WidgetAction selectAction = new DoubleClickSelectAction(this); - private final WidgetAction moveAction = ActionFactory.createMoveAction(null, this); - - public ControlFlowScene() { - selection = new HashSet<>(); - - getInputBindings().setZoomActionModifiers(0); - setLayout(LayoutFactory.createAbsoluteLayout()); - - mainLayer = new LayerWidget(this); - addChild(mainLayer); - - edgeLayer = new LayerWidget(this); - addChild(edgeLayer); - - LayerWidget selectLayer = new LayerWidget(this); - addChild(selectLayer); - - getActions().addAction(hoverAction); - getActions().addAction(selectAction); - getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this)); - getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1)); - } - - public void setGraph(InputGraph g) { - if (g == oldGraph) { - return; - } - oldGraph = g; - - ArrayList blocks = new ArrayList<>(getNodes()); - for (InputBlock b : blocks) { - removeNode(b); - } - - ArrayList edges = new ArrayList<>(getEdges()); - for (InputBlockEdge e : edges) { - removeEdge(e); - } - - edgeLayer.removeChildren(); - mainLayer.removeChildren(); - - for (InputBlock b : g.getBlocks()) { - addNode(b); - } - - for (InputBlockEdge e : g.getBlockEdges()) { - addEdge(e); - assert g.getBlocks().contains(e.getFrom()); - assert g.getBlocks().contains(e.getTo()); - setEdgeSource(e, e.getFrom()); - setEdgeTarget(e, e.getTo()); - } - - GraphLayout layout = new HierarchicalGraphLayout<>(); - SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(this, layout); - sceneLayout.invokeLayout(); - - validate(); - } - - private void clearSelection() { - for (BlockWidget w : selection) { - w.setState(w.getState().deriveSelected(false)); - } - selection.clear(); - selectionChanged(); - } - - private void selectionChanged() { - InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class); - if (p != null) { - Set inputNodes = new HashSet<>(); - for (BlockWidget w : selection) { - inputNodes.addAll(w.getBlock().getNodes()); - } - p.clearSelectedNodes(); - p.addSelectedNodes(inputNodes, true); - p.centerSelectedNodes(); - } - } - - private void addToSelection(BlockWidget widget) { - widget.setState(widget.getState().deriveSelected(true)); - selection.add(widget); - selectionChanged(); - } - - private void removeFromSelection(BlockWidget widget) { - widget.setState(widget.getState().deriveSelected(false)); - selection.remove(widget); - selectionChanged(); - } - - @Override - public boolean isAimingAllowed(Widget widget, Point point, boolean b) { - return false; - } - - @Override - public boolean isSelectionAllowed(Widget widget, Point point, boolean b) { - return true; - } - - @Override - public void select(Widget widget, Point point, boolean change) { - if (widget == this) { - clearSelection(); - } else { - - assert widget instanceof BlockWidget; - BlockWidget bw = (BlockWidget) widget; - if (change) { - if (selection.contains(bw)) { - removeFromSelection(bw); - } else { - addToSelection(bw); - } - } else { - if (!selection.contains(bw)) { - clearSelection(); - addToSelection(bw); - } - } - } - } - - @Override - public void movementStarted(Widget widget) {} - - @Override - - public void movementFinished(Widget widget) {} - - @Override - public Point getOriginalLocation(Widget widget) { - return widget.getPreferredLocation(); - } - - @Override - public void setNewLocation(Widget widget, Point location) { - assert widget instanceof BlockWidget; - if (selection.contains((BlockWidget) widget)) { - // move entire selection - Point originalLocation = getOriginalLocation(widget); - int xOffset = location.x - originalLocation.x; - int yOffset = location.y - originalLocation.y; - for (Widget w : selection) { - Point p = new Point(w.getPreferredLocation()); - p.translate(xOffset, yOffset); - w.setPreferredLocation(p); - } - } else { - widget.setPreferredLocation(location); - } - } - - @Override - public Widget createSelectionWidget() { - Widget widget = new Widget(this); - widget.setOpaque(false); - widget.setBorder(BorderFactory.createLineBorder(Color.black, 2)); - widget.setForeground(Color.red); - return widget; - } - - @Override - public void performSelection(Rectangle rectangle) { - - if (rectangle.width < 0) { - rectangle.x += rectangle.width; - rectangle.width *= -1; - } - - if (rectangle.height < 0) { - rectangle.y += rectangle.height; - rectangle.height *= -1; - } - - boolean changed = false; - for (InputBlock b : getNodes()) { - BlockWidget w = (BlockWidget) findWidget(b); - Rectangle r = new Rectangle(w.getBounds()); - r.setLocation(w.getLocation()); - if (r.intersects(rectangle)) { - if (!selection.contains(w)) { - changed = true; - selection.add(w); - w.setState(w.getState().deriveSelected(true)); - } - } else { - if (selection.contains(w)) { - changed = true; - selection.remove(w); - w.setState(w.getState().deriveSelected(false)); - } - } - } - - if (changed) { - selectionChanged(); - } - - } - - @Override - protected Widget attachNodeWidget(InputBlock node) { - BlockWidget w = new BlockWidget(this, node); - mainLayer.addChild(w); - w.getActions().addAction(hoverAction); - w.getActions().addAction(selectAction); - w.getActions().addAction(moveAction); - return w; - } - - @Override - protected Widget attachEdgeWidget(InputBlockEdge edge) { - BlockConnectionWidget w = new BlockConnectionWidget(this, edge); - switch (edge.getState()) { - case NEW: - w.setBold(true); - break; - case DELETED: - w.setDashed(true); - break; - } - w.setRouter(RouterFactory.createDirectRouter()); - w.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED); - edgeLayer.addChild(w); - return w; - } - - @Override - protected void attachEdgeSourceAnchor(InputBlockEdge edge, InputBlock oldSourceNode, InputBlock sourceNode) { - Widget w = findWidget(edge); - assert w instanceof ConnectionWidget; - ConnectionWidget cw = (ConnectionWidget) w; - cw.setSourceAnchor(AnchorFactory.createRectangularAnchor(findWidget(sourceNode))); - - } - - @Override - protected void attachEdgeTargetAnchor(InputBlockEdge edge, InputBlock oldTargetNode, InputBlock targetNode) { - Widget w = findWidget(edge); - assert w instanceof ConnectionWidget; - ConnectionWidget cw = (ConnectionWidget) w; - cw.setTargetAnchor(AnchorFactory.createRectangularAnchor(findWidget(targetNode))); - } -} diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form deleted file mode 100644 index 7061b53f324a3..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form +++ /dev/null @@ -1,28 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java deleted file mode 100644 index f4c5b98a841a1..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.controlflow; - -import com.sun.hotspot.igv.data.ChangedListener; -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.services.InputGraphProvider; -import com.sun.hotspot.igv.util.LookupHistory; -import java.awt.BorderLayout; -import javax.swing.JScrollPane; -import javax.swing.SwingUtilities; -import org.openide.ErrorManager; -import org.openide.util.NbBundle; -import org.openide.windows.TopComponent; -import org.openide.windows.WindowManager; - -/** - * - * @author Thomas Wuerthinger - */ -final class ControlFlowTopComponent extends TopComponent implements ChangedListener { - - private static ControlFlowTopComponent instance; - private static final String PREFERRED_ID = "ControlFlowTopComponent"; - private final ControlFlowScene scene; - - private ControlFlowTopComponent() { - initComponents(); - setName(NbBundle.getMessage(ControlFlowTopComponent.class, "CTL_ControlFlowTopComponent")); - setToolTipText(NbBundle.getMessage(ControlFlowTopComponent.class, "HINT_ControlFlowTopComponent")); - - scene = new ControlFlowScene(); - setLayout(new BorderLayout()); - associateLookup(scene.getLookup()); - - JScrollPane panel = new JScrollPane(scene.createView()); - add(panel, BorderLayout.CENTER); - } - - /** - * Gets default instance. Do not use directly: reserved for *.settings files only, - * i.e. deserialization routines; otherwise you could get a non-deserialized instance. - * To obtain the singleton instance, use {@link #findInstance()}. - */ - public static synchronized ControlFlowTopComponent getDefault() { - if (instance == null) { - instance = new ControlFlowTopComponent(); - } - return instance; - } - - /** - * Obtain the ControlFlowTopComponent instance. Never call {@link #getDefault} directly! - */ - public static synchronized ControlFlowTopComponent findInstance() { - TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); - if (win == null) { - ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find ControlFlow component. It will not be located properly in the window system."); - return getDefault(); - } - if (win instanceof ControlFlowTopComponent) { - return (ControlFlowTopComponent) win; - } - ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior."); - return getDefault(); - } - - @Override - public int getPersistenceType() { - return TopComponent.PERSISTENCE_ALWAYS; - } - - @Override - public void componentOpened() { - LookupHistory.addListener(InputGraphProvider.class, this); - } - - @Override - public void componentClosed() { - LookupHistory.removeListener(InputGraphProvider.class, this); - } - - @Override - public void changed(InputGraphProvider lastProvider) { - SwingUtilities.invokeLater(() -> { - if (lastProvider != null) { - InputGraph graph = lastProvider.getGraph(); - if (graph != null) { - scene.setGraph(graph); - return; - } - } - scene.setGraph(new InputGraph("")); - }); - } - - @Override - protected String preferredID() { - return PREFERRED_ID; - } - - @Override - public void requestActive() { - super.requestActive(); - scene.getView().requestFocus(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - // //GEN-BEGIN:initComponents - private void initComponents() { - - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 400, Short.MAX_VALUE) - ); - layout.setVerticalGroup( - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 300, Short.MAX_VALUE) - ); - }// //GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables - // End of variables declaration//GEN-END:variables -} diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/DoubleClickSelectAction.java b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/DoubleClickSelectAction.java deleted file mode 100644 index f70ba33df7d1a..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/DoubleClickSelectAction.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.controlflow; - -import java.awt.Point; -import java.awt.event.MouseEvent; -import org.netbeans.api.visual.action.SelectProvider; -import org.netbeans.api.visual.action.WidgetAction; -import org.netbeans.api.visual.widget.Widget; -import org.openide.util.Utilities; - -/** - * Selection action that acts on double-click only. Does not support aiming. - * - * @author Peter Hofer - */ -public class DoubleClickSelectAction extends WidgetAction.LockedAdapter { - - private final SelectProvider provider; - - public DoubleClickSelectAction(SelectProvider provider) { - this.provider = provider; - } - - protected int getModifierMask () { - return Utilities.isMac() ? MouseEvent.META_DOWN_MASK : MouseEvent.CTRL_DOWN_MASK; - } - - protected boolean isLocked() { - return false; - } - - @Override - public State mousePressed(Widget widget, WidgetMouseEvent event) { - if (event.getClickCount() >= 2 && (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2)) { - boolean invert = (event.getModifiersEx() & getModifierMask()) != 0; - Point point = event.getPoint(); - if (provider.isSelectionAllowed(widget, point, invert)) { - provider.select(widget, point, invert); - return State.CHAIN_ONLY; - } - } - return State.REJECTED; - } -} diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java deleted file mode 100644 index ca83df7ae29ce..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.controlflow; - -import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager; -import com.sun.hotspot.igv.layout.*; -import java.awt.Dimension; -import java.awt.Point; -import java.util.*; -import org.netbeans.api.visual.graph.layout.GraphLayout; -import org.netbeans.api.visual.graph.layout.UniversalGraph; -import org.netbeans.api.visual.widget.Widget; - -/** - * - * @author Thomas Wuerthinger - */ -public class HierarchicalGraphLayout extends GraphLayout { - - public HierarchicalGraphLayout() {} - - private class LinkWrapper implements Link { - - private final VertexWrapper from; - private final VertexWrapper to; - - public LinkWrapper(VertexWrapper from, VertexWrapper to) { - this.from = from; - this.to = to; - } - - public Port getFrom() { - return from.getSlot(); - } - - public Port getTo() { - return to.getSlot(); - } - - public Cluster getFromCluster() { - return null; - } - - public Cluster getToCluster() { - return null; - } - - public List getControlPoints() { - return new ArrayList<>(); - } - - public void setControlPoints(List list) { - // Do nothing for now - } - - public boolean isVIP() { - return false; - } - } - - private class VertexWrapper implements Vertex { - - private final N node; - private final UniversalGraph graph; - private final Port slot; - private Point position; - - public VertexWrapper(N node, UniversalGraph graph) { - this.node = node; - this.graph = graph; - final VertexWrapper vertex = this; - this.slot = new Port() { - - public Vertex getVertex() { - return vertex; - } - - public Point getRelativePosition() { - return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2)); - } - }; - - Widget w = graph.getScene().findWidget(node); - this.position = w.getPreferredLocation(); - } - - public Cluster getCluster() { - return null; - } - - public Dimension getSize() { - Widget w = graph.getScene().findWidget(node); - assert w.getBounds() != null; - return w.getBounds().getSize(); - } - - public Point getPosition() { - return position; - } - - public void setPosition(Point p) { - HierarchicalGraphLayout.this.setResolvedNodeLocation(graph, node, p); - position = p; - } - - public boolean isRoot() { - return false; - } - - public int compareTo(Vertex o) { - @SuppressWarnings("unchecked") - VertexWrapper vw = (VertexWrapper) o; - return node.toString().compareTo(vw.node.toString()); - } - - public Port getSlot() { - return slot; - } - } - - protected void performGraphLayout(UniversalGraph graph) { - - Set links = new LinkedHashSet<>(); - Set vertices = new LinkedHashSet<>(); - Map vertexMap = new HashMap<>(); - - for (N node : graph.getNodes()) { - VertexWrapper v = new VertexWrapper(node, graph); - vertexMap.put(node, v); - vertices.add(v); - } - - for (E edge : graph.getEdges()) { - N source = graph.getEdgeSource(edge); - N target = graph.getEdgeTarget(edge); - LinkWrapper l = new LinkWrapper(vertexMap.get(source), vertexMap.get(target)); - links.add(l); - } - - HierarchicalLayoutManager m = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.NONE); - - LayoutGraph layoutGraph = new LayoutGraph(links, vertices); - m.doLayout(layoutGraph); - } - - protected void performNodesLayout(UniversalGraph graph, Collection nodes) { - throw new UnsupportedOperationException(); - } -} diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/nbm/manifest.mf b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/nbm/manifest.mf deleted file mode 100644 index c745f8a82b4cb..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/nbm/manifest.mf +++ /dev/null @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.sun.hotspot.igv.controlflow -OpenIDE-Module-Layer: com/sun/hotspot/igv/controlflow/layer.xml -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/controlflow/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/Bundle.properties b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/Bundle.properties deleted file mode 100644 index 587299c05df87..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/Bundle.properties +++ /dev/null @@ -1,4 +0,0 @@ -CTL_ControlFlowAction=Control Flow -CTL_ControlFlowTopComponent=Control Flow -HINT_ControlFlowTopComponent=Shows the blocks of the current graph. -OpenIDE-Module-Name=ControlFlow diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml deleted file mode 100644 index 5ffb8213fbc5c..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml deleted file mode 100644 index 66bc3093c7ea6..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/layer.xml b/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/layer.xml deleted file mode 100644 index 5e79cc22ee712..0000000000000 --- a/src/utils/IdealGraphVisualizer/ControlFlow/src/main/resources/com/sun/hotspot/igv/controlflow/layer.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/IdealGraphVisualizer/application/pom.xml b/src/utils/IdealGraphVisualizer/application/pom.xml index 0fc3ae119f0c2..2590281680867 100644 --- a/src/utils/IdealGraphVisualizer/application/pom.xml +++ b/src/utils/IdealGraphVisualizer/application/pom.xml @@ -115,11 +115,6 @@ HierarchicalLayout ${project.version} - - ${project.groupId} - ControlFlow - ${project.version} - ${project.groupId} Filter diff --git a/src/utils/IdealGraphVisualizer/pom.xml b/src/utils/IdealGraphVisualizer/pom.xml index 4e4da82e1091d..7f9bd67af42fa 100644 --- a/src/utils/IdealGraphVisualizer/pom.xml +++ b/src/utils/IdealGraphVisualizer/pom.xml @@ -102,7 +102,6 @@ SelectionCoordinator Graph HierarchicalLayout - ControlFlow Filter Bytecodes ServerCompiler