Search code examples
eclipsercpe4

Eclipse e4 application: parts opened by default for the first run


I have an eclipse e4 application, with a main plugin with an "Application.e4xmi" describing a view with some part stacks.

Also, I have a fragment plugin with a "fragment.e4xmi" contributing some things.

If the fragment plugin contributes with a part, the part is opened for the first time the application is executed, but if I move it to another part stack, and open the part with a button handler (using the EPartService), it will be opened again (I don't understand why).

If the fragment plugin contributes with a part descriptor, the part is opened only once using the handler, but for the first application run time, the part is not created (and I need it).

What is the correct way to create a part/part descriptor in a fragment plugin and get it opened only for the application first execution (if the user closes the part, it should remain closed for the next application execution).


Solution

  • As I found, the best way to do it is adding apply="initial" to the fragment tag in the plugin.xml file. It works as expected.

    You can see more info at: https://help.eclipse.org/photon/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_e4_workbench_model.html