aboutsummaryrefslogtreecommitdiff
path: root/src/share/tools
diff options
context:
space:
mode:
authornever <none@none>2008-06-24 16:00:14 -0700
committernever <none@none>2008-06-24 16:00:14 -0700
commit9991c91c989256630814af54dae59af52311c759 (patch)
tree5b5d9192ca1f04957e0ba7b60b5843f2a2ab84ef /src/share/tools
parent34eee71691b49a1254bd4ed1ca26fbbf1a4ef92a (diff)
downloadjdk8u_hotspot-9991c91c989256630814af54dae59af52311c759.tar.gz
6718676: putback for 6604014 is incomplete
Reviewed-by: kvn, jrose
Diffstat (limited to 'src/share/tools')
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/build.xml8
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/manifest.mf6
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/build-impl.xml30
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/genfiles.properties8
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.properties2
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.xml14
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/suite.properties1
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/BatikSVG.java86
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/Bundle.properties1
-rw-r--r--src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/layer.xml4
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/build.xml8
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/manifest.mf6
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/build-impl.xml30
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/genfiles.properties8
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/platform.properties29
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.properties2
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.xml62
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/suite.properties1
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/Bundle.properties5
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java100
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewAction.java45
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.form26
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java172
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentSettings.xml8
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentWstcref.xml7
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/MethodNode.java102
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesAction.java75
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesCookie.java47
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/bytecode.gifbin0 -> 70 bytes
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/link.gifbin0 -> 898 bytes
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/method.gifbin0 -> 346 bytes
-rw-r--r--src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/layer.xml29
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/build.xml8
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/manifest.mf6
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/build-impl.xml30
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/genfiles.properties8
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/platform.properties29
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.properties2
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.xml70
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/suite.properties1
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java83
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java160
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/Bundle.properties4
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowAction.java46
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java296
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form26
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java179
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml8
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml7
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java167
-rw-r--r--src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/layer.xml26
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/build.xml8
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/manifest.mf6
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/build-impl.xml30
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/genfiles.properties8
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/platform.properties29
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.properties2
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml126
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/suite.properties1
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupOrganizer2
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/Bundle.properties7
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java139
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphCountGroupOrganizer.java81
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java130
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.form41
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java271
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentSettings.xml8
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentWstcref.xml7
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardConfiguration.xml13
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardGroupOrganizer.java62
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties18
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphAction.java70
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java56
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java175
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/OutlineAction.java48
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java73
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java70
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveCookie.java36
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java69
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java122
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/StructuredViewAction.java180
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/customLeftWsmode.xml18
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/diff.gifbin0 -> 449 bytes
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/folder.gifbin0 -> 132 bytes
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/graph.gifbin0 -> 996 bytes
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/import.gifbin0 -> 949 bytes
-rw-r--r--src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/remove.gifbin0 -> 231 bytes
-rw-r--r--src/share/tools/IdealGraphVisualizer/README45
88 files changed, 4029 insertions, 0 deletions
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/build.xml b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/build.xml
new file mode 100644
index 000000000..2c8642cfb
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/build.xml
@@ -0,0 +1,8 @@
+<?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.svg" default="netbeans" basedir=".">
+ <description>Builds, tests, and runs the project com.sun.hotspot.igv.svg.</description>
+ <import file="nbproject/build-impl.xml"/>
+</project>
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/manifest.mf b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/manifest.mf
new file mode 100644
index 000000000..689e17a01
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/manifest.mf
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+OpenIDE-Module: com.sun.hotspot.igv.svg
+OpenIDE-Module-Layer: com/sun/hotspot/igv/svg/layer.xml
+OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/svg/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/build-impl.xml b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/build-impl.xml
new file mode 100644
index 000000000..5fe569eec
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/build-impl.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT ***
+*** EDIT ../build.xml INSTEAD ***
+-->
+<project name="com.sun.hotspot.igv.svg-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>
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/genfiles.properties b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/genfiles.properties
new file mode 100644
index 000000000..5018df1e6
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=ebcf0422
+build.xml.script.CRC32=d7a2678d
+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=ebcf0422
+nbproject/build-impl.xml.script.CRC32=57997f94
+nbproject/build-impl.xml.stylesheet.CRC32=deb65f65
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.properties b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.properties
new file mode 100644
index 000000000..152f44eca
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.properties
@@ -0,0 +1,2 @@
+javac.source=1.5
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.xml b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.xml
new file mode 100644
index 000000000..3939a84a0
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.xml
@@ -0,0 +1,14 @@
+<?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.svg</code-name-base>
+ <suite-component/>
+ <module-dependencies/>
+ <public-packages>
+ <package>com.sun.hotspot.igv.svg</package>
+ </public-packages>
+ </data>
+ </configuration>
+</project>
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/suite.properties b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/suite.properties
new file mode 100644
index 000000000..29d7cc9bd
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/suite.properties
@@ -0,0 +1 @@
+suite.dir=${basedir}/..
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/BatikSVG.java b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/BatikSVG.java
new file mode 100644
index 000000000..8326ff110
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/BatikSVG.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.svg;
+
+import java.awt.Graphics2D;
+import java.io.Writer;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import org.w3c.dom.DOMImplementation;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class BatikSVG {
+
+ private static Constructor SVGGraphics2DConstructor;
+ private static Method Method_stream;
+ private static Method Method_createDefault;
+ private static Method Method_getDOMImplementation;
+ private static Method Method_setEmbeddedFontsOn;
+
+ public static Graphics2D createGraphicsObject() {
+ try {
+ if (SVGGraphics2DConstructor == null) {
+ ClassLoader cl = BatikSVG.class.getClassLoader();
+ Class Class_GenericDOMImplementation = cl.loadClass("org.apache.batik.dom.GenericDOMImplementation");
+ Class Class_SVGGeneratorContext = cl.loadClass("org.apache.batik.svggen.SVGGeneratorContext");
+ Class Class_SVGGraphics2D = cl.loadClass("org.apache.batik.svggen.SVGGraphics2D");
+ Method_getDOMImplementation = Class_GenericDOMImplementation.getDeclaredMethod("getDOMImplementation", new Class[0]);
+ Method_createDefault = Class_SVGGeneratorContext.getDeclaredMethod("createDefault", new Class[]{org.w3c.dom.Document.class});
+ Method_setEmbeddedFontsOn = Class_SVGGeneratorContext.getDeclaredMethod("setEmbeddedFontsOn", new Class[]{boolean.class});
+ Method_stream = Class_SVGGraphics2D.getDeclaredMethod("stream", Writer.class, boolean.class);
+ SVGGraphics2DConstructor = Class_SVGGraphics2D.getConstructor(Class_SVGGeneratorContext, boolean.class);
+ }
+ DOMImplementation dom = (DOMImplementation) Method_getDOMImplementation.invoke(null);
+ org.w3c.dom.Document document = dom.createDocument("http://www.w3.org/2000/svg", "svg", null);
+ Object ctx = Method_createDefault.invoke(null, document);
+ Method_setEmbeddedFontsOn.invoke(ctx, true);
+ Graphics2D svgGenerator = (Graphics2D) SVGGraphics2DConstructor.newInstance(ctx, true);
+ return svgGenerator;
+ } catch (ClassNotFoundException e) {
+ return null;
+ } catch (NoSuchMethodException e) {
+ return null;
+ } catch (IllegalAccessException e) {
+ return null;
+ } catch (InvocationTargetException e) {
+ return null;
+ } catch (InstantiationException e) {
+ return null;
+ }
+ }
+
+ public static void printToStream(Graphics2D svgGenerator, Writer stream, boolean useCSS) {
+ try {
+ Method_stream.invoke(svgGenerator, stream, useCSS);
+ } catch (IllegalAccessException e) {
+ assert false;
+ } catch (InvocationTargetException e) {
+ assert false;
+ }
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/Bundle.properties b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/Bundle.properties
new file mode 100644
index 000000000..e57991292
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/Bundle.properties
@@ -0,0 +1 @@
+OpenIDE-Module-Name=BatikSVGProxy
diff --git a/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/layer.xml b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/layer.xml
new file mode 100644
index 000000000..c16a8a0fe
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/layer.xml
@@ -0,0 +1,4 @@
+<?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>
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/build.xml b/src/share/tools/IdealGraphVisualizer/Bytecodes/build.xml
new file mode 100644
index 000000000..1466d8606
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/build.xml
@@ -0,0 +1,8 @@
+<?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.bytecodes" default="netbeans" basedir=".">
+ <description>Builds, tests, and runs the project com.sun.hotspot.igv.bytecodes.</description>
+ <import file="nbproject/build-impl.xml"/>
+</project>
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/manifest.mf b/src/share/tools/IdealGraphVisualizer/Bytecodes/manifest.mf
new file mode 100644
index 000000000..a04660a02
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/manifest.mf
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+OpenIDE-Module: com.sun.hotspot.igv.bytecodes
+OpenIDE-Module-Layer: com/sun/hotspot/igv/bytecodes/layer.xml
+OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/bytecodes/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/build-impl.xml b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/build-impl.xml
new file mode 100644
index 000000000..4991499c3
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/build-impl.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT ***
+*** EDIT ../build.xml INSTEAD ***
+-->
+<project name="com.sun.hotspot.igv.bytecodes-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>
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/genfiles.properties b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/genfiles.properties
new file mode 100644
index 000000000..a60cd07ca
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=1dee290d
+build.xml.script.CRC32=d594034f
+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=1dee290d
+nbproject/build-impl.xml.script.CRC32=b4dab126
+nbproject/build-impl.xml.stylesheet.CRC32=deb65f65
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/platform.properties b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/platform.properties
new file mode 100644
index 000000000..68ad75e57
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/platform.properties
@@ -0,0 +1,29 @@
+# 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
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.properties b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.properties
new file mode 100644
index 000000000..152f44eca
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.properties
@@ -0,0 +1,2 @@
+javac.source=1.5
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.xml b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.xml
new file mode 100644
index 000000000..91bd81205
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.xml
@@ -0,0 +1,62 @@
+<?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.bytecodes</code-name-base>
+ <suite-component/>
+ <module-dependencies>
+ <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>org.jdesktop.layout</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.4</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.explorer</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.11</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.nodes</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.2.0.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.9.0.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.16</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <public-packages/>
+ </data>
+ </configuration>
+</project>
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/suite.properties b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/suite.properties
new file mode 100644
index 000000000..29d7cc9bd
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/suite.properties
@@ -0,0 +1 @@
+suite.dir=${basedir}/..
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/Bundle.properties b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/Bundle.properties
new file mode 100644
index 000000000..cd6852f9d
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/Bundle.properties
@@ -0,0 +1,5 @@
+CTL_BytecodeViewAction=Open BytecodeView Window
+CTL_BytecodeViewTopComponent=BytecodeView Window
+CTL_SelectBytecodesAction=Select nodes
+HINT_BytecodeViewTopComponent=This is a BytecodeView window
+OpenIDE-Module-Name=Bytecodes
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java
new file mode 100644
index 000000000..f9d1aa0ec
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.bytecodes;
+
+import com.sun.hotspot.igv.data.InputBytecode;
+import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.InputNode;
+import com.sun.hotspot.igv.data.Properties;
+import com.sun.hotspot.igv.data.Properties.StringPropertyMatcher;
+import java.awt.Image;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.swing.Action;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Utilities;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class BytecodeNode extends AbstractNode {
+
+ private Set<InputNode> nodes;
+
+ public BytecodeNode(InputBytecode bytecode, InputGraph graph, String bciValue) {
+
+ super(Children.LEAF);
+ this.setDisplayName(bytecode.getBci() + " " + bytecode.getName());
+
+ bciValue = bytecode.getBci() + " " + bciValue;
+ bciValue = bciValue.trim();
+
+ Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<InputNode>(graph.getNodes());
+ StringPropertyMatcher matcher = new StringPropertyMatcher("bci", bciValue);
+ List<InputNode> nodeList = selector.selectMultiple(matcher);
+ if (nodeList.size() > 0) {
+ nodes = new HashSet<InputNode>();
+ for (InputNode n : nodeList) {
+ nodes.add(n);
+ }
+ this.setDisplayName(this.getDisplayName() + " (" + nodes.size() + " nodes)");
+ }
+ }
+
+ @Override
+ public Image getIcon(int i) {
+ if (nodes != null) {
+ return Utilities.loadImage("com/sun/hotspot/igv/bytecodes/images/link.gif");
+ } else {
+ return Utilities.loadImage("com/sun/hotspot/igv/bytecodes/images/bytecode.gif");
+ }
+ }
+
+ @Override
+ public Image getOpenedIcon(int i) {
+ return getIcon(i);
+ }
+
+ @Override
+ public Action[] getActions(boolean b) {
+ return new Action[]{(Action) SelectBytecodesAction.findObject(SelectBytecodesAction.class, true)};
+ }
+
+ @Override
+ public Action getPreferredAction() {
+ return (Action) SelectBytecodesAction.findObject(SelectBytecodesAction.class, true);
+ }
+
+ @Override
+ public <T extends Node.Cookie> T getCookie(Class<T> aClass) {
+ if (aClass == SelectBytecodesCookie.class && nodes != null) {
+ return (T) (new SelectBytecodesCookie(nodes));
+ }
+ return super.getCookie(aClass);
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewAction.java b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewAction.java
new file mode 100644
index 000000000..df7b398e5
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewAction.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.bytecodes;
+
+import java.awt.event.ActionEvent;
+import javax.swing.AbstractAction;
+import org.openide.util.NbBundle;
+import org.openide.windows.TopComponent;
+
+/**
+ * @author Thomas Wuerthinger
+ */
+public class BytecodeViewAction extends AbstractAction {
+
+ public BytecodeViewAction() {
+ super(NbBundle.getMessage(BytecodeViewAction.class, "CTL_BytecodeViewAction"));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ TopComponent win = BytecodeViewTopComponent.findInstance();
+ win.open();
+ win.requestActive();
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.form b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.form
new file mode 100644
index 000000000..c2549ecaf
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.form
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+ <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"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="400" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="300" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+</Form>
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java
new file mode 100644
index 000000000..6fbbe90e9
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.bytecodes;
+
+import com.sun.hotspot.igv.data.Group;
+import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.services.InputGraphProvider;
+import java.awt.BorderLayout;
+import java.io.Serializable;
+import org.openide.ErrorManager;
+import org.openide.explorer.ExplorerManager;
+import org.openide.explorer.ExplorerUtils;
+import org.openide.explorer.view.BeanTreeView;
+import org.openide.util.Lookup;
+import org.openide.util.LookupEvent;
+import org.openide.util.LookupListener;
+import org.openide.util.NbBundle;
+import org.openide.util.Utilities;
+import org.openide.windows.TopComponent;
+import org.openide.windows.WindowManager;
+
+/**
+ * @author Thomas Wuerthinger
+ */
+final class BytecodeViewTopComponent extends TopComponent implements ExplorerManager.Provider, LookupListener {
+
+ private static BytecodeViewTopComponent instance;
+ private static final String PREFERRED_ID = "BytecodeViewTopComponent";
+ private ExplorerManager manager;
+ private BeanTreeView treeView;
+ private Lookup.Result result = null;
+ private MethodNode rootNode;
+
+ private BytecodeViewTopComponent() {
+ initComponents();
+ setName(NbBundle.getMessage(BytecodeViewTopComponent.class, "CTL_BytecodeViewTopComponent"));
+ setToolTipText(NbBundle.getMessage(BytecodeViewTopComponent.class, "HINT_BytecodeViewTopComponent"));
+
+ manager = new ExplorerManager();
+ rootNode = new MethodNode(null, null, "");
+ manager.setRootContext(rootNode);
+
+ setLayout(new BorderLayout());
+
+ treeView = new BeanTreeView();
+ treeView.setRootVisible(false);
+ this.add(BorderLayout.CENTER, treeView);
+ associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
+ }
+
+ /** 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() {
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 400, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 300, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+ /**
+ * 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 BytecodeViewTopComponent getDefault() {
+ if (instance == null) {
+ instance = new BytecodeViewTopComponent();
+ }
+ return instance;
+ }
+
+ /**
+ * Obtain the BytecodeViewTopComponent instance. Never call {@link #getDefault} directly!
+ */
+ public static synchronized BytecodeViewTopComponent findInstance() {
+ TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
+ if (win == null) {
+ ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find BytecodeView component. It will not be located properly in the window system.");
+ return getDefault();
+ }
+ if (win instanceof BytecodeViewTopComponent) {
+ return (BytecodeViewTopComponent) 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() {
+ Lookup.Template tpl = new Lookup.Template(Object.class);
+ result = Utilities.actionsGlobalContext().lookup(tpl);
+ result.addLookupListener(this);
+ }
+
+ @Override
+ public void componentClosed() {
+ result.removeLookupListener(this);
+ result = null;
+ }
+
+ @Override
+ public Object writeReplace() {
+ return new ResolvableHelper();
+ }
+
+ @Override
+ protected String preferredID() {
+ return PREFERRED_ID;
+ }
+
+ public ExplorerManager getExplorerManager() {
+ return manager;
+ }
+
+ public void resultChanged(LookupEvent lookupEvent) {
+ InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class);
+ if (p != null) {
+ InputGraph graph = p.getGraph();
+ if (graph != null) {
+ Group g = graph.getGroup();
+ rootNode.update(graph, g.getMethod());
+ }
+ }
+ }
+
+ final static class ResolvableHelper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public Object readResolve() {
+ return BytecodeViewTopComponent.getDefault();
+ }
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentSettings.xml b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentSettings.xml
new file mode 100644
index 000000000..d9469aba6
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentSettings.xml
@@ -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.sun.hotspot.igv.bytecodes" spec="1.0"/>
+ <instanceof class="org.openide.windows.TopComponent"/>
+ <instanceof class="com.sun.hotspot.igv.bytecodes.BytecodeViewTopComponent"/>
+ <instance class="com.sun.hotspot.igv.bytecodes.BytecodeViewTopComponent" method="getDefault"/>
+</settings>
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentWstcref.xml b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentWstcref.xml
new file mode 100644
index 000000000..a680c8f02
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentWstcref.xml
@@ -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.sun.hotspot.igv.bytecodes" spec="1.0"/>
+ <tc-id id="BytecodeViewTopComponent"/>
+ <state opened="true"/>
+</tc-ref>
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/MethodNode.java b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/MethodNode.java
new file mode 100644
index 000000000..b8f777e85
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/MethodNode.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.bytecodes;
+
+import com.sun.hotspot.igv.data.InputBytecode;
+import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.InputMethod;
+import java.awt.Image;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Utilities;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class MethodNode extends AbstractNode {
+
+ private static class MethodNodeChildren extends Children.Keys {
+
+ private InputMethod method;
+ private InputGraph graph;
+ private String bciString;
+
+ public MethodNodeChildren(InputMethod method, InputGraph graph, String bciString) {
+ this.method = method;
+ this.bciString = bciString;
+ this.graph = graph;
+ }
+
+ protected Node[] createNodes(Object object) {
+ assert object instanceof InputBytecode;
+ InputBytecode bc = (InputBytecode) object;
+ if (bc.getInlined() == null) {
+ return new Node[]{new BytecodeNode(bc, graph, bciString)};
+ } else {
+ return new Node[]{new BytecodeNode(bc, graph, bciString), new MethodNode(bc.getInlined(), graph, bc.getBci() + " " + bciString)};
+ }
+ }
+
+ @Override
+ public void addNotify() {
+ if (method != null) {
+ setKeys(method.getBytecodes());
+ }
+ }
+
+ public void setMethod(InputMethod method, InputGraph graph) {
+ this.method = method;
+ this.graph = graph;
+ addNotify();
+ }
+ }
+
+ /** Creates a new instance of MethodNode */
+ public MethodNode(InputMethod method, InputGraph graph, String bciString) {
+ super((method != null && method.getBytecodes().size() == 0) ? Children.LEAF : new MethodNodeChildren(method, graph, bciString));
+ if (method != null) {
+ this.setDisplayName(method.getName());
+ }
+ }
+
+ @Override
+ public Image getIcon(int i) {
+ return Utilities.loadImage("com/sun/hotspot/igv/bytecodes/images/method.gif");
+ }
+
+ @Override
+ public Image getOpenedIcon(int i) {
+ return getIcon(i);
+ }
+
+ public void update(InputGraph graph, InputMethod method) {
+ ((MethodNodeChildren) this.getChildren()).setMethod(method, graph);
+ if (method != null) {
+ this.setDisplayName(method.getName());
+ }
+
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesAction.java b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesAction.java
new file mode 100644
index 000000000..317e3a0fb
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesAction.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.bytecodes;
+
+import com.sun.hotspot.igv.data.services.InputGraphProvider;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.CookieAction;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public final class SelectBytecodesAction extends CookieAction {
+
+ protected void performAction(Node[] activatedNodes) {
+ SelectBytecodesCookie c = activatedNodes[0].getCookie(SelectBytecodesCookie.class);
+ InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class);
+ if (p != null) {
+ p.setSelectedNodes(c.getNodes());
+ }
+ }
+
+ protected int mode() {
+ return CookieAction.MODE_EXACTLY_ONE;
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(SelectBytecodesAction.class, "CTL_SelectBytecodesAction");
+ }
+
+ protected Class[] cookieClasses() {
+ return new Class[]{
+ SelectBytecodesCookie.class
+ };
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ putValue("noIconInMenu", Boolean.TRUE);
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesCookie.java b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesCookie.java
new file mode 100644
index 000000000..ff48bbb49
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesCookie.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.bytecodes;
+
+import com.sun.hotspot.igv.data.InputNode;
+import java.util.Collections;
+import java.util.Set;
+import org.openide.nodes.Node;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class SelectBytecodesCookie implements Node.Cookie {
+
+ private Set<InputNode> nodes;
+
+ /** Creates a new instance of SelectBytecodesCookie */
+ public SelectBytecodesCookie(Set<InputNode> nodes) {
+ this.nodes = nodes;
+ }
+
+ public Set<InputNode> getNodes() {
+ return Collections.unmodifiableSet(nodes);
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/bytecode.gif b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/bytecode.gif
new file mode 100644
index 000000000..5a2a355e3
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/bytecode.gif
Binary files differ
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/link.gif b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/link.gif
new file mode 100644
index 000000000..fc6595b2c
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/link.gif
Binary files differ
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/method.gif b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/method.gif
new file mode 100644
index 000000000..dc90fd038
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/method.gif
Binary files differ
diff --git a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/layer.xml b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/layer.xml
new file mode 100644
index 000000000..de53ae1da
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/layer.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
+<filesystem>
+ <folder name="Actions">
+ <folder name="Edit">
+ <file name="com-sun-hotspot-igv-bytecodes-SelectBytecodesAction.instance"/>
+ </folder>
+ <folder name="Window">
+ <file name="com-sun-hotspot-igv-bytecodes-BytecodeViewAction.instance"/>
+ </folder>
+ </folder>
+ <folder name="Menu">
+ <folder name="Window">
+ <file name="BytecodeViewAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Window/com-sun-hotspot-igv-bytecodes-BytecodeViewAction.instance"/>
+ </file>
+ </folder>
+ </folder>
+ <folder name="Windows2">
+ <folder name="Components">
+ <file name="BytecodeViewTopComponent.settings" url="BytecodeViewTopComponentSettings.xml"/>
+ </folder>
+ <folder name="Modes">
+ <folder name="customRightTopMode">
+ <file name="BytecodeViewTopComponent.wstcref" url="BytecodeViewTopComponentWstcref.xml"/>
+ </folder>
+ </folder>
+ </folder>
+</filesystem>
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/build.xml b/src/share/tools/IdealGraphVisualizer/ControlFlow/build.xml
new file mode 100644
index 000000000..b90d3b8b1
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/build.xml
@@ -0,0 +1,8 @@
+<?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.controlflow" default="netbeans" basedir=".">
+ <description>Builds, tests, and runs the project com.sun.hotspot.igv.controlflow.</description>
+ <import file="nbproject/build-impl.xml"/>
+</project>
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/manifest.mf b/src/share/tools/IdealGraphVisualizer/ControlFlow/manifest.mf
new file mode 100644
index 000000000..3ed19068d
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/manifest.mf
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+OpenIDE-Module: com.sun.hotspot.igv.controlflow
+OpenIDE-Module-Layer: com/sun/hotspot/igv/controlflow/layer.xml
+OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/controlflow/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/build-impl.xml b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/build-impl.xml
new file mode 100644
index 000000000..1664c75b0
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/build-impl.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT ***
+*** EDIT ../build.xml INSTEAD ***
+-->
+<project name="com.sun.hotspot.igv.controlflow-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>
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/genfiles.properties b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/genfiles.properties
new file mode 100644
index 000000000..ba61dc52a
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=b524efb3
+build.xml.script.CRC32=79a27be9
+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=b524efb3
+nbproject/build-impl.xml.script.CRC32=582bdab7
+nbproject/build-impl.xml.stylesheet.CRC32=deb65f65
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/platform.properties b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/platform.properties
new file mode 100644
index 000000000..68ad75e57
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/platform.properties
@@ -0,0 +1,29 @@
+# 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
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.properties b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.properties
new file mode 100644
index 000000000..152f44eca
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.properties
@@ -0,0 +1,2 @@
+javac.source=1.5
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.xml b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.xml
new file mode 100644
index 000000000..212cf2345
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.xml
@@ -0,0 +1,70 @@
+<?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.controlflow</code-name-base>
+ <suite-component/>
+ <module-dependencies>
+ <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.hierarchicallayout</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.layout</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.jdesktop.layout</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.4</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.visual</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>2.9</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.9.0.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.16</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <public-packages/>
+ </data>
+ </configuration>
+</project>
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/suite.properties b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/suite.properties
new file mode 100644
index 000000000..29d7cc9bd
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/suite.properties
@@ -0,0 +1 @@
+suite.dir=${basedir}/..
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java
new file mode 100644
index 000000000..d1e9b9b9c
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.controlflow;
+
+import com.sun.hotspot.igv.data.InputBlockEdge;
+import com.sun.hotspot.igv.layout.Link;
+import com.sun.hotspot.igv.layout.Port;
+import java.awt.Point;
+import java.util.ArrayList;
+import java.util.List;
+import org.netbeans.api.visual.widget.ConnectionWidget;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class BlockConnectionWidget extends ConnectionWidget implements Link {
+
+ private BlockWidget from;
+ private BlockWidget to;
+ private Port inputSlot;
+ private Port outputSlot;
+ private List<Point> points;
+ private InputBlockEdge edge;
+
+ public BlockConnectionWidget(ControlFlowScene scene, InputBlockEdge edge) {
+ super(scene);
+
+ this.edge = edge;
+ this.from = (BlockWidget) scene.findWidget(edge.getFrom());
+ this.to = (BlockWidget) scene.findWidget(edge.getTo());
+ inputSlot = to.getInputSlot();
+ outputSlot = from.getOutputSlot();
+ points = new ArrayList<Point>();
+ }
+
+ public InputBlockEdge getEdge() {
+ return edge;
+ }
+
+ public Port getTo() {
+ return inputSlot;
+ }
+
+ public Port getFrom() {
+ return outputSlot;
+ }
+
+ public void setControlPoints(List<Point> p) {
+ this.points = p;
+ }
+
+ @Override
+ public List<Point> getControlPoints() {
+ return points;
+ }
+
+ @Override
+ public String toString() {
+ return "Connection[ " + from.toString() + " - " + to.toString() + "]";
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java
new file mode 100644
index 000000000..c56e93e73
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.controlflow;
+
+import com.sun.hotspot.igv.data.InputBlock;
+import com.sun.hotspot.igv.layout.Cluster;
+import com.sun.hotspot.igv.layout.Port;
+import com.sun.hotspot.igv.layout.Vertex;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Point;
+import org.netbeans.api.visual.border.BorderFactory;
+import org.netbeans.api.visual.model.ObjectState;
+import org.netbeans.api.visual.widget.LabelWidget;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class BlockWidget extends LabelWidget implements Vertex {
+
+ public static final Dimension SIZE = new Dimension(20, 20);
+ private InputBlock block;
+ private Port inputSlot;
+ private Port outputSlot;
+ private Cluster cluster;
+ private boolean root;
+ private static final Font font = new Font(Font.SERIF, Font.PLAIN, 12);
+ private static final Font boldFont = font.deriveFont(Font.BOLD);
+ public static final Color NORMAL_FOREGROUND_COLOR = Color.BLACK;
+ public static final Color HOVER_FOREGROUND_COLOR = Color.BLUE;
+
+ /** Creates a new instance of BlockWidget */
+ public BlockWidget(ControlFlowScene scene, InputBlock block) {
+ super(scene);
+ this.block = block;
+ this.setLabel(block.getName());
+ this.setForeground(NORMAL_FOREGROUND_COLOR);
+ this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
+ this.setMinimumSize(SIZE);
+ this.setMaximumSize(SIZE);
+
+ this.setFont(font);
+
+ final BlockWidget widget = this;
+ inputSlot = new Port() {
+
+ public Point getRelativePosition() {
+ return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
+ }
+
+ public Vertex getVertex() {
+ return widget;
+ }
+ };
+
+ outputSlot = new Port() {
+
+ public Point getRelativePosition() {
+ return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
+ }
+
+ public Vertex getVertex() {
+ return widget;
+ }
+ };
+ }
+
+ public Port getInputSlot() {
+ return inputSlot;
+ }
+
+ public Port getOutputSlot() {
+ return outputSlot;
+ }
+
+ public InputBlock getBlock() {
+ return block;
+ }
+
+ public Dimension getSize() {
+ return SIZE;
+ }
+
+ public void setPosition(Point p) {
+ this.setPreferredLocation(p);
+ }
+
+ @Override
+ public String toString() {
+ return block.getName();
+ }
+
+ public Point getPosition() {
+ return this.getPreferredLocation();
+ }
+
+ public Cluster getCluster() {
+ return cluster;
+ }
+
+ public boolean isRoot() {
+ return root;
+ }
+
+ public void setCluster(Cluster c) {
+ cluster = c;
+ }
+
+ public void setRoot(boolean b) {
+ root = b;
+ }
+
+ public int compareTo(Vertex o) {
+ return toString().compareTo(o.toString());
+ }
+
+ @Override
+ protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
+ super.notifyStateChanged(previousState, state);
+
+ if (previousState.isHovered() != state.isHovered()) {
+ if (state.isHovered()) {
+ this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
+ } else {
+ this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
+ }
+ }
+
+ if (previousState.isSelected() != state.isSelected()) {
+ if (state.isSelected()) {
+ this.setFont(boldFont);
+ } else {
+ this.setFont(font);
+ }
+ }
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/Bundle.properties b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/Bundle.properties
new file mode 100644
index 000000000..31865f13a
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/Bundle.properties
@@ -0,0 +1,4 @@
+CTL_ControlFlowAction=Open ControlFlow Window
+CTL_ControlFlowTopComponent=ControlFlow Window
+HINT_ControlFlowTopComponent=This is a ControlFlow window
+OpenIDE-Module-Name=ControlFlow
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowAction.java b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowAction.java
new file mode 100644
index 000000000..bafde1023
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowAction.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.controlflow;
+
+import java.awt.event.ActionEvent;
+import javax.swing.AbstractAction;
+import org.openide.util.NbBundle;
+import org.openide.windows.TopComponent;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class ControlFlowAction extends AbstractAction {
+
+ public ControlFlowAction() {
+ super(NbBundle.getMessage(ControlFlowAction.class, "CTL_ControlFlowAction"));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ TopComponent win = ControlFlowTopComponent.findInstance();
+ win.open();
+ win.requestActive();
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java
new file mode 100644
index 000000000..8b794b11a
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.controlflow;
+
+import com.sun.hotspot.igv.data.InputBlock;
+import com.sun.hotspot.igv.data.InputBlockEdge;
+import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.services.InputGraphProvider;
+import com.sun.hotspot.igv.data.InputNode;
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+import javax.swing.BorderFactory;
+import org.netbeans.api.visual.action.ActionFactory;
+import org.netbeans.api.visual.action.MoveProvider;
+import org.netbeans.api.visual.action.RectangularSelectDecorator;
+import org.netbeans.api.visual.action.RectangularSelectProvider;
+import org.netbeans.api.visual.action.SelectProvider;
+import org.netbeans.api.visual.action.WidgetAction;
+import org.netbeans.api.visual.anchor.AnchorFactory;
+import org.netbeans.api.visual.anchor.AnchorShape;
+import com.sun.hotspot.igv.controlflow.HierarchicalGraphLayout;
+import org.netbeans.api.visual.layout.LayoutFactory;
+import org.netbeans.api.visual.router.RouterFactory;
+import org.netbeans.api.visual.widget.LayerWidget;
+import org.netbeans.api.visual.widget.Widget;
+import org.netbeans.api.visual.graph.GraphScene;
+import org.netbeans.api.visual.graph.layout.GraphLayout;
+import org.netbeans.api.visual.layout.SceneLayout;
+import org.netbeans.api.visual.widget.ConnectionWidget;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class ControlFlowScene extends GraphScene<InputBlock, InputBlockEdge> implements SelectProvider, MoveProvider, RectangularSelectDecorator, RectangularSelectProvider {
+
+ private Set<BlockWidget> selection;
+ private Hashtable<InputBlock, BlockWidget> blockMap;
+ private InputGraph oldGraph;
+ private LayerWidget edgeLayer;
+ private LayerWidget mainLayer;
+ private LayerWidget selectLayer;
+ private WidgetAction hoverAction = this.createWidgetHoverAction();
+ private WidgetAction selectAction = ActionFactory.createSelectAction(this);
+ private WidgetAction moveAction = ActionFactory.createMoveAction(null, this);
+
+ public ControlFlowScene() {
+ selection = new HashSet<BlockWidget>();
+
+ this.getInputBindings().setZoomActionModifiers(0);
+ this.setLayout(LayoutFactory.createAbsoluteLayout());
+
+ mainLayer = new LayerWidget(this);
+ this.addChild(mainLayer);
+
+ edgeLayer = new LayerWidget(this);
+ this.addChild(edgeLayer);
+
+ selectLayer = new LayerWidget(this);
+ this.addChild(selectLayer);
+
+ this.getActions().addAction(hoverAction);
+ this.getActions().addAction(selectAction);
+ this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
+ this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
+ }
+
+ public void setGraph(InputGraph g) {
+ if (g == oldGraph) {
+ return;
+ }
+ oldGraph = g;
+
+ ArrayList<InputBlock> blocks = new ArrayList<InputBlock>(this.getNodes());
+ for (InputBlock b : blocks) {
+ removeNode(b);
+ }
+
+ ArrayList<InputBlockEdge> edges = new ArrayList<InputBlockEdge>(this.getEdges());
+ for (InputBlockEdge e : edges) {
+ removeEdge(e);
+ }
+
+ for (InputBlock b : g.getBlocks()) {
+ addNode(b);
+ }
+
+ for (InputBlock b : g.getBlocks()) {
+ for (InputBlockEdge e : b.getOutputs()) {
+ addEdge(e);
+ assert g.getBlocks().contains(e.getFrom());
+ assert g.getBlocks().contains(e.getTo());
+ this.setEdgeSource(e, e.getFrom());
+ this.setEdgeTarget(e, e.getTo());
+ }
+ }
+
+ GraphLayout layout = new HierarchicalGraphLayout();//GridGraphLayout();
+ SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(this, layout);
+ sceneLayout.invokeLayout();
+
+ this.validate();
+ }
+
+ public BlockWidget getBlockWidget(InputBlock b) {
+ return blockMap.get(b);
+ }
+
+ public void clearSelection() {
+ for (BlockWidget w : selection) {
+ w.setState(w.getState().deriveSelected(false));
+ }
+ selection.clear();
+ selectionChanged();
+ }
+
+ public void selectionChanged() {
+ InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class);
+ if (p != null) {
+ Set<InputNode> inputNodes = new HashSet<InputNode>();
+ for (BlockWidget w : selection) {
+ inputNodes.addAll(w.getBlock().getNodes());
+ }
+ p.setSelectedNodes(inputNodes);
+ }
+ }
+
+ public void addToSelection(BlockWidget widget) {
+ widget.setState(widget.getState().deriveSelected(true));
+ selection.add(widget);
+ selectionChanged();
+ }
+
+ public void removeFromSelection(BlockWidget widget) {
+ widget.setState(widget.getState().deriveSelected(false));
+ selection.remove(widget);
+ selectionChanged();
+ }
+
+ public boolean isAimingAllowed(Widget widget, Point point, boolean b) {
+ return false;
+ }
+
+ public boolean isSelectionAllowed(Widget widget, Point point, boolean b) {
+ return true;
+ }
+
+ public void select(Widget widget, Point point, boolean change) {
+ if (widget == this) {
+ clearSelection();
+ } else {
+
+ assert widget instanceof BlockWidget;
+ BlockWidget bw = (BlockWidget) widget;
+ if (change) {
+ if (selection.contains(bw)) {
+ removeFromSelection(bw);
+ } else {
+ addToSelection(bw);
+ }
+ } else {
+ if (!selection.contains(bw)) {
+ clearSelection();
+ addToSelection(bw);
+ }
+ }
+ }
+ }
+
+ public void movementStarted(Widget widget) {
+ }
+
+ public void movementFinished(Widget widget) {
+ }
+
+ public Point getOriginalLocation(Widget widget) {
+ return widget.getPreferredLocation();
+ }
+
+ public void setNewLocation(Widget widget, Point location) {
+ Point originalLocation = getOriginalLocation(widget);
+ int xOffset = location.x - originalLocation.x;
+ int yOffset = location.y - originalLocation.y;
+ for (Widget w : this.selection) {
+ Point p = new Point(w.getPreferredLocation());
+ p.translate(xOffset, yOffset);
+ w.setPreferredLocation(p);
+ }
+
+ }
+
+ public Widget createSelectionWidget() {
+ Widget widget = new Widget(this);
+ widget.setOpaque(false);
+ widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
+ widget.setForeground(Color.red);
+ return widget;
+ }
+
+ public void performSelection(Rectangle rectangle) {
+
+ if (rectangle.width < 0) {
+ rectangle.x += rectangle.width;
+ rectangle.width *= -1;
+ }
+
+ if (rectangle.height < 0) {
+ rectangle.y += rectangle.height;
+ rectangle.height *= -1;
+ }
+
+ boolean changed = false;
+ for (InputBlock b : this.getNodes()) {
+ BlockWidget w = (BlockWidget) findWidget(b);
+ Rectangle r = new Rectangle(w.getBounds());
+ r.setLocation(w.getLocation());
+ if (r.intersects(rectangle)) {
+ if (!selection.contains(w)) {
+ changed = true;
+ selection.add(w);
+ w.setState(w.getState().deriveSelected(true));
+ }
+ } else {
+ if (selection.contains(w)) {
+ changed = true;
+ selection.remove(w);
+ w.setState(w.getState().deriveSelected(false));
+ }
+ }
+ }
+
+ if (changed) {
+ selectionChanged();
+ }
+
+ }
+
+ protected Widget attachNodeWidget(InputBlock node) {
+ BlockWidget w = new BlockWidget(this, node);
+ mainLayer.addChild(w);
+ w.getActions().addAction(hoverAction);
+ w.getActions().addAction(selectAction);
+ w.getActions().addAction(moveAction);
+ return w;
+ }
+
+ protected Widget attachEdgeWidget(InputBlockEdge edge) {
+ ConnectionWidget w = new BlockConnectionWidget(this, edge);
+ w.setRouter(RouterFactory.createDirectRouter());
+ w.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);
+ edgeLayer.addChild(w);
+ return w;
+ }
+
+ protected void attachEdgeSourceAnchor(InputBlockEdge edge, InputBlock oldSourceNode, InputBlock sourceNode) {
+ Widget w = this.findWidget(edge);
+ assert w instanceof ConnectionWidget;
+ ConnectionWidget cw = (ConnectionWidget) w;
+ cw.setSourceAnchor(AnchorFactory.createRectangularAnchor(findWidget(sourceNode)));
+
+ }
+
+ protected void attachEdgeTargetAnchor(InputBlockEdge edge, InputBlock oldTargetNode, InputBlock targetNode) {
+ Widget w = this.findWidget(edge);
+ assert w instanceof ConnectionWidget;
+ ConnectionWidget cw = (ConnectionWidget) w;
+ cw.setTargetAnchor(AnchorFactory.createRectangularAnchor(findWidget(targetNode)));
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form
new file mode 100644
index 000000000..c2549ecaf
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+ <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"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="400" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="300" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+</Form>
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java
new file mode 100644
index 000000000..968cdd531
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.controlflow;
+
+import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.services.InputGraphProvider;
+import java.awt.BorderLayout;
+import java.io.Serializable;
+import javax.swing.JScrollPane;
+import org.openide.ErrorManager;
+import org.openide.util.Lookup;
+import org.openide.util.LookupEvent;
+import org.openide.util.LookupListener;
+import org.openide.util.NbBundle;
+import org.openide.util.Utilities;
+import org.openide.windows.TopComponent;
+import org.openide.windows.WindowManager;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+final class ControlFlowTopComponent extends TopComponent implements LookupListener {
+
+ private static ControlFlowTopComponent instance;
+ private Lookup.Result result = null;
+ private static final String PREFERRED_ID = "ControlFlowTopComponent";
+ private ControlFlowScene scene;
+
+ private ControlFlowTopComponent() {
+ initComponents();
+ setName(NbBundle.getMessage(ControlFlowTopComponent.class, "CTL_ControlFlowTopComponent"));
+ setToolTipText(NbBundle.getMessage(ControlFlowTopComponent.class, "HINT_ControlFlowTopComponent"));
+
+ scene = new ControlFlowScene();
+ this.setLayout(new BorderLayout());
+ this.associateLookup(scene.getLookup());
+
+
+ JScrollPane panel = new JScrollPane(scene.createView());
+ this.add(panel, BorderLayout.CENTER);
+ }
+
+ @Override
+ public void requestFocus() {
+ super.requestFocus();
+ scene.getView().requestFocus();
+ }
+
+ @Override
+ public boolean requestFocusInWindow() {
+ super.requestFocusInWindow();
+ return scene.getView().requestFocusInWindow();
+ }
+
+ /** 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() {
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 400, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 300, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+ /**
+ * Gets default instance. Do not use directly: reserved for *.settings files only,
+ * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
+ * To obtain the singleton instance, use {@link findInstance}.
+ */
+ public static synchronized ControlFlowTopComponent getDefault() {
+ if (instance == null) {
+ instance = new ControlFlowTopComponent();
+ }
+ return instance;
+ }
+
+ /**
+ * Obtain the ControlFlowTopComponent instance. Never call {@link #getDefault} directly!
+ */
+ public static synchronized ControlFlowTopComponent findInstance() {
+ TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
+ if (win == null) {
+ ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find ControlFlow component. It will not be located properly in the window system.");
+ return getDefault();
+ }
+ if (win instanceof ControlFlowTopComponent) {
+ return (ControlFlowTopComponent) win;
+ }
+ ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior.");
+ return getDefault();
+ }
+
+ @Override
+ public int getPersistenceType() {
+ return TopComponent.PERSISTENCE_ALWAYS;
+ }
+
+ @Override
+ public void componentOpened() {
+ Lookup.Template tpl = new Lookup.Template(Object.class);
+ result = Utilities.actionsGlobalContext().lookup(tpl);
+ result.addLookupListener(this);
+ }
+
+ @Override
+ public void componentClosed() {
+ result.removeLookupListener(this);
+ result = null;
+ }
+
+ public void resultChanged(LookupEvent lookupEvent) {
+
+ InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class);
+ if (p != null) {
+ InputGraph g = p.getGraph();
+ if (g != null) {
+ scene.setGraph(g);
+ }
+ }
+ }
+
+ @Override
+ public Object writeReplace() {
+ return new ResolvableHelper();
+ }
+
+ @Override
+ protected String preferredID() {
+ return PREFERRED_ID;
+ }
+
+ @Override
+ public void requestActive() {
+ scene.getView().requestFocusInWindow();
+ super.requestActive();
+ }
+
+ final static class ResolvableHelper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public Object readResolve() {
+ return ControlFlowTopComponent.getDefault();
+ }
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml
new file mode 100644
index 000000000..e226cd5ec
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml
@@ -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.sun.hotspot.igv.controlflow" spec="1.0"/>
+ <instanceof class="org.openide.windows.TopComponent"/>
+ <instanceof class="com.sun.hotspot.igv.controlflow.ControlFlowTopComponent"/>
+ <instance class="com.sun.hotspot.igv.controlflow.ControlFlowTopComponent" method="getDefault"/>
+</settings>
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml
new file mode 100644
index 000000000..07bbb1f52
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml
@@ -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.sun.hotspot.igv.controlflow" spec="1.0"/>
+ <tc-id id="ControlFlowTopComponent"/>
+ <state opened="true"/>
+</tc-ref>
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java
new file mode 100644
index 000000000..2a0c9ee48
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.controlflow;
+
+import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager;
+import com.sun.hotspot.igv.layout.Cluster;
+import com.sun.hotspot.igv.layout.LayoutGraph;
+import com.sun.hotspot.igv.layout.Link;
+import com.sun.hotspot.igv.layout.Port;
+import com.sun.hotspot.igv.layout.Vertex;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.netbeans.api.visual.graph.layout.GraphLayout;
+import org.netbeans.api.visual.graph.layout.UniversalGraph;
+import org.netbeans.api.visual.widget.Widget;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class HierarchicalGraphLayout<N, E> extends GraphLayout<N, E> {
+
+ public HierarchicalGraphLayout() {
+ }
+
+ private class LinkWrapper implements Link {
+
+ private VertexWrapper from;
+ private VertexWrapper to;
+
+ public LinkWrapper(VertexWrapper from, VertexWrapper to) {
+ this.from = from;
+ this.to = to;
+ }
+
+ public Port getFrom() {
+ return from.getSlot();
+ }
+
+ public Port getTo() {
+ return to.getSlot();
+ }
+
+ public List<Point> getControlPoints() {
+ return new ArrayList<Point>();
+ }
+
+ public void setControlPoints(List<Point> list) {
+ // Do nothing for now
+ }
+ }
+
+ private class VertexWrapper implements Vertex {
+
+ private N node;
+ private UniversalGraph<N, E> graph;
+ private Port slot;
+ private Point position;
+
+ public VertexWrapper(N node, UniversalGraph<N, E> graph) {
+ this.node = node;
+ this.graph = graph;
+ final VertexWrapper vertex = this;
+ this.slot = new Port() {
+
+ public Vertex getVertex() {
+ return vertex;
+ }
+
+ public Point getRelativePosition() {
+ return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2));
+ }
+ };
+
+ Widget w = graph.getScene().findWidget(node);
+ this.position = w.getPreferredLocation();
+ }
+
+ public Cluster getCluster() {
+ return null;
+ }
+
+ public Dimension getSize() {
+ Widget w = graph.getScene().findWidget(node);
+ return w.getBounds().getSize();
+ }
+
+ public Point getPosition() {
+ return position;
+ }
+
+ public void setPosition(Point p) {
+ HierarchicalGraphLayout.this.setResolvedNodeLocation(graph, node, p);
+ position = p;
+ }
+
+ public boolean isRoot() {
+ return false;
+ }
+
+ public int compareTo(Vertex o) {
+ VertexWrapper vw = (VertexWrapper) o;
+ return node.toString().compareTo(vw.node.toString());
+ }
+
+ public Port getSlot() {
+ return slot;
+ }
+ }
+
+ protected void performGraphLayout(UniversalGraph<N, E> graph) {
+
+ Set<LinkWrapper> links = new HashSet<LinkWrapper>();
+ Set<VertexWrapper> vertices = new HashSet<VertexWrapper>();
+ Map<N, VertexWrapper> vertexMap = new HashMap<N, VertexWrapper>();
+
+ for (N node : graph.getNodes()) {
+ VertexWrapper v = new VertexWrapper(node, graph);
+ vertexMap.put(node, v);
+ vertices.add(v);
+ }
+
+ for (E edge : graph.getEdges()) {
+ N source = graph.getEdgeSource(edge);
+ N target = graph.getEdgeTarget(edge);
+ LinkWrapper l = new LinkWrapper(vertexMap.get(source), vertexMap.get(target));
+ links.add(l);
+ }
+
+ HierarchicalLayoutManager m = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.NONE);
+
+ LayoutGraph layoutGraph = new LayoutGraph(links, vertices);
+ m.doLayout(layoutGraph);
+ }
+
+ protected void performNodesLayout(UniversalGraph<N, E> graph, Collection<N> nodes) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/layer.xml b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/layer.xml
new file mode 100644
index 000000000..36b0e8ce9
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/layer.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
+<filesystem>
+ <folder name="Actions">
+ <folder name="Window">
+ <file name="com-sun-hotspot-igv-controlflow-ControlFlowAction.instance"/>
+ </folder>
+ </folder>
+ <folder name="Menu">
+ <folder name="Window">
+ <file name="ControlFlowAction.shadow">
+ <attr name="originalFile" stringvalue="Actions/Window/com-sun-hotspot-igv-controlflow-ControlFlowAction.instance"/>
+ </file>
+ </folder>
+ </folder>
+ <folder name="Windows2">
+ <folder name="Components">
+ <file name="ControlFlowTopComponent.settings" url="ControlFlowTopComponentSettings.xml"/>
+ </folder>
+ <folder name="Modes">
+ <folder name="customRightTopMode">
+ <file name="ControlFlowTopComponent.wstcref" url="ControlFlowTopComponentWstcref.xml"/>
+ </folder>
+ </folder>
+ </folder>
+</filesystem>
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/build.xml b/src/share/tools/IdealGraphVisualizer/Coordinator/build.xml
new file mode 100644
index 000000000..a70f00802
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/build.xml
@@ -0,0 +1,8 @@
+<?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>
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/manifest.mf b/src/share/tools/IdealGraphVisualizer/Coordinator/manifest.mf
new file mode 100644
index 000000000..073c1e804
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/manifest.mf
@@ -0,0 +1,6 @@
+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
+
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/build-impl.xml b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/build-impl.xml
new file mode 100644
index 000000000..4deca64be
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/build-impl.xml
@@ -0,0 +1,30 @@
+<?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>
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/genfiles.properties b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/genfiles.properties
new file mode 100644
index 000000000..71781f95c
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+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
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/platform.properties b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/platform.properties
new file mode 100644
index 000000000..68ad75e57
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/platform.properties
@@ -0,0 +1,29 @@
+# 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
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.properties b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.properties
new file mode 100644
index 000000000..152f44eca
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.properties
@@ -0,0 +1,2 @@
+javac.source=1.5
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml
new file mode 100644
index 000000000..ad5afed15
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml
@@ -0,0 +1,126 @@
+<?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>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.10.0.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.6.1.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.awt</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.11.0.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.5.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.11</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.loaders</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.7</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.nodes</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.2.0.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.9.0.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.16</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <public-packages/>
+ </data>
+ </configuration>
+</project>
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/suite.properties b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/suite.properties
new file mode 100644
index 000000000..29d7cc9bd
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/suite.properties
@@ -0,0 +1 @@
+suite.dir=${basedir}/..
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupOrganizer b/src/share/tools/IdealGraphVisualizer/Coordinator/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupOrganizer
new file mode 100644
index 000000000..bf7aace9e
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupOrganizer
@@ -0,0 +1,2 @@
+com.sun.hotspot.igv.coordinator.StandardGroupOrganizer
+com.sun.hotspot.igv.coordinator.GraphCountGroupOrganizer \ No newline at end of file
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/Bundle.properties b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/Bundle.properties
new file mode 100644
index 000000000..455f64809
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/Bundle.properties
@@ -0,0 +1,7 @@
+
+AdvancedOption_DisplayName_Coordinator=Settings
+AdvancedOption_Tooltip_Coordinator=Visualization Tool Settings
+CTL_OutlineTopComponent=Outline Window
+CTL_SomeAction=test
+HINT_OutlineTopComponent=This is a Outline window
+OpenIDE-Module-Name=Coordinator
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java
new file mode 100644
index 000000000..b5398edae
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.coordinator;
+
+import com.sun.hotspot.igv.coordinator.actions.RemoveCookie;
+import com.sun.hotspot.igv.data.Group;
+import com.sun.hotspot.igv.data.services.GroupOrganizer;
+import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.Pair;
+import java.awt.Image;
+import java.util.ArrayList;
+import java.util.List;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Utilities;
+import org.openide.util.lookup.AbstractLookup;
+import org.openide.util.lookup.InstanceContent;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class FolderNode extends AbstractNode {
+
+ private GroupOrganizer organizer;
+ private InstanceContent content;
+ private List<Pair<String, List<Group>>> structure;
+ private List<String> subFolders;
+ private FolderChildren children;
+
+ private static class FolderChildren extends Children.Keys {
+
+ private FolderNode parent;
+
+ public void setParent(FolderNode parent) {
+ this.parent = parent;
+ }
+
+ @Override
+ protected Node[] createNodes(Object arg0) {
+
+ Pair<String, List<Group>> p = (Pair<String, List<Group>>) arg0;
+ if (p.getLeft().length() == 0) {
+
+ List<Node> curNodes = new ArrayList<Node>();
+ for (Group g : p.getRight()) {
+ for (InputGraph graph : g.getGraphs()) {
+ curNodes.add(new GraphNode(graph));
+ }
+ }
+
+ Node[] result = new Node[curNodes.size()];
+ for (int i = 0; i < curNodes.size(); i++) {
+ result[i] = curNodes.get(i);
+ }
+ return result;
+
+ } else {
+ return new Node[]{new FolderNode(p.getLeft(), parent.organizer, parent.subFolders, p.getRight())};
+ }
+ }
+
+ @Override
+ public void addNotify() {
+ this.setKeys(parent.structure);
+
+ }
+ }
+
+ protected InstanceContent getContent() {
+ return content;
+ }
+
+ @Override
+ public Image getIcon(int i) {
+ return Utilities.loadImage("com/sun/hotspot/igv/coordinator/images/folder.gif");
+ }
+
+ protected FolderNode(String name, GroupOrganizer organizer, List<String> subFolders, List<Group> groups) {
+ this(name, organizer, subFolders, groups, new FolderChildren(), new InstanceContent());
+ }
+
+ private FolderNode(String name, GroupOrganizer organizer, List<String> oldSubFolders, final List<Group> groups, FolderChildren children, InstanceContent content) {
+ super(children, new AbstractLookup(content));
+ children.setParent(this);
+ this.content = content;
+ this.children = children;
+ content.add(new RemoveCookie() {
+
+ public void remove() {
+ for (Group g : groups) {
+ if (g.getDocument() != null) {
+ g.getDocument().removeGroup(g);
+ }
+ }
+ }
+ });
+ init(name, organizer, oldSubFolders, groups);
+ }
+
+ public void init(String name, GroupOrganizer organizer, List<String> oldSubFolders, List<Group> groups) {
+ this.setDisplayName(name);
+ this.organizer = organizer;
+ this.subFolders = new ArrayList<String>(oldSubFolders);
+ if (name.length() > 0) {
+ this.subFolders.add(name);
+ }
+ structure = organizer.organize(subFolders, groups);
+ assert structure != null;
+ children.addNotify();
+ }
+
+ @Override
+ public Image getOpenedIcon(int i) {
+ return getIcon(i);
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphCountGroupOrganizer.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphCountGroupOrganizer.java
new file mode 100644
index 000000000..42648d0f0
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphCountGroupOrganizer.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1998-2007 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package com.sun.hotspot.igv.coordinator;
+
+import com.sun.hotspot.igv.data.Group;
+import com.sun.hotspot.igv.data.Pair;
+import com.sun.hotspot.igv.data.services.GroupOrganizer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class GraphCountGroupOrganizer implements GroupOrganizer {
+
+ public String getName() {
+ return "Graph count structure";
+ }
+
+ public List<Pair<String, List<Group>>> organize(List<String> subFolders, List<Group> groups) {
+
+ List<Pair<String, List<Group>>> result = new ArrayList<Pair<String, List<Group>>>();
+
+ if (subFolders.size() == 0) {
+ Map<Integer, List<Group>> map = new HashMap<Integer, List<Group>>();
+ for (Group g : groups) {
+ Integer cur = g.getGraphs().size();
+ if (!map.containsKey(cur)) {
+ map.put(cur, new ArrayList<Group>());
+ }
+ map.get(cur).add(g);
+ }
+
+ SortedSet<Integer> keys = new TreeSet<Integer>(map.keySet());
+ for (Integer i : keys) {
+ result.add(new Pair<String, List<Group>>("Graph count " + i, map.get(i)));
+ }
+
+ } else if (subFolders.size() == 1) {
+ for (Group g : groups) {
+ List<Group> children = new ArrayList<Group>();
+ children.add(g);
+ Pair<String, List<Group>> p = new Pair<String, List<Group>>();
+ p.setLeft(g.getName());
+ p.setRight(children);
+ result.add(p);
+ }
+ } else if (subFolders.size() == 2) {
+ result.add(new Pair<String, List<Group>>("", groups));
+ }
+
+ return result;
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java
new file mode 100644
index 000000000..0fd780cf6
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.coordinator;
+
+import com.sun.hotspot.igv.coordinator.actions.DiffGraphAction;
+import com.sun.hotspot.igv.coordinator.actions.DiffGraphCookie;
+import com.sun.hotspot.igv.coordinator.actions.RemoveCookie;
+import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.services.GraphViewer;
+import com.sun.hotspot.igv.data.services.InputGraphProvider;
+import com.sun.hotspot.igv.util.PropertiesSheet;
+import java.awt.Image;
+import javax.swing.Action;
+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.nodes.Sheet;
+import org.openide.util.Lookup;
+import org.openide.util.Utilities;
+import org.openide.util.lookup.AbstractLookup;
+import org.openide.util.lookup.InstanceContent;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class GraphNode extends AbstractNode {
+
+ private InputGraph graph;
+
+ /** Creates a new instance of GraphNode */
+ public GraphNode(InputGraph graph) {
+ this(graph, new InstanceContent());
+ }
+
+ private GraphNode(final InputGraph graph, InstanceContent content) {
+ super(Children.LEAF, new AbstractLookup(content));
+ this.graph = graph;
+ this.setDisplayName(graph.getName());
+ content.add(graph);
+
+ final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class);
+
+ if (viewer != null) {
+ // Action for opening the graph
+ content.add(new OpenCookie() {
+
+ public void open() {
+ viewer.view(graph);
+ }
+ });
+ }
+
+ // Action for removing a graph
+ content.add(new RemoveCookie() {
+
+ public void remove() {
+ graph.getGroup().removeGraph(graph);
+ }
+ });
+ }
+
+ @Override
+ protected Sheet createSheet() {
+ Sheet s = super.createSheet();
+ PropertiesSheet.initializeSheet(graph.getProperties(), s);
+ return s;
+ }
+
+ @Override
+ public Image getIcon(int i) {
+ return Utilities.loadImage("com/sun/hotspot/igv/coordinator/images/graph.gif");
+ }
+
+ @Override
+ public Image getOpenedIcon(int i) {
+ return getIcon(i);
+ }
+
+ @Override
+ public <T extends Node.Cookie> T getCookie(Class<T> aClass) {
+ if (aClass == DiffGraphCookie.class) {
+ InputGraphProvider graphProvider = Utilities.actionsGlobalContext().lookup(InputGraphProvider.class);
+
+ InputGraph graphA = null;
+ if (graphProvider != null) {
+ graphA = graphProvider.getGraph();
+ }
+
+ if (graphA != null && !graphA.isDifferenceGraph()) {
+ return (T) new DiffGraphCookie(graphA, graph);
+ }
+ }
+
+ return super.getCookie(aClass);
+ }
+
+ @Override
+ public Action[] getActions(boolean b) {
+ return new Action[]{(Action) DiffGraphAction.findObject(DiffGraphAction.class, true), (Action) OpenAction.findObject(OpenAction.class, true)};
+ }
+
+ @Override
+ public Action getPreferredAction() {
+ return (Action) OpenAction.findObject(OpenAction.class, true);
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.form b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.form
new file mode 100644
index 000000000..37e033f19
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.form
@@ -0,0 +1,41 @@
+<?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_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.JPanel" name="jPanel2">
+ <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.DesignBorderLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <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>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java
new file mode 100644
index 000000000..9e6177b17
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java
@@ -0,0 +1,271 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.hotspot.igv.coordinator;
+
+import com.sun.hotspot.igv.coordinator.actions.ImportAction;
+import com.sun.hotspot.igv.coordinator.actions.RemoveAction;
+import com.sun.hotspot.igv.coordinator.actions.RemoveAllAction;
+import com.sun.hotspot.igv.coordinator.actions.SaveAllAction;
+import com.sun.hotspot.igv.coordinator.actions.SaveAsAction;
+import com.sun.hotspot.igv.coordinator.actions.StructuredViewAction;
+import com.sun.hotspot.igv.data.GraphDocument;
+import com.sun.hotspot.igv.data.ChangedListener;
+import com.sun.hotspot.igv.data.Group;
+import com.sun.hotspot.igv.data.services.GroupCallback;
+import com.sun.hotspot.igv.data.services.GroupOrganizer;
+import com.sun.hotspot.igv.data.services.GroupReceiver;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import javax.swing.BoxLayout;
+import javax.swing.JPanel;
+import javax.swing.UIManager;
+import javax.swing.border.Border;
+import org.openide.ErrorManager;
+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.Lookup;
+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 FolderNode root;
+ private GroupOrganizer organizer;
+
+ 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();
+ organizer = new StandardGroupOrganizer();
+ root = new FolderNode("", organizer, new ArrayList<String>(), document.getGroups());
+ manager.setRootContext(root);
+ ((BeanTreeView) this.jScrollPane1).setRootVisible(false);
+
+ document.getChangedEvent().addListener(new ChangedListener<GraphDocument>() {
+
+ public void changed(GraphDocument document) {
+ updateStructure();
+ }
+ });
+
+ 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(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
+ toolbar.add(RemoveAllAction.get(RemoveAllAction.class));
+
+ toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
+ toolbar.add(SaveAllAction.get(SaveAllAction.class));
+
+ toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());
+
+ for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
+ tb.setVisible(false);
+ }
+
+ initOrganizers();
+ }
+
+ public void setOrganizer(GroupOrganizer organizer) {
+ this.organizer = organizer;
+ updateStructure();
+ }
+
+ private void initOrganizers() {
+
+ }
+
+ private void initReceivers() {
+
+ final GroupCallback callback = new GroupCallback() {
+
+ public void started(Group g) {
+ getDocument().addGroup(g);
+ }
+ };
+
+ Collection<? extends GroupReceiver> receivers = Lookup.getDefault().lookupAll(GroupReceiver.class);
+ if (receivers.size() > 0) {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+
+ for (GroupReceiver r : receivers) {
+ Component c = r.init(callback);
+ panel.add(c);
+ }
+
+ jPanel2.add(panel, BorderLayout.PAGE_START);
+ }
+ }
+
+ private void updateStructure() {
+ root.init("", organizer, new ArrayList<String>(), document.getGroups());
+ }
+
+ public void clear() {
+ document.clear();
+ }
+
+ 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;
+ }
+
+ 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.jScrollPane1).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() {
+
+ jPanel2 = new javax.swing.JPanel();
+ jScrollPane1 = new BeanTreeView();
+
+ setLayout(new java.awt.BorderLayout());
+
+ jPanel2.setLayout(new java.awt.BorderLayout());
+ jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);
+
+ add(jPanel2, java.awt.BorderLayout.CENTER);
+ }// </editor-fold>//GEN-END:initComponents
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel jPanel2;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentSettings.xml b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentSettings.xml
new file mode 100644
index 000000000..1acdbcbe9
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentSettings.xml
@@ -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.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>
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentWstcref.xml b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentWstcref.xml
new file mode 100644
index 000000000..329140ea6
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentWstcref.xml
@@ -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.sun.hotspot.igv.coordinator" spec="1.0"/>
+ <tc-id id="OutlineTopComponent"/>
+ <state opened="true"/>
+</tc-ref>
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardConfiguration.xml b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardConfiguration.xml
new file mode 100644
index 000000000..1e05bc21e
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardConfiguration.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configuration PUBLIC "-//NetBeans IDE//DTD toolbar//EN" "http://www.netbeans.org/dtds/toolbar.dtd">
+<Configuration>
+ <Row>
+ <Toolbar name="Edit" position="1" visible="false"/>
+ <Toolbar name="File" position="1" visible="false" />
+ <Toolbar name="Memory" position="1" visible="false" />
+ </Row>
+ <Row>
+ <Toolbar name="WorkspaceSwitcher" />
+ <Toolbar name="StatusLine" />
+ </Row>
+</Configuration>
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardGroupOrganizer.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardGroupOrganizer.java
new file mode 100644
index 000000000..d907ba80c
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardGroupOrganizer.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 1998-2007 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package com.sun.hotspot.igv.coordinator;
+
+import com.sun.hotspot.igv.data.Group;
+import com.sun.hotspot.igv.data.services.GroupOrganizer;
+import com.sun.hotspot.igv.data.Pair;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class StandardGroupOrganizer implements GroupOrganizer {
+
+ public String getName() {
+ return "-- None --";
+ }
+
+ public List<Pair<String, List<Group>>> organize(List<String> subFolders, List<Group> groups) {
+
+ List<Pair<String, List<Group>>> result = new ArrayList<Pair<String, List<Group>>>();
+
+ if (groups.size() == 1 && subFolders.size() > 0) {
+ result.add(new Pair<String, List<Group>>("", groups));
+ } else {
+ for (Group g : groups) {
+ List<Group> children = new ArrayList<Group>();
+ children.add(g);
+ Pair<String, List<Group>> p = new Pair<String, List<Group>>();
+ p.setLeft(g.getName());
+ p.setRight(children);
+ result.add(p);
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties
new file mode 100644
index 000000000..5b5b93f47
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties
@@ -0,0 +1,18 @@
+CTL_EditFilterAction=Edit...
+CTL_ImportAction=Open...
+CTL_OpenGraphAction=View graph
+CTL_DiffGraphAction=Difference to current graph
+CTL_RemoveAction=Remove methods
+CTL_ApplyFilterAction=Apply
+CTL_FilterAction=Open Filter Window
+CTL_AppliedFilterAction=Open AppliedFilter Window
+CTL_OutlineAction=Open Outline Window
+CTL_MoveFilterUpAction=Move upwards
+CTL_MoveFilterDownAction=Move downwards
+CTL_RemoveFilterAction=Remove
+CTL_RemoveFilterSettingsAction=Remove filter setting
+CTL_SaveAsAction=Save selected methods...
+CTL_SaveAllAction=Save all...
+CTL_SaveFilterSettingsAction=Save filter settings...
+CTL_PropertiesAction=Open Properties Window
+CTL_NewFilterAction=New filter...
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphAction.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphAction.java
new file mode 100644
index 000000000..3e7737e7f
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphAction.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+package com.sun.hotspot.igv.coordinator.actions;
+
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.CookieAction;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public final class DiffGraphAction extends CookieAction {
+
+ protected void performAction(Node[] activatedNodes) {
+ DiffGraphCookie c = activatedNodes[0].getCookie(DiffGraphCookie.class);
+ c.openDiff();
+ }
+
+ protected int mode() {
+ return CookieAction.MODE_EXACTLY_ONE;
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(DiffGraphAction.class, "CTL_DiffGraphAction");
+ }
+
+ protected Class[] cookieClasses() {
+ return new Class[]{
+ DiffGraphCookie.class
+ };
+ }
+
+ @Override
+ protected String iconResource() {
+ return "com/sun/hotspot/igv/coordinator/images/diff.gif";
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java
new file mode 100644
index 000000000..b95ecf032
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+package com.sun.hotspot.igv.coordinator.actions;
+
+import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.services.GraphViewer;
+import com.sun.hotspot.igv.difference.Difference;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public class DiffGraphCookie implements Node.Cookie {
+
+ private InputGraph a;
+ private InputGraph b;
+
+ public DiffGraphCookie(InputGraph a, InputGraph b) {
+ this.a = a;
+ this.b = b;
+ }
+
+ public void openDiff() {
+
+ final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class);
+
+ if(viewer != null) {
+ InputGraph diffGraph = Difference.createDiffGraph(a, b);
+ viewer.view(diffGraph);
+ }
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java
new file mode 100644
index 000000000..cc1e4b15e
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.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.settings.Settings;
+import com.sun.hotspot.igv.data.serialization.XMLParser;
+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.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.openide.xml.XMLUtil;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public final class ImportAction extends CallableSystemAction {
+
+ public static FileFilter getFileFilter() {
+ return new FileFilter() {
+
+ public boolean accept(File f) {
+ return f.getName().toLowerCase().endsWith(".xml") || f.isDirectory();
+ }
+
+ public String getDescription() {
+ return "XML files (*.xml)";
+ }
+ };
+ }
+
+ 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 XMLReader reader = XMLUtil.createXMLReader();
+ 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() {
+
+ 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) {
+ }
+ }
+
+ 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() {
+
+ public void run() {
+ GraphDocument document = null;
+ try {
+ document = parser.parse(reader, is, parseMonitor);
+ parseMonitor.setState("Finishing");
+ 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 (SAXException ex) {
+ ex.printStackTrace();
+ } catch (FileNotFoundException ex) {
+ ex.printStackTrace();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(ImportAction.class, "CTL_ImportAction");
+ }
+
+ public ImportAction() {
+ putValue(Action.SHORT_DESCRIPTION, "Open an XML graph document");
+ putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));
+ }
+
+ @Override
+ protected String iconResource() {
+ return "com/sun/hotspot/igv/coordinator/images/import.gif";
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/OutlineAction.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/OutlineAction.java
new file mode 100644
index 000000000..580d1fa45
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/OutlineAction.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+package com.sun.hotspot.igv.coordinator.actions;
+
+import com.sun.hotspot.igv.coordinator.*;
+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"));
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+ TopComponent win = OutlineTopComponent.findInstance();
+ win.open();
+ win.requestActive();
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java
new file mode 100644
index 000000000..180cb84c2
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+package com.sun.hotspot.igv.coordinator.actions;
+
+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 {
+
+ protected void performAction(Node[] activatedNodes) {
+ for (Node n : activatedNodes) {
+ RemoveCookie removeCookie = n.getCookie(RemoveCookie.class);
+ if (removeCookie != null) {
+ removeCookie.remove();
+ }
+ }
+ }
+
+ public RemoveAction() {
+ putValue(Action.SHORT_DESCRIPTION, "Remove");
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(RemoveAction.class, "CTL_RemoveAction");
+ }
+
+ @Override
+ protected String iconResource() {
+ return "com/sun/hotspot/igv/coordinator/images/remove.gif";
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ protected boolean enable(Node[] nodes) {
+ return nodes.length > 0;
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java
new file mode 100644
index 000000000..68372525a
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 1998-2007 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.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 {
+
+
+ public String getName() {
+ return NbBundle.getMessage(RemoveAllAction.class, "CTL_ImportAction");
+ }
+
+ public RemoveAllAction() {
+ putValue(Action.SHORT_DESCRIPTION, "Remove all methods");
+ putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_SHIFT, InputEvent.CTRL_MASK));
+ }
+
+ @Override
+ protected String iconResource() {
+ return "com/sun/hotspot/igv/coordinator/images/removeall.gif";
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public void performAction() {
+ OutlineTopComponent.findInstance().clear();
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveCookie.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveCookie.java
new file mode 100644
index 000000000..7fc2989bc
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveCookie.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 1998-2007 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.hotspot.igv.coordinator.actions;
+
+import org.openide.nodes.Node;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public interface RemoveCookie extends Node.Cookie {
+ void remove();
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java
new file mode 100644
index 000000000..af56a0093
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 1998-2007 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.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 {
+
+ public void performAction() {
+ final OutlineTopComponent component = OutlineTopComponent.findInstance();
+ SaveAsAction.save(component.getDocument());
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(SaveAllAction.class, "CTL_SaveAllAction");
+ }
+
+ public SaveAllAction() {
+ putValue(Action.SHORT_DESCRIPTION, "Save all methods 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";
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java
new file mode 100644
index 000000000..d8565b09b
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+package 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.serialization.Printer;
+import com.sun.hotspot.igv.settings.Settings;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+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 {
+
+ protected void performAction(Node[] activatedNodes) {
+
+ GraphDocument doc = new GraphDocument();
+ for (Node n : activatedNodes) {
+ Group group = n.getLookup().lookup(Group.class);
+ doc.addGroup(group);
+ }
+
+ 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 {
+ Writer writer = new OutputStreamWriter(new FileOutputStream(file));
+ Printer p = new Printer();
+ p.export(writer, doc);
+ writer.close();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+
+ }
+ }
+ }
+
+ protected int mode() {
+ return CookieAction.MODE_SOME;
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction");
+ }
+
+ @Override
+ protected String iconResource() {
+ return "com/sun/hotspot/igv/coordinator/images/save.gif";
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ protected boolean enable(Node[] nodes) {
+
+ int cnt = 0;
+ for (Node n : nodes) {
+ cnt += n.getLookup().lookupAll(Group.class).size();
+ }
+
+ return cnt > 0;
+ }
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/StructuredViewAction.java b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/StructuredViewAction.java
new file mode 100644
index 000000000..1486c2e8e
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/StructuredViewAction.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright 1998-2007 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.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.services.GroupOrganizer;
+import java.awt.Component;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.swing.Action;
+import javax.swing.ButtonGroup;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
+import org.openide.awt.DropDownButtonFactory;
+import org.openide.util.HelpCtx;
+import org.openide.util.Lookup;
+import org.openide.util.Utilities;
+import org.openide.util.actions.CallableSystemAction;
+
+public class StructuredViewAction extends CallableSystemAction {
+
+ private static JButton dropDownButton;
+ private static ButtonGroup buttonGroup;
+ private static JPopupMenu popup;
+ private MyMenuItemListener menuItemListener;
+ private Map<JMenuItem, GroupOrganizer> map;
+
+ public StructuredViewAction() {
+
+ putValue(Action.SHORT_DESCRIPTION, "Cluster nodes into blocks");
+ }
+
+ @Override
+ public Component getToolbarPresenter() {
+
+ Image iconImage = Utilities.loadImage("com/sun/hotspot/igv/coordinator/images/structure.gif");
+ ImageIcon icon = new ImageIcon(iconImage);
+
+ popup = new JPopupMenu();
+
+ menuItemListener = new MyMenuItemListener();
+
+ buttonGroup = new ButtonGroup();
+
+ Collection<? extends GroupOrganizer> organizersCollection = Lookup.getDefault().lookupAll(GroupOrganizer.class);
+
+ List<GroupOrganizer> organizers = new ArrayList<GroupOrganizer>(organizersCollection);
+ Collections.sort(organizers, new Comparator<GroupOrganizer>() {
+ public int compare(GroupOrganizer a, GroupOrganizer b) {
+ return a.getName().compareTo(b.getName());
+ }
+ });
+
+ map = new HashMap<JMenuItem, GroupOrganizer>();
+
+ boolean first = true;
+ for(GroupOrganizer organizer : organizers) {
+ JCheckBoxMenuItem item = new JCheckBoxMenuItem(organizer.getName());
+ map.put(item, organizer);
+ item.addActionListener(menuItemListener);
+ buttonGroup.add(item);
+ popup.add(item);
+ if(first) {
+ item.setSelected(true);
+ first = false;
+ }
+ }
+
+ dropDownButton = DropDownButtonFactory.createDropDownButton(
+ new ImageIcon(
+ new BufferedImage(32, 32, BufferedImage.TYPE_BYTE_GRAY)),
+ popup);
+
+ dropDownButton.setIcon(icon);
+
+ dropDownButton.setToolTipText("Insert Layer Registration");
+
+ dropDownButton.addItemListener(new ItemListener() {
+
+ public void itemStateChanged(ItemEvent e) {
+ int state = e.getStateChange();
+ if (state == ItemEvent.SELECTED) {
+ performAction();
+ }
+ }
+ });
+
+ dropDownButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ performAction();
+ }
+ });
+
+ popup.addPopupMenuListener(new PopupMenuListener() {
+
+ public void popupMenuCanceled(PopupMenuEvent e) {
+ dropDownButton.setSelected(false);
+ }
+
+ public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
+ dropDownButton.setSelected(false);
+ }
+
+ public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+ dropDownButton.setSelected(true);
+ }
+ });
+
+ return dropDownButton;
+
+ }
+
+ private class MyMenuItemListener implements ActionListener {
+
+ public void actionPerformed(ActionEvent ev) {
+ JMenuItem item = (JMenuItem) ev.getSource();
+ GroupOrganizer organizer = map.get(item);
+ assert organizer != null : "Organizer must exist!";
+ OutlineTopComponent.findInstance().setOrganizer(organizer);
+ }
+ }
+
+
+ @Override
+ public void performAction() {
+ popup.show(dropDownButton, 0, dropDownButton.getHeight());
+ }
+
+ public String getName() {
+ return "Structured View";
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+}
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/customLeftWsmode.xml b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/customLeftWsmode.xml
new file mode 100644
index 000000000..2655e46a1
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/customLeftWsmode.xml
@@ -0,0 +1,18 @@
+<?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.779245283018868"/>
+ <path orientation="vertical" number="0" weight="0.7511825922421949"/>
+ <path orientation="horizontal" number="0" weight="0.5"/>
+ <path orientation="vertical" number="20" weight="0.7"/>
+ <path orientation="horizontal" number="40" weight="0.55"/>
+ <path orientation="horizontal" number="0" weight="0.2711864406779661"/>
+ </constraints>
+ <bounds x="0" y="0" width="0" height="0" />
+ <frame state="0"/>
+ <active-tc id="OutlineTopComponent"/>
+ <empty-behavior permanent="false"/>
+</mode>
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/diff.gif b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/diff.gif
new file mode 100644
index 000000000..6e49c314a
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/diff.gif
Binary files differ
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/folder.gif b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/folder.gif
new file mode 100644
index 000000000..2d3ca05fb
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/folder.gif
Binary files differ
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/graph.gif b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/graph.gif
new file mode 100644
index 000000000..7a4e5fc8c
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/graph.gif
Binary files differ
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/import.gif b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/import.gif
new file mode 100644
index 000000000..c0b2ca24a
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/import.gif
Binary files differ
diff --git a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/remove.gif b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/remove.gif
new file mode 100644
index 000000000..9dc08247b
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/remove.gif
Binary files differ
diff --git a/src/share/tools/IdealGraphVisualizer/README b/src/share/tools/IdealGraphVisualizer/README
new file mode 100644
index 000000000..80e163295
--- /dev/null
+++ b/src/share/tools/IdealGraphVisualizer/README
@@ -0,0 +1,45 @@
+The Ideal Graph Visualizer is a tool developed to help examine the
+intermediate representation of C2 which is commonly referred to as the
+"ideal graph". It was developed in collaboration with the University
+of Linz in Austria and has been included as part of hotspot since that
+was the primary target of the tool. The tool itself is fairly general
+with only a few modules that contain C2 specific elements.
+
+The tool is built on top of the NetBeans 6.0 rich client
+infrastructure and so requires NetBeans to build. It currently
+requires Java 6 to run as it needs support for JavaScript for its
+filtering mechanism and assumes it's built into the platform. It
+should build out of the box whit NetBeans 6 and Java 6 or later. It's
+possible to run it on 1.5 by including Rhino on the classpath though
+that currently isn't working correctly. Support for exporting graphs
+as SVG can be enabled by adding batik to the classpath which isn't
+included by default.
+
+It can be built on top of NetBeans 6.1 if you change the required
+modules to be platform8 instead of platform7. The tool could run on
+JDK 1.5 with some reworking of the how the JavaScript support is
+enabled but currently it requires some tweaking of the setup. This
+will be fixed in a later setup.
+
+The JVM support is controlled by the flag -XX:PrintIdealGraphLevel=#
+where # is:
+
+ 0: no output, the default
+ 1: dumps graph after parsing, before matching, and final code.
+ also dumps graph for failed compiles, if available
+ 2: more detail, including after loop opts
+ 3: even more detail
+ 4: prints graph after parsing every bytecode (very slow)
+
+By default the JVM expects that it will connect to a visualizer on the
+local host on port 4444. This can be configured using the options
+-XX:PrintIdealGraphAddress= and -XX:PrintIdealGraphPort=.
+PrintIdealGraphAddress can actually be a hostname.
+
+Alternatively the output can be sent to a file using
+-XX:PrintIdealGraphFile=filename. Each compiler thread will get it's
+own file with unique names being generated by adding a number onto the
+provided file name.
+
+More information about the tool is available at
+http://wikis.sun.com/display/HotSpotInternals/IdealGraphVisualizer.