changeset 4501:d6f55cb223f4

Updated editor view.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 05 Feb 2012 02:42:16 +0100
parents ef80d24510fd
children 3c38bdaa6b39
files src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/CfgCompilationViewer.java src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/CompilationViewer.java src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/DiagramViewModel.java src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/EditorTopComponent.java src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/NodeQuickSearch.java src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/SplitCompilationViewer.java src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/TestAction.java src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/TestObject.java src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/layer.xml src/share/tools/IdealGraphVisualizer/OutlineView/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.java src/share/tools/IdealGraphVisualizer/OutlineView/src/com/oracle/graal/visualizer/outline/actions/RemoveAllAction.java src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/LookupHistory.java src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/GraphCompilationViewer.java
diffstat 14 files changed, 85 insertions(+), 316 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java	Sun Feb 05 02:42:16 2012 +0100
@@ -26,7 +26,6 @@
 import com.sun.hotspot.igv.data.Group;
 import com.sun.hotspot.igv.data.InputGraph;
 import com.sun.hotspot.igv.data.services.InputGraphProvider;
-import com.sun.hotspot.igv.util.LookupHistory;
 import java.awt.BorderLayout;
 import java.io.Serializable;
 import javax.swing.SwingUtilities;
@@ -170,7 +169,7 @@
 
     @Override
     public void resultChanged(LookupEvent lookupEvent) {
-        final InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class);//)Utilities.actionsGlobalContext().lookup(InputGraphProvider.class);
+        final InputGraphProvider p = null; // TODO(tw): FIXME //.getLast(InputGraphProvider.class);//)Utilities.actionsGlobalContext().lookup(InputGraphProvider.class);
         if (p != null) {
             SwingUtilities.invokeLater(new Runnable() {
                 @Override
--- a/src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/CfgCompilationViewer.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlowEditor/src/at/ssw/visualizer/cfg/CfgCompilationViewer.java	Sun Feb 05 02:42:16 2012 +0100
@@ -171,7 +171,7 @@
 
     }
 
-    @Override
+    /*@Override
     public Component getToolBarComponent() {
         Toolbar tb = new Toolbar("CfgToolbar");
 
@@ -222,7 +222,7 @@
         tb.doLayout();
 
         return tb;
-    }
+    }*/
 
     @Override
     public Lookup getLookup() {
--- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/CompilationViewer.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/CompilationViewer.java	Sun Feb 05 02:42:16 2012 +0100
@@ -40,6 +40,4 @@
     public Lookup getLookup();
 
     public Component getComponent();
-    
-    public Component getToolBarComponent();
 }
--- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/DiagramViewModel.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/DiagramViewModel.java	Sun Feb 05 02:42:16 2012 +0100
@@ -31,15 +31,8 @@
 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.*;
 
-/**
- *
- * @author Thomas Wuerthinger
- */
 public class DiagramViewModel {
 
     private Set<Integer> hiddenNodes;
--- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/EditorTopComponent.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/EditorTopComponent.java	Sun Feb 05 02:42:16 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,11 +23,10 @@
  */
 package com.oracle.graal.visualizer.editor;
 
-import com.sun.hotspot.igv.data.*;
-import com.sun.hotspot.igv.data.services.InputGraphProvider;
-import com.sun.hotspot.igv.graph.services.DiagramProvider;
-import com.sun.hotspot.igv.util.LookupHistory;
-import com.sun.hotspot.igv.util.RangeSlider;
+import com.oracle.graal.visualizer.util.LookupUtils;
+import com.sun.hotspot.igv.data.ChangedListener;
+import com.sun.hotspot.igv.data.Group;
+import com.sun.hotspot.igv.data.InputGraph;
 import com.sun.hotspot.igv.util.RangeSliderModel;
 import java.awt.BorderLayout;
 import java.awt.CardLayout;
@@ -36,13 +35,7 @@
 import java.awt.event.ActionListener;
 import java.util.*;
 import javax.swing.*;
-import javax.swing.border.Border;
-import org.openide.actions.RedoAction;
-import org.openide.actions.UndoAction;
 import org.openide.awt.Toolbar;
-import org.openide.awt.ToolbarPool;
-import org.openide.filesystems.FileUtil;
-import org.openide.util.ContextAwareAction;
 import org.openide.util.Lookup;
 import org.openide.util.NbBundle;
 import org.openide.util.Utilities;
@@ -51,29 +44,24 @@
 import org.openide.util.lookup.InstanceContent;
 import org.openide.util.lookup.Lookups;
 import org.openide.util.lookup.ProxyLookup;
-import org.openide.windows.*;
+import org.openide.windows.Mode;
+import org.openide.windows.TopComponent;
+import org.openide.windows.WindowManager;
 
-/**
- * 
- * @author Thomas Wuerthinger
- */
 public final class EditorTopComponent extends TopComponent {
 
     private InstanceContent content;
-    private RangeSlider rangeSlider;
     private static final String PREFERRED_ID = "EditorTopComponent";
     private RangeSliderModel rangeSliderModel;
     private CompilationViewer activeViewer;
     private CompilationViewerFactory activeFactory;
     private Group group;
-    private final JPanel viewerToolBarPanel;
-    private final CardLayout viewerToolBarPanelCardLayout;
+    private final JToolBar viewerToolBar;
     private final JPanel viewerPanel;
     private final CardLayout viewerPanelCardLayout;
     private final Map<String, CompilationViewer> createdComponents = new HashMap<>();
     private final Lookup proxyLookup;
     private Lookup currentLookup = Lookups.fixed();
-    
     private final Lookup.Provider currentViewLookupProvider = new Lookup.Provider() {
 
         @Override
@@ -89,7 +77,7 @@
     private InputGraph getSecondGraph() {
         return group.getGraphs().get(getModel().getSecondPosition());
     }
-    
+
     private void updateDisplayName() {
         int first = getModel().getFirstPosition();
         int second = getModel().getSecondPosition();
@@ -99,27 +87,22 @@
             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) {
-
-        LookupHistory.init(InputGraphProvider.class);
-        LookupHistory.init(DiagramProvider.class);
-        this.setFocusable(true);
-
         setName(NbBundle.getMessage(EditorTopComponent.class, "CTL_EditorTopComponent"));
         setToolTipText(NbBundle.getMessage(EditorTopComponent.class, "HINT_EditorTopComponent"));
 
         initComponents();
 
-        ToolbarPool.getDefault().setPreferredIconSize(16);
+        //ToolbarPool.getDefault().setPreferredIconSize(16);
         Toolbar toolBar = new Toolbar();
-        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
-        toolBar.setBorder(b);
+        //Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
+        //toolBar.setBorder(b);
         this.add(BorderLayout.NORTH, toolBar);
 
         this.group = graph.getGroup();
@@ -128,7 +111,6 @@
         content.add(rangeSliderModel);
         int graphPos = group.getGraphs().indexOf(graph);
         rangeSliderModel.setPositions(graphPos, graphPos);
-        rangeSlider = new RangeSlider(rangeSliderModel);
 
         Collection<? extends CompilationViewerFactory> factories = Lookup.getDefault().lookupAll(CompilationViewerFactory.class);
         proxyLookup = Lookups.proxy(currentViewLookupProvider);
@@ -136,14 +118,6 @@
 
         rangeSliderModel.getChangedEvent().addListener(rangeSliderListener);
 
-        toolBar.addSeparator();
-        toolBar.add(UndoAction.get(UndoAction.class));
-        toolBar.add(RedoAction.get(RedoAction.class));
-        
-        ContextAwareAction a = FileUtil.getConfigObject("Actions/View/com-oracle-graal-visualizer-editor-actions-TestAction.instance", ContextAwareAction.class);
-        FileUtil.getConfigFile("Actions/View/com-oracle-graal-visualizer-editor-actions-TestAction.instance");
-        toolBar.add(a.createContextAwareInstance(proxyLookup));
-        
         ButtonGroup factoryButtonGroup = new ButtonGroup();
         for (CompilationViewerFactory factory : factories) {
             AbstractButton button = createFactoryChangeButton(factory);
@@ -152,31 +126,25 @@
         }
         toolBar.addSeparator();
 
+        viewerToolBar = new JToolBar();
+        toolBar.add(viewerToolBar);
+        toolBar.add(Box.createHorizontalGlue());        
+
         Action action = Utilities.actionsForPath("QuickSearchShadow").get(0);
         Component quicksearch = ((Presenter.Toolbar) action).getToolbarPresenter();
         quicksearch.setMinimumSize(quicksearch.getPreferredSize()); // necessary for GTK LAF
         toolBar.add(quicksearch);
 
-        toolBar.add(Box.createHorizontalGlue());        
-        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), viewerPanel);
-        splitPane.setOneTouchExpandable(true);
-        splitPane.setDividerLocation(250);
-        this.add(splitPane, BorderLayout.CENTER);
-        
-        ((JToggleButton)factoryButtonGroup.getElements().nextElement()).setSelected(true);
+        this.add(viewerPanel, BorderLayout.CENTER);
+
+        ((JToggleButton) factoryButtonGroup.getElements().nextElement()).setSelected(true);
         activeFactory = factories.iterator().next();
         updateView();
     }
-    
+
     private static List<String> calculateStringList(Group g) {
         List<String> result = new ArrayList<>();
         for (InputGraph graph : g.getGraphs()) {
@@ -185,16 +153,6 @@
         return result;
     }
 
-    public void showPrevDiagram() {
-        int fp = getModel().getFirstPosition();
-        int sp = getModel().getSecondPosition();
-        if (fp != 0) {
-            fp--;
-            sp--;
-            getModel().setPositions(fp, sp);
-        }
-    }
-
     private RangeSliderModel getModel() {
         return rangeSliderModel;
     }
@@ -209,11 +167,10 @@
         }
         return null;
     }
-    
-    /** This method is called from within the constructor to
-     * initialize the form.
-     * WARNING: Do NOT modify this code. The content of this method is
-     * always regenerated by the Form Editor.
+
+    /**
+     * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always
+     * regenerated by the Form Editor.
      */
     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
     private void initComponents() {
@@ -247,14 +204,12 @@
     protected String preferredID() {
         return PREFERRED_ID;
     }
-
     private ChangedListener<RangeSliderModel> rangeSliderListener = new ChangedListener<RangeSliderModel>() {
 
         @Override
         public void changed(RangeSliderModel source) {
             updateView();
         }
-        
     };
 
     private void updateView() {
@@ -264,28 +219,27 @@
             CompilationViewer newViewer = createViewer(activeFactory);
             createdComponents.put(id, newViewer);
             viewerPanel.add(newViewer.getComponent(), id);
-            viewerToolBarPanel.add(newViewer.getToolBarComponent(), id);
         }
-        
+
         CompilationViewer newViewer = createdComponents.get(id);
         if (newViewer != activeViewer) {
             activeViewer = newViewer;
             viewerPanelCardLayout.show(viewerPanel, id);
-            viewerToolBarPanelCardLayout.show(viewerToolBarPanel, id);
-            
+            initializeToolBar(id);
+
             // Make sure that lookup is updated.
             currentLookup = new ProxyLookup(activeViewer.getLookup(), Lookups.fixed(getFirstGraph(), getSecondGraph()));
             proxyLookup.lookup(Object.class);
         }
     }
-    
+
     private String getViewStringIdentifier() {
         return String.format("%s/%d/%d", activeFactory.getName(), getModel().getFirstPosition(), getModel().getSecondPosition());
     }
 
     private AbstractButton createFactoryChangeButton(final CompilationViewerFactory factory) {
         JToggleButton toggleButton = new JToggleButton(factory.getName());
-        toggleButton.addActionListener(new ActionListener(){
+        toggleButton.addActionListener(new ActionListener() {
 
             @Override
             public void actionPerformed(ActionEvent e) {
@@ -294,10 +248,17 @@
         });
         return toggleButton;
     }
-    
+
     private CompilationViewer createViewer(CompilationViewerFactory activeFactory) {
         InputGraph firstSnapshot = getFirstGraph();
         InputGraph secondSnapshot = getSecondGraph();
         return activeFactory.createViewer(firstSnapshot, secondSnapshot);
     }
+
+    private void initializeToolBar(String id) {
+        viewerToolBar.removeAll();
+        for (Action a : LookupUtils.lookupActions(String.format("CompilationViewer/%s/Actions", id))) {
+            viewerToolBar.add(a);
+        }
+    }
 }
--- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/NodeQuickSearch.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/NodeQuickSearch.java	Sun Feb 05 02:42:16 2012 +0100
@@ -27,7 +27,6 @@
 import com.sun.hotspot.igv.data.Properties;
 import com.sun.hotspot.igv.data.Properties.RegexpPropertyMatcher;
 import com.sun.hotspot.igv.data.services.InputGraphProvider;
-import com.sun.hotspot.igv.util.LookupHistory;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -79,7 +78,7 @@
             value = ".*";
         }
 
-        final InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class);
+        final InputGraphProvider p = null;// TODO: FIXME LookupHistory.getLast(InputGraphProvider.class);
         if (p != null && p.getGraph() != null) {
             List<InputNode> matches = null;
             try {
--- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/SplitCompilationViewer.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/SplitCompilationViewer.java	Sun Feb 05 02:42:16 2012 +0100
@@ -21,31 +21,59 @@
  * questions.
  *
  */
-
 package com.oracle.graal.visualizer.editor;
 
 import com.sun.hotspot.igv.graph.Figure;
 import java.awt.BorderLayout;
 import java.awt.Component;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 import java.util.Collection;
+import java.util.prefs.Preferences;
 import javax.swing.JPanel;
 import javax.swing.JSplitPane;
 import javax.swing.JToolBar;
 import org.openide.util.Lookup;
+import org.openide.util.NbPreferences;
 import org.openide.util.lookup.Lookups;
 
 class SplitCompilationViewer implements CompilationViewer {
 
     private JSplitPane splitPane;
-    private JPanel firstPanel;
-    private JPanel secondPanel;
-    
+    private Component firstPanel;
+    private Component secondPanel;
+    private static final String DIVIDER_LOCATION = "dividerLocation";
+    private final PropertyChangeListener splitChanged = new PropertyChangeListener() {
+
+        @Override
+        public void propertyChange(PropertyChangeEvent changeEvent) {
+            String propertyName = changeEvent.getPropertyName();
+            if (propertyName.equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)) {
+                setLastDividerLocation((Integer) changeEvent.getNewValue());
+            }
+        }
+    };
+
+    private static void setLastDividerLocation(int pos) {
+        NbPreferences.forModule(SplitCompilationViewer.class).put(DIVIDER_LOCATION, Integer.toString(pos));
+    }
+
+    private static int getLastDividerLocation() {
+        try {
+            return Integer.parseInt(NbPreferences.forModule(SplitCompilationViewer.class).get(DIVIDER_LOCATION, "400"));
+        } catch (NumberFormatException e) {
+            return 400;
+        }
+    }
+
     public SplitCompilationViewer(CompilationViewer firstViewer, CompilationViewer secondViewer) {
         splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
-        firstPanel = createPanel(firstViewer);
-        secondPanel = createPanel(secondViewer);
+        firstPanel = createComponent(firstViewer);
+        secondPanel = createComponent(secondViewer);
         splitPane.add(firstPanel);
         splitPane.add(secondPanel);
+        splitPane.addPropertyChangeListener(splitChanged);
+        splitPane.setDividerLocation(getLastDividerLocation());
     }
 
     @Override
@@ -58,19 +86,7 @@
         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;
-        
+    private Component createComponent(CompilationViewer viewer) {
+        return viewer.getComponent();
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/TestAction.java	Sun Feb 05 02:03:30 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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.oracle.graal.visualizer.editor.actions;
-
-import com.sun.hotspot.igv.data.InputGraph;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.List;
-import javax.swing.JOptionPane;
-import org.openide.awt.ActionID;
-import org.openide.awt.ActionReference;
-import org.openide.awt.ActionRegistration;
-
-/**
- *
- * @author Thomas Wuerthinger
- */
-@ActionID(id = "com.oracle.graal.visualizer.editor.actions.TestAction", category = "View")
-@ActionRegistration(displayName = "My test action", iconBase="com/sun/hotspot/igv/view/images/next_diagram.png")
-@ActionReference(path = "Menu/View", position = 150)
-public final class TestAction implements ActionListener {
-    
-    List<InputGraph> inputs;
-    
-    public TestAction(List<InputGraph> inputs) {
-        this.inputs = inputs;
-    }
-    
-    @Override
-    public void actionPerformed(ActionEvent e) {
-        JOptionPane.showMessageDialog(null, "number of input graphs: " + inputs.size());
-        
-    }
-
-}
--- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/TestObject.java	Sun Feb 05 02:03:30 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.oracle.graal.visualizer.editor.actions;
-
-/**
- *
- * @author tw
- */
-public interface TestObject {
-    
-}
--- a/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/layer.xml	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/layer.xml	Sun Feb 05 02:42:16 2012 +0100
@@ -1,19 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
 <filesystem>
-    <folder name="Menu">
-        <folder name="File">
-            <file name="ExportActionSeparator.instance">
-                <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
-                <attr name="position" intvalue="700"/>
-            </file>
-            <file name="com-oracle-graal-visualizer-editor-actions-ExportAction.shadow">
-                <attr name="originalFile" stringvalue="Actions/File/com-oracle-graal-visualizer-editor-actions-ExportAction.instance"/>
-                <attr name="position" intvalue="710"/>
-            </file>
-        </folder>
-    </folder>
-
     <folder name="QuickSearch">
         <folder name="Nodes">
             <attr name="command" stringvalue="n"/>
--- a/src/share/tools/IdealGraphVisualizer/OutlineView/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/OutlineView/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.java	Sun Feb 05 02:42:16 2012 +0100
@@ -27,19 +27,13 @@
 import com.oracle.graal.visualizer.util.LookupUtils;
 import com.sun.hotspot.igv.data.GraphDocument;
 import java.awt.BorderLayout;
-import java.util.ArrayList;
-import java.util.List;
 import javax.swing.Action;
-import javax.swing.UIManager;
-import javax.swing.border.Border;
 import org.openide.actions.GarbageCollectAction;
 import org.openide.awt.Toolbar;
 import org.openide.explorer.ExplorerManager;
 import org.openide.explorer.ExplorerUtils;
 import org.openide.explorer.view.BeanTreeView;
-import org.openide.util.ContextAwareAction;
 import org.openide.util.NbBundle;
-import org.openide.util.lookup.Lookups;
 import org.openide.windows.TopComponent;
 import org.openide.windows.WindowManager;
 
@@ -71,10 +65,7 @@
     }
 
     private void initToolbar() {
-
         Toolbar toolbar = new Toolbar();
-        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
-        toolbar.setBorder(b);
         this.add(toolbar, BorderLayout.NORTH);
         for (Action a : LookupUtils.lookupActions(GLOBAL_ACTIONS_FOLDER, getLookup())) {
             toolbar.add(a);
@@ -83,10 +74,6 @@
         toolbar.add(new ServerPanel(getDocument()));
     }
 
-    public void clear() {
-        document.clear();
-    }
-
     @Override
     public ExplorerManager getExplorerManager() {
         return manager;
--- a/src/share/tools/IdealGraphVisualizer/OutlineView/src/com/oracle/graal/visualizer/outline/actions/RemoveAllAction.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/OutlineView/src/com/oracle/graal/visualizer/outline/actions/RemoveAllAction.java	Sun Feb 05 02:42:16 2012 +0100
@@ -41,6 +41,6 @@
 
     @Override
     public void actionPerformed(ActionEvent e) {
-        OutlineTopComponent.findInstance().clear();
+        OutlineTopComponent.findInstance().getDocument().clear();
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/LookupHistory.java	Sun Feb 05 02:03:30 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +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.util;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.openide.util.Lookup.Result;
-import org.openide.util.LookupEvent;
-import org.openide.util.LookupListener;
-import org.openide.util.Utilities;
-
-/**
- *
- * @author Thomas
- */
-public class LookupHistory {
-
-    private static Map<Class, LookupHistoryImpl> cache = new HashMap<>();
-
-    private static class LookupHistoryImpl<T> implements LookupListener {
-
-        private Class<T> klass;
-        private Result<T> result;
-        private T last;
-
-        public LookupHistoryImpl(Class<T> klass) {
-            this.klass = klass;
-            result = Utilities.actionsGlobalContext().lookupResult(klass);
-            result.addLookupListener(this);
-            last = Utilities.actionsGlobalContext().lookup(klass);
-        }
-
-        public T getLast() {
-            return last;
-        }
-
-        @Override
-        public void resultChanged(LookupEvent ev) {
-            T current = Utilities.actionsGlobalContext().lookup(klass);
-            if (current != null) {
-                last = current;
-            }
-        }
-    }
-
-    public static <T> void init(Class<T> klass) {
-        if (!cache.containsKey(klass)) {
-            cache.put(klass, new LookupHistoryImpl<>(klass));
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public static <T> T getLast(Class<T> klass) {
-        init(klass);
-        assert cache.containsKey(klass);
-        return (T) cache.get(klass).getLast();
-    }
-}
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/GraphCompilationViewer.java	Sun Feb 05 02:03:30 2012 +0100
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/scene/GraphCompilationViewer.java	Sun Feb 05 02:42:16 2012 +0100
@@ -92,32 +92,14 @@
         scene = new DiagramScene(model);
         
         Action[] actions = new Action[]{
-            ExtractAction.get(ExtractAction.class),
-            ShowAllAction.get(HideAction.class),
-            ShowAllAction.get(ShowAllAction.class),
-            null,
-          //  new ZoomInAction(scene),
-            //new ZoomOutAction(scene),
-            null,
-            ExpandPredecessorsAction.get(ExpandPredecessorsAction.class),
-            ExpandSuccessorsAction.get(ExpandSuccessorsAction.class)
         };
         
         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));
-
-        predSuccAction = new PredSuccAction();
-        JToggleButton button = new JToggleButton(predSuccAction);
-        button.setSelected(true);
-        toolBar.add(button);
-        predSuccAction.addPropertyChangeListener(this);
+//        predSuccAction = new PredSuccAction();
+//        JToggleButton button = new JToggleButton(predSuccAction);
+//        button.setSelected(true);
+//        toolBar.add(button);
+//        predSuccAction.addPropertyChangeListener(this);
         
         lookup = new ProxyLookup(scene.getLookup(), Lookups.singleton(exportCookie));
     }
@@ -133,11 +115,6 @@
     }
 
     @Override
-    public Component getToolBarComponent() {
-        return toolBar;
-    }
-
-    @Override
     public void propertyChange(PropertyChangeEvent evt) {
         if (evt.getSource() == this.predSuccAction) {
             boolean b = (Boolean) predSuccAction.getValue(PredSuccAction.STATE);