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

Bug 330055

Summary: [Contributions] MenuService contributes Items into CoolbarManager not correctly when a workbench site has multiple contribution manager
Product: [Eclipse Project] Platform Reporter: Jeeeyul Lee <jeeeyul>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED INVALID QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: prakash
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Screen shot
none
bug example project
none
screenshot after toolbar id changed none

Description Jeeeyul Lee CLA 2010-11-12 01:13:26 EST
Hello,

I used 2 Coolbar managers in an EditorPart, and I'v let MenuService contribute through Menu Extensions.
like this:

this.tagToolbarManager = new CoolBarManager(SWT.FLAT);
getMenuService().populateContributionManager(this.tagToolbar Manager, TOOLBAR_URI_TAG_EDIOR);

this.termsToolbarManager = new CoolBarManager(SWT.FLAT);
getMenuService().populateContributionManager(this.termsToolb arManager, TOOLBAR_URI_TERMS_EDITOR);

but menu service contributed same toolbar contents for 2 toolbar even each has different Menu URI.
Contents seems to merged from contents of two Menu URIs.

It works like URIs are same.
URIs are "toolbar:termsEditor" and "toolbar:tagsEditor";

I found this on eclipse 3.6, and This problem was not exist on Eclipse 3.4.


Reproduce Step:
 1. in EditorPart or in ViewPart create two CoolbarManager and let menu service contribute items with different menu URI.
 2. Add different command into each menu uri with menu extension.
    (You have to add parent toolbar node because it is coolbar)
 3. run. You will see same contents from two coolbar.

OR:
 1. Download attachment and import existing project.
 2. run plugin.
 3. select any file in workspace and select "open with / other.. / internal / Bug Sample Editor"
 4. or just open bug sample view.
Comment 1 Jeeeyul Lee CLA 2010-11-12 01:17:28 EST
Created attachment 182955 [details]
Screen shot
Comment 2 Jeeeyul Lee CLA 2010-11-12 01:18:54 EST
Created attachment 182956 [details]
bug example project
Comment 3 Prakash Rangaraj CLA 2010-11-12 01:38:55 EST
  <menuContribution
        allPopups="false"
        locationURI="toolbar:example/first">
     <toolbar
           id="group1">
        <command
              commandId="org.eclipse.ui.help.aboutAction"
              style="push">
        </command>
     </toolbar>
  </menuContribution>
  <menuContribution
        allPopups="false"
        locationURI="toolbar:example/second">
     <toolbar
           id="group1">
        <command
              commandId="org.eclipse.ui.edit.delete"
              style="push">
        </command>
     </toolbar>
  </menuContribution>


As per the contribution, the toolbar ids are not unique, so both the contributions are added to the toolbar. This is correct behaviour. Not sure how this was working in 3.4 though. Probably a bug in 3.4 fixed in later releases.
Comment 4 Jeeeyul Lee CLA 2010-11-12 02:19:24 EST
Prakash, That was just my mis typing.

Even toolbar ids are not same,
result will not change.

please try it.
Comment 5 Prakash Rangaraj CLA 2010-11-12 02:28:05 EST
Created attachment 182961 [details]
screenshot after toolbar id changed

(In reply to comment #4)
> Even toolbar ids are not same,
> result will not change.

    I tried with 

  <menuContribution
        allPopups="false"
        locationURI="toolbar:example/first">
     <toolbar
           id="group1">
        <command
              commandId="org.eclipse.ui.help.aboutAction"
              style="push">
        </command>
     </toolbar>
  </menuContribution>
  <menuContribution
        allPopups="false"
        locationURI="toolbar:example/second">
     <toolbar
           id="group2">
        <command
              commandId="org.eclipse.ui.edit.delete"
              style="push">
        </command>
     </toolbar>
  </menuContribution>


and get it correctly as in the screenshot.
Comment 6 Jeeeyul Lee CLA 2010-11-12 02:34:09 EST
I specified problem more detail.

when toolbar id starts with "toolbar:"
It works incorrectly.

please try with this again:

   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="toolbar:example/first">
         <toolbar
               id="toolbar:AAA">
            <command
                  commandId="org.eclipse.ui.help.aboutAction"
                  style="push">
            </command>
         </toolbar>
      </menuContribution>
      <menuContribution
            allPopups="false"
            locationURI="toolbar:example/second">
         <toolbar
               id="toolbar:BBB">
            <command
                  commandId="org.eclipse.ui.edit.delete"
                  style="push">
            </command>
         </toolbar>
      </menuContribution>
   </extension>

anyway I can correct my problem now.
but I can't sure it's bug or not.
Comment 7 Prakash Rangaraj CLA 2010-11-12 02:52:01 EST
(In reply to comment #6)
>          <toolbar
>                id="toolbar:AAA">


   The toolbar id isn't a URI and doesn't have to start with "toolbar:"
Comment 8 Jeeeyul Lee CLA 2010-11-12 04:27:45 EST
Thanks, You're right. id is just query part of menu uri.
But I think, it also can be start with any string which is just unique.

can I close this issue?
Comment 9 Paul Webster CLA 2010-11-12 06:41:42 EST
(In reply to comment #8)
> can I close this issue?

Yes, please.
PW