# HG changeset patch # User Thomas Wuerthinger # Date 1328109436 -3600 # Node ID 897ea0dd3ce1a9ed5522192fcdf9d4aa747d7aa8 # Parent a989546bb0351da7cfacd992912ac78ea1a86996 strip down and clean up outline view. diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java Wed Feb 01 16:17:16 2012 +0100 @@ -23,14 +23,15 @@ */ package com.sun.hotspot.igv.coordinator; -import com.sun.hotspot.igv.coordinator.actions.DiffGraphAction; -import com.sun.hotspot.igv.coordinator.actions.RemoveCookie; +import com.sun.hotspot.igv.coordinator.actions.RemoveAction; +import com.sun.hotspot.igv.coordinator.actions.SaveAsAction; import com.sun.hotspot.igv.data.*; import com.sun.hotspot.igv.data.services.GraphViewer; import java.awt.Image; import java.util.ArrayList; import java.util.List; import javax.swing.Action; +import javax.swing.JOptionPane; import org.openide.actions.OpenAction; import org.openide.cookies.OpenCookie; import org.openide.nodes.AbstractNode; @@ -105,33 +106,29 @@ private FolderNode(final Folder folder, Children children, InstanceContent content) { super(children, new AbstractLookup(content)); - if (folder instanceof FolderElement) { - final FolderElement folderElement = (FolderElement) folder; - this.setDisplayName(folderElement.getName()); - content.add(new RemoveCookie() { - - @Override - public void remove() { - folderElement.getParent().removeElement(folderElement); - } - }); - } + this.setDisplayName(folder.getName()); if (folder instanceof Group) { content.add(new OpenCookie() { @Override public void open() { - Lookup.getDefault().lookup(GraphViewer.class).view(((Group) folder).getGraphs().get(0)); + final List graphs = ((Group) folder).getGraphs(); + if (graphs.isEmpty()) { + JOptionPane.showMessageDialog(null, "Cannot open compilation, because there was no snapshots recorded!"); + } else { + Lookup.getDefault().lookup(GraphViewer.class).view(graphs.get(0)); + } } }); } + content.add(folder); folder.getChangedEvent().addListener(this); } @Override public Action[] getActions(boolean b) { - return new Action[]{(Action) OpenAction.findObject(OpenAction.class, true)}; + return new Action[]{(Action) OpenAction.findObject(OpenAction.class, true), RemoveAction.findObject(RemoveAction.class), SaveAsAction.findObject(SaveAsAction.class)}; } @Override diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java Wed Feb 01 13:30:02 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.coordinator; - -import com.sun.hotspot.igv.coordinator.actions.DiffGraphAction; -import com.sun.hotspot.igv.coordinator.actions.DiffGraphCookie; -import com.sun.hotspot.igv.coordinator.actions.GraphOpenCookie; -import com.sun.hotspot.igv.coordinator.actions.GraphRemoveCookie; -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.Properties; -import com.sun.hotspot.igv.data.services.GraphViewer; -import com.sun.hotspot.igv.util.PropertiesSheet; -import java.awt.Image; -import javax.swing.Action; -import org.openide.actions.OpenAction; -import org.openide.nodes.AbstractNode; -import org.openide.nodes.Children; -import org.openide.nodes.Sheet; -import org.openide.util.ImageUtilities; -import org.openide.util.Lookup; -import org.openide.util.lookup.AbstractLookup; -import org.openide.util.lookup.InstanceContent; - -/** - * - * @author Thomas Wuerthinger - */ -public class GraphNode extends AbstractNode { - private final InputGraph graph; - - /** Creates a new instance of GraphNode */ - public GraphNode(InputGraph graph) { - this(graph, new InstanceContent()); - } - - private GraphNode(InputGraph graph, InstanceContent content) { - super(Children.LEAF, new AbstractLookup(content)); - this.graph = graph; - this.setDisplayName(graph.getName()); - content.add(graph); - - final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class); - - if (viewer != null) { - // Action for opening the graph - content.add(new GraphOpenCookie(viewer, graph)); - } - - // Action for removing a graph - content.add(new GraphRemoveCookie(graph)); - - // Action for diffing to the current graph - content.add(new DiffGraphCookie(graph)); - } - - @Override - protected Sheet createSheet() { - Sheet s = super.createSheet(); - Properties p = new Properties(); - p.add(graph.getProperties()); - p.setProperty("nodeCount", Integer.toString(graph.getNodes().size())); - p.setProperty("edgeCount", Integer.toString(graph.getEdges().size())); - PropertiesSheet.initializeSheet(p, s); - return s; - } - - @Override - public Image getIcon(int i) { - return ImageUtilities.loadImage("com/sun/hotspot/igv/coordinator/images/graph.png"); - } - - @Override - public Image getOpenedIcon(int i) { - return getIcon(i); - } - - @Override - public Action[] getActions(boolean b) { - return new Action[]{(Action) DiffGraphAction.findObject(DiffGraphAction.class, true), (Action) OpenAction.findObject(OpenAction.class, true)}; - } - - @Override - public Action getPreferredAction() { - return (Action) OpenAction.findObject(OpenAction.class, true); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof GraphNode) { - return (graph == ((GraphNode) obj).graph); - } - return false; - } - - @Override - public int hashCode() { - return graph.hashCode(); - } -} diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java Wed Feb 01 16:17:16 2012 +0100 @@ -59,7 +59,6 @@ public static final String PREFERRED_ID = "OutlineTopComponent"; private ExplorerManager manager; private GraphDocument document; - private FolderNode root; private Server server; private OutlineTopComponent() { @@ -76,10 +75,8 @@ private void initListView() { manager = new ExplorerManager(); - root = new FolderNode(document); - manager.setRootContext(root); + manager.setRootContext(new FolderNode(document)); ((BeanTreeView) this.treeView).setRootVisible(false); - associateLookup(ExplorerUtils.createLookup(manager, getActionMap())); } @@ -91,18 +88,9 @@ this.add(toolbar, BorderLayout.NORTH); toolbar.add(ImportAction.get(ImportAction.class)); - - toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup())); toolbar.add(SaveAllAction.get(SaveAllAction.class)); - - toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup())); toolbar.add(RemoveAllAction.get(RemoveAllAction.class)); - toolbar.add(GarbageCollectAction.get(GarbageCollectAction.class).getToolbarPresenter()); - - for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) { - tb.setVisible(false); - } } private void initReceivers() { diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardConfiguration.xml --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardConfiguration.xml Wed Feb 01 13:30:02 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties Wed Feb 01 16:17:16 2012 +0100 @@ -1,10 +1,9 @@ CTL_ImportAction=Open... -CTL_OpenGraphAction=View graph -CTL_DiffGraphAction=Difference to current graph -CTL_RemoveAction=Remove selected graphs and groups -CTL_RemoveAllAction=Remove all graphs and groups +CTL_OpenGraphAction=View compilation +CTL_RemoveAction=Delete +CTL_RemoveAllAction=Delete all compilations CTL_OutlineAction=Outline -CTL_SaveAsAction=Save selected groups... -CTL_SaveAllAction=Save all groups... +CTL_SaveAsAction=Save... +CTL_SaveAllAction=Save all compilations... CTL_PropertiesAction=Open Properties Window CTL_NewFilterAction=New filter... diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphAction.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphAction.java Wed Feb 01 13:30:02 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package com.sun.hotspot.igv.coordinator.actions; - -import org.openide.nodes.Node; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -import org.openide.util.actions.CookieAction; - -/** - * - * @author Thomas Wuerthinger - */ -public final class DiffGraphAction extends CookieAction { - - @Override - protected void performAction(Node[] activatedNodes) { - DiffGraphCookie c = activatedNodes[0].getCookie(DiffGraphCookie.class); - assert c != null; - c.openDiff(); - } - - @Override - protected int mode() { - return CookieAction.MODE_EXACTLY_ONE; - } - - @Override - protected boolean enable(Node[] activatedNodes) { - boolean b = super.enable(activatedNodes); - if (b) { - assert activatedNodes.length == 1; - DiffGraphCookie c = activatedNodes[0].getCookie(DiffGraphCookie.class); - assert c != null; - return c.isPossible(); - } - - return false; - } - - @Override - public String getName() { - return NbBundle.getMessage(DiffGraphAction.class, "CTL_DiffGraphAction"); - } - - @Override - protected Class[] cookieClasses() { - return new Class[]{ - DiffGraphCookie.class - }; - } - - @Override - protected String iconResource() { - return "com/sun/hotspot/igv/coordinator/images/diff.png"; - } - - @Override - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - @Override - protected boolean asynchronous() { - return false; - } -} - diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java Wed Feb 01 13:30:02 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.coordinator.actions; - -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.services.GraphViewer; -import com.sun.hotspot.igv.data.services.InputGraphProvider; -import com.sun.hotspot.igv.difference.Difference; -import com.sun.hotspot.igv.util.LookupHistory; -import org.openide.nodes.Node; -import org.openide.util.Lookup; - -/** - * - * @author Thomas Wuerthinger - */ -public class DiffGraphCookie implements Node.Cookie { - - private InputGraph graph; - - public DiffGraphCookie(InputGraph graph) { - this.graph = graph; - } - - private InputGraph getCurrentGraph() { - InputGraphProvider graphProvider = LookupHistory.getLast(InputGraphProvider.class); - if (graphProvider != null) { - return graphProvider.getGraph(); - } - return null; - } - - public boolean isPossible() { - return getCurrentGraph() != null; - } - - public void openDiff() { - InputGraph other = getCurrentGraph(); - final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class); - if (viewer != null) { - InputGraph diffGraph = Difference.createDiffGraph(other, graph); - viewer.view(diffGraph); - } - } -} diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphOpenCookie.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphOpenCookie.java Wed Feb 01 13:30:02 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.coordinator.actions; - -import at.ssw.visualizer.cfg.editor.CfgEditorSupport; -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.services.GraphViewer; -import org.openide.cookies.OpenCookie; - -public class GraphOpenCookie implements OpenCookie { - - private final GraphViewer viewer; - private final InputGraph graph; - - public GraphOpenCookie(GraphViewer viewer, InputGraph graph) { - this.viewer = viewer; - this.graph = graph; - } - - @Override - public void open() { - CfgEditorSupport support = new CfgEditorSupport(graph); - support.open(); - - viewer.view(graph); - } -} diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphRemoveCookie.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphRemoveCookie.java Wed Feb 01 13:30:02 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.coordinator.actions; - -import com.sun.hotspot.igv.data.InputGraph; - -public class GraphRemoveCookie implements RemoveCookie { - private final InputGraph graph; - - public GraphRemoveCookie(InputGraph graph) { - this.graph = graph; - } - - @Override - public void remove() { - graph.getGroup().removeElement(graph); - } -} diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java Wed Feb 01 16:17:16 2012 +0100 @@ -163,7 +163,7 @@ } public ImportAction() { - putValue(Action.SHORT_DESCRIPTION, "Open XML graph document..."); + putValue(Action.SHORT_DESCRIPTION, getName()); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); } diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java Wed Feb 01 16:17:16 2012 +0100 @@ -24,6 +24,7 @@ package com.sun.hotspot.igv.coordinator.actions; +import com.sun.hotspot.igv.data.FolderElement; import javax.swing.Action; import org.openide.nodes.Node; import org.openide.util.HelpCtx; @@ -39,15 +40,13 @@ @Override protected void performAction(Node[] activatedNodes) { for (Node n : activatedNodes) { - RemoveCookie removeCookie = n.getCookie(RemoveCookie.class); - if (removeCookie != null) { - removeCookie.remove(); - } + FolderElement element = n.getLookup().lookup(FolderElement.class); + element.getParent().removeElement(element); } } public RemoveAction() { - putValue(Action.SHORT_DESCRIPTION, "Remove selected graphs and groups"); + putValue(Action.SHORT_DESCRIPTION, getName()); } @Override diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java Wed Feb 01 16:17:16 2012 +0100 @@ -46,7 +46,7 @@ } public RemoveAllAction() { - putValue(Action.SHORT_DESCRIPTION, "Remove all graphs and groups"); + putValue(Action.SHORT_DESCRIPTION, getName()); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_SHIFT, InputEvent.CTRL_MASK)); } diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveCookie.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveCookie.java Wed Feb 01 13:30:02 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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.coordinator.actions; - -import org.openide.nodes.Node; - -/** - * - * @author Thomas Wuerthinger - */ -public interface RemoveCookie extends Node.Cookie { - void remove(); -} diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java Wed Feb 01 16:17:16 2012 +0100 @@ -24,11 +24,15 @@ package com.sun.hotspot.igv.coordinator.actions; +import com.sun.hotspot.igv.data.Folder; +import com.sun.hotspot.igv.data.FolderElement; import com.sun.hotspot.igv.data.GraphDocument; import com.sun.hotspot.igv.data.Group; import com.sun.hotspot.igv.data.serialization.Printer; import com.sun.hotspot.igv.settings.Settings; import java.io.*; +import java.util.HashSet; +import java.util.Set; import javax.swing.Action; import javax.swing.JFileChooser; import org.openide.nodes.Node; @@ -51,9 +55,25 @@ protected void performAction(Node[] activatedNodes) { GraphDocument doc = new GraphDocument(); + Set elements = new HashSet<>(); for (Node n : activatedNodes) { - Group group = n.getLookup().lookup(Group.class); - doc.addElement(group); + FolderElement element = n.getLookup().lookup(FolderElement.class); + elements.add(element); + } + + outer: for (FolderElement element : elements) { + Folder cur = element.getParent(); + while (cur instanceof FolderElement) { + FolderElement curElement = (FolderElement) cur; + if (elements.contains(curElement)) { + continue outer; + } + cur = curElement.getParent(); + } + + Folder previousParent = element.getParent(); + doc.addElement(element); + element.setParent(previousParent); } save(doc); diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml Wed Feb 01 16:17:16 2012 +0100 @@ -43,11 +43,11 @@ - + - + @@ -184,6 +184,16 @@ + + + + + + + + + + @@ -195,4 +205,10 @@ + + + + + + diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Folder.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Folder.java Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Folder.java Wed Feb 01 16:17:16 2012 +0100 @@ -26,6 +26,7 @@ import java.util.List; public interface Folder { + String getName(); List getElements(); void removeElement(FolderElement element); void addElement(FolderElement group); diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java Wed Feb 01 16:17:16 2012 +0100 @@ -87,6 +87,12 @@ @Override public void addElement(FolderElement element) { elements.add(element); + element.setParent(this); getChangedEvent().fire(); } + + @Override + public String getName() { + return "root"; + } } diff -r a989546bb035 -r 897ea0dd3ce1 src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSlider.java --- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSlider.java Wed Feb 01 13:30:02 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSlider.java Wed Feb 01 16:17:16 2012 +0100 @@ -172,7 +172,7 @@ List list = getPaintingModel().getPositions(); for (int i = 0; i < list.size(); i++) { Rectangle curItemBounds = getItemBounds(i); - if (lastMouseMove != null && curItemBounds.y <= lastMouseMove.y && curItemBounds.y + curItemBounds.height >= lastMouseMove.y) { + if (lastMouseMove != null && curItemBounds.y <= lastMouseMove.y && curItemBounds.y + curItemBounds.height > lastMouseMove.y) { g.setColor(TEXT_SELECTION_COLOR); g.fillRect(0, curItemBounds.y, getWidth(), curItemBounds.height); }