Bug 53171 - [Contributions] adapters: Sometimes multiple instances of menu shown when multi-selecting hetrogenous items
Summary: [Contributions] adapters: Sometimes multiple instances of menu shown when mul...
Status: RESOLVED DUPLICATE of bug 133749
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.2   Edit
Assignee: Duong Nguyen CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2004-02-26 08:55 EST by Heather Fraser-Dubé CLA
Modified: 2006-05-15 14:33 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Heather Fraser-Dubé CLA 2004-02-26 08:55:22 EST
I have a popup menu that is to be shown for every object that implements 
ICElement.  When I multi-select 2 items which implement ICElement but are 
hetrogeneous types, I am seeing 3 instances of each of my menu items.  All I 
want/need is 1 instance.

My xml looks like:
      <objectContribution
            objectClass="org.eclipse.cdt.core.model.ICElement"
            id="myPopup">
         <menu
               label="%My_Menu_name"
               path="additions"
               id="myMenu">
            <separator
                  name="addToNew">
            </separator>
         </menu>
         <action
               label="%Action1.actionLabel"
               class="com.ibm.xtools.viz.ui.internal.actions.AddToNewAction"
               menubarPath="myMenu/addToNew"
               id="addToNewAction">
         </action>
      </objectContribution>

When looking into the code, 
org.eclipse.ui.internal.ObjectActionContributorManager.contributeObjectActions
(...)  will calculate the common class and interfaces  (in getCommonClasses).  
In my case, the 2 items selected implement ICElement but are different classes 
org.eclipse.cdt.internal.core.model.Enumeration and 
org.eclipse.cdt.internal.core.model.Structure.  

getCommonClasses identifies (correctly) the common classes/interfaces are:
org.eclipse.cdt.internal.core.model.SourceManipulation
org.eclipse.cdt.core.model.IVariableDeclaration
org.eclipse.cdt.core.model.IDeclaration

contributeObjectActions then iterates over these classes/iterations to 
determine contributors and adds them to the list.  Each of these 
class/interfaces implement ICElement.  So I end up with 3 contributors in the 
list of the same thing.

What we think it should do is add a contributor to the list only if it is not 
already in the list.
Comment 1 Heather Fraser-Dubé CLA 2004-10-08 14:37:02 EDT
It is important to us to have this fixed.  The context menus are really ugly 
when the each menu contribution occurs 3 times for the selected elements.  I 
was also not able to find any work around for this.
Comment 2 Heather Fraser-Dubé CLA 2004-10-08 14:45:15 EDT
Sorry, figured out that I need to change Severity not priority (even though it 
is higher than P4 priority for us).
Comment 3 Tod Creasey CLA 2004-10-08 14:55:46 EDT
Upgrading to P2. If you have any suggestions about this please attach a patch.
Comment 4 Douglas Pollock CLA 2005-04-28 15:05:22 EDT
A lot of this code has change.  Is this still a problem?
Comment 5 Jean-Michel Lemieux CLA 2005-04-28 23:13:42 EDT
I'm pretty sure this has been fixed. When I changed this code early in 3.0, I
remember fixing some of these duplicate issues. Hey Heather works with us now,
so we should ask her if she can still reproduce.
Comment 6 Douglas Pollock CLA 2005-04-29 10:48:40 EDT
Heather: does this work for you now?
Comment 7 Heather Fraser-Dubé CLA 2005-05-03 08:20:23 EDT
Yes it still occurs.  Using CDT plugin, I created a project with a struct, 
enum and class.  When I multi-select the three of them, the contribution 
described earlier occurs multiple times.  I did an about and it says the 
versions of org.eclipse.ui are 3.0.2 & 3.0.1.
Comment 8 Douglas Pollock CLA 2005-05-03 11:13:52 EDT
What happens if you test against a recent 3.1 build (e.g., N20050503-0010)?
Comment 9 Douglas Pollock CLA 2005-09-01 12:39:30 EDT
Investigate for 3.2 
Comment 10 Michael Van Meekeren CLA 2006-04-21 13:56:14 EDT
Moving Dougs bugs
Comment 11 Eric Moffatt CLA 2006-05-15 14:33:24 EDT

*** This bug has been marked as a duplicate of 133749 ***