6718676: putback for 6604014 is incomplete
Reviewed-by: kvn, jrose
@ -2,3 +2,6 @@
|
||||
^dist/
|
||||
^nbproject/private/
|
||||
^src/share/tools/hsdis/bin/
|
||||
^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
|
||||
^src/share/tools/IdealGraphVisualizer/build/
|
||||
^src/share/tools/IdealGraphVisualizer/dist/
|
||||
|
@ -70,6 +70,10 @@ inline int hpi::send(int fd, char *buf, int nBytes, int flags) {
|
||||
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags));
|
||||
}
|
||||
|
||||
inline int hpi::raw_send(int fd, char *buf, int nBytes, int flags) {
|
||||
return send(fd, buf, nBytes, flags);
|
||||
}
|
||||
|
||||
inline int hpi::timeout(int fd, long timeout) {
|
||||
julong prevtime,newtime;
|
||||
struct timeval t;
|
||||
|
@ -71,6 +71,10 @@ inline int hpi::send(int fd, char *buf, int nBytes, int flags) {
|
||||
INTERRUPTIBLE_RETURN_INT(::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
|
||||
}
|
||||
|
||||
inline int hpi::raw_send(int fd, char *buf, int nBytes, int flags) {
|
||||
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
|
||||
}
|
||||
|
||||
// As both poll and select can be interrupted by signals, we have to be
|
||||
// prepared to restart the system call after updating the timeout, unless
|
||||
// a poll() is done with timeout == -1, in which case we repeat with this
|
||||
|
@ -102,6 +102,10 @@ HPIDECL(send, "send", _socket, Send, int, "%d",
|
||||
fd, buf, nBytes, flags),
|
||||
(fd, buf, nBytes, flags));
|
||||
|
||||
inline int hpi::raw_send(int fd, char *buf, int nBytes, int flags) {
|
||||
return send(fd, buf, nBytes, flags);
|
||||
}
|
||||
|
||||
HPIDECL(timeout, "timeout", _socket, Timeout, int, "%d",
|
||||
(int fd, long timeout),
|
||||
("fd = %d, timeout = %ld", fd, timeout),
|
||||
|
@ -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>
|
@ -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
|
||||
|
@ -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>
|
@ -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
|
@ -0,0 +1,2 @@
|
||||
javac.source=1.5
|
||||
javac.compilerargs=-Xlint -Xlint:-serial
|
@ -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>
|
@ -0,0 +1 @@
|
||||
suite.dir=${basedir}/..
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
OpenIDE-Module-Name=BatikSVGProxy
|
@ -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>
|
@ -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>
|
@ -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
|
||||
|
@ -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>
|
@ -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
|
@ -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
|
@ -0,0 +1,2 @@
|
||||
javac.source=1.5
|
||||
javac.compilerargs=-Xlint -Xlint:-serial
|
@ -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>
|
@ -0,0 +1 @@
|
||||
suite.dir=${basedir}/..
|
@ -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
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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>
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
@ -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>
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 70 B |
After Width: | Height: | Size: 898 B |
After Width: | Height: | Size: 346 B |
@ -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>
|
@ -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>
|
@ -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
|
||||
|
@ -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>
|
@ -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
|
@ -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
|
@ -0,0 +1,2 @@
|
||||
javac.source=1.5
|
||||
javac.compilerargs=-Xlint -Xlint:-serial
|
@ -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>
|
@ -0,0 +1 @@
|
||||
suite.dir=${basedir}/..
|
@ -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() + "]";
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
CTL_ControlFlowAction=Open ControlFlow Window
|
||||
CTL_ControlFlowTopComponent=ControlFlow Window
|
||||
HINT_ControlFlowTopComponent=This is a ControlFlow window
|
||||
OpenIDE-Module-Name=ControlFlow
|
@ -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();
|
||||
}
|
||||
}
|
@ -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)));
|
||||
}
|
||||
}
|
@ -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>
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
@ -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>
|
@ -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();
|
||||
}
|
||||
}
|
@ -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>
|
@ -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>
|
@ -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
|
||||
|
@ -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>
|
@ -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
|
@ -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
|
@ -0,0 +1,2 @@
|
||||
javac.source=1.5
|
||||
javac.compilerargs=-Xlint -Xlint:-serial
|
@ -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>
|
@ -0,0 +1 @@
|
||||
suite.dir=${basedir}/..
|
@ -0,0 +1,2 @@
|
||||
com.sun.hotspot.igv.coordinator.StandardGroupOrganizer
|
||||
com.sun.hotspot.igv.coordinator.GraphCountGroupOrganizer
|
@ -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
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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>
|
@ -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
|
||||
}
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -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;
|
||||
}
|
||||
}
|
@ -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...
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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>
|
After Width: | Height: | Size: 449 B |
After Width: | Height: | Size: 132 B |
After Width: | Height: | Size: 996 B |
After Width: | Height: | Size: 949 B |
After Width: | Height: | Size: 231 B |
45
hotspot/src/share/tools/IdealGraphVisualizer/README
Normal file
@ -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.
|
@ -1084,6 +1084,7 @@ idealGraphPrinter.hpp dict.hpp
|
||||
idealGraphPrinter.hpp vectset.hpp
|
||||
idealGraphPrinter.hpp growableArray.hpp
|
||||
idealGraphPrinter.hpp ostream.hpp
|
||||
idealGraphPrinter.hpp xmlstream.hpp
|
||||
|
||||
idealGraphPrinter.cpp idealGraphPrinter.hpp
|
||||
idealGraphPrinter.cpp chaitin.hpp
|
||||
|
@ -209,10 +209,7 @@ int symbolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
|
||||
|
||||
void symbolKlass::oop_print_on(oop obj, outputStream* st) {
|
||||
st->print("Symbol: '");
|
||||
symbolOop sym = symbolOop(obj);
|
||||
for (int i = 0; i < sym->utf8_length(); i++) {
|
||||
st->print("%c", sym->byte_at(i));
|
||||
}
|
||||
symbolOop(obj)->print_symbol_on(st);
|
||||
st->print("'");
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,17 @@ char* symbolOopDesc::as_C_string_flexible_buffer(Thread* t,
|
||||
|
||||
void symbolOopDesc::print_symbol_on(outputStream* st) {
|
||||
st = st ? st : tty;
|
||||
for (int index = 0; index < utf8_length(); index++)
|
||||
st->put((char)byte_at(index));
|
||||
int length = UTF8::unicode_length((const char*)bytes(), utf8_length());
|
||||
const char *ptr = (const char *)bytes();
|
||||
jchar value;
|
||||
for (int index = 0; index < length; index++) {
|
||||
ptr = UTF8::next(ptr, &value);
|
||||
if (value >= 32 && value < 127 || value == '\'' || value == '\\') {
|
||||
st->put(value);
|
||||
} else {
|
||||
st->print("\\u%04x", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jchar* symbolOopDesc::as_unicode(int& length) const {
|
||||
|
@ -313,9 +313,6 @@ CompileWrapper::CompileWrapper(Compile* compile) : _compile(compile) {
|
||||
_compile->begin_method();
|
||||
}
|
||||
CompileWrapper::~CompileWrapper() {
|
||||
if (_compile->failing()) {
|
||||
_compile->print_method("Failed");
|
||||
}
|
||||
_compile->end_method();
|
||||
if (_compile->scratch_buffer_blob() != NULL)
|
||||
BufferBlob::free(_compile->scratch_buffer_blob());
|
||||
@ -604,6 +601,8 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
|
||||
if (failing()) return;
|
||||
NOT_PRODUCT( verify_graph_edges(); )
|
||||
|
||||
print_method("Before Matching");
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (PrintIdeal) {
|
||||
ttyLocker ttyl; // keep the following output all in one block
|
||||
@ -1481,7 +1480,7 @@ void Compile::Optimize() {
|
||||
|
||||
NOT_PRODUCT( verify_graph_edges(); )
|
||||
|
||||
print_method("Start");
|
||||
print_method("After Parsing");
|
||||
|
||||
{
|
||||
// Iterative Global Value Numbering, including ideal transforms
|
||||
@ -1688,7 +1687,7 @@ void Compile::Code_Gen() {
|
||||
Output();
|
||||
}
|
||||
|
||||
print_method("End");
|
||||
print_method("Final Code");
|
||||
|
||||
// He's dead, Jim.
|
||||
_cfg = (PhaseCFG*)0xdeadbeef;
|
||||
@ -2466,6 +2465,9 @@ void Compile::record_failure(const char* reason) {
|
||||
// Record the first failure reason.
|
||||
_failure_reason = reason;
|
||||
}
|
||||
if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) {
|
||||
C->print_method(_failure_reason);
|
||||
}
|
||||
_root = NULL; // flush the graph, too
|
||||
}
|
||||
|
||||
|
@ -82,222 +82,42 @@ private:
|
||||
static const char *METHOD_SHORT_NAME_PROPERTY;
|
||||
static const char *ASSEMBLY_ELEMENT;
|
||||
|
||||
class Property {
|
||||
|
||||
private:
|
||||
|
||||
const char *_name;
|
||||
const char *_value;
|
||||
|
||||
public:
|
||||
|
||||
Property();
|
||||
Property(const Property* p);
|
||||
~Property();
|
||||
Property(const char *name, const char *value);
|
||||
Property(const char *name, int value);
|
||||
bool equals(Property* p);
|
||||
void print(IdealGraphPrinter *printer);
|
||||
void print_as_attribute(IdealGraphPrinter *printer);
|
||||
bool is_null();
|
||||
void clean();
|
||||
const char *name();
|
||||
|
||||
static const char* dup(const char *str) {
|
||||
char * copy = new char[strlen(str)+1];
|
||||
strcpy(copy, str);
|
||||
return copy;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class Properties {
|
||||
|
||||
private:
|
||||
|
||||
GrowableArray<Property *> *list;
|
||||
|
||||
public:
|
||||
|
||||
Properties();
|
||||
~Properties();
|
||||
void add(Property *p);
|
||||
void remove(const char *name);
|
||||
bool equals(Properties* p);
|
||||
void print(IdealGraphPrinter *printer);
|
||||
void print_as_attributes(IdealGraphPrinter *printer);
|
||||
void clean();
|
||||
|
||||
};
|
||||
|
||||
|
||||
class Description {
|
||||
|
||||
private:
|
||||
|
||||
State _state;
|
||||
|
||||
public:
|
||||
|
||||
Description();
|
||||
|
||||
State state();
|
||||
void set_state(State s);
|
||||
void print(IdealGraphPrinter *printer);
|
||||
virtual void print_changed(IdealGraphPrinter *printer) = 0;
|
||||
virtual void print_removed(IdealGraphPrinter *printer) = 0;
|
||||
|
||||
};
|
||||
|
||||
class NodeDescription : public Description{
|
||||
|
||||
public:
|
||||
|
||||
static int count;
|
||||
|
||||
private:
|
||||
|
||||
GrowableArray<NodeDescription *> _succs;
|
||||
int _block_index;
|
||||
uintptr_t _id;
|
||||
Properties _properties;
|
||||
Node* _node;
|
||||
|
||||
public:
|
||||
|
||||
NodeDescription(Node* node);
|
||||
~NodeDescription();
|
||||
Node* node();
|
||||
|
||||
// void set_node(Node* node);
|
||||
GrowableArray<NodeDescription *>* succs();
|
||||
void init_succs();
|
||||
void clear_succs();
|
||||
void add_succ(NodeDescription *desc);
|
||||
int block_index();
|
||||
void set_block_index(int i);
|
||||
Properties* properties();
|
||||
virtual void print_changed(IdealGraphPrinter *printer);
|
||||
virtual void print_removed(IdealGraphPrinter *printer);
|
||||
bool equals(NodeDescription *desc);
|
||||
uint id();
|
||||
|
||||
};
|
||||
|
||||
class Block {
|
||||
|
||||
private:
|
||||
|
||||
NodeDescription *_start;
|
||||
NodeDescription *_proj;
|
||||
GrowableArray<int> _succs;
|
||||
GrowableArray<NodeDescription *> _nodes;
|
||||
GrowableArray<int> _dominates;
|
||||
GrowableArray<int> _children;
|
||||
int _semi;
|
||||
int _parent;
|
||||
GrowableArray<int> _pred;
|
||||
GrowableArray<int> _bucket;
|
||||
int _index;
|
||||
int _dominator;
|
||||
int _ancestor;
|
||||
int _label;
|
||||
|
||||
public:
|
||||
|
||||
Block();
|
||||
Block(int index);
|
||||
|
||||
void add_node(NodeDescription *n);
|
||||
GrowableArray<NodeDescription *>* nodes();
|
||||
GrowableArray<int>* children();
|
||||
void add_child(int i);
|
||||
void add_succ(int index);
|
||||
GrowableArray<int>* succs();
|
||||
GrowableArray<int>* dominates();
|
||||
void add_dominates(int i);
|
||||
NodeDescription *start();
|
||||
NodeDescription *proj();
|
||||
void set_start(NodeDescription *n);
|
||||
void set_proj(NodeDescription *n);
|
||||
|
||||
int label();
|
||||
void set_label(int i);
|
||||
int ancestor();
|
||||
void set_ancestor(int i);
|
||||
int index();
|
||||
int dominator();
|
||||
void set_dominator(int i);
|
||||
int parent();
|
||||
void set_parent(int i);
|
||||
int semi();
|
||||
GrowableArray<int>* bucket();
|
||||
void add_to_bucket(int i);
|
||||
void clear_bucket();
|
||||
GrowableArray<int>* pred();
|
||||
void set_semi(int i);
|
||||
void add_pred(int i);
|
||||
|
||||
};
|
||||
|
||||
class EdgeDescription : public Description {
|
||||
|
||||
private:
|
||||
|
||||
int _from;
|
||||
int _to;
|
||||
int _index;
|
||||
public:
|
||||
|
||||
EdgeDescription(int from, int to, int index);
|
||||
~EdgeDescription();
|
||||
|
||||
virtual void print_changed(IdealGraphPrinter *printer);
|
||||
virtual void print_removed(IdealGraphPrinter *printer);
|
||||
bool equals(EdgeDescription *desc);
|
||||
int from();
|
||||
int to();
|
||||
};
|
||||
|
||||
elapsedTimer _walk_time;
|
||||
elapsedTimer _output_time;
|
||||
elapsedTimer _build_blocks_time;
|
||||
|
||||
static int _file_count;
|
||||
networkStream *_stream;
|
||||
xmlStream *_xml;
|
||||
outputStream *_output;
|
||||
ciMethod *_current_method;
|
||||
GrowableArray<NodeDescription *> _nodes;
|
||||
GrowableArray<EdgeDescription *> _edges;
|
||||
int _depth;
|
||||
Arena *_arena;
|
||||
char buffer[128];
|
||||
bool _should_send_method;
|
||||
PhaseChaitin* _chaitin;
|
||||
bool _clear_nodes;
|
||||
Matcher* _matcher;
|
||||
bool _traverse_outs;
|
||||
|
||||
void start_element_helper(const char *name, Properties *properties, bool endElement, bool print_indent = false, bool print_return = true);
|
||||
NodeDescription *create_node_description(Node* node);
|
||||
Compile *C;
|
||||
|
||||
static void pre_node(Node* node, void *env);
|
||||
static void post_node(Node* node, void *env);
|
||||
|
||||
void schedule_latest(int **common_dominator, GrowableArray<Block>* blocks);
|
||||
void build_common_dominator(int **common_dominator, int index, GrowableArray<Block>* blocks);
|
||||
void compress(int index, GrowableArray<Block>* blocks);
|
||||
int eval(int index, GrowableArray<Block>* blocks);
|
||||
void link(int index1, int index2, GrowableArray<Block>* blocks);
|
||||
void build_dominators(GrowableArray<Block>* blocks);
|
||||
void build_blocks(Node *node);
|
||||
void walk(Node *n);
|
||||
void start_element(const char *name, Properties *properties = NULL, bool print_indent = false, bool print_return = true);
|
||||
void simple_element(const char *name, Properties *properties = NULL, bool print_indent = false);
|
||||
void end_element(const char *name, bool print_indent = false, bool print_return = true);
|
||||
void print_edge(int from, int to, int index);
|
||||
void print_indent();
|
||||
void print_method(ciMethod *method, int bci, InlineTree *tree);
|
||||
void print_inline_tree(InlineTree *tree);
|
||||
void clear_nodes();
|
||||
|
||||
void visit_node(Node *n, void *param);
|
||||
void walk_nodes(Node *start, void *param);
|
||||
void begin_elem(const char *s);
|
||||
void end_elem();
|
||||
void begin_head(const char *s);
|
||||
void end_head();
|
||||
void print_attr(const char *name, const char *val);
|
||||
void print_attr(const char *name, intptr_t val);
|
||||
void print_prop(const char *name, const char *val);
|
||||
void print_prop(const char *name, int val);
|
||||
void tail(const char *name);
|
||||
void head(const char *name);
|
||||
void text(const char *s);
|
||||
intptr_t get_node_id(Node *n);
|
||||
IdealGraphPrinter();
|
||||
~IdealGraphPrinter();
|
||||
|
||||
@ -308,7 +128,6 @@ public:
|
||||
|
||||
bool traverse_outs();
|
||||
void set_traverse_outs(bool b);
|
||||
void print_ifg(PhaseIFG* ifg);
|
||||
outputStream *output();
|
||||
void print_inlining(Compile* compile);
|
||||
void begin_method(Compile* compile);
|
||||
|
@ -1072,8 +1072,6 @@ bool IdealLoopTree::beautify_loops( PhaseIdealLoop *phase ) {
|
||||
phase->_igvn.add_users_to_worklist(l->fast_out(i));
|
||||
}
|
||||
|
||||
phase->C->print_method("After beautify loops", 3);
|
||||
|
||||
// Now recursively beautify nested loops
|
||||
if( _child ) result |= _child->beautify_loops( phase );
|
||||
if( _next ) result |= _next ->beautify_loops( phase );
|
||||
@ -1470,6 +1468,8 @@ PhaseIdealLoop::PhaseIdealLoop( PhaseIterGVN &igvn, const PhaseIdealLoop *verify
|
||||
}
|
||||
// Reset loop nesting depth
|
||||
_ltree_root->set_nest( 0 );
|
||||
|
||||
C->print_method("After beautify loops", 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ Matcher::Matcher( Node_List &proj_list ) :
|
||||
PhaseTransform( Phase::Ins_Select ),
|
||||
#ifdef ASSERT
|
||||
_old2new_map(C->comp_arena()),
|
||||
_new2old_map(C->comp_arena()),
|
||||
#endif
|
||||
_shared_nodes(C->comp_arena()),
|
||||
_reduceOp(reduceOp), _leftOp(leftOp), _rightOp(rightOp),
|
||||
@ -835,10 +836,16 @@ Node *Matcher::xform( Node *n, int max_stack ) {
|
||||
if( n->is_Proj() && n->in(0)->is_Multi()) { // Projections?
|
||||
// Convert to machine-dependent projection
|
||||
m = n->in(0)->as_Multi()->match( n->as_Proj(), this );
|
||||
#ifdef ASSERT
|
||||
_new2old_map.map(m->_idx, n);
|
||||
#endif
|
||||
if (m->in(0) != NULL) // m might be top
|
||||
collect_null_checks(m);
|
||||
} else { // Else just a regular 'ol guy
|
||||
m = n->clone(); // So just clone into new-space
|
||||
#ifdef ASSERT
|
||||
_new2old_map.map(m->_idx, n);
|
||||
#endif
|
||||
// Def-Use edges will be added incrementally as Uses
|
||||
// of this node are matched.
|
||||
assert(m->outcnt() == 0, "no Uses of this clone yet");
|
||||
@ -887,6 +894,9 @@ Node *Matcher::xform( Node *n, int max_stack ) {
|
||||
// || op == Op_BoxLock // %%%% enable this and remove (+++) in chaitin.cpp
|
||||
) {
|
||||
m = m->clone();
|
||||
#ifdef ASSERT
|
||||
_new2old_map.map(m->_idx, n);
|
||||
#endif
|
||||
mstack.push(m, Post_Visit, n, i); // Don't neet to visit
|
||||
mstack.push(m->in(0), Visit, m, 0);
|
||||
} else {
|
||||
@ -1190,6 +1200,7 @@ MachNode *Matcher::match_tree( const Node *n ) {
|
||||
MachNode *m = ReduceInst( s, s->_rule[mincost], mem );
|
||||
#ifdef ASSERT
|
||||
_old2new_map.map(n->_idx, m);
|
||||
_new2old_map.map(m->_idx, (Node*)n);
|
||||
#endif
|
||||
|
||||
// Add any Matcher-ignored edges
|
||||
@ -1491,6 +1502,9 @@ MachNode *Matcher::ReduceInst( State *s, int rule, Node *&mem ) {
|
||||
for( uint i=0; i<mach->req(); i++ ) {
|
||||
mach->set_req(i,NULL);
|
||||
}
|
||||
#ifdef ASSERT
|
||||
_new2old_map.map(ex->_idx, s->_leaf);
|
||||
#endif
|
||||
}
|
||||
|
||||
// PhaseChaitin::fixup_spills will sometimes generate spill code
|
||||
|