Search code examples
eclipsee4eclipse-emfemfeclipse-emf-ecore

When trying to create Application Menus using Model Fragments (XMI Model) in Eclipse e4. The created menu is getting disabled by default


I'm actually migrating my Workspace from 3.x to Eclipse e4 version. I created one new menu using Model Fragments as described in the "Section 7.6. Creating a model contribution" under the following link .

With these steps, the menu item was getting created succesfully but it remains disabled :( even though the enabled [] check-box is checked by default.

What could be the reason behind this ??

The Fragment.e4xmi code which I've used is :

 <fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_c8CZsFVoEeWXIM1iTwboYg">
 <fragments xsi:type="fragment:StringModelFragment" xmi:id="_ylQWEFYyEeWz-PkqHRIpVg" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="commands:Command" xmi:id="_CqXYcFYzEeWz-PkqHRIpVg" elementId="test_emf_project.command.sample" commandName="Sample"/>
  </fragments>
 <fragments xsi:type="fragment:StringModelFragment" xmi:id="_HPsk0FYzEeWz-PkqHRIpVg" featurename="Handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="commands:Handler" xmi:id="_KcOLMFYzEeWz-PkqHRIpVg" elementId="test_emf_project.handler.0" contributionURI="bundleclass://Test_EMF_Project/com.ami.launch.HandlerImplementation" command="_CqXYcFYzEeWz-PkqHRIpVg"/>
  </fragments>
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_Q9KvsFYzEeWz-PkqHRIpVg" featurename="menuContributions" parentElementId="org.eclipse.e4.legacy.ide.application">
  <elements xsi:type="menu:MenuContribution" xmi:id="_VRqDsFYzEeWz-PkqHRIpVg" elementId="test_emf_project.menucontribution.0" parentId="org.eclipse.ui.main.menu">
    <children xsi:type="menu:Menu" xmi:id="_gzz4QFYzEeWz-PkqHRIpVg" elementId="test_emf_project.menu.custommenu" label="Custommenu">
     <children xsi:type="menu:HandledMenuItem" xmi:id="_vHCtUFYzEeWz-PkqHRIpVg" elementId="test_emf_project.handledmenuitem.openDialog" label="Open Dialog" iconURI="" command="_CqXYcFYzEeWz-PkqHRIpVg"/>
   </children>
  </elements>
 </fragments>
</fragment:ModelFragments>

Solution

  • Your 'Feature Name' for the handlers fragment is set to Handlers - it should be all lower case handlers.