A First Look at Eclipse Plug-In Programming, Page 3
1.6.1 Eclipse startup
Eclipse contains an executable called eclipse.exe under the root directory of the Eclipse installation. The executable binary file allocates an amount of memory and launches the org.eclipse.core.launcher.Main application, located in startup.jar, from within its allocated memory. This startup file is in the same directory as the Eclipse executable.
The source code of the startup.jar file is located under the org.eclipse.platform plug-in directory of the Eclipse source code. In binary Eclipse, this plug-in only contains the splash screens and icons of the Eclipse platform. This jar file only contains one Main class that loads the platform. The package name of the class is org.eclipse.core.launcher.Main, which is different from the plug-in name.
If the boot <URL> option is not specified as a startup parameter to the Eclipse binary executable, the startup.jar will load the org.eclipse.core.boot.BootLoader by default. This class is responsible for loading the platform runtime.
The org.eclipse.core.runtime package is the main player.
The Eclipse.exe file is a platform-specific binary file. By default, it runs org.eclipse.core.launcher.Main, which is located in the startup.jar file.
You can only run one instance of Eclipse with one workspace. If you want to run another instance of Eclipse at the same time, you need to specify another workspace location as the startup parameter to theeclipse.exe binary executable file.
1.7. Eclipse vocabulary
It is helpful to learn a little Eclipse vocabulary before getting into it. The picture below shows a workbench window.
Figure 5. Eclipse Workbench Window
- Workbench—from the end-user's point of view, a workbench is the main window of Eclipse.
- Parts—a set of views or editors in a workbench window.
- Perspective—defines tje layout and initial set of views and editors (parts) in a workbench. The Shortcut bar shows a list of perspectives.
- Extension point—a place where you can extend an existing functionality.
- Extension—a thing with which you extend an existing functionality.
- Display—represents the connection between SWT and the underlying platform's GUI system.
- Shell—a window managed by operation system's window manager.
2. Plug-in development
2.1. Setting up Eclipse
Developing plug-ins is different than developing a pure Java application. Apart from the JDT, PDE tools are also provided to develop plug-ins for the Eclipse platform.
You need to use other plug-ins defined by the Eclipse platform. Those plug-ins must exist in your class path. Instead of importing all plug-ins as a Java project, PDE provides a space-efficient way to use them; you cannot modify the plug-in code, but you can browse.
To set up your workspace, you need to do the following:
- Switch to the appropriate perspective: Window->Open Perspective-> Java
- Import the necessary plug-ins through a widget: "File->Import...->External Plug-ins and Fragments".
Figure 6. Perspective Selection
|If you create a new project, Eclipse will ask you to switch to the associated perspective of the created project.|
Figure 7. Plug-in Import
Accept the default values on the second page. The third page shows the available plug-ins. Choose "Select All" to import all the plug-ins into your workspace. Click finish.
Figure 8. Selection of the Plug-ins for Import
Afterwards, plug-ins will be copied into your workspace and they will be available in the classpath. You can see the imported plug-ins and their source code from "Window-> Open Perspective -> Plug-in Development."
|If you skip that step, the Eclipse plug-in creation wizard will import the required plug-ins that are needed to compile the plug-in.|