Bug 529924 - [Model] Menu defined in model fragment cannot be extended
Summary: [Model] Menu defined in model fragment cannot be extended
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 562497
  Show dependency tree
 
Reported: 2018-01-17 02:23 EST by Björn Mårtensson CLA
Modified: 2020-04-26 13:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Mårtensson CLA 2018-01-17 02:23:51 EST
When a model fragment specifies a position relative to some other item, any new model fragments extending an item inside it won't show up.

I have plugin for an RCP application which adds a menu to the main menu bar. Since we want this menu to appear between a bunch of other menus already present in the application model, we specify a position in list for the menu's model fragment like this:

  Extended Element ID * | menu:org.eclipse.ui.main.menu
         Feature Name * | children
       Position in list | after:com.company.application.gui.menu.othermenu

In this model fragment, we define a single Menu like this:

  ID    | com.company.ourplugin.gui.menu.ourmenu
  Label | Our Menu

So far everything works as expected, the "Our Menu" menu appears after the "Other Menu" menu on the menu bar and all items defined in the same model fragment are visible. However, I've created a second plugin in which I want to add a submenu to "Our Menu", creating a model fragment as following:

  Extended Element ID * | com.company.ourplugin.gui.menu.ourmenu
         Feature Name * | children
       Position in list | 

... with a single Menu like this:

  ID    | com.company.myplugin.gui.menu.mysubmenu
  Label | My Submenu

When I start the application with this plugin included, "My Submenu" doesn't appear in "Our Menu". However, if I empty the "Position in list field" of the model fragment containing "Our Menu", "My Submenu" appears as it should. The same applies if I use an absolute position, such as "first" or "index:".

Further experimentation shows the problem does not depend on having separate plugins, as it persisted even if I extended the model fragment containing "My Submenu" into the fragment.e4xmi file containing "Our Menu" (without merging the model fragments). Neither is it restricted to top level menus, as the same happens if I make "Our Menu" a submenu of some other menu (and give it a position relative some other item in it).
Comment 1 Björn Mårtensson CLA 2018-02-16 10:56:00 EST
Bug still exists in Eclipse 4.7.2

Furthermore, the fact that fragment extension worked with absolute positions seems to have been a  fluke, because when we continued developing our application, the extending menu parts stopped working altogether. Now we can't make "My Submenu" appear in "Our Menu" at all.

I have updated the summary and the version.