From 7fb2ac6fa228492b4bfe4b2b163f39a2ceeeb7e5 Mon Sep 17 00:00:00 2001 From: "edburns%acm.org" Date: Sat, 17 Mar 2007 01:32:24 +0000 Subject: [PATCH] A plugins/netbeans A plugins/netbeans/.cvsignore A plugins/netbeans/build.xml A plugins/netbeans/manifest.mf A plugins/netbeans/nbproject/.cvsignore A plugins/netbeans/nbproject/build-impl.xml A plugins/netbeans/nbproject/genfiles.properties A plugins/netbeans/nbproject/project.properties A plugins/netbeans/nbproject/project.xml A plugins/netbeans/pluglet.properties A plugins/release/build.xml A plugins/examples/EmptyMainClass/EmptyMainClass.java A plugins/examples/index.html A plugins/examples/simple/src/main/java/simple/SimplePluglet.java A plugins/examples/simple/src/main/web/index.html M plugins/build.xml M plugins/mozilla/nppluglet.cpp - Towards a binar distribution of pluglets git-svn-id: svn://10.0.0.236/trunk@221999 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/java/plugins/build.xml | 2 + .../EmptyMainClass/EmptyMainClass.java | 6 + mozilla/java/plugins/examples/index.html | 24 + .../src/main/java/simple/SimplePluglet.java | 255 +++++++++ .../examples/simple/src/main/web/index.html | 7 + mozilla/java/plugins/mozilla/nppluglet.cpp | 9 + mozilla/java/plugins/netbeans/build.xml | 260 +++++++++ mozilla/java/plugins/netbeans/manifest.mf | 3 + .../plugins/netbeans/nbproject/build-impl.xml | 538 ++++++++++++++++++ .../netbeans/nbproject/genfiles.properties | 8 + .../netbeans/nbproject/project.properties | 61 ++ .../plugins/netbeans/nbproject/project.xml | 15 + .../java/plugins/netbeans/pluglet.properties | 5 + mozilla/java/plugins/release/build.xml | 310 ++++++++++ 14 files changed, 1503 insertions(+) create mode 100755 mozilla/java/plugins/examples/EmptyMainClass/EmptyMainClass.java create mode 100755 mozilla/java/plugins/examples/index.html create mode 100755 mozilla/java/plugins/examples/simple/src/main/java/simple/SimplePluglet.java create mode 100755 mozilla/java/plugins/examples/simple/src/main/web/index.html create mode 100755 mozilla/java/plugins/netbeans/build.xml create mode 100755 mozilla/java/plugins/netbeans/manifest.mf create mode 100755 mozilla/java/plugins/netbeans/nbproject/build-impl.xml create mode 100755 mozilla/java/plugins/netbeans/nbproject/genfiles.properties create mode 100755 mozilla/java/plugins/netbeans/nbproject/project.properties create mode 100755 mozilla/java/plugins/netbeans/nbproject/project.xml create mode 100755 mozilla/java/plugins/netbeans/pluglet.properties create mode 100755 mozilla/java/plugins/release/build.xml diff --git a/mozilla/java/plugins/build.xml b/mozilla/java/plugins/build.xml index 9b979b49aca..6f5f4838dd2 100644 --- a/mozilla/java/plugins/build.xml +++ b/mozilla/java/plugins/build.xml @@ -64,6 +64,8 @@ + + diff --git a/mozilla/java/plugins/examples/EmptyMainClass/EmptyMainClass.java b/mozilla/java/plugins/examples/EmptyMainClass/EmptyMainClass.java new file mode 100755 index 00000000000..9b94dffe9ae --- /dev/null +++ b/mozilla/java/plugins/examples/EmptyMainClass/EmptyMainClass.java @@ -0,0 +1,6 @@ +public class EmptyMainClass { + + public static void main(String args[]) { + } + +} diff --git a/mozilla/java/plugins/examples/index.html b/mozilla/java/plugins/examples/index.html new file mode 100755 index 00000000000..c08074f985d --- /dev/null +++ b/mozilla/java/plugins/examples/index.html @@ -0,0 +1,24 @@ + + + + Pluglet Examples + + + +

Pluglet Examples

+ + + + +
+ + +Last modified: Fri Mar 16 14:13:01 Eastern Standard Time 2007 + + + diff --git a/mozilla/java/plugins/examples/simple/src/main/java/simple/SimplePluglet.java b/mozilla/java/plugins/examples/simple/src/main/java/simple/SimplePluglet.java new file mode 100755 index 00000000000..8ec79234787 --- /dev/null +++ b/mozilla/java/plugins/examples/simple/src/main/java/simple/SimplePluglet.java @@ -0,0 +1,255 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Sun Microsystems, + * Inc. Portions created by Sun are + * Copyright (C) 1999 Sun Microsystems, Inc. All + * Rights Reserved. + * + * Contributor(s): + */ + +package simple; + +import java.awt.Button; +import java.awt.Frame; +import java.awt.List; +import java.awt.Panel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.print.PrinterJob; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import org.mozilla.pluglet.Pluglet; +import org.mozilla.pluglet.PlugletFactory; +import org.mozilla.pluglet.PlugletStreamListener; +import org.mozilla.pluglet.mozilla.PlugletManager; +import org.mozilla.pluglet.mozilla.PlugletPeer; +import org.mozilla.pluglet.mozilla.PlugletStreamInfo; +import org.mozilla.pluglet.mozilla.PlugletTagInfo; +import org.mozilla.pluglet.mozilla.PlugletTagInfo2; + + +public class SimplePluglet implements PlugletFactory { + public SimplePluglet() { + org.mozilla.util.DebugPluglet.print("--test.test()\n"); + } + /** + * Creates a new pluglet instance, based on a MIME type. This + * allows different impelementations to be created depending on + * the specified MIME type. + */ + public Pluglet createPluglet(String mimeType) { + org.mozilla.util.DebugPluglet.print("--test.createPlugletInstance\n"); + return new SimplePlugletInstance(); + } + /** + * Initializes the pluglet and will be called before any new instances are + * created. + */ + public void initialize(String plugletPath, PlugletManager manager) { + org.mozilla.util.DebugPluglet.print("--test.initialize(" + + plugletPath + ")\n"); + } + /** + * Called when the browser is done with the pluglet factory, or when + * the pluglet is disabled by the user. + */ + public void shutdown() { + org.mozilla.util.DebugPluglet.print("--test.shutdown\n"); + } +} + +class SimplePlugletInstance implements Pluglet { + Panel panel; + Button button; + List list; + PlugletPeer peer; + public SimplePlugletInstance() { + org.mozilla.util.DebugPluglet.print("--SimplePlugletInstance.SimplePlugletInstance() \n"); + panel = new Panel(); + button = new Button("Press me :)"); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int t = list.getSelectedIndex(); + t++; + if (t >= list.getItemCount()) { + t = 0; + } + list.select(t); + } + } + ); + panel.add(button); + list = new List(4,false); + list.add("Pluglet"); + list.add("not"); + list.add("bad"); + list.select(0); + panel.add(list); + } + /** + * Initializes a newly created pluglet instance, passing to it the pluglet + * instance peer which it should use for all communication back to the browser. + * + * @param peer the corresponding pluglet instance peer + */ + + public void initialize(PlugletPeer peer) { + this.peer = peer; + org.mozilla.util.DebugPluglet.print("--SimplePlugletInstance.initialize\n"); + peer.showStatus("Hello world"); + org.mozilla.util.DebugPluglet.print("--SimplePlugletInstance.initialize "+peer.getMIMEType()); + /* + try { + OutputStreamWriter out = new OutputStreamWriter(peer.newStream("text/plain","_new")); + String msg = "Hello, world"; + out.write(msg,0,msg.length()); + out.flush(); + out.close(); + } catch (Exception e) { + ; + } + */ + } + /** + * Called to instruct the pluglet instance to start. This will be called after + * the pluglet is first created and initialized, and may be called after the + * pluglet is stopped (via the Stop method) if the pluglet instance is returned + * to in the browser window's history. + */ + public void start() { + org.mozilla.util.DebugPluglet.print("--SimplePlugletInstance.start\n"); + } + /** + * Called to instruct the pluglet instance to stop, thereby suspending its state. + * This method will be called whenever the browser window goes on to display + * another page and the page containing the pluglet goes into the window's history + * list. + */ + public void stop() { + org.mozilla.util.DebugPluglet.print("--SimplePlugletInstance.stop\n"); + } + /** + * Called to instruct the pluglet instance to destroy itself. This is called when + * it become no longer possible to return to the pluglet instance, either because + * the browser window's history list of pages is being trimmed, or because the + * window containing this page in the history is being closed. + */ + public void destroy() { + org.mozilla.util.DebugPluglet.print("--SimplePlugletInstance.destroy\n"); + } + /** + * Called to tell the pluglet that the initial src/data stream is + * ready. + * + * @result PlugletStreamListener + */ + public PlugletStreamListener newStream() { + org.mozilla.util.DebugPluglet.print("--SimplePlugletInstance.newStream\n"); + return new TestStreamListener(); + } + /** + * Called when the window containing the pluglet instance changes. + * + * @param frame the pluglet panel + */ + public void setWindow(Frame frame) { + org.mozilla.util.DebugPluglet.print("--Test...SetWindow "+frame+"\n"); + if(frame == null) { + return; + } + PlugletTagInfo info = peer.getTagInfo(); + if (info instanceof PlugletTagInfo2) { + PlugletTagInfo2 info2 = (PlugletTagInfo2)info; + frame.setSize(info2.getWidth(),info2.getHeight()); + org.mozilla.util.DebugPluglet.print("--SimplePlugletInstance.SetWindow width "+info2.getWidth()+ " height "+info2.getHeight()+"\n"); + org.mozilla.util.DebugPluglet.print("--Test...SetWindow "+frame+"\n"); + } + frame.add(panel); + frame.pack(); + frame.show(); + } + /** + * Called to instruct the pluglet instance to print itself to a printer. + * + * @param print printer information. + */ + public void print(PrinterJob printerJob) { + } + + protected void finalize() { + org.mozilla.util.DebugPluglet.print("--SimplePlugletInstance.finalize()\n"); + } +} + +class TestStreamListener implements PlugletStreamListener { + public TestStreamListener() { + org.mozilla.util.DebugPluglet.print("--TestStreamListener.TestStreamListener()\n"); + } + /** + * Notify the observer that the URL has started to load. This method is + * called only once, at the beginning of a URL load.

+ */ + public void onStartBinding(PlugletStreamInfo streamInfo) { + org.mozilla.util.DebugPluglet.print("--TestStreamListener.onStartBinding "); + org.mozilla.util.DebugPluglet.print("length "+streamInfo.getLength()); + org.mozilla.util.DebugPluglet.print(" contenet type "+ streamInfo.getContentType()); + org.mozilla.util.DebugPluglet.print(" url "+ streamInfo.getURL()); + org.mozilla.util.DebugPluglet.print(" seekable "+ streamInfo.isSeekable()); + + } + /** + * Notify the client that data is available in the input stream. This + * method is called whenver data is written into the input stream by the + * networking library...

+ * + * @param input The input stream containing the data. This stream can + * be either a blocking or non-blocking stream. + * @param length The amount of data that was just pushed into the stream. + */ + public void onDataAvailable(PlugletStreamInfo plugletInfo, InputStream input,int length) { + try{ + org.mozilla.util.DebugPluglet.print("--TestStreamListener.onDataAvailable "); + org.mozilla.util.DebugPluglet.print("--length "+input.available()+"\n"); + String cur = null; + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(input)); + while (null != (cur = bufferedReader.readLine())) { + org.mozilla.util.DebugPluglet.print(cur); + } + } catch(Exception e) { + ; + } + } + public void onFileAvailable(PlugletStreamInfo plugletInfo, String fileName) { + org.mozilla.util.DebugPluglet.print("--TestStreamListener.onFileAvailable\n"); + org.mozilla.util.DebugPluglet.print(" fileName" + fileName); + } + /** + * Notify the observer that the URL has finished loading. + */ + public void onStopBinding(PlugletStreamInfo plugletInfo,int status) { + org.mozilla.util.DebugPluglet.print("--TestStreamListener.onStopBinding\n"); + } + public int getStreamType() { + org.mozilla.util.DebugPluglet.print("--TestStreamListener.getStreamType\n"); + return 1; //:) + } +} + + + + + + diff --git a/mozilla/java/plugins/examples/simple/src/main/web/index.html b/mozilla/java/plugins/examples/simple/src/main/web/index.html new file mode 100755 index 00000000000..2db8e9863a1 --- /dev/null +++ b/mozilla/java/plugins/examples/simple/src/main/web/index.html @@ -0,0 +1,7 @@ + +TestPluglet that loads its source file + + + + diff --git a/mozilla/java/plugins/mozilla/nppluglet.cpp b/mozilla/java/plugins/mozilla/nppluglet.cpp index 03bd1ca8a2e..60e7f72fa5b 100644 --- a/mozilla/java/plugins/mozilla/nppluglet.cpp +++ b/mozilla/java/plugins/mozilla/nppluglet.cpp @@ -53,6 +53,10 @@ #include "npAPInsIInputStreamShim.h" +#include "prlog.h" + +static PRLogModuleInfo* log = NULL; + // service manager which will give the access to all public browser services // we will use memory service as an illustration nsIServiceManager * gServiceManager = NULL; @@ -97,6 +101,11 @@ NPError NS_PluginInitialize() // this is probably a good place to get the service manager // note that Mozilla will add reference, so do not forget to release nsISupports * sm = NULL; + + log = PR_NewLogModule("nppluglet"); + + PR_LOG(log, PR_LOG_DEBUG, + ("nppluglet NS_PluginInitialize\n")); NPN_GetValue(NULL, NPNVserviceManager, &sm); diff --git a/mozilla/java/plugins/netbeans/build.xml b/mozilla/java/plugins/netbeans/build.xml new file mode 100755 index 00000000000..ea5cf358c19 --- /dev/null +++ b/mozilla/java/plugins/netbeans/build.xml @@ -0,0 +1,260 @@ + + + + + + Builds, tests, and runs the project pluglet. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Conditions for compilation have not been met. +Have you verified that the property browser.bin.dir has been set +to the binary directory of the host browser in the webclient.properties +file? The current value of this property is: +${browser.bin.dir} and this directory must contain the file +${so.prefix}xpcom.${so.extension}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mozilla/java/plugins/netbeans/manifest.mf b/mozilla/java/plugins/netbeans/manifest.mf new file mode 100755 index 00000000000..328e8e5bc3b --- /dev/null +++ b/mozilla/java/plugins/netbeans/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/mozilla/java/plugins/netbeans/nbproject/build-impl.xml b/mozilla/java/plugins/netbeans/nbproject/build-impl.xml new file mode 100755 index 00000000000..c28e5d7ad52 --- /dev/null +++ b/mozilla/java/plugins/netbeans/nbproject/build-impl.xml @@ -0,0 +1,538 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.EmptyMainClass.dir + Must set src.java.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + diff --git a/mozilla/java/plugins/netbeans/nbproject/genfiles.properties b/mozilla/java/plugins/netbeans/nbproject/genfiles.properties new file mode 100755 index 00000000000..2ce4d11c982 --- /dev/null +++ b/mozilla/java/plugins/netbeans/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=8df37aff +build.xml.script.CRC32=4cc13411 +build.xml.stylesheet.CRC32=240b97a2 +# 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=59b0de98 +nbproject/build-impl.xml.script.CRC32=5b6a971b +nbproject/build-impl.xml.stylesheet.CRC32=20b9345e diff --git a/mozilla/java/plugins/netbeans/nbproject/project.properties b/mozilla/java/plugins/netbeans/nbproject/project.properties new file mode 100755 index 00000000000..5214aefcc7f --- /dev/null +++ b/mozilla/java/plugins/netbeans/nbproject/project.properties @@ -0,0 +1,61 @@ +application.args= +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/pluglet.jar +dist.javadoc.dir=${dist.dir}/javadoc +file.reference.examples-EmptyMainClass=../examples/EmptyMainClass +file.reference.main-java=../examples/simple/src/main/java +file.reference.pluglet-1_1_a1.jar=../lib/pluglet-1_1_a1.jar +jar.compress=false +javac.classpath=\ + ${file.reference.pluglet-1_1_a1.jar}:\ + ${libs.JMF.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding= +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=EmptyMainClass +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +src.EmptyMainClass.dir=${file.reference.examples-EmptyMainClass} +src.java.dir=${file.reference.main-java} diff --git a/mozilla/java/plugins/netbeans/nbproject/project.xml b/mozilla/java/plugins/netbeans/nbproject/project.xml new file mode 100755 index 00000000000..e2a6729e1ee --- /dev/null +++ b/mozilla/java/plugins/netbeans/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + pluglet + 1.6.5 + + + + + + + + diff --git a/mozilla/java/plugins/netbeans/pluglet.properties b/mozilla/java/plugins/netbeans/pluglet.properties new file mode 100755 index 00000000000..cc654a264d4 --- /dev/null +++ b/mozilla/java/plugins/netbeans/pluglet.properties @@ -0,0 +1,5 @@ +bin.artifacts.pattern=${so.prefix}plugletjni.${so.extension},components/${so.prefix}pluglet.${so.extension},components/pluglet.xpt,plugins/np${so.prefix}pluglet.${so.extension},plugins/SimplePluglet.jar +#debug.jvm.args=-Xdebug -Xrunjdwp:transport=dt_shmem,address=jdbconn,server=y,suspend=y + +#Make this point to the bin directory of your XULRUNNER installation +browser.bin.dir=C:\\Projects\\chaff\\pluglet-1-1-alpha-1\\ff1509 diff --git a/mozilla/java/plugins/release/build.xml b/mozilla/java/plugins/release/build.xml new file mode 100755 index 00000000000..248a34d0de5 --- /dev/null +++ b/mozilla/java/plugins/release/build.xml @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +