# HG changeset patch # User Thomas Wuerthinger # Date 1327703488 -3600 # Node ID 0c632ed89063c0a2e3a67863e43444fd3a04e1a6 # Parent 2fe2bb2e912b63dc059b497391949b248d7df8aa Removed scripting proxies (and therefore support for running igv on java 5 or below). diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java Fri Jan 27 23:25:52 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java Fri Jan 27 23:31:28 2012 +0100 @@ -32,6 +32,7 @@ import java.util.Collection; import java.util.logging.Level; import java.util.logging.Logger; +import javax.script.*; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.cookies.OpenCookie; @@ -49,7 +50,6 @@ public class CustomFilter extends AbstractFilter { public static final String JAVASCRIPT_HELPER_ID = "JavaScriptHelper"; - private static ScriptEngineAbstraction engine; private String code; private String name; @@ -100,29 +100,6 @@ return getName(); } - public static ScriptEngineAbstraction getEngine() { - if (engine == null) { - - Collection list = Lookup.getDefault().lookupAll(ScriptEngineAbstraction.class); - ScriptEngineAbstraction chosen = null; - for (ScriptEngineAbstraction s : list) { - if (s.initialize(getJsHelperText())) { - chosen = s; - } - } - - if (chosen == null) { - NotifyDescriptor message = new NotifyDescriptor.Message("Could not find a scripting engine. Please make sure that the Rhino scripting engine is available. Otherwise filter cannot be used.", NotifyDescriptor.ERROR_MESSAGE); - DialogDisplayer.getDefault().notifyLater(message); - chosen = new NullScriptEngine(); - } - - engine = chosen; - } - - return engine; - } - private static String getJsHelperText() { InputStream is = null; StringBuilder sb = new StringBuilder("importPackage(Packages.com.sun.hotspot.igv.filter);importPackage(Packages.com.sun.hotspot.igv.graph);importPackage(Packages.com.sun.hotspot.igv.data);importPackage(Packages.com.sun.hotspot.igv.util);importPackage(java.awt);"); @@ -149,6 +126,16 @@ } public void apply(Diagram d) { - getEngine().execute(d, code); + try { + ScriptEngineManager sem = new ScriptEngineManager(); + ScriptEngine e = sem.getEngineByName("ECMAScript"); + e.eval(getJsHelperText()); + Bindings b = e.getContext().getBindings(ScriptContext.ENGINE_SCOPE); + b.put("graph", d); + b.put("IO", System.out); + e.eval(code, b); + } catch (ScriptException ex) { + Exceptions.printStackTrace(ex); + } } } diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/NullScriptEngine.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/NullScriptEngine.java Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.filter; - -import com.sun.hotspot.igv.graph.Diagram; - -/** - * - * @author Thomas Wuerthinger - */ -public class NullScriptEngine implements ScriptEngineAbstraction { - - public boolean initialize(String jsHelperText) { - return true; - } - - public void execute(Diagram d, String code) { - } -} diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ScriptEngineAbstraction.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ScriptEngineAbstraction.java Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.hotspot.igv.filter; - -import com.sun.hotspot.igv.graph.Diagram; - -/** - * - * @author Thomas Wuerthinger - */ -public interface ScriptEngineAbstraction { - - public boolean initialize(String jsHelperText); - - public void execute(Diagram d, String code); -} diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/build.xml --- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/build.xml Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - Builds, tests, and runs the project com.sun.hotspot.igv.java6scriptingproxy. - - diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/manifest.mf --- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/manifest.mf Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.sun.hotspot.igv.java6scriptingproxy -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/java6scriptingproxy/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/build-impl.xml --- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/build-impl.xml Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - - - - - - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/genfiles.properties --- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/genfiles.properties Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -# 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=485d21b4 -nbproject/build-impl.xml.script.CRC32=341e7d1e -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/project.properties Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -javac.source=1.5 -javac.compilerargs=-Xlint -Xlint:-serial diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/project.xml Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ - - - org.netbeans.modules.apisupport.project - - - com.sun.hotspot.igv.java6scriptingproxy - - - - com.sun.hotspot.igv.filter - - - - 1.0 - - - - com.sun.hotspot.igv.graph - - - - 1.0 - - - - - com.sun.hotspot.igv.java6scriptingproxy - - - - diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/suite.properties --- a/src/share/tools/IdealGraphVisualizer/Java6ScriptingProxy/nbproject/suite.properties Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -suite.dir=${basedir}/.. diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/build.xml --- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/build.xml Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - Builds, tests, and runs the project com.sun.hotspot.igv.rhino. - - diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/manifest.mf --- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/manifest.mf Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.sun.hotspot.igv.rhino -OpenIDE-Module-Layer: com/sun/hotspot/igv/rhino/layer.xml -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/rhino/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/build-impl.xml --- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/build-impl.xml Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - - - - - - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/genfiles.properties --- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/genfiles.properties Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -# 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=0c3e7912 -nbproject/build-impl.xml.script.CRC32=87376d18 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/project.properties Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -javac.source=1.5 -javac.compilerargs=-Xlint -Xlint:-serial diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/project.xml Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ - - - org.netbeans.modules.apisupport.project - - - com.sun.hotspot.igv.rhino - - - - com.sun.hotspot.igv.filter - - - - 1.0 - - - - com.sun.hotspot.igv.graph - - - - 1.0 - - - - - com.sun.hotspot.igv.rhino - - - - diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/suite.properties --- a/src/share/tools/IdealGraphVisualizer/RhinoScriptEngineProxy/nbproject/suite.properties Fri Jan 27 23:25:52 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -suite.dir=${basedir}/.. diff -r 2fe2bb2e912b -r 0c632ed89063 src/share/tools/IdealGraphVisualizer/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Fri Jan 27 23:25:52 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Fri Jan 27 23:31:28 2012 +0100 @@ -1,58 +1,54 @@ -app.icon=branding/core/core.jar/org/netbeans/core/startup/frame48.gif -app.name=idealgraphvisualizer -app.title=IdealGraphVisualizer -branding.token=${app.name} -modules=\ - ${project.com.sun.hotspot.igv.graph}:\ - ${project.com.sun.hotspot.igv.coordinator}:\ - ${project.com.sun.hotspot.igv.filter}:\ - ${project.com.sun.hotspot.igv.hierarchicallayout}:\ - ${project.com.sun.hotspot.igv.layout}:\ - ${project.com.sun.hotspot.igv.controlflow}:\ - ${project.com.sun.hotspot.igv.data}:\ - ${project.com.sun.hotspot.igv.view}:\ - ${project.com.sun.hotspot.igv.bytecodes}:\ - ${project.com.sun.hotspot.igv.difference}:\ - ${project.com.sun.hotspot.igv.settings}:\ - ${project.com.sun.hotspot.igv.util}:\ - ${project.com.sun.hotspot.igv.rhino}:\ - ${project.com.sun.hotspot.igv.svg}:\ - ${project.com.sun.hotspot.connection}:\ - ${project.com.sun.hotspot.igv.servercompilerscheduler}:\ - ${project.com.sun.hotspot.igv.filterwindow}:\ - ${project.com.sun.hotspot.igv.graphtotext}:\ - ${project.com.sun.hotspot.igv.java6scriptingproxy}:\ - ${project.com.sun.hotspot.igv.graphtexteditor}:\ - ${project.com.sun.hotspot.igv.structuredtext}:\ - ${project.com.sun.hotspot.igv.texteditor}:\ - ${project.com.sun.hotspot.igv.selectioncoordinator}:\ - ${project.com.sun.hotspot.igv.graal} -project.com.sun.hotspot.connection=NetworkConnection -project.com.sun.hotspot.igv.bytecodes=Bytecodes -project.com.sun.hotspot.igv.controlflow=ControlFlow -project.com.sun.hotspot.igv.coordinator=Coordinator -project.com.sun.hotspot.igv.data=Data -project.com.sun.hotspot.igv.difference=Difference -project.com.sun.hotspot.igv.filter=Filter -project.com.sun.hotspot.igv.filterwindow=FilterWindow -project.com.sun.hotspot.igv.graal=Graal -project.com.sun.hotspot.igv.graph=Graph -project.com.sun.hotspot.igv.graphtexteditor=GraphTextEditor -project.com.sun.hotspot.igv.graphtotext=GraphToText -project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout -project.com.sun.hotspot.igv.java6scriptingproxy=Java6ScriptingProxy -project.com.sun.hotspot.igv.layout=Layout -project.com.sun.hotspot.igv.rhino=RhinoScriptEngineProxy -project.com.sun.hotspot.igv.selectioncoordinator=SelectionCoordinator -project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler -project.com.sun.hotspot.igv.settings=Settings -project.com.sun.hotspot.igv.structuredtext=StructuredText -project.com.sun.hotspot.igv.svg=BatikSVGProxy -project.com.sun.hotspot.igv.texteditor=TextEditor -project.com.sun.hotspot.igv.view=View -project.com.sun.hotspot.igv.util=Util - -# Disable assertions for RequestProcessor to prevent annoying messages in case -# of multiple SceneAnimator update tasks in the default RequestProcessor. -run.args.extra = -J-client -J-da:org.openide.util.RequestProcessor -debug.args.extra = -J-client -J-da:org.openide.util.RequestProcessor +app.icon=branding/core/core.jar/org/netbeans/core/startup/frame48.gif +app.name=idealgraphvisualizer +app.title=IdealGraphVisualizer +branding.token=${app.name} +modules=\ + ${project.com.sun.hotspot.igv.graph}:\ + ${project.com.sun.hotspot.igv.coordinator}:\ + ${project.com.sun.hotspot.igv.filter}:\ + ${project.com.sun.hotspot.igv.hierarchicallayout}:\ + ${project.com.sun.hotspot.igv.layout}:\ + ${project.com.sun.hotspot.igv.controlflow}:\ + ${project.com.sun.hotspot.igv.data}:\ + ${project.com.sun.hotspot.igv.view}:\ + ${project.com.sun.hotspot.igv.bytecodes}:\ + ${project.com.sun.hotspot.igv.difference}:\ + ${project.com.sun.hotspot.igv.settings}:\ + ${project.com.sun.hotspot.igv.util}:\ + ${project.com.sun.hotspot.igv.svg}:\ + ${project.com.sun.hotspot.connection}:\ + ${project.com.sun.hotspot.igv.servercompilerscheduler}:\ + ${project.com.sun.hotspot.igv.filterwindow}:\ + ${project.com.sun.hotspot.igv.graphtotext}:\ + ${project.com.sun.hotspot.igv.graphtexteditor}:\ + ${project.com.sun.hotspot.igv.structuredtext}:\ + ${project.com.sun.hotspot.igv.texteditor}:\ + ${project.com.sun.hotspot.igv.selectioncoordinator}:\ + ${project.com.sun.hotspot.igv.graal} +project.com.sun.hotspot.connection=NetworkConnection +project.com.sun.hotspot.igv.bytecodes=Bytecodes +project.com.sun.hotspot.igv.controlflow=ControlFlow +project.com.sun.hotspot.igv.coordinator=Coordinator +project.com.sun.hotspot.igv.data=Data +project.com.sun.hotspot.igv.difference=Difference +project.com.sun.hotspot.igv.filter=Filter +project.com.sun.hotspot.igv.filterwindow=FilterWindow +project.com.sun.hotspot.igv.graal=Graal +project.com.sun.hotspot.igv.graph=Graph +project.com.sun.hotspot.igv.graphtexteditor=GraphTextEditor +project.com.sun.hotspot.igv.graphtotext=GraphToText +project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout +project.com.sun.hotspot.igv.layout=Layout +project.com.sun.hotspot.igv.selectioncoordinator=SelectionCoordinator +project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler +project.com.sun.hotspot.igv.settings=Settings +project.com.sun.hotspot.igv.structuredtext=StructuredText +project.com.sun.hotspot.igv.svg=BatikSVGProxy +project.com.sun.hotspot.igv.texteditor=TextEditor +project.com.sun.hotspot.igv.view=View +project.com.sun.hotspot.igv.util=Util + +# Disable assertions for RequestProcessor to prevent annoying messages in case +# of multiple SceneAnimator update tasks in the default RequestProcessor. +run.args.extra = -J-client -J-da:org.openide.util.RequestProcessor +debug.args.extra = -J-client -J-da:org.openide.util.RequestProcessor