NetBeans in Eclipse
Part of the Google Summer of Code 2007
Student: Beyhan Veliev (IRC: beyhan)
Mentor: Philippe Ombredanne (IRC: pombreda)
The plugins models for Eclipse and NetBeans are very similar yet different. This project would provide the ability to run and embed a minimal NetBeans environment within Eclipse -- as Eclipse plugins-- , and support running NetBeans plugins like Matisse (Swing UI painter) or Coyote (dynamic languages toolkit).
The original proposal is available here: Google_Summer_of_Code_2007_Ideas
Design Goals after the analysis of the problem
A Netbeans module can be viewed as a component. It has required functionality, that is implemented from Netbeans. It has provided functionality to Netbeans. The life cycle of a NetBeans module within eclipse is divided in two phases. This two phases are the installation of a NetBeans module in Eclipse and the runtime of this module within Eclipse. As next is the implementation of this two phases explained.
- The installation phase
Layer.xml -> Plugin.xml Transformer and Wrapper Genarator: This plugin will be able to transform layer.xml to plugin.xml. It will generate the NetBeans Module Wrapper during the transformation.
NetBeans Module Wrapper: Will be the Plugin that wraps the Netbeans Module and will contain Eclipse extensions, that wrap NetBeans extensions e.g Netbeans editor wrapped from an Eclipse editor
- The runtime phase
NetBeans APIs Adapter: This plugin implements the required functionality (required API). This plugin will be able to emulate the NetBeans Platform. It will adapt and forward the calls of a NetBeans module to Eclipse. The Netbeans module will communicate with Eclipse by the NetBeans APIs Adapter.
NetBeans Module Wrapper: This plugin is the same generated during the transformation.
NetBeans Module Loader: This plugin will extend the plugin loader of Eclipse to be able to load Netbeans modules.
- Module is always a NetBeans module
- Plugin is always an Eclipse plugin
- plugin.xml is the description of an Eclipse plugin called plug-in manifest file
- layer.xml is the description of a NetBeans module
- Reuired API the implementation of the functionality required by a NetBeans module
- Action-Wrapper is an Eclipse-Action that has as attribute an NetBeans-Action and run this NetBeans-Action when it is invoked
- Editor-Wrapper is an Eclipse-Editor that has as input an NetBeans Editor
Creation of Editor-Wrappers is more complicated than creation of Action-Wrappers, because a NetBeans-Editor is opened from a NetBeans-Action that means the NetBeans module should call Eclipse-Framework. There must be implemented a register that maps the NetBeans-Editor to its Editor-Wrapper. The Editor-Wrapper will become its NetBeans-Editor as editor input. The dynamically mapping is needed here, because we don't want to change the code of the NetBeans module and we must be able to find dynamically the Editor-Wrapper of an NetBeans-Editor.
The NetBeans-Action will be injected in its Action-Wrapper as attribute during the creation of the Action-Wrapper. Here is no register needed that maps the actions to each other because the Action-wrapper knows its NetBeans-Action and the NetBeans-Action don't need to know its Action-Wrapper.
- A Netbeans module:
- an very simple editor.
- an main menu action (Window->Open TestEditor Window), that opens this editor.
- an main toolbar action, that opens an message dialog. The button have an yellow icon.
- I integrated the code of the Netbeans module in an Eclipse plugin.The Eclipse plugin has:
- an very simple editor, that is the wrapper of the editor in the Netbeans module.
- an main toolbar action, that is the wrapper of the equivalent Netbeans module action.
- an main menu bar action (Window->Open TestEditor Window), that is the wrapper of the equivalent Netbeans module action.
- The required API for the Netbeans module.
- Here ist the source code of this example:org.eclipse.soc.netbeans.
- Migrate an more complex Netbeans module to Eclipse.
- We migrated a module called paint-application. The source code can be found here in project org.eclipse.soc.netbeans.paint.editor.
- Required API was extended, but the extension is still in progress.
Work to be done
1. Migrate Matisse in Eclipse
2. Find a way to translate the layer.xml to plugin.xml.
3. During the translation automatically creation of the Action-Wrappers and Editor-Wrappers.
I will try to implement a NetBeans environment plugin for Eclipse that have the following features:
- Provide an Eclipse perspective.
- Provide a Wizard to install Netbeans’ plugins.
- Read and understand the plugin information of a Netbeans plugin.
- Generate an Eclipse plugin that is able to run the Netbeans plugin within Eclipse.