Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 37796

Summary: [Contributions] interactions: MenuManager findMenuUsingPath not working for action set items
Product: [Eclipse Project] Platform Reporter: Lynne Kues <lynne_kues>
Component: UIAssignee: Paul Webster <pwebster>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: joanne.woo
Version: 2.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
test case none

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