0

As stated in the title: I want to run an Eclipse-Plugin, more specifically a GEF-Editor, without starting an Eclipse instance before.

I've tried to use the export functionality provided in the MANIFEST.MF file: enter image description here

However, running the generated JAR (call it editor.jar) by executing java -jar editor.jar on the command line fails with the message no main manifest attribute, in plugins editor.jar.

I'm aware of the fact, that this is because my MANIFEST.MF file is missing the following line

Main-Class: <packagename>.<classname>

which defines an entry point for my application. However, I've no idea what exactly I need to do here (in the case of an Eclipse-Plugin), cause I don't have something like a main method. I assume Eclipse is running some magic code it doesn't show to me, when I start my project as an Eclipse Application.

So, what do I need to do?

0xbadf00d
  • 17,405
  • 15
  • 67
  • 107
  • You can't run an Eclipse plugin outside of Eclipse. You can write an Eclipse Rich Client Program (RCP) which includes your plugin and all the other plugins that it depends on. – greg-449 Jul 04 '14 at 19:54
  • @greg-449 Why? Running the application as an "Eclipse Application" starts another Eclipse instance (running the Plugin) anyway. So, why is it impossible to run it outside of Eclipse? How exactly can I write an "Eclipse Rich Client Program" which does nothing but run my Plugin? – 0xbadf00d Jul 04 '14 at 20:20
  • When you run as `Eclipse Application` it runs a complete new instance of Eclipse with all the plugins and support code. An Eclipse RCP is they way you create a package that does the same thing. Look at `Run > Run Configurations` find your app under Eclipse Applications and look at the Plug-ins tab to see everything that is being used. – greg-449 Jul 04 '14 at 20:31

2 Answers2

1

You could try running a GEF editor as a Java application. See Draw2D examples to understand how it can be done. You could probably re-use your GraphicalViewer and PaletteViewer, which means that mouse based interactions with the diagram and palette will be preserved. However, your editor class would probably have to be incorporated into an SWT shell. Also, all actions contributed to by your editor into Eclipse toolbars, popup menus etc. would be gone. Outline and Tree view would have to be incorporated into your java app somehow if needed. Think you'd be better off with an RCP application.

aboyko
  • 1,337
  • 1
  • 9
  • 11
0

Wrap your GEF editor in a simple RCP. You can create one via the Plug-in wizard, setting "Would you create a rich client application?" to "Yes" in the process. This gives you the option to create a minimal application via the Hello World template in the next step. Once you have this, you can either embed your GEF editor in this plugin, or declare a dependency from the new RCP application to your GEF editor plugin, and start the editor from the Application class' start method.

For an overview of resources about RCP development, cf. Getting started with the Eclipse RCP.

It really doesn't add that much overhead to your editor but gives you the opportunity to work with the platform's workbench and workspace metaphors and create easy-to-deploy-and-use application bundles.

Once you have that in place, you can test your RCP from plugin.xml > Overview > Testing > Launch an Eclipse application. This will not run a whole new instance of the IDE, but just the RCP application itself.

Rather than exporting from the MANIFEST.MF, look into creating a product (you can do it via the wizard: New > Product Configuration), and building it via the Maven Tycho plugin(s) (have a look at the respective - really worthwhile - tutorial from EclipseCon Europe 2012: http://eclipsecon.org/europe2012/sessions/building-eclipse-plugins-and-rcp-applications-tycho.html, this includes a section on creating a product as well). Tycho gives true cross-platform builds, as long as you're not on Windows.

No magic code there :).

Community
  • 1
  • 1
s.d
  • 4,017
  • 5
  • 35
  • 65