开发者

Plugin support for a Java swing App (like Eclipse)

I need to add Plugin support t开发者_开发百科o a Java Swing App (like in Eclipse).

The Plugin should have the ability to add new Menu items and tab components to the swing app.

I am looking for frameworks or libraries which support it. So far I have found Java Plugin Framework http://jpf.sourceforge.net/ and planning to use it.

Are there any other better alternatives to it?


You can use the plugin system from eclipse/osgi without using SWT. This is a minimal standalone "Hello world" application. You extending the extension point "org.eclipse.core.runtime.applications" and can put whatever you like in the Application class. You can generate an exe as launcher using eclipse and using the RCP framework from it.

package test;

import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext;

Application.java

public class Application implements IApplication {

    public Object start(IApplicationContext context) throws Exception {
        System.out.println("Hello world!");
        return IApplication.EXIT_OK;
    }

    public void stop() {
        System.out.println("By by!");
    }
}

plugin.xml

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

   <extension
         id="application"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="test.Application">
         </run>
      </application>
   </extension>

</plugin>

MANIFEST.MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test
Bundle-SymbolicName: Test; singleton:=true
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6


There is Netbeans RCP. In addition to plugin framework it provides window docking system which may be very useful in your app (you can easily add and remove menu items and tab components in plugins using xml-files for example). But framework is big and you have to do some things netbeans-way.


Even though using OSGi/Equinox would be the best option - there is an alternative solution. It is called Java Plugin Framework. Take a look at it here

http://jpf.sourceforge.net/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜