Mercurial > hg > truffle
changeset 4496:de4e6eb7265b
Clean, improve and rename coordinator component.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 04 Feb 2012 21:12:50 +0100 |
parents | bf4c1e7d71b3 |
children | b995eee36970 |
files | src/share/tools/IdealGraphVisualizer/Coordinator/build.xml src/share/tools/IdealGraphVisualizer/Coordinator/manifest.mf src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/build-impl.xml src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/genfiles.properties src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/platform.properties src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.properties src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/suite.properties src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Bundle.properties src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Client.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Server.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/layer.xml src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/Bundle.properties src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.form src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentSettings.xml src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentWstcref.xml src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/OutlineAction.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/customLeftWsmode.xml src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/diff.png src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/folder.png src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/graph.png src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/import.png src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/remove.png src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/removeall.png src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/save.png src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/saveall.gif src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/structure.png src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/structured.gif src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/TestObject.java src/share/tools/IdealGraphVisualizer/Outline/manifest.mf src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/Bundle.properties src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/CompilationNode.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.form src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponentSettings.xml src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponentWstcref.xml src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/ImportAction.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/OutlineAction.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/RemoveAction.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/RemoveAllAction.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/SaveAllAction.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/SaveAsAction.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/customLeftWsmode.xml src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/import.png src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/leaf_node.gif src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/node.gif src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/remove.png src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/removeall.png src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/save.png src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/saveall.gif src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/layer.xml src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/Bundle.properties src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/Client.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/Server.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/ServerCallback.java src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/ServerPanel.java src/share/tools/IdealGraphVisualizer/nbproject/project.properties |
diffstat | 66 files changed, 1418 insertions(+), 1671 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/build.xml Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- You may freely edit this file. See harness/README in the NetBeans platform --> -<!-- for some information on what you could do (e.g. targets to override). --> -<!-- If you delete this file and reopen the project it will be recreated. --> -<project name="com.sun.hotspot.igv.coordinator" default="netbeans" basedir="."> - <description>Builds, tests, and runs the project com.sun.hotspot.igv.coordinator.</description> - <import file="nbproject/build-impl.xml"/> -</project>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/manifest.mf Fri Feb 03 21:35:31 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.coordinator -OpenIDE-Module-Layer: com/sun/hotspot/igv/coordinator/layer.xml -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/coordinator/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 -
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/build-impl.xml Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -*** GENERATED FROM project.xml - DO NOT EDIT *** -*** EDIT ../build.xml INSTEAD *** ---> -<project name="com.sun.hotspot.igv.coordinator-impl" basedir=".."> - <property file="nbproject/private/suite-private.properties"/> - <property file="nbproject/suite.properties"/> - <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail> - <property file="${suite.dir}/nbproject/private/platform-private.properties"/> - <property file="${suite.dir}/nbproject/platform.properties"/> - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2"> - <attribute name="name"/> - <attribute name="value"/> - <sequential> - <property name="@{name}" value="${@{value}}"/> - </sequential> - </macrodef> - <property file="${user.properties.file}"/> - <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> - <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> - <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'"> - <condition> - <not> - <available file="${harness.dir}" type="dir"/> - </not> - </condition> - </fail> - <import file="${harness.dir}/build.xml"/> -</project>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/genfiles.properties Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -build.xml.data.CRC32=077de97c -build.xml.script.CRC32=d29d586c -build.xml.stylesheet.CRC32=79c3b980 -# 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=077de97c -nbproject/build-impl.xml.script.CRC32=03daa42d -nbproject/build-impl.xml.stylesheet.CRC32=deb65f65
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/platform.properties Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -# Deprecated since 5.0u1; for compatibility with 5.0: -disabled.clusters=\ - apisupport1,\ - harness,\ - ide8,\ - java1,\ - nb6.0,\ - profiler2 -disabled.modules=\ - org.netbeans.core.execution,\ - org.netbeans.core.multiview,\ - org.netbeans.core.output2,\ - org.netbeans.modules.applemenu,\ - org.netbeans.modules.autoupdate.services,\ - org.netbeans.modules.autoupdate.ui,\ - org.netbeans.modules.core.kit,\ - org.netbeans.modules.favorites,\ - org.netbeans.modules.javahelp,\ - org.netbeans.modules.masterfs,\ - org.netbeans.modules.options.keymap,\ - org.netbeans.modules.sendopts,\ - org.netbeans.modules.templates,\ - org.openide.compat,\ - org.openide.execution,\ - org.openide.util.enumerations -enabled.clusters=\ - platform7 -nbjdk.active=JDK_1.6 -nbplatform.active=default
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.properties Fri Feb 03 21:35:31 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
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://www.netbeans.org/ns/project/1"> - <type>org.netbeans.modules.apisupport.project</type> - <configuration> - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3"> - <code-name-base>com.sun.hotspot.igv.coordinator</code-name-base> - <suite-component/> - <module-dependencies> - <dependency> - <code-name-base>at.ssw.visualizer.cfg</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>1.0</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>com.sun.hotspot.igv.data</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>1.0</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>com.sun.hotspot.igv.difference</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>1.0</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>com.sun.hotspot.igv.settings</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>1.0</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>com.sun.hotspot.igv.util</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>1.0</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.netbeans.api.progress</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <release-version>1</release-version> - <specification-version>1.23.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.actions</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>6.21.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.awt</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>7.30.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.dialogs</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>7.18.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.explorer</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>6.34.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.filesystems</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>7.46.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.loaders</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>7.20.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.nodes</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>7.20.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.util</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>8.14.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.util.lookup</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>8.6.1</specification-version> - </run-dependency> - </dependency> - <dependency> - <code-name-base>org.openide.windows</code-name-base> - <build-prerequisite/> - <compile-dependency/> - <run-dependency> - <specification-version>6.39.1</specification-version> - </run-dependency> - </dependency> - </module-dependencies> - <public-packages/> - </data> - </configuration> -</project>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/suite.properties Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -suite.dir=${basedir}/..
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Bundle.properties Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -OpenIDE-Module-Name=NetworkConnection
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Client.java Fri Feb 03 21:35:31 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
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/Server.java Fri Feb 03 21:35:31 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); - } -}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/connection/layer.xml Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -<?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> -</filesystem>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/Bundle.properties Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -AdvancedOption_DisplayName_Coordinator=Settings -AdvancedOption_Tooltip_Coordinator=Visualization Tool Settings -CTL_OutlineTopComponent=Outline -CTL_SomeAction=test -HINT_OutlineTopComponent=Displays loaded groups of graphs. -OpenIDE-Module-Name=Coordinator
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +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.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; -import org.openide.nodes.Children; -import org.openide.nodes.Node; -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 FolderNode extends AbstractNode implements ChangedListener { - - @Override - public void changed(Object folder) { - if (this.getChildren() == Children.LEAF) { - setChildren(createFolderChildren((Folder)folder)); - } - } - - private static class FolderChildren extends Children.Keys<Folder> implements ChangedListener { - - private final Folder folder; - - public FolderChildren(Folder folder) { - this.folder = folder; - folder.getChangedEvent().addListener(this); - } - - @Override - protected Node[] createNodes(Folder e) { - return new Node[]{new FolderNode(e)}; - } - - @Override - public void addNotify() { - List<Folder> result = new ArrayList<>(); - for (FolderElement o : folder.getElements()) { - if (o instanceof Folder) { - result.add((Folder) o); - } - } - this.setKeys(result); - } - - @Override - public void changed(Object source) { - addNotify(); - } - } - - @Override - public Image getIcon(int i) { - return ImageUtilities.loadImage("com/sun/hotspot/igv/coordinator/images/folder.png"); - } - - protected FolderNode(Folder folder) { - this(folder, createFolderChildren(folder), new InstanceContent()); - } - - private static Children createFolderChildren(Folder folder) { - for (FolderElement elem : folder.getElements()) { - if (elem instanceof Folder) { - return new FolderChildren(folder); - } - } - return Children.LEAF; - } - - private FolderNode(final Folder folder, Children children, InstanceContent content) { - super(children, new AbstractLookup(content)); - this.setDisplayName(folder.getName()); - - if (folder instanceof Group) { - content.add(new OpenCookie() { - @Override - public void open() { - final List<InputGraph> 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), RemoveAction.findObject(RemoveAction.class), SaveAsAction.findObject(SaveAsAction.class)}; - } - - @Override - public Action getPreferredAction() { - return (Action) OpenAction.findObject(OpenAction.class, true); - } - - @Override - public Image getOpenedIcon(int i) { - return getIcon(i); - } -}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.form Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> - <AuxValues> - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/> - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/> - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> - <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> - </AuxValues> - - <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> - <SubComponents> - <Container class="javax.swing.JScrollPane" name="treeView"> - <AuxValues> - <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/> - </AuxValues> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> - <BorderConstraints direction="Center"/> - </Constraint> - </Constraints> - - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> - </Container> - </SubComponents> -</Form>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +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.connection.Server; -import com.sun.hotspot.igv.coordinator.actions.*; -import com.sun.hotspot.igv.data.GraphDocument; -import com.sun.hotspot.igv.data.Group; -import com.sun.hotspot.igv.data.services.GroupCallback; -import java.awt.BorderLayout; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.io.Serializable; -import javax.swing.UIManager; -import javax.swing.border.Border; -import org.openide.ErrorManager; -import org.openide.actions.GarbageCollectAction; -import org.openide.awt.Toolbar; -import org.openide.awt.ToolbarPool; -import org.openide.explorer.ExplorerManager; -import org.openide.explorer.ExplorerUtils; -import org.openide.explorer.view.BeanTreeView; -import org.openide.util.LookupEvent; -import org.openide.util.LookupListener; -import org.openide.util.NbBundle; -import org.openide.util.actions.NodeAction; -import org.openide.windows.TopComponent; -import org.openide.windows.WindowManager; - -/** - * - * @author Thomas Wuerthinger - */ -public final class OutlineTopComponent extends TopComponent implements ExplorerManager.Provider, LookupListener { - - public static OutlineTopComponent instance; - public static final String PREFERRED_ID = "OutlineTopComponent"; - private ExplorerManager manager; - private GraphDocument document; - private Server server; - - private OutlineTopComponent() { - initComponents(); - - setName(NbBundle.getMessage(OutlineTopComponent.class, "CTL_OutlineTopComponent")); - setToolTipText(NbBundle.getMessage(OutlineTopComponent.class, "HINT_OutlineTopComponent")); - - document = new GraphDocument(); - initListView(); - initToolbar(); - initReceivers(); - } - - private void initListView() { - manager = new ExplorerManager(); - manager.setRootContext(new FolderNode(document)); - ((BeanTreeView) this.treeView).setRootVisible(false); - associateLookup(ExplorerUtils.createLookup(manager, getActionMap())); - } - - 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); - - toolbar.add(ImportAction.get(ImportAction.class)); - toolbar.add(SaveAllAction.get(SaveAllAction.class)); - toolbar.add(RemoveAllAction.get(RemoveAllAction.class)); - toolbar.add(GarbageCollectAction.get(GarbageCollectAction.class).getToolbarPresenter()); - } - - private void initReceivers() { - - final GroupCallback callback = new GroupCallback() { - - @Override - public void started(Group g) { - getDocument().addElement(g); - } - }; - - server = new Server(callback); - } - - public void clear() { - document.clear(); - } - - @Override - public ExplorerManager getExplorerManager() { - return manager; - } - - public GraphDocument getDocument() { - return document; - } - - /** - * Gets default instance. Do not use directly: reserved for *.settings files only, - * i.e. deserialization routines; otherwise you could get a non-deserialized instance. - * To obtain the singleton instance, use {@link findInstance}. - */ - public static synchronized OutlineTopComponent getDefault() { - if (instance == null) { - instance = new OutlineTopComponent(); - } - return instance; - } - - /** - * Obtain the OutlineTopComponent instance. Never call {@link #getDefault} directly! - */ - public static synchronized OutlineTopComponent findInstance() { - TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); - if (win == null) { - ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find Outline component. It will not be located properly in the window system."); - return getDefault(); - } - if (win instanceof OutlineTopComponent) { - return (OutlineTopComponent) win; - } - ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior."); - return getDefault(); - } - - @Override - public int getPersistenceType() { - return TopComponent.PERSISTENCE_ALWAYS; - } - - @Override - public void componentOpened() { - this.requestActive(); - } - - @Override - public void componentClosed() { - } - - @Override - protected String preferredID() { - return PREFERRED_ID; - } - - @Override - public void requestActive() { - super.requestActive(); - treeView.requestFocus(); - } - - @Override - public boolean requestFocus(boolean temporary) { - treeView.requestFocus(); - return super.requestFocus(temporary); - } - - @Override - protected boolean requestFocusInWindow(boolean temporary) { - treeView.requestFocus(); - return super.requestFocusInWindow(temporary); - } - - @Override - public void resultChanged(LookupEvent lookupEvent) { - } - - @Override - public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { - // Not called when user starts application for the first time - super.readExternal(objectInput); - ((BeanTreeView) this.treeView).setRootVisible(false); - } - - @Override - public void writeExternal(ObjectOutput objectOutput) throws IOException { - super.writeExternal(objectOutput); - } - - static final class ResolvableHelper implements Serializable { - - private static final long serialVersionUID = 1L; - - public Object readResolve() { - return OutlineTopComponent.getDefault(); - } - } - - /** 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() { - - treeView = new BeanTreeView(); - - setLayout(new java.awt.BorderLayout()); - add(treeView, java.awt.BorderLayout.CENTER); - }// </editor-fold>//GEN-END:initComponents - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JScrollPane treeView; - // End of variables declaration//GEN-END:variables -}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentSettings.xml Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd"> -<settings version="1.0"> - <module name="com.sun.hotspot.igv.coordinator" spec="1.0"/> - <instanceof class="at.openide.windows.TopComponent"/> - <instanceof class="com.sun.hotspot.igv.coordinator.OutlineTopComponent"/> - <instance class="com.sun.hotspot.igv.coordinator.OutlineTopComponent" method="getDefault"/> -</settings>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentWstcref.xml Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd"> -<tc-ref version="2.0" > - <module name="com.sun.hotspot.igv.coordinator" spec="1.0"/> - <tc-id id="OutlineTopComponent"/> - <state opened="true"/> -</tc-ref>
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -CTL_ImportAction=Open... -CTL_OpenGraphAction=View compilation -CTL_RemoveAction=Delete -CTL_RemoveAllAction=Delete all compilations -CTL_OutlineAction=Outline -CTL_SaveAsAction=Save... -CTL_SaveAllAction=Save all compilations... -CTL_PropertiesAction=Open Properties Window -CTL_NewFilterAction=New filter...
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +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.coordinator.OutlineTopComponent; -import com.sun.hotspot.igv.data.GraphDocument; -import com.sun.hotspot.igv.data.serialization.Parser; -import com.sun.hotspot.igv.data.serialization.XMLParser; -import com.sun.hotspot.igv.settings.Settings; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import javax.swing.Action; -import javax.swing.JFileChooser; -import javax.swing.KeyStroke; -import javax.swing.SwingUtilities; -import javax.swing.filechooser.FileFilter; -import org.netbeans.api.progress.ProgressHandle; -import org.netbeans.api.progress.ProgressHandleFactory; -import org.openide.DialogDisplayer; -import org.openide.NotifyDescriptor; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -import org.openide.util.RequestProcessor; -import org.openide.util.actions.CallableSystemAction; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * - * @author Thomas Wuerthinger - */ -public final class ImportAction extends CallableSystemAction { - - public static FileFilter getFileFilter() { - return new FileFilter() { - - @Override - public boolean accept(File f) { - return f.getName().toLowerCase().endsWith(".xml") || f.isDirectory(); - } - - @Override - public String getDescription() { - return "XML files (*.xml)"; - } - }; - } - - @Override - public void performAction() { - - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(ImportAction.getFileFilter()); - fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT))); - - if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - - File dir = file; - if (!dir.isDirectory()) { - dir = dir.getParentFile(); - } - - Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); - - try { - final FileInputStream inputStream = new FileInputStream(file); - final InputSource is = new InputSource(inputStream); - - final ProgressHandle handle = ProgressHandleFactory.createHandle("Opening file " + file.getName()); - final int basis = 1000; - handle.start(basis); - final int start = inputStream.available(); - - final XMLParser.ParseMonitor parseMonitor = new XMLParser.ParseMonitor() { - - @Override - public void setProgress(double d) { - try { - int curAvailable = inputStream.available(); - int prog = (int) (basis * (double) (start - curAvailable) / (double) start); - handle.progress(prog); - } catch (IOException ex) { - } - } - - @Override - public void setState(String state) { - setProgress(0.0); - handle.progress(state); - } - }; - final Parser parser = new Parser(); - final OutlineTopComponent component = OutlineTopComponent.findInstance(); - - component.requestActive(); - - RequestProcessor.getDefault().post(new Runnable() { - - @Override - public void run() { - try { - final GraphDocument document = parser.parse(is, parseMonitor); - parseMonitor.setState("Finishing"); - SwingUtilities.invokeLater(new Runnable(){ - - @Override - public void run() { - component.getDocument().addGraphDocument(document); - } - }); - } catch (SAXException ex) { - String s = "Exception during parsing the XML file, could not load document!"; - if (ex instanceof XMLParser.MissingAttributeException) { - XMLParser.MissingAttributeException e = (XMLParser.MissingAttributeException) ex; - s += "\nMissing attribute \"" + e.getAttributeName() + "\""; - } - ex.printStackTrace(); - NotifyDescriptor d = new NotifyDescriptor.Message(s, NotifyDescriptor.ERROR_MESSAGE); - DialogDisplayer.getDefault().notify(d); - } - handle.finish(); - } - }); - - } catch (FileNotFoundException ex) { - ex.printStackTrace(); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - } - - @Override - public String getName() { - return NbBundle.getMessage(ImportAction.class, "CTL_ImportAction"); - } - - public ImportAction() { - putValue(Action.SHORT_DESCRIPTION, getName()); - putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); - } - - @Override - protected String iconResource() { - return "com/sun/hotspot/igv/coordinator/images/import.png"; - } - - @Override - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - @Override - protected boolean asynchronous() { - return false; - } -}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/OutlineAction.java Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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.coordinator.OutlineTopComponent; -import java.awt.event.ActionEvent; -import javax.swing.AbstractAction; -import org.openide.util.NbBundle; -import org.openide.windows.TopComponent; - -/** - * - * @author Thomas Wuerthinger - */ -public class OutlineAction extends AbstractAction { - - public OutlineAction() { - super(NbBundle.getMessage(OutlineAction.class, "CTL_OutlineAction")); - } - - @Override - public void actionPerformed(ActionEvent evt) { - TopComponent win = OutlineTopComponent.findInstance(); - win.open(); - win.requestActive(); - } -}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +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.FolderElement; -import javax.swing.Action; -import org.openide.nodes.Node; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -import org.openide.util.actions.NodeAction; - -/** - * - * @author Thomas Wuerthinger - */ -public final class RemoveAction extends NodeAction { - - @Override - protected void performAction(Node[] activatedNodes) { - for (Node n : activatedNodes) { - FolderElement element = n.getLookup().lookup(FolderElement.class); - element.getParent().removeElement(element); - } - } - - public RemoveAction() { - putValue(Action.SHORT_DESCRIPTION, getName()); - } - - @Override - public String getName() { - return NbBundle.getMessage(RemoveAction.class, "CTL_RemoveAction"); - } - - @Override - protected String iconResource() { - return "com/sun/hotspot/igv/coordinator/images/remove.png"; - } - - @Override - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - @Override - protected boolean asynchronous() { - return false; - } - - @Override - protected boolean enable(Node[] nodes) { - return nodes.length > 0; - } -}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +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 com.sun.hotspot.igv.coordinator.OutlineTopComponent; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import javax.swing.Action; -import javax.swing.KeyStroke; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -import org.openide.util.actions.CallableSystemAction; - -/** - * - * @author Thomas Wuerthinger - */ -public final class RemoveAllAction extends CallableSystemAction { - - - @Override - public String getName() { - return NbBundle.getMessage(RemoveAllAction.class, "CTL_RemoveAllAction"); - } - - public RemoveAllAction() { - putValue(Action.SHORT_DESCRIPTION, getName()); - putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_SHIFT, InputEvent.CTRL_MASK)); - } - - @Override - protected String iconResource() { - return "com/sun/hotspot/igv/coordinator/images/removeall.png"; - } - - @Override - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - @Override - protected boolean asynchronous() { - return false; - } - - @Override - public void performAction() { - OutlineTopComponent.findInstance().clear(); - } -}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +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 com.sun.hotspot.igv.coordinator.OutlineTopComponent; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import javax.swing.Action; -import javax.swing.KeyStroke; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -import org.openide.util.actions.CallableSystemAction; - -/** - * - * @author Thomas Wuerthinger - */ -public final class SaveAllAction extends CallableSystemAction { - - @Override - public void performAction() { - final OutlineTopComponent component = OutlineTopComponent.findInstance(); - SaveAsAction.save(component.getDocument()); - } - - @Override - public String getName() { - return NbBundle.getMessage(SaveAllAction.class, "CTL_SaveAllAction"); - } - - public SaveAllAction() { - putValue(Action.SHORT_DESCRIPTION, "Save all groups to XML file..."); - putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK)); - } - - @Override - protected String iconResource() { - return "com/sun/hotspot/igv/coordinator/images/saveall.gif"; - } - - @Override - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - @Override - protected boolean asynchronous() { - return false; - } -}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +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.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; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -import org.openide.util.actions.CookieAction; -import org.openide.util.actions.NodeAction; - -/** - * - * @author Thomas Wuerthinger - */ -public final class SaveAsAction extends NodeAction { - - public SaveAsAction() { - putValue(Action.SHORT_DESCRIPTION, "Save selected groups to XML file..."); - } - - @Override - protected void performAction(Node[] activatedNodes) { - - GraphDocument doc = new GraphDocument(); - Set<FolderElement> elements = new HashSet<>(); - for (Node n : activatedNodes) { - 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); - } - - public static void save(GraphDocument doc) { - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(ImportAction.getFileFilter()); - fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT))); - - if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - if (!file.getName().contains(".")) { - file = new File(file.getAbsolutePath() + ".xml"); - } - - File dir = file; - if (!dir.isDirectory()) { - dir = dir.getParentFile(); - } - Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); - try { - try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) { - Printer p = new Printer(); - p.export(writer, doc); - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - - } - } - } - - protected int mode() { - return CookieAction.MODE_SOME; - } - - @Override - public String getName() { - return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction"); - } - - @Override - protected String iconResource() { - return "com/sun/hotspot/igv/coordinator/images/save.png"; - } - - @Override - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - @Override - protected boolean asynchronous() { - return false; - } - - @Override - protected boolean enable(Node[] nodes) { - - int cnt = 0; - for (Node n : nodes) { - cnt += n.getLookup().lookupAll(Group.class).size(); - } - - return cnt > 0; - } -}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/customLeftWsmode.xml Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<mode version="2.1"> - <name unique="customLeft" /> - <kind type="view" /> - <state type="joined" /> - <constraints> - <path orientation="horizontal" number="0" weight="0.2"/> - <path orientation="vertical" number="0" weight="0.75"/> - </constraints> - <bounds x="0" y="0" width="0" height="0" /> - <frame state="0"/> - <active-tc id="OutlineTopComponent"/> - <empty-behavior permanent="false"/> -</mode>
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/diff.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/folder.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/graph.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/import.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/remove.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/removeall.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/save.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/saveall.gif has changed
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/structure.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/structured.gif has changed
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml Fri Feb 03 21:35:31 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,214 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd"> -<filesystem> - <folder name="Actions"> - <folder name="File"> - <file name="com-sun-hotspot-igv-coordinator-actions-SaveAsAction.instance"/> - <file name="com-sun-hotspot-igv-coordinator-actions-SaveAllAction.instance"/> - <file name="com-sun-hotspot-igv-coordinator-actions-ImportAction.instance"/> - </folder> - <folder name="Edit"> - <file name="com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"/> - <file name="com-sun-hotspot-igv-coordinator-actions-RemoveAllAction.instance"/> - </folder> - <folder name="Window"> - <file name="com-sun-hotspot-igv-coordinator-actions-OutlineAction.instance"/> - </folder> - </folder> - - <folder name="Menu"> - <folder name="File"> - <file name="Separator2.instance_hidden"/> - <file name="Separator3.instance_hidden"/> - <file name="SeparatorOpen.instance_hidden"/> - <file name="com-sun-hotspot-igv-coordinator-actions-ImportAction.shadow"> - <attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-ImportAction.instance"/> - <attr name="position" intvalue="100"/> - </file> - <file name="SeparatorSave.instance"> - <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> - <attr name="position" intvalue="150"/> - </file> - <file name="com-sun-hotspot-igv-coordinator-actions-SaveAsAction.shadow"> - <attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-SaveAsAction.instance"/> - <attr name="position" intvalue="200"/> - </file> - <file name="com-sun-hotspot-igv-coordinator-actions-SaveAllAction.shadow"> - <attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-SaveAllAction.instance"/> - <attr name="position" intvalue="300"/> - </file> - <file name="SeparatorRemove.instance"> - <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> - <attr name="position" intvalue="350"/> - </file> - <file name="com-sun-hotspot-igv-coordinator-actions-RemoveAction.shadow"> - <attr name="originalFile" stringvalue="Actions/Edit/com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"/> - <attr name="position" intvalue="400"/> - </file> - <file name="com-sun-hotspot-igv-coordinator-actions-RemoveAllAction.shadow"> - <attr name="originalFile" stringvalue="Actions/Edit/com-sun-hotspot-igv-coordinator-actions-RemoveAllAction.instance"/> - <attr name="position" intvalue="500"/> - </file> - - <!-- Hidden menu entries from other modules --> - <file name="org-netbeans-modules-editor-ExportHtmlAction.shadow_hidden"/> - <file name="org-netbeans-modules-openfile-OpenFileAction.shadow_hidden"/> - <file name="org-netbeans-modules-openfile-RecentFileAction.shadow_hidden"/> - <file name="org-netbeans-modules-print-action-PageSetupAction.shadow_hidden"/> - <file name="org-netbeans-modules-print-action-PrintAction.shadow_hidden"/> - <file name="org-netbeans-modules-project-ui-CloseProject.shadow_hidden"/> - <file name="org-netbeans-modules-project-ui-CustomizeProject.shadow_hidden"/> - <file name="org-netbeans-modules-project-ui-NewFile.shadow_hidden"/> - <file name="org-netbeans-modules-project-ui-NewProject.shadow_hidden"/> - <file name="org-netbeans-modules-project-ui-OpenProject.shadow_hidden"/> - <file name="org-netbeans-modules-project-ui-RecentProjects.shadow_hidden"/> - <file name="org-netbeans-modules-project-ui-groups-GroupsMenu.shadow_hidden"/> - <file name="org-openide-actions-SaveAction.shadow_hidden"/> - <file name="org-openide-actions-SaveAllAction.shadow_hidden"/> - <file name="org-openide-actions-SaveAsAction.shadow_hidden"/> - </folder> - - <folder name="Edit"> - <!-- Hidden menu entries from other modules --> - <file name="Separator1.instance_hidden"/> - <file name="Separator2.instance_hidden"/> - <file name="SeparatorAfterFindPrevious.instance_hidden"/> - <file name="SeparatorAfterProjectsSearch.instance_hidden"/> - <file name="WhereUsedAction.shadow_hidden"/> - <file name="org-netbeans-modules-editor-MainMenuAction$FindNextAction.instance_hidden"/> - <file name="org-netbeans-modules-editor-MainMenuAction$FindPreviousAction.instance_hidden"/> - <file name="org-netbeans-modules-editor-MainMenuAction$FindSelectionAction.instance_hidden"/> - <file name="org-netbeans-modules-editor-MainMenuAction$PasteFormattedAction.instance_hidden"/> - <file name="org-netbeans-modules-editor-MainMenuAction$SelectAllAction.instance_hidden"/> - <file name="org-netbeans-modules-editor-MainMenuAction$SelectIdentifierAction.instance_hidden"/> - <file name="org-netbeans-modules-editor-MainMenuAction$StartMacroRecordingAction.instance_hidden"/> - <file name="org-netbeans-modules-editor-MainMenuAction$StopMacroRecordingAction.instance_hidden"/> - <file name="org-netbeans-modules-search-FindInFilesAction.shadow_hidden"/> - <file name="org-netbeans-modules-search-ReplaceInFilesAction.shadow_hidden"/> - <file name="org-openide-actions-CopyAction.shadow_hidden"/> - <file name="org-openide-actions-CutAction.shadow_hidden"/> - <file name="org-openide-actions-DeleteAction.shadow_hidden"/> - <file name="org-openide-actions-FindAction.shadow_hidden"/> - <file name="org-openide-actions-PasteAction.shadow_hidden"/> - <file name="org-openide-actions-ReplaceAction.shadow_hidden"/> - <file name="sep-before-reposearch.instance_hidden"/> - </folder> - - <folder name="View"> - <!-- Hidden menu entries from other modules --> - <file name="Separator1.instance_hidden"/> - <file name="Separator2.instance_hidden"/> - <file name="org-netbeans-core-actions-HTMLViewAction.shadow_hidden"/> - <file name="org-netbeans-core-actions-LogAction.shadow_hidden"/> - <file name="org-netbeans-core-multiview-EditorsAction.instance_hidden"/> - <file name="org-netbeans-core-windows-actions-ToolbarsListAction.instance_hidden"/> - <file name="org-netbeans-modules-editor-NbCodeFoldingAction.instance_hidden"/> - <file name="org-netbeans-modules-project-ui-SyncEditorWithViewsAction.shadow_hidden"/> - <file name="org-netbeans-modules-versioning-ShowTextAnnotationsAction.shadow_hidden"/> - <file name="org-netbeans-modules-versioning-diff-ShowDiffSidebarAction.shadow_hidden"/> - <file name="toggle-line-numbers.shadow_hidden"/> - <file name="toggle-non-printable-characters.shadow_hidden"/> - <file name="toggle-toolbar.shadow_hidden"/> - </folder> - - <!-- Hidden menus --> - <folder name="GoTo_hidden"/> - <folder name="Source_hidden"/> - <folder name="Refactoring_hidden"/> - <folder name="BuildProject_hidden"/> - <folder name="RunProject_hidden"/> - <folder name="Versioning_hidden"/> - - <folder name="Tools"> - <!-- Hidden menu entries from other modules --> - <file name="LibrariesCustomizerAction.shadow_hidden"/> - <file name="PaletteManager_hidden"/> - <file name="Separator1.instance_hidden"/> - <file name="Separator2.instance_hidden"/> - <file name="ServerManagerAction3.shadow_hidden"/> - <file name="VariablesCustomizerAction.shadow_hidden"/> - <file name="org-netbeans-modules-autoupdate-ui-actions-PluginManagerAction.shadow_hidden"/> - <file name="org-netbeans-modules-favorites-templates-TemplatesAction.shadow_hidden"/> - <file name="org-netbeans-modules-options-OptionsWindowAction-separatorBefore.instance_hidden"/> - <file name="org-netbeans-modules-xml-catalog-CatalogAction.shadow_hidden"/> - <file name="org-openide-actions-ToolsAction.shadow_hidden"/> - </folder> - - <folder name="Window"> - <file name="OutlineAction.shadow"> - <attr name="originalFile" stringvalue="Actions/Window/com-sun-hotspot-igv-coordinator-actions-OutlineAction.instance"/> - </file> - - <!-- Hidden menu entries from other modules --> - <file name="Debug_hidden"/> - <file name="Navigator_hidden"/> - <file name="Other_hidden"/> - <file name="Output_hidden"/> - <file name="ProgressListAction.shadow_hidden"/> - <file name="ShowPaletteAction.shadow_hidden"/> - <file name="SwitchToRecentDocumentAction.shadow_hidden"/> - <file name="Versioning_hidden"/> - <file name="org-netbeans-core-ide-ServicesTabAction.shadow_hidden"/> - <file name="org-netbeans-modules-favorites-View.shadow_hidden"/> - <file name="org-netbeans-modules-project-ui-logical-tab-action.shadow_hidden"/> - <file name="org-netbeans-modules-project-ui-physical-tab-action.shadow_hidden"/> - <file name="org-netbeans-modules-tasklist-ui-TaskListAction.shadow_hidden"/> - <file name="CloneDocumentAction.shadow_hidden"/> - </folder> - - <folder name="Help"> - <!-- Hidden menu entries from other modules --> - <file name="Separator1.instance_hidden"/> - <file name="netbeans-kb.url_hidden"/> - <file name="org-netbeans-modules-autoupdate-ui-actions-CheckForUpdatesAction.shadow_hidden"/> - <file name="org-netbeans-modules-bugzilla-ReportNBIssueAction.shadow_hidden"/> - <file name="org-netbeans-modules-usersguide-master.xml_hidden"/> - <file name="shortcuts.xml_hidden"/> - </folder> - </folder> - - <folder name="OptionsDialog"> - <!-- Hidden option tabs from other modules --> - <file name="Editor.instance_hidden"/> - <file name="FontsAndColors.instance_hidden"/> - <file name="General.instance_hidden"/> - <file name="Keymaps.instance_hidden"/> - <folder name="Advanced"> - <file name="Files.instance_hidden"/> - <file name="IssueTracking.instance_hidden"/> - <file name="JavaScript.instance_hidden"/> - <file name="Spellchecker.instance_hidden"/> - <file name="TermAdvancedOption.instance_hidden"/> - <file name="ToDo.instance_hidden"/> - <file name="Versioning.instance_hidden"/> - </folder> - </folder> - - <folder name="Toolbars"> - <file name="Build_hidden"/> - <file name="Clipboard_hidden"/> - <file name="Debug_hidden"/> - <file name="Debugging.xml_hidden"/> - <file name="File_hidden"/> - <file name="Memory_hidden"/> - <file name="Standard.xml_hidden"/> - <file name="UndoRedo_hidden"/> - </folder> - <folder name="Windows2"> - <folder name="Components"> - <file name="OutlineTopComponent.settings" url="OutlineTopComponentSettings.xml"/> - </folder> - <folder name="Modes"> - <file name="customLeft.wsmode" url="customLeftWsmode.xml"/> - <folder name="customLeft"> - <file name="OutlineTopComponent.wstcref" url="OutlineTopComponentWstcref.xml"/> - </folder> - </folder> - </folder> - - <folder name="Shortcuts"> - <file name="Delete.shadow"> - <attr name="originalFile" stringvalue="Actions/Edit/com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"/> - </file> - </folder> -</filesystem>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Editor/src/com/oracle/graal/visualizer/editor/actions/TestObject.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,13 @@ +/* + * 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 { + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/manifest.mf Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +OpenIDE-Module: com.oracle.graal.visualizer.outline +OpenIDE-Module-Layer: com/oracle/graal/visualizer/outline/layer.xml +OpenIDE-Module-Localizing-Bundle: com/oracle/graal/visualizer/outline/Bundle.properties +OpenIDE-Module-Specification-Version: 1.0 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/Bundle.properties Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,5 @@ +AdvancedOption_DisplayName_Coordinator=Settings +AdvancedOption_Tooltip_Coordinator=Visualization Tool Settings +CTL_OutlineTopComponent=Outline +HINT_OutlineTopComponent=Displays loaded compilations. +OpenIDE-Module-Name=Outline
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/CompilationNode.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,148 @@ +/* + * 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.outline; + +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; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.ImageUtilities; +import org.openide.util.Lookup; +import org.openide.util.lookup.AbstractLookup; +import org.openide.util.lookup.InstanceContent; +import org.openide.util.lookup.Lookups; + +public class CompilationNode extends AbstractNode implements ChangedListener { + + private CompilationNode(final Folder folder, Children children, InstanceContent content) { + super(children, new AbstractLookup(content)); + this.setDisplayName(folder.getName()); + + if (folder instanceof Group) { + content.add(new OpenCookie() { + + @Override + public void open() { + final List<InputGraph> 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 void changed(Object folder) { + if (this.getChildren() == Children.LEAF) { + setChildren(createFolderChildren((Folder) folder)); + this.fireIconChange(); + } + } + + private static class FolderChildren extends Children.Keys<Folder> { + + private final Folder folder; + + public FolderChildren(Folder folder) { + this.folder = folder; + folder.getChangedEvent().addListener(changedListener); + } + + @Override + protected Node[] createNodes(Folder e) { + return new Node[]{new CompilationNode(e)}; + } + + @Override + public void addNotify() { + List<Folder> result = new ArrayList<>(); + for (FolderElement o : folder.getElements()) { + if (o instanceof Folder) { + result.add((Folder) o); + } + } + this.setKeys(result); + } + private final ChangedListener changedListener = new ChangedListener() { + + @Override + public void changed(Object source) { + addNotify(); + } + }; + } + + @Override + public Image getIcon(int i) { + if (this.getChildren() == Children.LEAF) { + return ImageUtilities.loadImage("com/oracle/graal/visualizer/outline/images/leaf_node.gif"); + } else { + return ImageUtilities.loadImage("com/oracle/graal/visualizer/outline/images/node.gif"); + } + } + + protected CompilationNode(Folder folder) { + this(folder, createFolderChildren(folder), new InstanceContent()); + } + + private static Children createFolderChildren(Folder folder) { + for (FolderElement elem : folder.getElements()) { + if (elem instanceof Folder) { + return new FolderChildren(folder); + } + } + return Children.LEAF; + } + + @Override + public Action[] getActions(boolean context) { + List<Action> actions = new ArrayList<>(); + actions.add((Action) OpenAction.findObject(OpenAction.class, true)); + actions.addAll(Lookups.forPath(OutlineTopComponent.NODE_ACTIONS_FOLDER).lookupAll(Action.class)); + return actions.toArray(new Action[actions.size()]); + } + + @Override + public Action getPreferredAction() { + return (Action) OpenAction.findObject(OpenAction.class, true); + } + + @Override + public Image getOpenedIcon(int i) { + return getIcon(i); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.form Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> + <SubComponents> + <Container class="javax.swing.JScrollPane" name="treeView"> + <AuxValues> + <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/> + </AuxValues> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> + <BorderConstraints direction="Center"/> + </Constraint> + </Constraints> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + </Container> + </SubComponents> +</Form>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,232 @@ +/* + * 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.outline; + +import com.oracle.graal.visualizer.outline.server.Server; +import com.oracle.graal.visualizer.outline.server.ServerPanel; +import com.sun.hotspot.igv.data.GraphDocument; +import java.awt.BorderLayout; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import javax.swing.Action; +import javax.swing.UIManager; +import javax.swing.border.Border; +import org.openide.ErrorManager; +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.LookupEvent; +import org.openide.util.LookupListener; +import org.openide.util.NbBundle; +import org.openide.util.lookup.Lookups; +import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; + +/** + * + * @author Thomas Wuerthinger + */ +public final class OutlineTopComponent extends TopComponent implements ExplorerManager.Provider, LookupListener { + + public static final String GLOBAL_ACTIONS_FOLDER = "Actions/Outline/Global"; + public static final String NODE_ACTIONS_FOLDER = "Actions/Outline/Nodes"; + public static OutlineTopComponent instance; + public static final String PREFERRED_ID = "OutlineTopComponent"; + private ExplorerManager manager; + private GraphDocument document; + private Server server; + + private OutlineTopComponent() { + initComponents(); + + setName(NbBundle.getMessage(OutlineTopComponent.class, "CTL_OutlineTopComponent")); + setToolTipText(NbBundle.getMessage(OutlineTopComponent.class, "HINT_OutlineTopComponent")); + + document = new GraphDocument(); + initListView(); + initToolbar(); + } + + private void initListView() { + manager = new ExplorerManager(); + manager.setRootContext(new CompilationNode(document)); + ((BeanTreeView) this.treeView).setRootVisible(false); + associateLookup(ExplorerUtils.createLookup(manager, getActionMap())); + } + + 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 : lookupActions(GLOBAL_ACTIONS_FOLDER)) { + toolbar.add(a); + } + toolbar.add(GarbageCollectAction.get(GarbageCollectAction.class).getToolbarPresenter()); + toolbar.add(new ServerPanel(getDocument())); + } + + private List<Action> lookupActions(String path) { + List<Action> actions = new ArrayList<>(); + for (Action a : Lookups.forPath(path).lookupAll(Action.class)) { + Action newAction = a; + if (a instanceof ContextAwareAction) { + newAction = ((ContextAwareAction) a).createContextAwareInstance(getLookup()); + } + newAction.putValue(Action.SHORT_DESCRIPTION, newAction.getValue(Action.NAME)); + actions.add(newAction); + + } + return actions; + } + + public void clear() { + document.clear(); + } + + @Override + public ExplorerManager getExplorerManager() { + return manager; + } + + public GraphDocument getDocument() { + return document; + } + + /** + * Gets default instance. Do not use directly: reserved for *.settings files + * only, i.e. deserialization routines; otherwise you could get a + * non-deserialized instance. To obtain the singleton instance, use {@link findInstance}. + */ + public static synchronized OutlineTopComponent getDefault() { + if (instance == null) { + instance = new OutlineTopComponent(); + } + return instance; + } + + /** + * Obtain the OutlineTopComponent instance. Never call {@link #getDefault} + * directly! + */ + public static synchronized OutlineTopComponent findInstance() { + TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); + if (win == null) { + ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find Outline component. It will not be located properly in the window system."); + return getDefault(); + } + if (win instanceof OutlineTopComponent) { + return (OutlineTopComponent) win; + } + ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior."); + return getDefault(); + } + + @Override + public int getPersistenceType() { + return TopComponent.PERSISTENCE_ALWAYS; + } + + @Override + public void componentOpened() { + this.requestActive(); + } + + @Override + public void componentClosed() { + } + + @Override + protected String preferredID() { + return PREFERRED_ID; + } + + @Override + public void requestActive() { + super.requestActive(); + treeView.requestFocus(); + } + + @Override + public boolean requestFocus(boolean temporary) { + treeView.requestFocus(); + return super.requestFocus(temporary); + } + + @Override + protected boolean requestFocusInWindow(boolean temporary) { + treeView.requestFocus(); + return super.requestFocusInWindow(temporary); + } + + @Override + public void resultChanged(LookupEvent lookupEvent) { + } + + @Override + public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { + // Not called when user starts application for the first time + super.readExternal(objectInput); + ((BeanTreeView) this.treeView).setRootVisible(false); + } + + @Override + public void writeExternal(ObjectOutput objectOutput) throws IOException { + super.writeExternal(objectOutput); + } + + static final class ResolvableHelper implements Serializable { + + private static final long serialVersionUID = 1L; + + public Object readResolve() { + return OutlineTopComponent.getDefault(); + } + } + + /** + * 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() { + + treeView = new BeanTreeView(); + + setLayout(new java.awt.BorderLayout()); + add(treeView, java.awt.BorderLayout.CENTER); + }// </editor-fold>//GEN-END:initComponents + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JScrollPane treeView; + // End of variables declaration//GEN-END:variables +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponentSettings.xml Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd"> +<settings version="1.0"> + <module name="com.oracle.graal.visualizer.outline" spec="1.0"/> + <instanceof class="at.openide.windows.TopComponent"/> + <instanceof class="com.oracle.graal.visualizer.outline.OutlineTopComponent"/> + <instance class="com.oracle.graal.visualizer.outline.OutlineTopComponent" method="getDefault"/> +</settings>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponentWstcref.xml Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd"> +<tc-ref version="2.0" > + <module name="com.oracle.graal.visualizer.outline" spec="1.0"/> + <tc-id id="OutlineTopComponent"/> + <state opened="true"/> +</tc-ref>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/ImportAction.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,155 @@ +/* + * 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.outline.actions; + +import com.oracle.graal.visualizer.outline.OutlineTopComponent; +import com.sun.hotspot.igv.data.GraphDocument; +import com.sun.hotspot.igv.data.serialization.Parser; +import com.sun.hotspot.igv.data.serialization.XMLParser; +import com.sun.hotspot.igv.settings.Settings; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import javax.swing.JFileChooser; +import javax.swing.SwingUtilities; +import javax.swing.filechooser.FileFilter; +import org.netbeans.api.progress.ProgressHandle; +import org.netbeans.api.progress.ProgressHandleFactory; +import org.openide.DialogDisplayer; +import org.openide.NotifyDescriptor; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; +import org.openide.util.RequestProcessor; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +@ActionID(id = "com.oracle.graal.visualizer.outline.actions.ImportAction", category = "File") +@ActionRegistration(displayName = "Import", iconBase="com/oracle/graal/visualizer/outline/images/import.png") +@ActionReferences(value = { + @ActionReference(path = "Menu/File", position = 100), + @ActionReference(path = OutlineTopComponent.GLOBAL_ACTIONS_FOLDER)}) +public final class ImportAction implements ActionListener { + + public static FileFilter getFileFilter() { + return new FileFilter() { + + @Override + public boolean accept(File f) { + return f.getName().toLowerCase().endsWith(".xml") || f.isDirectory(); + } + + @Override + public String getDescription() { + return "XML files (*.xml)"; + } + }; + } + + @Override + public void actionPerformed(ActionEvent e) { + + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(ImportAction.getFileFilter()); + fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT))); + + if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + + File dir = file; + if (!dir.isDirectory()) { + dir = dir.getParentFile(); + } + + Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); + + try { + final FileInputStream inputStream = new FileInputStream(file); + final InputSource is = new InputSource(inputStream); + + final ProgressHandle handle = ProgressHandleFactory.createHandle("Opening file " + file.getName()); + final int basis = 1000; + handle.start(basis); + final int start = inputStream.available(); + + final XMLParser.ParseMonitor parseMonitor = new XMLParser.ParseMonitor() { + + @Override + public void setProgress(double d) { + try { + int curAvailable = inputStream.available(); + int prog = (int) (basis * (double) (start - curAvailable) / (double) start); + handle.progress(prog); + } catch (IOException ex) { + } + } + + @Override + public void setState(String state) { + setProgress(0.0); + handle.progress(state); + } + }; + final Parser parser = new Parser(); + final OutlineTopComponent component = OutlineTopComponent.findInstance(); + + component.requestActive(); + + RequestProcessor.getDefault().post(new Runnable() { + + @Override + public void run() { + try { + final GraphDocument document = parser.parse(is, parseMonitor); + parseMonitor.setState("Finishing"); + SwingUtilities.invokeLater(new Runnable(){ + + @Override + public void run() { + component.getDocument().addGraphDocument(document); + } + }); + } catch (SAXException ex) { + String s = "Exception during parsing the XML file, could not load document!"; + if (ex instanceof XMLParser.MissingAttributeException) { + XMLParser.MissingAttributeException e = (XMLParser.MissingAttributeException) ex; + s += "\nMissing attribute \"" + e.getAttributeName() + "\""; + } + NotifyDescriptor d = new NotifyDescriptor.Message(s, NotifyDescriptor.ERROR_MESSAGE); + DialogDisplayer.getDefault().notify(d); + } + handle.finish(); + } + }); + + } catch (IOException ex) { + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message("Error reading file!", NotifyDescriptor.ERROR_MESSAGE)); + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/OutlineAction.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,45 @@ +/* + * 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.outline.actions; + +import com.oracle.graal.visualizer.outline.OutlineTopComponent; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionRegistration; +import org.openide.windows.TopComponent; + +@ActionID(id = "com.oracle.graal.visualizer.outline.actions.OutlineAction", category = "Window") +@ActionRegistration(displayName = "Compilations") +@ActionReference(path = "Menu/Window", name = "OutlineAction") +public class OutlineAction implements ActionListener { + @Override + public void actionPerformed(ActionEvent evt) { + TopComponent win = OutlineTopComponent.findInstance(); + win.open(); + win.requestActive(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/RemoveAction.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,55 @@ +/* + * 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.outline.actions; + +import com.oracle.graal.visualizer.outline.OutlineTopComponent; +import com.sun.hotspot.igv.data.FolderElement; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.List; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; + +@ActionID(id = "com.oracle.graal.visualizer.outline.actions.RemoveAction", category = "Edit") +@ActionRegistration(displayName = "Remove", iconBase = "com/oracle/graal/visualizer/outline/images/remove.png") +@ActionReferences(value = { + @ActionReference(path = "Menu/File", position = 400), + @ActionReference(path = OutlineTopComponent.NODE_ACTIONS_FOLDER)}) +public final class RemoveAction implements ActionListener { + + List<FolderElement> elements; + + public RemoveAction(List<FolderElement> elements) { + this.elements = elements; + } + + @Override + public void actionPerformed(ActionEvent e) { + for (FolderElement element : elements) { + element.getParent().removeElement(element); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/RemoveAllAction.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,46 @@ +/* + * 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. 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.outline.actions; + +import com.oracle.graal.visualizer.outline.OutlineTopComponent; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; + +@ActionID(id = "com.oracle.graal.visualizer.outline.actions.RemoveAllAction", category = "Edit") +@ActionRegistration(displayName = "Remove all", iconBase = "com/oracle/graal/visualizer/outline/images/removeall.png") +@ActionReferences(value = { + @ActionReference(path = "Menu/File", position = 500), + @ActionReference(path = OutlineTopComponent.GLOBAL_ACTIONS_FOLDER)}) +public final class RemoveAllAction implements ActionListener { + + @Override + public void actionPerformed(ActionEvent e) { + OutlineTopComponent.findInstance().clear(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/SaveAllAction.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,47 @@ +/* + * 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. 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.outline.actions; + +import com.oracle.graal.visualizer.outline.OutlineTopComponent; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; + +@ActionID(id = "com.oracle.graal.visualizer.outline.actions.SaveAllAction", category = "File") +@ActionRegistration(displayName = "Save all..", iconBase = "com/oracle/graal/visualizer/outline/images/saveall.gif") +@ActionReferences(value = { + @ActionReference(path = "Menu/File", position = 300), + @ActionReference(path = OutlineTopComponent.GLOBAL_ACTIONS_FOLDER)}) +public final class SaveAllAction implements ActionListener { + + @Override + public void actionPerformed(ActionEvent e) { + final OutlineTopComponent component = OutlineTopComponent.findInstance(); + SaveAsAction.save(component.getDocument()); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/actions/SaveAsAction.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,105 @@ +/* + * 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.outline.actions; + +import com.oracle.graal.visualizer.outline.OutlineTopComponent; +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.serialization.Printer; +import com.sun.hotspot.igv.settings.Settings; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.*; +import java.util.List; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; + +@ActionID(id = "com.oracle.graal.visualizer.outline.actions.SaveAsAction", category = "File") +@ActionRegistration(displayName = "Save as...", iconBase="com/oracle/graal/visualizer/outline/images/save.png") +@ActionReferences(value = { + @ActionReference(path = "Menu/File", position = 200), + @ActionReference(path = OutlineTopComponent.NODE_ACTIONS_FOLDER)}) +public final class SaveAsAction implements ActionListener { + + private final List<FolderElement> elements; + + public SaveAsAction(List<FolderElement> elements) { + this.elements = elements; + } + + + @Override + public void actionPerformed(ActionEvent e) { + GraphDocument doc = new GraphDocument(); + 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); + } + + public static void save(GraphDocument doc) { + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(ImportAction.getFileFilter()); + fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT))); + + if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + if (!file.getName().contains(".")) { + file = new File(file.getAbsolutePath() + ".xml"); + } + + File dir = file; + if (!dir.isDirectory()) { + dir = dir.getParentFile(); + } + Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); + try { + try (Writer writer = new OutputStreamWriter(new FileOutputStream(file))) { + Printer p = new Printer(); + p.export(writer, doc); + } + } catch (IOException e) { + JOptionPane.showMessageDialog(null, "Error writing file " + file.getAbsolutePath()); + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/customLeftWsmode.xml Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<mode version="2.1"> + <name unique="customLeft" /> + <kind type="view" /> + <state type="joined" /> + <constraints> + <path orientation="horizontal" number="0" weight="0.2"/> + <path orientation="vertical" number="0" weight="0.75"/> + </constraints> + <bounds x="0" y="0" width="0" height="0" /> + <frame state="0"/> + <active-tc id="OutlineTopComponent"/> + <empty-behavior permanent="false"/> +</mode>
Binary file src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/import.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/leaf_node.gif has changed
Binary file src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/node.gif has changed
Binary file src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/remove.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/removeall.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/save.png has changed
Binary file src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/images/saveall.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/layer.xml Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,174 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd"> +<filesystem> + <folder name="Actions"/> + + <folder name="Menu"> + <folder name="File"> + <file name="Separator2.instance_hidden"/> + <file name="Separator3.instance_hidden"/> + <file name="SeparatorOpen.instance_hidden"/> + <file name="SeparatorSave.instance"> + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> + <attr name="position" intvalue="150"/> + </file> + <file name="SeparatorRemove.instance"> + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> + <attr name="position" intvalue="350"/> + </file> + + <!-- Hidden menu entries from other modules --> + <file name="org-netbeans-modules-editor-ExportHtmlAction.shadow_hidden"/> + <file name="org-netbeans-modules-openfile-OpenFileAction.shadow_hidden"/> + <file name="org-netbeans-modules-openfile-RecentFileAction.shadow_hidden"/> + <file name="org-netbeans-modules-print-action-PageSetupAction.shadow_hidden"/> + <file name="org-netbeans-modules-print-action-PrintAction.shadow_hidden"/> + <file name="org-netbeans-modules-project-ui-CloseProject.shadow_hidden"/> + <file name="org-netbeans-modules-project-ui-CustomizeProject.shadow_hidden"/> + <file name="org-netbeans-modules-project-ui-NewFile.shadow_hidden"/> + <file name="org-netbeans-modules-project-ui-NewProject.shadow_hidden"/> + <file name="org-netbeans-modules-project-ui-OpenProject.shadow_hidden"/> + <file name="org-netbeans-modules-project-ui-RecentProjects.shadow_hidden"/> + <file name="org-netbeans-modules-project-ui-groups-GroupsMenu.shadow_hidden"/> + <file name="org-openide-actions-SaveAction.shadow_hidden"/> + <file name="org-openide-actions-SaveAllAction.shadow_hidden"/> + <file name="org-openide-actions-SaveAsAction.shadow_hidden"/> + </folder> + + <folder name="Edit"> + <!-- Hidden menu entries from other modules --> + <file name="Separator1.instance_hidden"/> + <file name="Separator2.instance_hidden"/> + <file name="SeparatorAfterFindPrevious.instance_hidden"/> + <file name="SeparatorAfterProjectsSearch.instance_hidden"/> + <file name="WhereUsedAction.shadow_hidden"/> + <file name="org-netbeans-modules-editor-MainMenuAction$FindNextAction.instance_hidden"/> + <file name="org-netbeans-modules-editor-MainMenuAction$FindPreviousAction.instance_hidden"/> + <file name="org-netbeans-modules-editor-MainMenuAction$FindSelectionAction.instance_hidden"/> + <file name="org-netbeans-modules-editor-MainMenuAction$PasteFormattedAction.instance_hidden"/> + <file name="org-netbeans-modules-editor-MainMenuAction$SelectAllAction.instance_hidden"/> + <file name="org-netbeans-modules-editor-MainMenuAction$SelectIdentifierAction.instance_hidden"/> + <file name="org-netbeans-modules-editor-MainMenuAction$StartMacroRecordingAction.instance_hidden"/> + <file name="org-netbeans-modules-editor-MainMenuAction$StopMacroRecordingAction.instance_hidden"/> + <file name="org-netbeans-modules-search-FindInFilesAction.shadow_hidden"/> + <file name="org-netbeans-modules-search-ReplaceInFilesAction.shadow_hidden"/> + <file name="org-openide-actions-CopyAction.shadow_hidden"/> + <file name="org-openide-actions-CutAction.shadow_hidden"/> + <file name="org-openide-actions-DeleteAction.shadow_hidden"/> + <file name="org-openide-actions-FindAction.shadow_hidden"/> + <file name="org-openide-actions-PasteAction.shadow_hidden"/> + <file name="org-openide-actions-ReplaceAction.shadow_hidden"/> + <file name="sep-before-reposearch.instance_hidden"/> + </folder> + + <folder name="View"> + <!-- Hidden menu entries from other modules --> + <file name="Separator1.instance_hidden"/> + <file name="Separator2.instance_hidden"/> + <file name="org-netbeans-core-actions-HTMLViewAction.shadow_hidden"/> + <file name="org-netbeans-core-actions-LogAction.shadow_hidden"/> + <file name="org-netbeans-core-multiview-EditorsAction.instance_hidden"/> + <file name="org-netbeans-core-windows-actions-ToolbarsListAction.instance_hidden"/> + <file name="org-netbeans-modules-editor-NbCodeFoldingAction.instance_hidden"/> + <file name="org-netbeans-modules-project-ui-SyncEditorWithViewsAction.shadow_hidden"/> + <file name="org-netbeans-modules-versioning-ShowTextAnnotationsAction.shadow_hidden"/> + <file name="org-netbeans-modules-versioning-diff-ShowDiffSidebarAction.shadow_hidden"/> + <file name="toggle-line-numbers.shadow_hidden"/> + <file name="toggle-non-printable-characters.shadow_hidden"/> + <file name="toggle-toolbar.shadow_hidden"/> + </folder> + + <!-- Hidden menus --> + <folder name="GoTo_hidden"/> + <folder name="Source_hidden"/> + <folder name="Refactoring_hidden"/> + <folder name="BuildProject_hidden"/> + <folder name="RunProject_hidden"/> + <folder name="Versioning_hidden"/> + + <folder name="Tools"> + <!-- Hidden menu entries from other modules --> + <file name="LibrariesCustomizerAction.shadow_hidden"/> + <file name="PaletteManager_hidden"/> + <file name="Separator1.instance_hidden"/> + <file name="Separator2.instance_hidden"/> + <file name="ServerManagerAction3.shadow_hidden"/> + <file name="VariablesCustomizerAction.shadow_hidden"/> + <file name="org-netbeans-modules-autoupdate-ui-actions-PluginManagerAction.shadow_hidden"/> + <file name="org-netbeans-modules-favorites-templates-TemplatesAction.shadow_hidden"/> + <file name="org-netbeans-modules-options-OptionsWindowAction-separatorBefore.instance_hidden"/> + <file name="org-netbeans-modules-xml-catalog-CatalogAction.shadow_hidden"/> + <file name="org-openide-actions-ToolsAction.shadow_hidden"/> + </folder> + + <folder name="Window"> + + <!-- Hidden menu entries from other modules --> + <file name="Debug_hidden"/> + <file name="Navigator_hidden"/> + <file name="Other_hidden"/> + <file name="Output_hidden"/> + <file name="ProgressListAction.shadow_hidden"/> + <file name="ShowPaletteAction.shadow_hidden"/> + <file name="SwitchToRecentDocumentAction.shadow_hidden"/> + <file name="Versioning_hidden"/> + <file name="org-netbeans-core-ide-ServicesTabAction.shadow_hidden"/> + <file name="org-netbeans-modules-favorites-View.shadow_hidden"/> + <file name="org-netbeans-modules-project-ui-logical-tab-action.shadow_hidden"/> + <file name="org-netbeans-modules-project-ui-physical-tab-action.shadow_hidden"/> + <file name="org-netbeans-modules-tasklist-ui-TaskListAction.shadow_hidden"/> + <file name="CloneDocumentAction.shadow_hidden"/> + </folder> + + <folder name="Help"> + <!-- Hidden menu entries from other modules --> + <file name="Separator1.instance_hidden"/> + <file name="netbeans-kb.url_hidden"/> + <file name="org-netbeans-modules-autoupdate-ui-actions-CheckForUpdatesAction.shadow_hidden"/> + <file name="org-netbeans-modules-bugzilla-ReportNBIssueAction.shadow_hidden"/> + <file name="org-netbeans-modules-usersguide-master.xml_hidden"/> + <file name="shortcuts.xml_hidden"/> + </folder> + </folder> + + <folder name="OptionsDialog"> + <!-- Hidden option tabs from other modules --> + <file name="Editor.instance_hidden"/> + <file name="FontsAndColors.instance_hidden"/> + <file name="General.instance_hidden"/> + <file name="Keymaps.instance_hidden"/> + <folder name="Advanced"> + <file name="Files.instance_hidden"/> + <file name="IssueTracking.instance_hidden"/> + <file name="JavaScript.instance_hidden"/> + <file name="Spellchecker.instance_hidden"/> + <file name="TermAdvancedOption.instance_hidden"/> + <file name="ToDo.instance_hidden"/> + <file name="Versioning.instance_hidden"/> + </folder> + </folder> + + <folder name="Toolbars"> + <file name="Build_hidden"/> + <file name="Clipboard_hidden"/> + <file name="Debug_hidden"/> + <file name="Debugging.xml_hidden"/> + <file name="File_hidden"/> + <file name="Memory_hidden"/> + <file name="Standard.xml_hidden"/> + <file name="UndoRedo_hidden"/> + </folder> + <folder name="Windows2"> + <folder name="Components"> + <file name="OutlineTopComponent.settings" url="OutlineTopComponentSettings.xml"/> + </folder> + <folder name="Modes"> + <file name="customLeft.wsmode" url="customLeftWsmode.xml"/> + <folder name="customLeft"> + <file name="OutlineTopComponent.wstcref" url="OutlineTopComponentWstcref.xml"/> + </folder> + </folder> + </folder> + + +</filesystem>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/Bundle.properties Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,1 @@ +OpenIDE-Module-Name=NetworkConnection
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/Client.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,67 @@ +/* + * 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. 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.outline.server; + +import com.sun.hotspot.igv.data.serialization.Parser; +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.Socket; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +public class Client implements Runnable { + + private Socket socket; + private ServerCallback callback; + + public Client(Socket socket, ServerCallback callback) { + this.callback = callback; + this.socket = socket; + } + + @Override + public void run() { + callback.connectionOpened(socket.getInetAddress()); + 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) { + throw new IOException(ex); + } + } catch (IOException ex) { + } finally { + try { + socket.close(); + } catch (IOException ex) { + } + callback.connectionClosed(); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/Server.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,89 @@ +/* + * 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. 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.outline.server; + +import java.io.IOException; +import java.net.ServerSocket; +import java.net.Socket; +import org.openide.DialogDisplayer; +import org.openide.NotifyDescriptor; +import org.openide.util.RequestProcessor; + +public class Server { + + private Runnable serverRunnable; + private ServerSocket serverSocket; + + private Server() {} + + + public static Server start(final ServerCallback callback, int port) { + + final Server server = new Server(); + + try { + server.serverSocket = new java.net.ServerSocket(port); + } 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 null; + } + + Runnable runnable = new Runnable() { + + @Override + public void run() { + while (true) { + try { + Socket clientSocket = server.serverSocket.accept(); + if (server.serverRunnable != this) { + clientSocket.close(); + return; + } + RequestProcessor.getDefault().post(new Client(clientSocket, callback), 0, Thread.MAX_PRIORITY); + } catch (IOException ex) { + server.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; + } + } + } + }; + + server.serverRunnable = runnable; + RequestProcessor.getDefault().post(runnable, 0, Thread.MAX_PRIORITY); + return server; + } + + void shutdown() { + try { + serverSocket.close(); + } catch (IOException ex) { + } + + serverSocket = null; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/ServerCallback.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,37 @@ +/* + * 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. 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.outline.server; + +import com.sun.hotspot.igv.data.services.GroupCallback; +import java.net.InetAddress; + +public interface ServerCallback extends GroupCallback { + + public void connectionOpened(InetAddress inetAddress); + + public void connectionClosed(); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/server/ServerPanel.java Sat Feb 04 21:12:50 2012 +0100 @@ -0,0 +1,130 @@ +/* + * 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. 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.outline.server; + +import com.sun.hotspot.igv.data.GraphDocument; +import com.sun.hotspot.igv.data.Group; +import com.sun.hotspot.igv.settings.Settings; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Font; +import java.net.InetAddress; +import java.util.prefs.PreferenceChangeEvent; +import java.util.prefs.PreferenceChangeListener; +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +public class ServerPanel extends JPanel { + + private final static int BORDER_SIZE = 2; + JLabel label; + private Server server; + private int port = -1; + private int numberOfConnections; + private final GraphDocument document; + private final PreferenceChangeListener preferenceChanged = new PreferenceChangeListener() { + + @Override + public void preferenceChange(PreferenceChangeEvent evt) { + updateServer(); + } + }; + private ServerCallback callback = new ServerCallback() { + + @Override + public void connectionOpened(InetAddress inetAddress) { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + numberOfConnections++; + updateLabel(); + } + }); + } + + @Override + public void connectionClosed() { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + numberOfConnections--; + updateLabel(); + } + }); + } + + @Override + public void started(Group g) { + document.addElement(g); + } + }; + + private void updateLabel() { + if (numberOfConnections == 0) { + label.setText(String.format("Listening on %d", port)); + label.setFont(label.getFont().deriveFont(Font.PLAIN)); + } else { + label.setText(String.format("%d connections", numberOfConnections)); + label.setFont(label.getFont().deriveFont(Font.BOLD)); + } + } + + private void updateServer() { + int curPort = Integer.parseInt(Settings.get().get(Settings.PORT, Settings.PORT_DEFAULT)); + if (curPort != port) { + port = curPort; + if (server != null) { + server.shutdown(); + } + server = Server.start(callback, port); + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + updateLabel(); + } + }); + } + } + + public ServerPanel(GraphDocument document) { + + this.document = document; + Settings.get().addPreferenceChangeListener(preferenceChanged); + label = new JLabel(); + label.setBorder(BorderFactory.createEmptyBorder(0, BORDER_SIZE, 0, BORDER_SIZE)); + this.setLayout(new BorderLayout()); + this.add(label, BorderLayout.WEST); + updateServer(); + } + + public Component getToolbarPresenter() { + return label; + } +}
--- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Fri Feb 03 21:35:31 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Sat Feb 04 21:12:50 2012 +0100 @@ -4,7 +4,7 @@ branding.token=${app.name} modules=\ ${project.com.sun.hotspot.igv.graph}:\ - ${project.com.sun.hotspot.igv.coordinator}:\ + ${project.com.oracle.graal.visualizer.outline}:\ ${project.com.sun.hotspot.igv.filter}:\ ${project.com.sun.hotspot.igv.hierarchicallayout}:\ ${project.com.sun.hotspot.igv.layout}:\ @@ -24,7 +24,7 @@ project.at.ssw.visualizer.cfg=ControlFlowEditor project.com.oracle.graal.visualizer.editor=Editor project.com.sun.hotspot.igv.bytecodes=Bytecodes -project.com.sun.hotspot.igv.coordinator=Coordinator +project.com.oracle.graal.visualizer.outline=Outline project.com.sun.hotspot.igv.data=Data project.com.sun.hotspot.igv.difference=Difference project.com.sun.hotspot.igv.filter=Filter