Sudar
Sudar

Reputation: 19992

Plugin support for a Java swing App (like Eclipse)

I need to add Plugin support to 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?

Upvotes: 2

Views: 1580

Answers (3)

Eugene Ryzhikov
Eugene Ryzhikov

Reputation: 17359

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/

Upvotes: 0

Arne Deutsch
Arne Deutsch

Reputation: 14769

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

Upvotes: 2

Ha.
Ha.

Reputation: 3454

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.

Upvotes: 0

Related Questions