# HG changeset patch # User Thomas Wuerthinger # Date 1328201499 -3600 # Node ID e55e2fca50fae88aa379d5339370979e520a7d14 # Parent bcce7f52832d7cf4bb66dd2a18bf57277a8f1464 Removed SelectionCoordinator; now CFG and Graph view working in parallel. diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/META-INF/services/com.oracle.graal.visualizer.editor.CompilationViewerFactory --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/META-INF/services/com.oracle.graal.visualizer.editor.CompilationViewerFactory Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,1 @@ +at.ssw.visualizer.cfg.CfgCompilationViewerFactory \ No newline at end of file diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/CfgCompilationViewer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/CfgCompilationViewer.java Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,236 @@ +/* + * Copyright (c) 2012, 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 at.ssw.visualizer.cfg; + +import at.ssw.visualizer.cfg.action.*; +import at.ssw.visualizer.cfg.graph.CfgEventListener; +import at.ssw.visualizer.cfg.graph.CfgScene; +import at.ssw.visualizer.cfg.graph.EdgeWidget; +import at.ssw.visualizer.cfg.graph.NodeWidget; +import at.ssw.visualizer.cfg.model.CfgEdge; +import at.ssw.visualizer.cfg.model.CfgNode; +import at.ssw.visualizer.cfg.preferences.CfgPreferences; +import at.ssw.visualizer.cfg.preferences.FlagsSetting; +import at.ssw.visualizer.model.cfg.ControlFlowGraph; +import com.oracle.graal.visualizer.editor.CompilationViewer; +import com.sun.hotspot.igv.data.InputGraph; +import java.awt.Color; +import java.awt.Component; +import java.beans.PropertyChangeEvent; +import javax.swing.*; +import javax.swing.border.Border; +import org.netbeans.api.visual.widget.Widget; +import org.openide.awt.Toolbar; +import org.openide.util.Lookup; +import org.openide.util.actions.SystemAction; +import org.openide.util.lookup.Lookups; + +class CfgCompilationViewer implements CompilationViewer { + + private CfgScene scene; + private JScrollPane jScrollPane; + private ControlFlowGraph cfg; + private JComponent myView; + + public CfgCompilationViewer(InputGraph cfg) { + this.cfg = cfg; + + // setIcon(ImageUtilities.loadImage("at/ssw/visualizer/cfg/icons/cfg.gif")); +// setName(cfg.getParent().getShortName()); +// setToolTipText(cfg.getCompilation().getMethod() + " - " + cfg.getName()); + // TODO(tw): Add title. + + //panel setup + this.jScrollPane = new JScrollPane(); + this.jScrollPane.setOpaque(true); + this.jScrollPane.setBorder(BorderFactory.createEmptyBorder()); + this.jScrollPane.setViewportBorder(BorderFactory.createEmptyBorder()); + this.scene = new CfgScene(jScrollPane, cfg); + this.myView = scene.createView(); + this.jScrollPane.setViewportView(myView); + jScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + jScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + jScrollPane.getVerticalScrollBar().setEnabled(true); + jScrollPane.getHorizontalScrollBar().setEnabled(true); + + //setup enviroment,register listeners + // TODO(tw): Add to lookup. +// selection = new Selection(); +// selection.put(cfg); +// selection.put(scene); +// selection.addChangeListener(scene); + + scene.validate(); + scene.applyLayout(); + } + + public void propertyChange(PropertyChangeEvent evt) { + if (this.scene != null) { + + String propName = evt.getPropertyName(); + CfgPreferences prefs = CfgPreferences.getInstance(); + switch (propName) { + case CfgPreferences.PROP_BACKGROUND_COLOR: + scene.setBackground(prefs.getBackgroundColor()); + scene.revalidate(); + break; + case CfgPreferences.PROP_NODE_COLOR: + for (NodeWidget nw : scene.getNodeWidgets()) { + //only change the node color if its not a custom color + if (!nw.isNodeColorCustomized()) { + nw.setNodeColor(prefs.getNodeColor(), false); + } + } + break; + case CfgPreferences.PROP_EDGE_COLOR: + for (CfgEdge e : scene.getEdges()) { + if (!e.isBackEdge() && !e.isXhandler()) { + EdgeWidget w = (EdgeWidget) scene.findWidget(e); + w.setLineColor(prefs.getEdgeColor()); + } + } + break; + case CfgPreferences.PROP_BACK_EDGE_COLOR: + for (CfgEdge e : scene.getEdges()) { + if (e.isBackEdge()) { + EdgeWidget w = (EdgeWidget) scene.findWidget(e); + w.setLineColor(prefs.getBackedgeColor()); + } + } + break; + case CfgPreferences.PROP_EXCEPTION_EDGE_COLOR: + for (CfgEdge e : scene.getEdges()) { + if (e.isXhandler()) { + EdgeWidget w = (EdgeWidget) scene.findWidget(e); + w.setLineColor(prefs.getExceptionEdgeColor()); + } + } + break; + case CfgPreferences.PROP_BORDER_COLOR: + for (CfgNode n : scene.getNodes()) { + NodeWidget nw = (NodeWidget) scene.findWidget(n); + nw.setBorderColor(prefs.getBorderColor()); + } + break; + case CfgPreferences.PROP_TEXT_FONT: + for (CfgNode n : scene.getNodes()) { + NodeWidget nw = (NodeWidget) scene.findWidget(n); + nw.adjustFont(prefs.getTextFont()); + } + break; + case CfgPreferences.PROP_TEXT_COLOR: + for (CfgNode n : scene.getNodes()) { + NodeWidget nw = (NodeWidget) scene.findWidget(n); + nw.setForeground(prefs.getTextColor()); + } + break; + case CfgPreferences.PROP_FLAGS: + FlagsSetting fs = CfgPreferences.getInstance().getFlagsSetting(); + for (CfgNode n : scene.getNodes()) { + NodeWidget nw = (NodeWidget) scene.findWidget(n); + Color nodeColor = fs.getColor(n.getBasicBlock().getFlags()); + if (nodeColor != null) { + nw.setNodeColor(nodeColor, true); + } else { + nw.setNodeColor(CfgPreferences.getInstance().getNodeColor(), false); + } + } + break; + case CfgPreferences.PROP_SELECTION_COLOR_BG: + case CfgPreferences.PROP_SELECTION_COLOR_FG: + for (CfgNode n : scene.getNodes()) { + Widget w = scene.findWidget(n); + w.revalidate(); + } + break; + } + scene.validate(); + } + + } + + @Override + public Component getToolBarComponent() { + Toolbar tb = new Toolbar("CfgToolbar"); + + tb.setBorder((Border) UIManager.get("Nb.Editor.Toolbar.border")); + + //zoomin/zoomout buttons + tb.add(SystemAction.get(ZoominAction.class).getToolbarPresenter()); + tb.add(SystemAction.get(ZoomoutAction.class).getToolbarPresenter()); + tb.addSeparator(); + + //router buttons + ButtonGroup routerButtons = new ButtonGroup(); + UseDirectLineRouterAction direct = SystemAction.get(UseDirectLineRouterAction.class); + UseBezierRouterAction bezier = SystemAction.get(UseBezierRouterAction.class); + JToggleButton button = (JToggleButton) direct.getToolbarPresenter(); + button.getModel().setGroup(routerButtons); + button.setSelected(true); + tb.add(button); + button = (JToggleButton) bezier.getToolbarPresenter(); + button.getModel().setGroup(routerButtons); + tb.add(button); + tb.addSeparator(); + + //layout buttons + tb.add(SystemAction.get(HierarchicalNodeLayoutAction.class).getToolbarPresenter()); + tb.add(SystemAction.get(HierarchicalCompoundLayoutAction.class).getToolbarPresenter()); + + tb.addSeparator(); + tb.add(SystemAction.get(ShowAllAction.class).getToolbarPresenter()); + tb.addSeparator(); + + //cluster button + tb.add(SystemAction.get(SwitchLoopClustersAction.class).getToolbarPresenter()); + tb.addSeparator(); + + //show/hide edge button + tb.add(SystemAction.get(ShowEdgesAction.class).getToolbarPresenter()); + tb.add(SystemAction.get(HideEdgesAction.class).getToolbarPresenter()); + tb.addSeparator(); + + //color button + JComponent colorButton = SystemAction.get(ColorAction.class).getToolbarPresenter(); + scene.addCfgEventListener((CfgEventListener) colorButton); + tb.add(colorButton); + + //export button + tb.add(SystemAction.get(ExportAction.class).getToolbarPresenter()); + tb.doLayout(); + + return tb; + } + + @Override + public Lookup getLookup() { + return Lookups.fixed(); + } + + @Override + public Component getComponent() { + return jScrollPane; + } +} diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/CfgCompilationViewerFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/CfgCompilationViewerFactory.java Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.ssw.visualizer.cfg; + +import com.oracle.graal.visualizer.editor.CompilationViewer; +import com.oracle.graal.visualizer.editor.CompilationViewerFactory; +import com.oracle.graal.visualizer.editor.DiagramViewModel; +import com.oracle.graal.visualizer.editor.SplitCompilationViewerFactory; +import com.sun.hotspot.igv.data.InputGraph; + +public class CfgCompilationViewerFactory extends SplitCompilationViewerFactory { + + @Override + public String getName() { + return "CFG"; + } + + @Override + protected CompilationViewer createViewer(InputGraph graph) { + return new CfgCompilationViewer(graph); + } + +} diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/editor/CfgEditorTopComponent.java --- a/src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/editor/CfgEditorTopComponent.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/editor/CfgEditorTopComponent.java Thu Feb 02 17:51:39 2012 +0100 @@ -60,7 +60,7 @@ this.jScrollPane.setOpaque(true); this.jScrollPane.setBorder(BorderFactory.createEmptyBorder()); this.jScrollPane.setViewportBorder(BorderFactory.createEmptyBorder()); - this.scene = new CfgScene(this); + this.scene = new CfgScene(jScrollPane, cfg); this.myView = scene.createView(); this.jScrollPane.setViewportView(myView); this.setLayout(new BorderLayout()); diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/graph/CfgScene.java --- a/src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/graph/CfgScene.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/graph/CfgScene.java Thu Feb 02 17:51:39 2012 +0100 @@ -17,6 +17,7 @@ import at.ssw.visualizer.cfg.visual.PolylineRouterV2; import at.ssw.visualizer.cfg.visual.WidgetCollisionCollector; import at.ssw.visualizer.model.cfg.BasicBlock; +import at.ssw.visualizer.model.cfg.ControlFlowGraph; import java.awt.Color; import java.awt.Dimension; import java.awt.Point; @@ -75,21 +76,21 @@ private CfgEnv env; private int currentLayout=-1; private int currentRouter=-1; - private CfgEditorTopComponent cfgtc; + private JScrollPane scrollPane; private EventListenerList listenerList = new EventListenerList(); private WidgetAction contextPopupAction = this.createContextMenuAction(this); private List nodeWidgets=null; private boolean loopClustersVisible = true; - public CfgScene(final CfgEditorTopComponent cfgtc){ + public CfgScene(final JScrollPane scrollPane, final ControlFlowGraph cfg){ addChild(clusterLayer); addChild(mainLayer); addChild(interractionLayer); addChild(connectionLayer); this.loadDefaults(); - this.cfgtc=cfgtc; - this.loadModel(new CfgEnv(cfgtc.getCfg())); + this.scrollPane = scrollPane; + this.loadModel(new CfgEnv(cfg)); this.setSceneLayout(CfgEditorContext.LAYOUT_HIERARCHICALNODELAYOUT);//default this.getInputBindings().setZoomActionModifiers(0); this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1)); @@ -561,7 +562,7 @@ //animated scene Zoom to the max bounds of current viewport public void zoomScene(){ - JScrollPane pane = this.cfgtc.getJScrollPanel(); + JScrollPane pane = scrollPane; Rectangle prefBounds = this.getPreferredBounds(); Dimension viewDim = pane.getViewportBorderBounds().getSize(); diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml Thu Feb 02 17:51:39 2012 +0100 @@ -15,14 +15,6 @@ - com.sun.hotspot.igv.connection - - - - 1.0 - - - com.sun.hotspot.igv.data diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Bundle.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Bundle.properties Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,1 @@ +OpenIDE-Module-Name=NetworkConnection diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Client.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Client.java Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 1998, 2007, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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.connection; + +import com.sun.hotspot.igv.data.serialization.Parser; +import com.sun.hotspot.igv.data.services.GroupCallback; +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.Socket; +import org.openide.util.Exceptions; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * + * @author Thomas Wuerthinger + */ +public class Client implements Runnable { + + private Socket socket; + private GroupCallback callback; + + public Client(Socket socket, GroupCallback callback) { + this.callback = callback; + this.socket = socket; + } + + @Override + public void run() { + + try { + InputStream inputStream = new BufferedInputStream(socket.getInputStream()); + InputSource is = new InputSource(inputStream); + + try { + Parser parser = new Parser(callback); + parser.parse(is, null); + } catch (SAXException ex) { + ex.printStackTrace(); + } + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } finally { + try { + socket.close(); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + } + } +} \ No newline at end of file diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Server.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Server.java Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,103 @@ +/* + * Copyright (c) 1998, 2007, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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.connection; + +import com.sun.hotspot.igv.data.services.GroupCallback; +import com.sun.hotspot.igv.settings.Settings; +import java.io.IOException; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.prefs.PreferenceChangeEvent; +import java.util.prefs.PreferenceChangeListener; +import org.openide.DialogDisplayer; +import org.openide.NotifyDescriptor; +import org.openide.util.RequestProcessor; + +/** + * + * @author Thomas Wuerthinger + */ +public class Server implements PreferenceChangeListener { + + private ServerSocket serverSocket; + private GroupCallback callback; + private int port; + private Runnable serverRunnable; + + public Server(GroupCallback callback) { + + this.callback = callback; + initializeNetwork(); + Settings.get().addPreferenceChangeListener(this); + } + + @Override + public void preferenceChange(PreferenceChangeEvent e) { + + int curPort = Integer.parseInt(Settings.get().get(Settings.PORT, Settings.PORT_DEFAULT)); + if (curPort != port) { + initializeNetwork(); + } + } + + private void initializeNetwork() { + + int curPort = Integer.parseInt(Settings.get().get(Settings.PORT, Settings.PORT_DEFAULT)); + this.port = curPort; + try { + serverSocket = new java.net.ServerSocket(curPort); + } catch (IOException ex) { + NotifyDescriptor message = new NotifyDescriptor.Message("Could not create server. Listening for incoming data is disabled.", NotifyDescriptor.ERROR_MESSAGE); + DialogDisplayer.getDefault().notifyLater(message); + return; + } + + Runnable runnable = new Runnable() { + + @Override + public void run() { + while (true) { + try { + Socket clientSocket = serverSocket.accept(); + if (serverRunnable != this) { + clientSocket.close(); + return; + } + RequestProcessor.getDefault().post(new Client(clientSocket, callback), 0, Thread.MAX_PRIORITY); + } catch (IOException ex) { + serverSocket = null; + NotifyDescriptor message = new NotifyDescriptor.Message("Error during listening for incoming connections. Listening for incoming data is disabled.", NotifyDescriptor.ERROR_MESSAGE); + DialogDisplayer.getDefault().notifyLater(message); + return; + } + } + } + }; + + serverRunnable = runnable; + + RequestProcessor.getDefault().post(runnable, 0, Thread.MAX_PRIORITY); + } +} diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/layer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/layer.xml Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,4 @@ + + + + diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/CompilationViewer.java --- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/CompilationViewer.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/CompilationViewer.java Thu Feb 02 17:51:39 2012 +0100 @@ -42,14 +42,4 @@ public Component getComponent(); public Component getToolBarComponent(); - - public UndoRedo getUndoRedo(); - - public void setSelection(Collection
list); - - public void paint(Graphics2D svgGenerator); - - public void zoomOut(); - - public void zoomIn(); } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/CompilationViewerFactory.java --- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/CompilationViewerFactory.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/CompilationViewerFactory.java Thu Feb 02 17:51:39 2012 +0100 @@ -23,7 +23,9 @@ */ package com.oracle.graal.visualizer.editor; +import com.sun.hotspot.igv.data.InputGraph; + public interface CompilationViewerFactory { - CompilationViewer createViewer(DiagramViewModel model); + CompilationViewer createViewer(InputGraph firstGraph, InputGraph secondGraph); String getName(); } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/DiagramViewModel.java --- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/DiagramViewModel.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/DiagramViewModel.java Thu Feb 02 17:51:39 2012 +0100 @@ -31,6 +31,7 @@ import com.sun.hotspot.igv.graph.Diagram; import com.sun.hotspot.igv.graph.Figure; import com.sun.hotspot.igv.settings.Settings; +import com.sun.hotspot.igv.util.CompilationViewModel; import com.sun.hotspot.igv.util.RangeSliderModel; import java.awt.Color; import java.util.*; @@ -39,7 +40,7 @@ * * @author Thomas Wuerthinger */ -public class DiagramViewModel extends RangeSliderModel implements ChangedListener { +public class DiagramViewModel { // Warning: Update setData method if fields are added private Group group; @@ -50,12 +51,13 @@ private FilterChain sequenceFilterChain; private Diagram diagram; private InputGraph inputGraph; - private ChangedEvent groupChangedEvent; private ChangedEvent diagramChangedEvent; private ChangedEvent viewChangedEvent; private ChangedEvent hiddenNodesChangedEvent; private ChangedEvent viewPropertiesChangedEvent; private boolean showNodeHull; + private final InputGraph secondGraph; + private final InputGraph firstGraph; private ChangedListener filterChainChangedListener = new ChangedListener() { @Override @@ -64,51 +66,6 @@ } }; - @Override - public DiagramViewModel copy() { - DiagramViewModel result = new DiagramViewModel(group, filterChain, sequenceFilterChain); - result.setData(this); - return result; - } - - public void setData(DiagramViewModel newModel) { - super.setData(newModel); - boolean diagramChanged = false; - boolean viewChanged = false; - boolean viewPropertiesChanged = false; - - boolean groupChanged = (group == newModel.group); - this.group = newModel.group; - diagramChanged |= (filterChain != newModel.filterChain); - this.filterChain = newModel.filterChain; - diagramChanged |= (sequenceFilterChain != newModel.sequenceFilterChain); - this.sequenceFilterChain = newModel.sequenceFilterChain; - diagramChanged |= (diagram != newModel.diagram); - this.diagram = newModel.diagram; - viewChanged |= (hiddenNodes != newModel.hiddenNodes); - this.hiddenNodes = newModel.hiddenNodes; - viewChanged |= (onScreenNodes != newModel.onScreenNodes); - this.onScreenNodes = newModel.onScreenNodes; - viewChanged |= (selectedNodes != newModel.selectedNodes); - this.selectedNodes = newModel.selectedNodes; - viewPropertiesChanged |= (showNodeHull != newModel.showNodeHull); - this.showNodeHull = newModel.showNodeHull; - - if (groupChanged) { - groupChangedEvent.fire(); - } - - if (diagramChanged) { - diagramChangedEvent.fire(); - } - if (viewPropertiesChanged) { - viewPropertiesChangedEvent.fire(); - } - if (viewChanged) { - viewChangedEvent.fire(); - } - } - public boolean getShowNodeHull() { return showNodeHull; } @@ -118,9 +75,10 @@ viewPropertiesChangedEvent.fire(); } - public DiagramViewModel(Group g, FilterChain filterChain, FilterChain sequenceFilterChain) { - super(calculateStringList(g)); + public DiagramViewModel(InputGraph firstGraph, InputGraph secondGraph, Group g, FilterChain filterChain, FilterChain sequenceFilterChain) { + this.firstGraph = firstGraph; + this.secondGraph = secondGraph; this.showNodeHull = true; this.group = g; assert filterChain != null; @@ -130,41 +88,14 @@ hiddenNodes = new HashSet<>(); onScreenNodes = new HashSet<>(); selectedNodes = new HashSet<>(); - super.getChangedEvent().addListener(this); diagramChangedEvent = new ChangedEvent<>(this); viewChangedEvent = new ChangedEvent<>(this); hiddenNodesChangedEvent = new ChangedEvent<>(this); viewPropertiesChangedEvent = new ChangedEvent<>(this); - groupChangedEvent = new ChangedEvent<>(this); - groupChangedEvent.addListener(groupChangedListener); - groupChangedEvent.fire(); - filterChain.getChangedEvent().addListener(filterChainChangedListener); sequenceFilterChain.getChangedEvent().addListener(filterChainChangedListener); } - private final ChangedListener groupChangedListener = new ChangedListener() { - - private Group oldGroup; - - @Override - public void changed(DiagramViewModel source) { - if (oldGroup != null) { - oldGroup.getChangedEvent().removeListener(groupContentChangedListener); - } - group.getChangedEvent().addListener(groupContentChangedListener); - oldGroup = group; - } - }; - private final ChangedListener groupContentChangedListener = new ChangedListener() { - - @Override - public void changed(Group source) { - assert source == group; - setPositions(calculateStringList(source)); - setSelectedNodes(selectedNodes); - } - }; public ChangedEvent getDiagramChangedEvent() { return diagramChangedEvent; @@ -196,8 +127,8 @@ public void setSelectedNodes(Set nodes) { this.selectedNodes = nodes; - List colors = new ArrayList<>(); - for (String s : getPositions()) { + /* List colors = new ArrayList<>(); + for (int i = 0; i < group.getGraphs().size(); ++i) { colors.add(Color.black); } if (nodes.size() >= 1) { @@ -231,7 +162,8 @@ } } } - setColors(colors); + compilationViewModel.setColors(colors);*/ + // TODO: Add colorization. viewChangedEvent.fire(); } @@ -248,7 +180,6 @@ setHiddenNodes(newHiddenNodes); } - public Set
getSelectedFigures() { Set
result = new HashSet<>(); for (Figure f : diagram.getFigures()) { @@ -321,25 +252,11 @@ } public InputGraph getFirstGraph() { - List graphs = group.getGraphs(); - if (getFirstPosition() < graphs.size()) { - return graphs.get(getFirstPosition()); - } - return graphs.get(graphs.size() - 1); + return firstGraph; } public InputGraph getSecondGraph() { - List graphs = group.getGraphs(); - if (getSecondPosition() < graphs.size()) { - return graphs.get(getSecondPosition()); - } - return getFirstGraph(); - } - - public void selectGraph(InputGraph g) { - int index = group.getGraphs().indexOf(g); - assert index != -1; - setPositions(index, index); + return secondGraph; } public Diagram getDiagramToView() { @@ -347,14 +264,14 @@ if (diagram == null) { diagram = Diagram.createDiagram(getGraphToView(), Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT)); getFilterChain().apply(diagram, getSequenceFilterChain()); - if (getFirstPosition() != getSecondPosition()) { + if (getFirstGraph() != getSecondGraph()) { CustomFilter f = new CustomFilter( "difference", "colorize('state', 'same', white);" + "colorize('state', 'changed', orange);" + "colorize('state', 'new', green);" + "colorize('state', 'deleted', red);"); f.apply(diagram); - } + } } return diagram; @@ -372,12 +289,6 @@ return inputGraph; } - @Override - public void changed(RangeSliderModel source) { - inputGraph = null; - diagramChanged(); - } - void setSelectedFigures(List
list) { Set newSelectedNodes = new HashSet<>(); for (Figure f : list) { diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/EditorInputGraphProvider.java --- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/EditorInputGraphProvider.java Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1998, 2007, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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.oracle.graal.visualizer.editor; - -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.InputNode; -import com.sun.hotspot.igv.data.services.InputGraphProvider; -import java.util.Set; - -/** - * - * @author Thomas Wuerthinger - */ -public class EditorInputGraphProvider implements InputGraphProvider { - - private EditorTopComponent editor; - - public EditorInputGraphProvider(EditorTopComponent editor) { - this.editor = editor; - } - - @Override - public InputGraph getGraph() { - return editor.getDiagramModel().getGraphToView(); - } - - @Override - public void setSelectedNodes(Set nodes) { - editor.setSelectedNodes(nodes); - } -} diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/EditorTopComponent.java --- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/EditorTopComponent.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/EditorTopComponent.java Thu Feb 02 17:51:39 2012 +0100 @@ -25,10 +25,7 @@ import com.oracle.graal.visualizer.editor.actions.NextDiagramAction; import com.oracle.graal.visualizer.editor.actions.PrevDiagramAction; -import com.sun.hotspot.igv.data.ChangedEvent; -import com.sun.hotspot.igv.data.ChangedListener; -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.InputNode; +import com.sun.hotspot.igv.data.*; import com.sun.hotspot.igv.data.services.InputGraphProvider; import com.sun.hotspot.igv.filter.FilterChain; import com.sun.hotspot.igv.filter.FilterChainProvider; @@ -37,8 +34,12 @@ import com.sun.hotspot.igv.graph.services.DiagramProvider; import com.sun.hotspot.igv.util.LookupHistory; import com.sun.hotspot.igv.util.RangeSlider; +import com.sun.hotspot.igv.util.RangeSliderModel; import java.awt.BorderLayout; +import java.awt.CardLayout; import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.*; import javax.swing.*; import javax.swing.border.Border; @@ -48,11 +49,13 @@ import org.openide.awt.ToolbarPool; import org.openide.awt.UndoRedo; import org.openide.util.Lookup; +import org.openide.util.Lookup.Provider; import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.util.actions.Presenter; import org.openide.util.lookup.AbstractLookup; import org.openide.util.lookup.InstanceContent; +import org.openide.util.lookup.Lookups; import org.openide.util.lookup.ProxyLookup; import org.openide.windows.Mode; import org.openide.windows.TopComponent; @@ -65,31 +68,40 @@ public final class EditorTopComponent extends TopComponent { private InstanceContent content; - private InstanceContent graphContent; private RangeSlider rangeSlider; private static final String PREFERRED_ID = "EditorTopComponent"; - private DiagramViewModel rangeSliderModel; - private CompilationViewer viewer; + private RangeSliderModel rangeSliderModel; + private CompilationViewer activeViewer; + private CompilationViewerFactory activeFactory; + private Group group; + private final JPanel viewerToolBarPanel; + private final CardLayout viewerToolBarPanelCardLayout; + private final JPanel viewerPanel; + private final CardLayout viewerPanelCardLayout; + private final Map createdComponents = new HashMap<>(); + private final Lookup proxyLookup; - - private DiagramProvider diagramProvider = new DiagramProvider() { + private final Lookup.Provider currentViewLookupProvider = new Lookup.Provider() { @Override - public Diagram getDiagram() { - return getModel().getDiagramToView(); - } - - @Override - public ChangedEvent getChangedEvent() { - return diagramChangedEvent; + public Lookup getLookup() { + return (activeViewer == null) ? Lookups.fixed() : activeViewer.getLookup(); } }; - - private ChangedEvent diagramChangedEvent = new ChangedEvent<>(diagramProvider); - private void updateDisplayName() { - setDisplayName(getDiagram().getName()); + int first = getModel().getFirstPosition(); + int second = getModel().getSecondPosition(); + if (first == second) { + setDisplayName(getModel().getPositions().get(first)); + } else { + setDisplayName(String.format("%s: %s - %s", activeFactory.getName(), getModel().getPositions().get(first), getModel().getPositions().get(second))); + } + } + + private void activateFactory(CompilationViewerFactory factory) { + this.activeFactory = factory; + updateView(); } public EditorTopComponent(InputGraph graph) { @@ -97,16 +109,6 @@ LookupHistory.init(InputGraphProvider.class); LookupHistory.init(DiagramProvider.class); this.setFocusable(true); - FilterChain filterChain; - FilterChain sequence; - FilterChainProvider provider = Lookup.getDefault().lookup(FilterChainProvider.class); - if (provider == null) { - filterChain = new FilterChain(); - sequence = new FilterChain(); - } else { - filterChain = provider.getFilterChain(); - sequence = provider.getSequence(); - } setName(NbBundle.getMessage(EditorTopComponent.class, "CTL_EditorTopComponent")); setToolTipText(NbBundle.getMessage(EditorTopComponent.class, "HINT_EditorTopComponent")); @@ -119,20 +121,19 @@ toolBar.setBorder(b); this.add(BorderLayout.NORTH, toolBar); - rangeSliderModel = new DiagramViewModel(graph.getGroup(), filterChain, sequence); + this.group = graph.getGroup(); + rangeSliderModel = new RangeSliderModel(calculateStringList(group)); + int graphPos = group.getGraphs().indexOf(graph); + rangeSliderModel.setPositions(graphPos, graphPos); rangeSlider = new RangeSlider(); rangeSlider.setModel(rangeSliderModel); - CompilationViewerFactory factory = Lookup.getDefault().lookup(CompilationViewerFactory.class); - viewer = factory.createViewer(rangeSliderModel); + Collection factories = Lookup.getDefault().lookupAll(CompilationViewerFactory.class); content = new InstanceContent(); - graphContent = new InstanceContent(); - this.associateLookup(new ProxyLookup(new Lookup[]{viewer.getLookup(), new AbstractLookup(graphContent), new AbstractLookup(content)})); - content.add(rangeSliderModel); - content.add(diagramProvider); + proxyLookup = Lookups.proxy(currentViewLookupProvider); + this.associateLookup(new ProxyLookup(new Lookup[]{proxyLookup, new AbstractLookup(content)})); - rangeSliderModel.getDiagramChangedEvent().addListener(diagramChangedListener); - rangeSliderModel.selectGraph(graph); + rangeSliderModel.getChangedEvent().addListener(rangeSliderListener); toolBar.add(PrevDiagramAction.get(PrevDiagramAction.class)); toolBar.add(NextDiagramAction.get(NextDiagramAction.class)); @@ -140,7 +141,13 @@ toolBar.addSeparator(); toolBar.add(UndoAction.get(UndoAction.class)); toolBar.add(RedoAction.get(RedoAction.class)); - + + ButtonGroup factoryButtonGroup = new ButtonGroup(); + for (CompilationViewerFactory factory : factories) { + AbstractButton button = createFactoryChangeButton(factory); + factoryButtonGroup.add(button); + toolBar.add(button); + } toolBar.addSeparator(); Action action = Utilities.actionsForPath("QuickSearchShadow").get(0); @@ -149,19 +156,31 @@ toolBar.add(quicksearch); toolBar.add(Box.createHorizontalGlue()); - toolBar.add(viewer.getToolBarComponent()); + viewerToolBarPanel = new JPanel(); + viewerToolBarPanelCardLayout = new CardLayout(); + viewerToolBarPanel.setLayout(viewerToolBarPanelCardLayout); + toolBar.add(viewerToolBarPanel); + viewerPanel = new JPanel(); + viewerPanelCardLayout = new CardLayout(); + viewerPanel.setLayout(viewerPanelCardLayout); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - new JScrollPane(rangeSlider), viewer.getComponent()); + new JScrollPane(rangeSlider), viewerPanel); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(250); this.add(splitPane, BorderLayout.CENTER); - updateDisplayName(); + ((JToggleButton)factoryButtonGroup.getElements().nextElement()).setSelected(true); + activeFactory = factories.iterator().next(); + updateView(); } - - public DiagramViewModel getDiagramModel() { - return rangeSliderModel; + + private static List calculateStringList(Group g) { + List result = new ArrayList<>(); + for (InputGraph graph : g.getGraphs()) { + result.add(graph.getName()); + } + return result; } public void showPrevDiagram() { @@ -174,14 +193,10 @@ } } - public DiagramViewModel getModel() { + private RangeSliderModel getModel() { return rangeSliderModel; } - public FilterChain getFilterChain() { - return getModel().getFilterChain(); - } - public static EditorTopComponent getActive() { Set modes = WindowManager.getDefault().getModes(); for (Mode m : modes) { @@ -231,121 +246,55 @@ return PREFERRED_ID; } - private ChangedListener diagramChangedListener = new ChangedListener() { + private ChangedListener rangeSliderListener = new ChangedListener() { @Override - public void changed(DiagramViewModel source) { - updateDisplayName(); - Collection list = new ArrayList<>(); - list.add(new EditorInputGraphProvider(EditorTopComponent.this)); - graphContent.set(list, null); - diagramProvider.getChangedEvent().fire(); + public void changed(RangeSliderModel source) { + updateView(); } }; - public void setSelectedFigures(List
list) { - viewer.setSelection(list); - } - - public void setSelectedNodes(Set nodes) { - - List
list = new ArrayList<>(); - Set ids = new HashSet<>(); - for (InputNode n : nodes) { - ids.add(n.getId()); + private void updateView() { + updateDisplayName(); + String id = getViewStringIdentifier(); + if (!createdComponents.containsKey(id)) { + CompilationViewer newViewer = createViewer(activeFactory, getModel().getFirstPosition(), getModel().getSecondPosition()); + createdComponents.put(id, newViewer); + viewerPanel.add(newViewer.getComponent(), id); + viewerToolBarPanel.add(newViewer.getToolBarComponent(), id); } - - for (Figure f : getModel().getDiagramToView().getFigures()) { - for (InputNode n : f.getSource().getSourceNodes()) { - if (ids.contains(n.getId())) { - list.add(f); - break; - } - } + + CompilationViewer newViewer = createdComponents.get(id); + if (newViewer != activeViewer) { + activeViewer = newViewer; + viewerPanelCardLayout.show(viewerPanel, id); + viewerToolBarPanelCardLayout.show(viewerToolBarPanel, id); + + // Make sure that lookup is updated. + proxyLookup.lookup(Object.class); } - - setSelectedFigures(list); } - - public void extract() { - getModel().showOnly(getModel().getSelectedNodes()); - } - - public void hideNodes() { - Set selectedNodes = this.getModel().getSelectedNodes(); - HashSet nodes = new HashSet<>(getModel().getHiddenNodes()); - nodes.addAll(selectedNodes); - this.getModel().showNot(nodes); + + private String getViewStringIdentifier() { + return String.format("%s/%d/%d", activeFactory.getName(), getModel().getFirstPosition(), getModel().getSecondPosition()); } - public void expandPredecessors() { - Set
oldSelection = getModel().getSelectedFigures(); - Set
figures = new HashSet<>(); - - for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) { - boolean ok = false; - if (oldSelection.contains(f)) { - ok = true; - } else { - for (Figure pred : f.getSuccessors()) { - if (oldSelection.contains(pred)) { - ok = true; - break; - } - } - } - - if (ok) { - figures.add(f); - } - } - - getModel().showAll(figures); - } - - public void expandSuccessors() { - Set
oldSelection = getModel().getSelectedFigures(); - Set
figures = new HashSet<>(); + private AbstractButton createFactoryChangeButton(final CompilationViewerFactory factory) { + JToggleButton toggleButton = new JToggleButton(factory.getName()); + toggleButton.addActionListener(new ActionListener(){ - for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) { - boolean ok = false; - if (oldSelection.contains(f)) { - ok = true; - } else { - for (Figure succ : f.getPredecessors()) { - if (oldSelection.contains(succ)) { - ok = true; - break; - } - } + @Override + public void actionPerformed(ActionEvent e) { + activateFactory(factory); } - - if (ok) { - figures.add(f); - } - } - - getModel().showAll(figures); + }); + return toggleButton; } - - public void showAll() { - getModel().showNot(new HashSet()); - } - - public Diagram getDiagram() { - return getDiagramModel().getDiagramToView(); + + private CompilationViewer createViewer(CompilationViewerFactory activeFactory, int firstPosition, int secondPosition) { + InputGraph firstSnapshot = group.getGraphs().get(firstPosition); + InputGraph secondSnapshot = group.getGraphs().get(secondPosition); + return activeFactory.createViewer(firstSnapshot, secondSnapshot); } - - @Override - public void requestActive() { - super.requestActive(); - viewer.getComponent().requestFocus(); - } - - @Override - public UndoRedo getUndoRedo() { - return viewer.getUndoRedo(); - } - } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/NodeQuickSearch.java --- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/NodeQuickSearch.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/NodeQuickSearch.java Thu Feb 02 17:51:39 2012 +0100 @@ -109,7 +109,8 @@ public void run() { final EditorTopComponent comp = EditorTopComponent.getActive(); if (comp != null) { - comp.setSelectedNodes(set); + // TODO: find connection again! + //comp.setSelectedNodes(set); comp.requestActive(); } } @@ -126,7 +127,8 @@ if (comp != null) { final Set tmpSet = new HashSet<>(); tmpSet.add(n); - comp.setSelectedNodes(tmpSet); + // TODO: find connection again! + //comp.setSelectedNodes(tmpSet); comp.requestActive(); } } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/SplitCompilationViewer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/SplitCompilationViewer.java Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2012, 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.oracle.graal.visualizer.editor; + +import com.sun.hotspot.igv.graph.Figure; +import java.awt.BorderLayout; +import java.awt.Component; +import java.util.Collection; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.JToolBar; +import org.openide.util.Lookup; +import org.openide.util.lookup.Lookups; + +class SplitCompilationViewer implements CompilationViewer { + + private JSplitPane splitPane; + private JPanel firstPanel; + private JPanel secondPanel; + + public SplitCompilationViewer(CompilationViewer firstViewer, CompilationViewer secondViewer) { + splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); + firstPanel = createPanel(firstViewer); + secondPanel = createPanel(secondViewer); + } + + @Override + public Lookup getLookup() { + return Lookups.fixed(); + } + + @Override + public Component getComponent() { + return splitPane; + } + + @Override + public Component getToolBarComponent() { + return new JPanel(); + } + + private JPanel createPanel(CompilationViewer viewer) { + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + JToolBar toolBar = new JToolBar(); + toolBar.add(viewer.getToolBarComponent()); + panel.add(BorderLayout.NORTH, toolBar); + panel.add(BorderLayout.CENTER, viewer.getComponent()); + return panel; + + } +} diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/SplitCompilationViewerFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/SplitCompilationViewerFactory.java Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2012, 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.oracle.graal.visualizer.editor; + +import com.sun.hotspot.igv.data.InputGraph; + +public abstract class SplitCompilationViewerFactory implements CompilationViewerFactory { + + @Override + public CompilationViewer createViewer(InputGraph firstGraph, InputGraph secondGraph) { + if (firstGraph == secondGraph) { + return createViewer(firstGraph); + } else { + CompilationViewer firstViewer = createViewer(firstGraph); + CompilationViewer secondViewer = createViewer(secondGraph); + return new SplitCompilationViewer(firstViewer, secondViewer); + } + } + + protected abstract CompilationViewer createViewer(InputGraph graph); +} diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/NextDiagramAction.java --- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/NextDiagramAction.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/NextDiagramAction.java Thu Feb 02 17:51:39 2012 +0100 @@ -26,6 +26,7 @@ import com.sun.hotspot.igv.data.ChangedListener; import com.sun.hotspot.igv.util.ContextAction; import com.oracle.graal.visualizer.editor.DiagramViewModel; +import com.sun.hotspot.igv.util.RangeSliderModel; import javax.swing.Action; import javax.swing.ImageIcon; import org.openide.awt.ActionID; @@ -40,9 +41,9 @@ @ActionID(id = "com.oracle.graal.visualizer.editor.actions.NextDiagramAction", category = "View") @ActionRegistration(displayName = "Next snapshot") @ActionReference(path = "Menu/View", position = 150) -public final class NextDiagramAction extends ContextAction implements ChangedListener { +public final class NextDiagramAction extends ContextAction implements ChangedListener { - private DiagramViewModel model; + private RangeSliderModel model; public NextDiagramAction() { this(Utilities.actionsGlobalContext()); @@ -64,12 +65,12 @@ } @Override - public Class contextClass() { - return DiagramViewModel.class; + public Class contextClass() { + return RangeSliderModel.class; } @Override - public void performAction(DiagramViewModel model) { + public void performAction(RangeSliderModel model) { int fp = model.getFirstPosition(); int sp = model.getSecondPosition(); if (sp != model.getPositions().size() - 1) { @@ -80,23 +81,23 @@ } @Override - public void update(DiagramViewModel model) { + public void update(RangeSliderModel model) { super.update(model); if (this.model != model) { if (this.model != null) { - this.model.getDiagramChangedEvent().removeListener(this); + this.model.getChangedEvent().removeListener(this); } this.model = model; if (this.model != null) { - this.model.getDiagramChangedEvent().addListener(this); + this.model.getChangedEvent().addListener(this); } } } @Override - public boolean isEnabled(DiagramViewModel model) { + public boolean isEnabled(RangeSliderModel model) { return model.getSecondPosition() != model.getPositions().size() - 1; } @@ -106,7 +107,7 @@ } @Override - public void changed(DiagramViewModel source) { + public void changed(RangeSliderModel source) { update(source); } } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/PrevDiagramAction.java --- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/PrevDiagramAction.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/PrevDiagramAction.java Thu Feb 02 17:51:39 2012 +0100 @@ -26,6 +26,7 @@ import com.sun.hotspot.igv.data.ChangedListener; import com.sun.hotspot.igv.util.ContextAction; import com.oracle.graal.visualizer.editor.DiagramViewModel; +import com.sun.hotspot.igv.util.RangeSliderModel; import javax.swing.Action; import javax.swing.ImageIcon; import org.openide.awt.ActionID; @@ -40,9 +41,9 @@ @ActionID(id = "com.oracle.graal.visualizer.editor.actions.PrevDiagramAction", category = "View") @ActionRegistration(displayName = "Previous snapshot") @ActionReference(path = "Menu/View", position = 100) -public final class PrevDiagramAction extends ContextAction implements ChangedListener { +public final class PrevDiagramAction extends ContextAction implements ChangedListener { - private DiagramViewModel model; + private RangeSliderModel model; public PrevDiagramAction() { this(Utilities.actionsGlobalContext()); @@ -64,12 +65,12 @@ } @Override - public Class contextClass() { - return DiagramViewModel.class; + public Class contextClass() { + return RangeSliderModel.class; } @Override - public void performAction(DiagramViewModel model) { + public void performAction(RangeSliderModel model) { int fp = model.getFirstPosition(); int sp = model.getSecondPosition(); if (fp != 0) { @@ -80,23 +81,23 @@ } @Override - public void update(DiagramViewModel model) { + public void update(RangeSliderModel model) { super.update(model); if (this.model != model) { if (this.model != null) { - this.model.getDiagramChangedEvent().removeListener(this); + this.model.getChangedEvent().removeListener(this); } this.model = model; if (this.model != null) { - this.model.getDiagramChangedEvent().addListener(this); + this.model.getChangedEvent().addListener(this); } } } @Override - public boolean isEnabled(DiagramViewModel model) { + public boolean isEnabled(RangeSliderModel model) { return model.getFirstPosition() != 0; } @@ -106,7 +107,7 @@ } @Override - public void changed(DiagramViewModel source) { + public void changed(RangeSliderModel source) { update(source); } } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/build.xml --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/build.xml Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - Builds, tests, and runs the project com.sun.hotspot.igv.connection. - - diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/manifest.mf --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/manifest.mf Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.sun.hotspot.igv.connection -OpenIDE-Module-Layer: com/sun/hotspot/igv/connection/layer.xml -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/connection/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/build-impl.xml --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/build-impl.xml Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - - - - - - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/genfiles.properties --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/genfiles.properties Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=5a0e591e -nbproject/build-impl.xml.script.CRC32=61516e53 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/project.properties Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -javac.source=1.7 -javac.compilerargs=-Xlint -Xlint:-serial diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/project.xml Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ - - - org.netbeans.modules.apisupport.project - - - com.sun.hotspot.igv.connection - - - - com.sun.hotspot.igv.data - - - - 1.0 - - - - com.sun.hotspot.igv.settings - - - - 1.0 - - - - org.openide.awt - - - - 7.30.1 - - - - org.openide.dialogs - - - - 7.18.1 - - - - org.openide.util - - - - 8.14.1 - - - - org.openide.util.lookup - - - - 8.6.1 - - - - - com.sun.hotspot.igv.connection - - - - diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/suite.properties --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/nbproject/suite.properties Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -suite.dir=${basedir}/.. diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Bundle.properties --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Bundle.properties Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -OpenIDE-Module-Name=NetworkConnection diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Client.java --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Client.java Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1998, 2007, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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.connection; - -import com.sun.hotspot.igv.data.serialization.Parser; -import com.sun.hotspot.igv.data.services.GroupCallback; -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.Socket; -import org.openide.util.Exceptions; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * - * @author Thomas Wuerthinger - */ -public class Client implements Runnable { - - private Socket socket; - private GroupCallback callback; - - public Client(Socket socket, GroupCallback callback) { - this.callback = callback; - this.socket = socket; - } - - @Override - public void run() { - - try { - InputStream inputStream = new BufferedInputStream(socket.getInputStream()); - InputSource is = new InputSource(inputStream); - - try { - Parser parser = new Parser(callback); - parser.parse(is, null); - } catch (SAXException ex) { - ex.printStackTrace(); - } - } catch (IOException ex) { - Exceptions.printStackTrace(ex); - } finally { - try { - socket.close(); - } catch (IOException ex) { - Exceptions.printStackTrace(ex); - } - } - } -} \ No newline at end of file diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Server.java --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Server.java Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1998, 2007, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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.connection; - -import com.sun.hotspot.igv.data.services.GroupCallback; -import com.sun.hotspot.igv.settings.Settings; -import java.io.IOException; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.prefs.PreferenceChangeEvent; -import java.util.prefs.PreferenceChangeListener; -import org.openide.DialogDisplayer; -import org.openide.NotifyDescriptor; -import org.openide.util.RequestProcessor; - -/** - * - * @author Thomas Wuerthinger - */ -public class Server implements PreferenceChangeListener { - - private ServerSocket serverSocket; - private GroupCallback callback; - private int port; - private Runnable serverRunnable; - - public Server(GroupCallback callback) { - - this.callback = callback; - initializeNetwork(); - Settings.get().addPreferenceChangeListener(this); - } - - @Override - public void preferenceChange(PreferenceChangeEvent e) { - - int curPort = Integer.parseInt(Settings.get().get(Settings.PORT, Settings.PORT_DEFAULT)); - if (curPort != port) { - initializeNetwork(); - } - } - - private void initializeNetwork() { - - int curPort = Integer.parseInt(Settings.get().get(Settings.PORT, Settings.PORT_DEFAULT)); - this.port = curPort; - try { - serverSocket = new java.net.ServerSocket(curPort); - } catch (IOException ex) { - NotifyDescriptor message = new NotifyDescriptor.Message("Could not create server. Listening for incoming data is disabled.", NotifyDescriptor.ERROR_MESSAGE); - DialogDisplayer.getDefault().notifyLater(message); - return; - } - - Runnable runnable = new Runnable() { - - @Override - public void run() { - while (true) { - try { - Socket clientSocket = serverSocket.accept(); - if (serverRunnable != this) { - clientSocket.close(); - return; - } - RequestProcessor.getDefault().post(new Client(clientSocket, callback), 0, Thread.MAX_PRIORITY); - } catch (IOException ex) { - serverSocket = null; - NotifyDescriptor message = new NotifyDescriptor.Message("Error during listening for incoming connections. Listening for incoming data is disabled.", NotifyDescriptor.ERROR_MESSAGE); - DialogDisplayer.getDefault().notifyLater(message); - return; - } - } - } - }; - - serverRunnable = runnable; - - RequestProcessor.getDefault().post(runnable, 0, Thread.MAX_PRIORITY); - } -} diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/layer.xml --- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/layer.xml Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - - - - diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/SelectionCoordinator/build.xml --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/build.xml Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - Builds, tests, and runs the project com.sun.hotspot.igv.selectioncoordinator. - - diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/SelectionCoordinator/manifest.mf --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/manifest.mf Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.sun.hotspot.igv.selectioncoordinator -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/selectioncoordinator/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/build-impl.xml --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/build-impl.xml Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - - - - - - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/genfiles.properties --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/genfiles.properties Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=13553862 -nbproject/build-impl.xml.script.CRC32=3db87c68 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/platform.properties --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/platform.properties Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -# Deprecated since 5.0u1; for compatibility with 5.0: -disabled.clusters=\ - apisupport1,\ - gsf1,\ - harness,\ - java2,\ - nb6.1,\ - profiler3 -disabled.modules=\ - org.apache.xml.resolver,\ - org.netbeans.api.debugger,\ - org.netbeans.api.xml,\ - org.netbeans.core.execution,\ - org.netbeans.core.ide,\ - org.netbeans.core.multiview,\ - org.netbeans.core.nativeaccess,\ - org.netbeans.core.output2,\ - org.netbeans.insane,\ - org.netbeans.lib.cvsclient,\ - org.netbeans.libs.commons_logging,\ - org.netbeans.libs.freemarker,\ - org.netbeans.libs.ini4j,\ - org.netbeans.libs.jna,\ - org.netbeans.libs.jsch,\ - org.netbeans.libs.jsr223,\ - org.netbeans.libs.lucene,\ - org.netbeans.libs.svnClientAdapter,\ - org.netbeans.libs.xerces,\ - org.netbeans.modules.applemenu,\ - org.netbeans.modules.autoupdate.services,\ - org.netbeans.modules.autoupdate.ui,\ - org.netbeans.modules.classfile,\ - org.netbeans.modules.core.kit,\ - org.netbeans.modules.db,\ - org.netbeans.modules.db.core,\ - org.netbeans.modules.db.drivers,\ - org.netbeans.modules.db.kit,\ - org.netbeans.modules.db.mysql,\ - org.netbeans.modules.db.sql.editor,\ - org.netbeans.modules.db.sql.visualeditor,\ - org.netbeans.modules.dbapi,\ - org.netbeans.modules.defaults,\ - org.netbeans.modules.diff,\ - org.netbeans.modules.editor.bookmarks,\ - org.netbeans.modules.editor.bracesmatching,\ - org.netbeans.modules.editor.codetemplates,\ - org.netbeans.modules.editor.completion,\ - org.netbeans.modules.editor.errorstripe,\ - org.netbeans.modules.editor.errorstripe.api,\ - org.netbeans.modules.editor.guards,\ - org.netbeans.modules.editor.highlights,\ - org.netbeans.modules.editor.macros,\ - org.netbeans.modules.editor.plain,\ - org.netbeans.modules.editor.plain.lib,\ - org.netbeans.modules.editor.structure,\ - org.netbeans.modules.extbrowser,\ - org.netbeans.modules.favorites,\ - org.netbeans.modules.gototest,\ - org.netbeans.modules.httpserver,\ - org.netbeans.modules.ide.kit,\ - org.netbeans.modules.image,\ - org.netbeans.modules.javahelp,\ - org.netbeans.modules.jumpto,\ - org.netbeans.modules.languages,\ - org.netbeans.modules.languages.bat,\ - org.netbeans.modules.languages.diff,\ - org.netbeans.modules.languages.manifest,\ - org.netbeans.modules.languages.sh,\ - org.netbeans.modules.lexer.editorbridge,\ - org.netbeans.modules.lexer.nbbridge,\ - org.netbeans.modules.localhistory,\ - org.netbeans.modules.masterfs,\ - org.netbeans.modules.mercurial,\ - org.netbeans.modules.progress.ui,\ - org.netbeans.modules.project.ant,\ - org.netbeans.modules.project.libraries,\ - org.netbeans.modules.projectui,\ - org.netbeans.modules.projectuiapi,\ - org.netbeans.modules.properties,\ - org.netbeans.modules.properties.syntax,\ - org.netbeans.modules.refactoring.api,\ - org.netbeans.modules.schema2beans,\ - org.netbeans.modules.sendopts,\ - org.netbeans.modules.server,\ - org.netbeans.modules.servletapi,\ - org.netbeans.modules.subversion,\ - org.netbeans.modules.tasklist.kit,\ - org.netbeans.modules.tasklist.projectint,\ - org.netbeans.modules.tasklist.todo,\ - org.netbeans.modules.tasklist.ui,\ - org.netbeans.modules.templates,\ - org.netbeans.modules.timers,\ - org.netbeans.modules.usersguide,\ - org.netbeans.modules.utilities,\ - org.netbeans.modules.utilities.project,\ - org.netbeans.modules.versioning,\ - org.netbeans.modules.versioning.system.cvss,\ - org.netbeans.modules.versioning.util,\ - org.netbeans.modules.web.flyingsaucer,\ - org.netbeans.modules.xml,\ - org.netbeans.modules.xml.axi,\ - org.netbeans.modules.xml.catalog,\ - org.netbeans.modules.xml.core,\ - org.netbeans.modules.xml.lexer,\ - org.netbeans.modules.xml.multiview,\ - org.netbeans.modules.xml.retriever,\ - org.netbeans.modules.xml.schema.completion,\ - org.netbeans.modules.xml.schema.model,\ - org.netbeans.modules.xml.tax,\ - org.netbeans.modules.xml.text,\ - org.netbeans.modules.xml.tools,\ - org.netbeans.modules.xml.wsdl.model,\ - org.netbeans.modules.xml.xam,\ - org.netbeans.modules.xml.xdm,\ - org.netbeans.modules.xsl,\ - org.netbeans.spi.debugger.ui,\ - org.netbeans.spi.editor.hints,\ - org.netbeans.spi.navigator,\ - org.netbeans.spi.palette,\ - org.netbeans.spi.tasklist,\ - org.netbeans.spi.viewmodel,\ - org.netbeans.swing.dirchooser,\ - org.openide.compat,\ - org.openide.util.enumerations -enabled.clusters=\ - ide9,\ - platform8 -nbjdk.active=default -nbplatform.active=default diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/project.properties Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -javac.source=1.7 -javac.compilerargs=-Xlint -Xlint:-serial diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/project.xml Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ - - - org.netbeans.modules.apisupport.project - - - com.sun.hotspot.igv.selectioncoordinator - - - - com.sun.hotspot.igv.data - - - - 1.0 - - - - - com.sun.hotspot.igv.selectioncoordinator - - - - diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/suite.properties --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/nbproject/suite.properties Wed Feb 01 18:29:28 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -suite.dir=${basedir}/.. diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/SelectionCoordinator/src/com/sun/hotspot/igv/selectioncoordinator/SelectionCoordinator.java --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/src/com/sun/hotspot/igv/selectioncoordinator/SelectionCoordinator.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/src/com/sun/hotspot/igv/selectioncoordinator/SelectionCoordinator.java Thu Feb 02 17:51:39 2012 +0100 @@ -100,7 +100,6 @@ private void highlightedObjectsChanged() { highlightedChangedEvent.fire(); - } public void addAllSelected(Set s) { diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/CompilationViewModel.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/CompilationViewModel.java Thu Feb 02 17:51:39 2012 +0100 @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.sun.hotspot.igv.util; + +import com.sun.hotspot.igv.data.*; +import java.awt.Color; +import java.util.List; + +public class CompilationViewModel implements ChangedEventProvider { + + private final ChangedEvent changedEvent = new ChangedEvent<>(this); + private final RangeSliderModel model; + private final Group group; + + @Override + public ChangedEvent getChangedEvent() { + return changedEvent; + } + + public CompilationViewModel(RangeSliderModel model, Group group) { + this.model = model; + this.group = group; + model.getChangedEvent().addListener(rangeSliderChangedListener); + } + + private final ChangedListener rangeSliderChangedListener = new ChangedListener() { + @Override + public void changed(RangeSliderModel source) { + changedEvent.fire(); + } + }; + + public InputGraph getFirstSnapshot() { + return group.getGraphs().get(model.getFirstPosition()); + } + + public InputGraph getSecondSnapshot() { + return group.getGraphs().get(model.getSecondPosition()); + } + + public void setColors(List colors) { + model.setColors(colors); + } +} diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java --- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java Thu Feb 02 17:51:39 2012 +0100 @@ -70,7 +70,7 @@ setPositions(positions); } - protected void setPositions(List positions) { + protected final void setPositions(List positions) { this.positions = positions; colors = new ArrayList<>(); for (int i = 0; i < positions.size(); i++) { diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/View/nbproject/project.xml Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/nbproject/project.xml Thu Feb 02 17:51:39 2012 +0100 @@ -63,14 +63,6 @@ - com.sun.hotspot.igv.selectioncoordinator - - - - 1.0 - - - com.sun.hotspot.igv.settings diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandPredecessorsAction.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandPredecessorsAction.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandPredecessorsAction.java Thu Feb 02 17:51:39 2012 +0100 @@ -37,7 +37,7 @@ public void performAction() { EditorTopComponent editor = EditorTopComponent.getActive(); if (editor != null) { - editor.expandPredecessors(); + //editor.expandPredecessors(); } } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandSuccessorsAction.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandSuccessorsAction.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExpandSuccessorsAction.java Thu Feb 02 17:51:39 2012 +0100 @@ -37,7 +37,7 @@ public void performAction() { EditorTopComponent editor = EditorTopComponent.getActive(); if (editor != null) { - editor.expandSuccessors(); + //editor.expandSuccessors(); } } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExtractAction.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExtractAction.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExtractAction.java Thu Feb 02 17:51:39 2012 +0100 @@ -47,7 +47,7 @@ public void performAction() { EditorTopComponent editor = EditorTopComponent.getActive(); if (editor != null) { - editor.extract(); + //editor.extract(); } } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/HideAction.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/HideAction.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/HideAction.java Thu Feb 02 17:51:39 2012 +0100 @@ -47,7 +47,7 @@ public void performAction() { EditorTopComponent editor = EditorTopComponent.getActive(); if (editor != null) { - editor.hideNodes(); + //editor.hideNodes(); } } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ShowAllAction.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ShowAllAction.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ShowAllAction.java Thu Feb 02 17:51:39 2012 +0100 @@ -47,7 +47,7 @@ public void performAction() { EditorTopComponent editor = EditorTopComponent.getActive(); if (editor != null) { - editor.showAll(); + //editor.showAll(); } } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomInAction.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomInAction.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomInAction.java Thu Feb 02 17:51:39 2012 +0100 @@ -24,6 +24,7 @@ package com.sun.hotspot.igv.view.actions; import com.oracle.graal.visualizer.editor.EditorTopComponent; +import com.sun.hotspot.igv.view.scene.DiagramScene; import com.sun.hotspot.igv.view.scene.GraphCompilationViewer; import java.awt.Event; import java.awt.event.KeyEvent; @@ -40,11 +41,11 @@ * @author Thomas Wuerthinger */ public final class ZoomInAction extends CallableSystemAction { - private final GraphCompilationViewer viewer; + private final DiagramScene scene; @Override public void performAction() { - viewer.zoomIn(); + scene.zoomIn(); } @Override @@ -52,8 +53,8 @@ return "Zoom in"; } - public ZoomInAction(GraphCompilationViewer viewer) { - this.viewer = viewer; + public ZoomInAction(DiagramScene scene) { + this.scene = scene; putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, Event.CTRL_MASK, false)); putValue(Action.SHORT_DESCRIPTION, "Zoom in"); } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomOutAction.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomOutAction.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ZoomOutAction.java Thu Feb 02 17:51:39 2012 +0100 @@ -24,6 +24,7 @@ package com.sun.hotspot.igv.view.actions; import com.oracle.graal.visualizer.editor.EditorTopComponent; +import com.sun.hotspot.igv.view.scene.DiagramScene; import com.sun.hotspot.igv.view.scene.GraphCompilationViewer; import java.awt.Event; import java.awt.event.KeyEvent; @@ -40,15 +41,15 @@ * @author Thomas Wuerthinger */ public final class ZoomOutAction extends CallableSystemAction { - private final GraphCompilationViewer viewer; + private final DiagramScene scene; @Override public void performAction() { - viewer.zoomOut(); + scene.zoomOut(); } - public ZoomOutAction(GraphCompilationViewer viewer) { - this.viewer = viewer; + public ZoomOutAction(DiagramScene scene) { + this.scene = scene; putValue(Action.SHORT_DESCRIPTION, "Zoom out"); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, Event.CTRL_MASK, false)); } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/DiagramScene.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/DiagramScene.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/DiagramScene.java Thu Feb 02 17:51:39 2012 +0100 @@ -23,6 +23,7 @@ */ package com.sun.hotspot.igv.view.scene; +import com.oracle.graal.visualizer.editor.DiagramViewModel; import com.sun.hotspot.igv.data.ChangedListener; import com.sun.hotspot.igv.data.ControllableChangedListener; import com.sun.hotspot.igv.data.Pair; @@ -30,12 +31,9 @@ import com.sun.hotspot.igv.graph.*; import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager; import com.sun.hotspot.igv.layout.LayoutGraph; -import com.sun.hotspot.igv.selectioncoordinator.SelectionCoordinator; import com.sun.hotspot.igv.util.ColorIcon; import com.sun.hotspot.igv.util.DoubleClickAction; import com.sun.hotspot.igv.util.PropertiesSheet; -import com.oracle.graal.visualizer.editor.CompilationViewer; -import com.oracle.graal.visualizer.editor.DiagramViewModel; import com.sun.hotspot.igv.view.actions.CustomizablePanAction; import com.sun.hotspot.igv.view.widgets.*; import java.awt.*; @@ -43,10 +41,6 @@ import java.util.List; import java.util.*; import javax.swing.*; -import javax.swing.event.UndoableEditEvent; -import javax.swing.undo.AbstractUndoableEdit; -import javax.swing.undo.CannotRedoException; -import javax.swing.undo.CannotUndoException; import org.netbeans.api.visual.action.*; import org.netbeans.api.visual.animator.SceneAnimator; import org.netbeans.api.visual.layout.LayoutFactory; @@ -75,13 +69,11 @@ private Action[] actions; private LayerWidget connectionLayer; private JScrollPane scrollPane; - private UndoRedo.Manager undoRedoManager; private LayerWidget mainLayer; private LayerWidget blockLayer; private Widget topLeft; private Widget bottomRight; private DiagramViewModel model; - private DiagramViewModel modelCopy; private WidgetAction zoomAction; private boolean rebuilding; /** @@ -139,7 +131,7 @@ return false; } - void zoomOut() { + public void zoomOut() { double zoom = getZoomFactor(); Point viewPosition = getScrollPane().getViewport().getViewPosition(); double newZoom = zoom / DiagramScene.ZOOM_INCREMENT; @@ -150,7 +142,7 @@ } } - void zoomIn() { + public void zoomIn() { double zoom = getZoomFactor(); Point viewPosition = getScrollPane().getViewport().getViewPosition(); @@ -163,11 +155,7 @@ } private void centerFigures(Collection
list) { - - boolean b = getUndoRedoEnabled(); - setUndoRedoEnabled(false); gotoFigures(list); - setUndoRedoEnabled(b); } private Set getObjectsFromIdSet(Set set) { @@ -185,26 +173,6 @@ } return selectedObjects; } - private ControllableChangedListener highlightedCoordinatorListener = new ControllableChangedListener() { - - @Override - public void filteredChanged(SelectionCoordinator source) { - if (DiagramScene.this.isVisible()) { - DiagramScene.this.setHighlightedObjects(getObjectsFromIdSet(source.getHighlightedObjects())); - DiagramScene.this.validate(); - } - } - }; - private ControllableChangedListener selectedCoordinatorListener = new ControllableChangedListener() { - - @Override - public void filteredChanged(SelectionCoordinator source) { - if (DiagramScene.this.isVisible()) { - DiagramScene.this.gotoSelection(source.getSelectedObjects()); - DiagramScene.this.validate(); - } - } - }; private RectangularSelectProvider rectangularSelectProvider = new RectangularSelectProvider() { @Override @@ -328,12 +296,6 @@ } } getModel().setSelectedNodes(nodeSelection); - - boolean b = selectedCoordinatorListener.isEnabled(); - selectedCoordinatorListener.setEnabled(false); - SelectionCoordinator.getInstance().setSelectedObjects(nodeSelection); - selectedCoordinatorListener.setEnabled(b); - } @Override @@ -346,10 +308,11 @@ nodeHighlighting.addAll(((Slot) o).getSource().getSourceNodesAsSet()); } } - boolean b = highlightedCoordinatorListener.isEnabled(); - highlightedCoordinatorListener.setEnabled(false); - SelectionCoordinator.getInstance().setHighlightedObjects(nodeHighlighting); - highlightedCoordinatorListener.setEnabled(b); +// boolean b = highlightedCoordinatorListener.isEnabled(); +// highlightedCoordinatorListener.setEnabled(false); +// SelectionCoordinator.getInstance().setHighlightedObjects(nodeHighlighting); +// highlightedCoordinatorListener.setEnabled(b); + validate(); } @Override @@ -369,10 +332,15 @@ } }; - public DiagramScene(Action[] actions, DiagramViewModel model) { + public void setActions(Action[] actions) { + this.actions = actions; + } + + - this.actions = actions; + public DiagramScene(DiagramViewModel model) { + this.model = model; content = new InstanceContent(); lookup = new AbstractLookup(content); @@ -425,14 +393,9 @@ this.addChild(selectLayer); this.getActions().addAction(ActionFactory.createRectangularSelectAction(rectangularSelectDecorator, selectLayer, rectangularSelectProvider)); - boolean b = this.getUndoRedoEnabled(); - this.setUndoRedoEnabled(false); - this.setNewModel(model); - this.setUndoRedoEnabled(b); this.addObjectSceneListener(selectionChangedListener, ObjectSceneEventType.OBJECT_SELECTION_CHANGED, ObjectSceneEventType.OBJECT_HIGHLIGHTING_CHANGED, ObjectSceneEventType.OBJECT_HOVER_CHANGED); - SelectionCoordinator.getInstance().getHighlightedChangedEvent().addListener(highlightedCoordinatorListener); - SelectionCoordinator.getInstance().getSelectedChangedEvent().addListener(selectedCoordinatorListener); + update(); } public DiagramViewModel getModel() { @@ -475,18 +438,6 @@ return a; } - public void setNewModel(DiagramViewModel model) { - assert this.model == null : "can set model only once!"; - this.model = model; - this.modelCopy = null; - - model.getDiagramChangedEvent().addListener(fullChange); - model.getViewPropertiesChangedEvent().addListener(fullChange); - model.getViewChangedEvent().addListener(selectionChange); - model.getHiddenNodesChangedEvent().addListener(hiddenNodesChange); - update(); - } - private void update() { mainLayer.removeChildren(); blockLayer.removeChildren(); @@ -536,11 +487,7 @@ private void smallUpdate(boolean relayout) { - System.out.println("smallUpdate " + relayout); this.updateHiddenNodes(model.getHiddenNodes(), relayout); - boolean b = this.getUndoRedoEnabled(); - this.setUndoRedoEnabled(false); - this.setUndoRedoEnabled(b); this.validate(); } @@ -871,19 +818,6 @@ centerFigures(list); } - private UndoRedo.Manager getUndoRedoManager() { - if (undoRedoManager == null) { - undoRedoManager = new UndoRedo.Manager(); - undoRedoManager.setLimit(UNDOREDO_LIMIT); - } - - return undoRedoManager; - } - - UndoRedo getUndoRedo() { - return getUndoRedoManager(); - } - private boolean isVisible(Figure f) { for (Integer n : f.getSource().getSourceNodesAsSet()) { if (getModel().getHiddenNodes().contains(n)) { @@ -974,7 +908,6 @@ relayout(oldVisibleWidgets); } this.validate(); - addUndo(); } private void showFigure(Figure f) { @@ -1023,73 +956,7 @@ } return menu; } - - private static class DiagramUndoRedo extends AbstractUndoableEdit implements ChangedListener { - - private DiagramViewModel oldModel; - private DiagramViewModel newModel; - private Point oldScrollPosition; - private DiagramScene scene; - - public DiagramUndoRedo(DiagramScene scene, Point oldScrollPosition, DiagramViewModel oldModel, DiagramViewModel newModel) { - assert oldModel != null; - assert newModel != null; - this.oldModel = oldModel; - this.newModel = newModel; - this.scene = scene; - this.oldScrollPosition = oldScrollPosition; - } - - @Override - public void redo() throws CannotRedoException { - super.redo(); - boolean b = scene.getUndoRedoEnabled(); - scene.setUndoRedoEnabled(false); - scene.getModel().getViewChangedEvent().addListener(this); - scene.getModel().setData(newModel); - scene.getModel().getViewChangedEvent().removeListener(this); - scene.setUndoRedoEnabled(b); - } - - @Override - public void undo() throws CannotUndoException { - super.undo(); - boolean b = scene.getUndoRedoEnabled(); - scene.setUndoRedoEnabled(false); - scene.getModel().getViewChangedEvent().addListener(this); - scene.getModel().setData(oldModel); - scene.getModel().getViewChangedEvent().removeListener(this); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - scene.setScrollPosition(oldScrollPosition); - } - }); - - scene.setUndoRedoEnabled(b); - } - - @Override - public void changed(DiagramViewModel source) { - scene.getModel().getViewChangedEvent().removeListener(this); - if (oldModel.getHiddenNodes().equals(newModel.getHiddenNodes())) { - scene.smallUpdate(false); - } else { - scene.smallUpdate(true); - } - } - } - private boolean undoRedoEnabled = true; - - public void setUndoRedoEnabled(boolean b) { - this.undoRedoEnabled = b; - } - - public boolean getUndoRedoEnabled() { - return undoRedoEnabled; - } + private final ChangedListener fullChange = new ChangedListener() { @Override @@ -1117,15 +984,4 @@ smallUpdate(false); } }; - - private void addUndo() { - - DiagramViewModel newModelCopy = model.copy(); - - if (undoRedoEnabled) { - this.getUndoRedoManager().undoableEditHappened(new UndoableEditEvent(this, new DiagramUndoRedo(this, this.getScrollPosition(), modelCopy, newModelCopy))); - } - - this.modelCopy = newModelCopy; - } } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/GraphCompilationViewer.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/GraphCompilationViewer.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/GraphCompilationViewer.java Thu Feb 02 17:51:39 2012 +0100 @@ -24,11 +24,11 @@ package com.sun.hotspot.igv.view.scene; -import com.sun.hotspot.igv.graph.Figure; import com.sun.hotspot.igv.svg.BatikSVG; import com.oracle.graal.visualizer.editor.CompilationViewer; import com.oracle.graal.visualizer.editor.DiagramViewModel; import com.oracle.graal.visualizer.editor.ExportCookie; +import com.sun.hotspot.igv.graph.Figure; import com.sun.hotspot.igv.view.actions.*; import java.awt.Component; import java.awt.Graphics2D; @@ -41,7 +41,6 @@ import javax.swing.JToolBar; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; -import org.openide.awt.UndoRedo; import org.openide.util.Lookup; import org.openide.util.lookup.Lookups; import org.openide.util.lookup.ProxyLookup; @@ -90,28 +89,29 @@ GraphCompilationViewer(DiagramViewModel model) { + scene = new DiagramScene(model); + Action[] actions = new Action[]{ ExtractAction.get(ExtractAction.class), ShowAllAction.get(HideAction.class), ShowAllAction.get(ShowAllAction.class), null, - new ZoomInAction(this), - new ZoomOutAction(this), + // new ZoomInAction(scene), + //new ZoomOutAction(scene), null, ExpandPredecessorsAction.get(ExpandPredecessorsAction.class), ExpandSuccessorsAction.get(ExpandSuccessorsAction.class) }; - scene = new DiagramScene(actions, model); - + scene.setActions(actions); toolBar = new JToolBar(); toolBar.add(ExtractAction.get(ExtractAction.class)); toolBar.add(ShowAllAction.get(HideAction.class)); toolBar.add(ShowAllAction.get(ShowAllAction.class)); toolBar.addSeparator(); - toolBar.add(ShowAllAction.get(ZoomInAction.class)); - toolBar.add(ShowAllAction.get(ZoomOutAction.class)); + //toolBar.add(ShowAllAction.get(ZoomInAction.class)); + //toolBar.add(ShowAllAction.get(ZoomOutAction.class)); predSuccAction = new PredSuccAction(); JToggleButton button = new JToggleButton(predSuccAction); @@ -138,32 +138,6 @@ } @Override - public UndoRedo getUndoRedo() { - return scene.getUndoRedo(); - } - - @Override - public void setSelection(Collection
list) { - scene.setSelection(list); - } - - @Override - public void paint(Graphics2D svgGenerator) { - scene.paint(svgGenerator); - } - - @Override - public void zoomOut() { - scene.zoomOut(); - } - - @Override - public void zoomIn() { - scene.zoomIn(); - } - - - @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() == this.predSuccAction) { boolean b = (Boolean) predSuccAction.getValue(PredSuccAction.STATE); diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/GraphCompilationViewerFactory.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/GraphCompilationViewerFactory.java Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/GraphCompilationViewerFactory.java Thu Feb 02 17:51:39 2012 +0100 @@ -27,11 +27,26 @@ import com.oracle.graal.visualizer.editor.CompilationViewer; import com.oracle.graal.visualizer.editor.CompilationViewerFactory; import com.oracle.graal.visualizer.editor.DiagramViewModel; +import com.sun.hotspot.igv.data.InputGraph; +import com.sun.hotspot.igv.filter.FilterChain; +import com.sun.hotspot.igv.filter.FilterChainProvider; +import org.openide.util.Lookup; public class GraphCompilationViewerFactory implements CompilationViewerFactory{ @Override - public CompilationViewer createViewer(DiagramViewModel model) { + public CompilationViewer createViewer(InputGraph firstGraph, InputGraph secondGraph) { + FilterChain filterChain; + FilterChain sequence; + FilterChainProvider provider = Lookup.getDefault().lookup(FilterChainProvider.class); + if (provider == null) { + filterChain = new FilterChain(); + sequence = new FilterChain(); + } else { + filterChain = provider.getFilterChain(); + sequence = provider.getSequence(); + } + DiagramViewModel model = new DiagramViewModel(firstGraph, secondGraph, firstGraph.getGroup(), filterChain, filterChain); return new GraphCompilationViewer(model); } diff -r bcce7f52832d -r e55e2fca50fa src/share/tools/IdealGraphVisualizer/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Wed Feb 01 18:29:28 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Thu Feb 02 17:51:39 2012 +0100 @@ -15,17 +15,14 @@ ${project.com.sun.hotspot.igv.settings}:\ ${project.com.sun.hotspot.igv.util}:\ ${project.com.sun.hotspot.igv.svg}:\ - ${project.com.sun.hotspot.connection}:\ ${project.com.sun.hotspot.igv.servercompilerscheduler}:\ ${project.com.sun.hotspot.igv.filterwindow}:\ - ${project.com.sun.hotspot.igv.selectioncoordinator}:\ ${project.com.sun.hotspot.igv.graal}:\ ${project.at.ssw.visualizer.cfg}:\ ${project.org.eclipse.draw2d}:\ ${project.com.oracle.graal.visualizer.editor} project.at.ssw.visualizer.cfg=ControlFlowEditor project.com.oracle.graal.visualizer.editor=Editor -project.com.sun.hotspot.connection=NetworkConnection project.com.sun.hotspot.igv.bytecodes=Bytecodes project.com.sun.hotspot.igv.coordinator=Coordinator project.com.sun.hotspot.igv.data=Data @@ -36,7 +33,6 @@ project.com.sun.hotspot.igv.graph=Graph project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout project.com.sun.hotspot.igv.layout=Layout -project.com.sun.hotspot.igv.selectioncoordinator=SelectionCoordinator project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler project.com.sun.hotspot.igv.settings=Settings project.com.sun.hotspot.igv.svg=BatikSVGProxy