Editor 3.x/4.x – org.eclipse.ui.editorss

I would like to show you how to re-use the Eclipse editor area in an e4 application. Before, I had the problem that the editor disappeared after maximizing views or that Eclipse showed me messages like:


!MESSAGE Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/tags/REMOVE] {ChangedElement=org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@4981d95b (elementId: org.eclipse.chemclipse.ux.extension.msd.ui.partstack.main.2, tags: [active], contributorURI: platform:/plugin/org.eclipse.chemclipse.ux.extension.msd.ui) (widget: CTabFolder {}, renderer: org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer@7b2f8152, toBeRendered: true, onTop: false, visible: true, containerData: 10000, accessibilityPhrase: null), Widget=CTabFolder {}, AttName=tags, EventType=REMOVE, Position=1, OldValue=Maximized} to handler org.eclipse.e4.ui.internal.di.UIEventObjectSupplier$UIEventHandler@5f32ab17
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.ClassCastException: org.eclipse.e4.ui.model.application.ui.advanced.impl.AreaImpl cannot be cast to org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:68)
at org.eclipse.e4.ui.internal.di.UIEventObjectSupplier$UIEventHandler$1.run(UIEventObjectSupplier.java:56)

So, here’s the description how to use the editor correctly:

A) Define an Area under “Shared Elements” in the Application.e4xmi:

Application.e4xmi Area

B) Insert a “Part Stack” called “org.eclipse.e4.primaryDataStack”:

Application.e4xmi Part Stack

Add the tags:

  • newtablook
  • org.eclipse.e4.primaryDataStack
  • EditorStack
  • NoAutoCollapse

Application.e4xmi Part Stack Tags

C) Import the Area in the fragment.e4xmi:

fragment.e4xmi Import

D) Reference the Area via a Placeholder called “org.eclipse.ui.editorss”:

fragment.e4xmi Placeholder

It’s important that the Placeholder gets the ID “org.eclipse.ui.editorss”. The Area must be referenced in other perspectives via the same placeholder ID “org.eclipse.ui.editorss”.

E) The 3.x editor is used when elements are opened via the “Project Explorer”:

3.x Editor

F) The 4.x editor is used when elements are opened via 4.x editor parts:

4.x Editor

That’s it!

Advertisements

About Philip Wenig

Founder of OpenChrom
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s