Now I thought about introducing the menu to the workbench model.
It is possible to add menus to parts or create menu contributions via
the model editor.
So what is the proper way to (combine and) show them up in this case?
That only succeeds, when the menu is defined in the "Menus" section of
the part and is of type MPopupMenu.
I had to add the type as an attribute in the e4xmi manually (the e4
Workbenchmodel editor doesn't seem to support popup menus there yet):
<menus xsi:type="menu:PopupMenu" .. > .. </menus>
Now the context menu is showing up, but the set of menu items is still
My question now is whether I could use visibleWhen-Expressions to show /
hide single items depending on the current selection in the tree.
I don't know how and where to define those expressions, so
I would appreciate if anyone could give me a simple example.
Paul Webster Messages: 6859 Registered: July 2009 Location: Ottawa
Check out the org.eclipse.e4.demo.simpleide.navigator project.
This is the context menu view with a visibleWhen example:
Jens Piegsa Messages: 16 Registered: July 2009 Location: Germany
Thank you very much! Now, my context menu lives up to its name.
* I have to define the core expression via the extension point
* they must refer to variables that I modify by the part's
IEclipseContext in an ISelectionChangedListener of the TreeViewer
* I should use Menu Contributions, since "normal" menu items won't
disappear again (when the visibleWhen expression is no longer true)
* DirectMenuItems don't call the @CanExecute-Method, therefore I have to
* An entire Menu Contribution can be addressed by a visibleWhen
expression (rather than every single item)
Proposals for the e4 Workbenchmodel Editor:
* visibleWhen expressions should be assignable to Menu Contributions
* Popup Menus should be insertable into Parts
* Ctrl+X in a text field (on the right) should not cut the entire item
(on the left) ^^
> Proposals for the e4 Workbenchmodel Editor:
> * visibleWhen expressions should be assignable to Menu Contributions
Could you file a bug an CC me
> * Popup Menus should be insertable into Parts
Could you file a bug and CC me
> * Ctrl+X in a text field (on the right) should not cut the entire item
> (on the left) ^^
There is already a bug for the incorrect C&P which is a subject to
improve like the rest of the Model Editor but my day job didn't give me
any time to work on this which is at least *in my personal opinion a
real problem* because without tooling our fantastic new concept of the
modeled workbench will not be understood/manageable by software
It would be the same fun as you'd have to write bundles without PDE but
I currently don't see how we (at least) I can fix this because no other
party has really invested into this area (I'm talking about time which
is equal to money) or stepped up to support my work on it.