Embedding a Swing App
Before you begin:
-
You must have a working Swing app.
-
Create a new Eclipse plug-in project.
You can use the build.bat
file that is included in the sample Swing plug-in archive. It compiles and packs the sources that are included in the Swing plug-in. The archive also includes source code for a sample Swing app and MANIFEST.MF
. These files are located in the SwingAppCode
folder.
To make build.bat
function, add javac.exe
and jar.exe
from the Java SDK to your PATH
system variable.
Adding Plug-in Dependencies
-
From Eclipse Package Explorer, add the following plug-in dependencies:
-
org.eclipse.albireo.core
-
com.sabre.edge.platform.core.common
-
If you are embedding your Swing application in an editor, the com.sabre.edge.platform.core.editor dependency is also required.
-
Adding JAR Files for Your Application
-
In Package Explorer, right-click the package name.
Choose New > Folder from the menu. Name the folder lib
.
-
Put the JAR file for your application into the lib folder. (See the following figure.)
Tip
|
If you need a sample application, you can copy the sample.jar file from the sample Swing plug-in. |
-
Open the Runtime tab.
-
In the MANIFEST.MF file, click Add. Select the folder that contains the application JAR file. After you select the folder, Eclipse adds the JAR to the classpath in your plug-in.
Next, you will add the UI extension points for either an editor, a view, or both. Complete one of the following procedures to wrap your class:
Afterwards, you must complete the steps in the following procedures: