Cratylus
Cratylus

Reputation: 54074

Eclipse Plugin Project does not display Window added in Application Model

Looking into Eclipse 4 RCP.
Did the following:

  1. Created an Eclipse Plugin Project (no Rich Client unchecked, Actvator unchecked) so no classes under /src
  2. Created a Product Configuration. Application selected is E4Application
  3. Created a Feature Project and include the plugin I created in step 1
  4. In the .product file I checked the configuration to be based on features. In the dependencies tab I added org.eclipse.e4.rcp and the feature I created in step 3 (added required dependencies as well)
  5. Created Application Model with container to be the plugin project of step 1 and added a New Trimmed Window

Saved all and tried to launch an Eclipse Application
No window is showing up and I don't see an error in console.
Any idea what am I missing here or how is this debugged?

Update:
I am following: 10. Tutorial: From Plug-in to Eclipse 4 application
The 10.6. Start application is the one that fails

Update 2:
I noticed that some directories have been created outside of my workspace with the name runtime-todo.product (i.e. the plugin name).
Going into runtime-todo.product\.metadata\.plugins\org.eclipse.e4.workbench and deleting the workbench the window showed up.
Why are these directories created outside my workspace and what was the problem here?

Upvotes: 3

Views: 3014

Answers (2)

Jörg
Jörg

Reputation: 2494

You can check the Clear flag in your run configuration or specify -clearPersistedState in your product definition ... as mentioned here in a Lars Vogel Tutorial (search for Problem "Application model changes are not reflected in the Eclipse 4 application" in Table2).

Upvotes: 3

Modus Tollens
Modus Tollens

Reputation: 5123

I followed all your steps and got the expected empty window after the application started, so something is strange here.

You can try to:

  • Look for an error log file in the .metadata folder of your runtime workspace
  • Delete the file .metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi
  • Add -clean as a program argument to your product launch configuration

Try to start the application again.

If this doesn't help, you can set a break point at org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel to see what happens when Eclipse tries to load your application model (see also Eclipse 4 Source). I hope this helps!

[Update]: When you start your application, a runtime workspace is created. Here, all the meta data of your application is stored, like settings and resources. For example, in .metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi the user settings of the Application Model are stored.

Sometimes during development, this workspace can become corrupted (e.g. by stopping the application while debugging before settings are saved etc.).

You can see the location of your runtime workspace when you look into the Run Configuration of your application. In the Main tab you can see (and change) the workspace data location. You should keep this runtime workspace separate from your development workspace.

[Update 2]: Information about the role of the workbench.xmi file can be found here: Constructing the runtime application model. The web page of Lars Vogel offers a lot of useful Eclipse Tutorials at Eclipse Plugin and Eclipse RCP Tutorials.

The Eclipse Help page lets you browse the user and developer guides or search for specific topics. Information about the Eclipse launcher and thus the runtime can be found here in Plug-in Development Environment Guide > Reference > Launchers > Eclipse Application Launcher. Look under Main Tab for explanations about workspace data.

The Eclipse variables are explained in the run configuration dialog of your application. In the main tab, look for the Variables... button. When you select a variable, an explanation is given in the Variable Description field.

Upvotes: 5

Related Questions