Bug 37796 - [Contributions] interactions: MenuManager findMenuUsingPath not working for action set items
Summary: [Contributions] interactions: MenuManager findMenuUsingPath not working for a...
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-16 18:49 EDT by Lynne Kues CLA
Modified: 2007-06-20 13:13 EDT (History)
1 user (show)

See Also:


Attachments
test case (992 bytes, text/plain)
2003-05-16 19:03 EDT, Lynne Kues CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lynne Kues CLA 2003-05-16 18:49:26 EDT
 
Comment 1 Lynne Kues CLA 2003-05-16 19:00:16 EDT
Turn on all action sets.
Run the attached code snippet.  

Notice that findMenuUsingPath does not work for menus created by action sets.

The Workbench MenuManager includes ActionSetContributionItems, which are 
subcontribution items which wrap MenuManagers.  The findMenuUsingPath code does 
not take this into account.  I believe the find code should be something like 
the following.

  String id = path;
  String rest = null;
  int separator = path.indexOf('/');
  if (separator != -1) {
    id = path.substring(0, separator);
    rest = path.substring(separator + 1);
  } 
  IContributionItem item = super.find(id);
  IMenuManager menu = null;
  MenuManager manager = null;
  if (item instanceof MenuManager) {
    manager = (MenuManager) item;
    if (rest != null) {
      menu = manager.findMenuUsingPath(rest);
    } else {
      menu = manager;
    }
  } else if (item instanceof SubContributionItem) {
    SubContributionItem subContributionItem = (SubContributionItem)item;
    IContributionItem innerItem = subContributionItem.getInnerItem();
    if (innerItem instanceof MenuManager) {
      manager = (MenuManager)innerItem;
      if (rest != null) {
        menu = manager.findMenuUsingPath(rest);
      } else {
        menu = manager;
      }
    } 
  } else {
    return null;
  }
  return menu;
Comment 2 Lynne Kues CLA 2003-05-16 19:02:20 EDT
Simon, could you comment on this?  I can fix it up if necessary, but I wanted 
to double check that my assumptions are correct.  
Comment 3 Lynne Kues CLA 2003-05-16 19:03:01 EDT
Created attachment 4896 [details]
test case
Comment 4 Simon Arsenault CLA 2003-05-20 14:08:36 EDT
Lynne, is there a known problem in Eclipse that is related to this? Or is it 
just something you found while looking at the code?

If the latter, then I rather wait a while. We are looking into reworking the 
action contribution story. Current implementation is way to complicated, not to 
mention "fragile"!
Comment 5 Lynne Kues CLA 2003-05-20 15:34:52 EDT
No it's not causing a problem.  I worked around it for changes I am doing to 
Customize Perspective, so there is no rush to fix this now.
Comment 6 Michael Van Meekeren CLA 2006-04-21 13:56:26 EDT
Moving Dougs bugs
Comment 7 Paul Webster CLA 2007-04-05 19:02:29 EDT
Assigning to component owner
PW
Comment 8 Paul Webster CLA 2007-06-20 13:13:57 EDT
This item has been fixed/superceded by the menu contribution mechanism - bug 154130