Show in Frame No Frame
Up Previous Next Title Page Contents Search

5.2 Eclipse plug-in for MetaEdit+

While the Watch Example Java code generator does not require any IDE to be present in order to produce fully functional code, quite often users still want to browse, compile and manage their code base from within an IDE. In order to make this kind of tighter integration easier, MetaCase provides a plug-in for the popular Eclipse Java IDE. The integration between MetaEdit+ and Eclipse includes:
*Launching MetaEdit+ from Eclipse and logging in, opening MetaEdit+ projects and starting its API,
*Showing the MetaEdit+ model hierarchy in an Eclipse tree view,
*Opening and editing MetaEdit+ models from Eclipse,
*Running generators on MetaEdit+ models, and importing the results as Eclipse solutions.
To try out the integration between MetaEdit+ and Eclipse, you must have the Eclipse IDE and plug-in installed. Eclipse is available for download at http://www.eclipse.org/downloads (we recommend you use Eclipse IDE for Java Developers as the plug-in has been tested with it). The plug-in is available at the Eclipse Marketplace (http://marketplace.eclipse.org/content/metaedit-plugin-eclipse), on its own update site at https://dl.bintray.com/metacase/metaedit-plugin-for-eclipse or as a release on GitHub (https://github.com/MetaCase/metaedit-plugin-for-eclipse/releases).

After installing Eclipse, there are three alternative ways of installing the plug-in:
*Install the plug-in from the Eclipse Marketplace by dragging the Install button from the plug-in’s Marketplace site (http://marketplace.eclipse.org/content/metaedit-plugin-eclipse) onto the Eclipse workspace.
*Install the plug-in from the update site. Open Eclipse and choose Help | Install New Software, set the update site to https://dl.bintray.com/metacase/metaedit-plugin-for-eclipse and follow the instructions in the wizard.
*Download the plug-in as a single JAR file from the plug-in’s release page on GitHub (https://github.com/MetaCase/metaedit-plugin-for-eclipse/releases). Place it in the plug-ins folder under your Eclipse installation folder.
With Eclipse and plug-in installed, you can start the plug-in from the Eclipse Workbench by selecting Window | Show view | Other | MetaEdit+ | Graph Browser. The plug-in tries to connect to the MetaEdit+ API server at startup. If it doesn't find any available connection, it will offer to launch MetaEdit+, start the API server, and login to the repository. This needs some paths and other parameters, which are stored in a ‘default.mer’ file that is saved in the root of the Eclipse workspace. When running the plug-in for the first time there is no 'default.mer' file. In this case the plug-in tries to find and suggest the correct paths needed for launching MetaEdit+. It shows them to the user who can edit and accept them by clicking Open MetaEdit+. Accepting them will open MetaEdit+.

If the plug-in doesn’t show any models after starting MetaEdit+ and its API, try clicking the Update Graph List icon on the plug-in’s toolbar. If the problem persists and the plug-in reports ‘No API connection found’, it may be that the requests made to port 6390 in localhost do not get through, most likely because of a proxy or firewall problem. On Windows, go to the Internet Explorer proxy server advanced settings and add localhost to the list of addresses for which the proxy server is bypassed (“Bypass proxy server for local addresses” does not seem to be enough). If you are using Microsoft Firewall Client for ISA Server, also turn off its “Enable Web browser automatic configuration” setting.

When the plug-in establishes a connection to MetaEdit+, it will populate the Graph Browser pane with a list of graphs available in MetaEdit+ at the time (as shown in Figure 5-1).

Eclipse plugin

Figure 5-1. Eclipse plug-in.

The following operations are available in the Graph Browser pane:
*Run ‘Autobuild’ generator for selected graph
*Run selected generator for selected graph
*Open selected graph in MetaEdit+
*Edit properties of the selected graph
*Create new graph
*Update graph list
*Show/hide types
*Setting launch parameters
All communication between the plug-in and MetaEdit+ is carried out via the MetaEdit+ API. Hence, all model editing and code generation is carried out natively in MetaEdit+ while the generated code is loaded into, build and executed in Eclipse. To try this out, select ‘WatchModels’ graph in Graph Browser plug-in and then Edit Graph Properties from its popup menu. This will open the usual property dialog in MetaEdit+. Set ‘Java: Windows’ as the Generation target platform, OK the dialog and select Run Autobuild from ‘WatchModels’ popup menu in the Graph Browser pane to launch the code generation. After the code is generated and compiled, the test environment will be launched (as shown in Figure 5-2).

Running Eclipse plugin

Figure 5-2. Using the Eclipse plug-in

For further information on the plug-in, please see its documentation on GitHub, https://github.com/MetaCase/metaedit-plugin-for-eclipse/.

Show in Frame No Frame
Up Previous Next Title Page Contents Search