I have a Plug-in Project defining a product with an e4 Application Model, and another Plug-in Project that extends the application by some menu items.

When defining commands and handlers in the fragment XMI, I have to specify a String Model Fragment with the feature name "commands" of the element id "<my application id>".

So defining commands/handlers within an e4 Model Fragment does always refer to a single application. So for the definition of common menu entries, I have to use extension points, is that correct?
And e4 Model Fragments within a plugin make the plugin dependent from launching a special product, right?

Ralf Zahn wrote:
> When defining commands and handlers in the fragment XMI, I have to
> specify a String Model Fragment with the feature name "commands" of the
> element id "<my application id>".
>
> So defining commands/handlers within an e4 Model Fragment does always
> refer to a single application. So for the definition of common menu
> entries, I have to use extension points, is that correct?
> And e4 Model Fragments within a plugin make the plugin dependent from
> launching a special product, right?

You are right. Currently the contribution system expects you to know the
ID of the element but for 4.1 I plan to improve it in a way that you can
use XPath expressions one could then contribute to the
MApplication-Element through "/MApplication", ... .

In 4.0 you can use a Processor to generically identify the root element
to contribute a command and do much more fancy contributions (e.g. based
upon a user credential, ...).

If you are not sure how this looks like you can take a look at my
Live-ModelTooling integration which does exactly what you asking for here.

The source is available in:
e4/org.eclipse.e4.tools/bundles/org.eclipse.e4.tools.emf.liv eeditor and
the thing you are interested in is the:
* ModelProcessor
* plugin.xml

Tom

Am 31.08.10 08:44, schrieb Ralf Zahn:
> Hi,
>
> I have a Plug-in Project defining a product with an e4 Application
> Model, and another Plug-in Project that extends the application by some
> menu items.
>
> When defining commands and handlers in the fragment XMI, I have to
> specify a String Model Fragment with the feature name "commands" of the
> element id "<my application id>".
>
> So defining commands/handlers within an e4 Model Fragment does always
> refer to a single application. So for the definition of common menu
> entries, I have to use extension points, is that correct?
> And e4 Model Fragments within a plugin make the plugin dependent from
> launching a special product, right?
>
> Hope I expressed the problem understandably.