Bug 405262 - [Contributions] Duplicate context menu entries in XML editor source tab
Summary: [Contributions] Duplicate context menu entries in XML editor source tab
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2.2   Edit
Hardware: PC Windows 7
: P3 normal with 5 votes (vote)
Target Milestone: 4.2.2+   Edit
Assignee: Paul Webster CLA
QA Contact: Wojciech Sudol CLA
URL:
Whiteboard:
Keywords:
: 405859 413176 427785 429117 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-09 06:39 EDT by Robert Klemme CLA
Modified: 2015-03-25 12:36 EDT (History)
21 users (show)

See Also:


Attachments
Screenshot of the phenomenon (69.85 KB, image/png)
2013-04-09 06:40 EDT, Robert Klemme CLA
no flags Details
bundles.info file (107.42 KB, text/plain)
2013-04-15 02:51 EDT, Robert Klemme CLA
no flags Details
snapshot of team menu with duplicate entries (370.25 KB, image/png)
2013-05-23 03:35 EDT, Christian Plätzinger CLA
no flags Details
Eclipse-4.3.0-egit (43.62 KB, image/png)
2013-07-04 16:59 EDT, Espen Klæboe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Klemme CLA 2013-04-09 06:39:12 EDT
There are duplicate entries in the "Team" context menu when in an XML file (but not at the last position of the file).  I'll add a screenshot to show what I mean in a minute.


Product:	Subversive

Version:	1.0.1.I20130306-1700

SVN Client:	org.eclipse.team.svn.connector.svnkit16 3.0.1.I20130301-1700 SVN/1.6.18 SVNKit/1.3.8 (http://svnkit.com/) r9269_v20120525_1825

JVM Properties:
{java.runtime.name=Java(TM) SE Runtime Environment, java.runtime.version=1.7.0_17-b02, java.vendor=Oracle Corporation, line.separator=
 , java.class.version=51.0, os.name=Windows 7, os.arch=amd64, user.country=DE, os.version=6.1, eclipse.commands=-os win32 -ws win32 -arch x86_64 -showsplash C:\Users\rklemme\Applications\eclipse\\plugins\org.eclipse.platform_4.2.2.v201302041200\splash.bmp -launcher C:\Users\rklemme\Applications\eclipse\eclipse.exe -name Eclipse --launcher.library C:\Users\rklemme\Applications\eclipse\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807\eclipse_1503.dll -startup C:\Users\rklemme\Applications\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.overrideVmargs -exitdata 1164_98 -product org.eclipse.epp.package.jee.product -vm C:\Windows\system32\javaw.exe , java.version=1.7.0_17, osgi.framework.version=3.8.2.v20130124-134944, file.separator=\, java.vm.info=mixed mode, path.separator=;, user.timezone=Europe/Berlin, user.language=de, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding=Cp1252}




-- Configuration Details --
Product: Eclipse 1.5.2.20130110-1126 (org.eclipse.epp.package.jee.product)
Installed Features:
 org.eclipse.team.svn 1.0.1.I20130306-1700
Comment 1 Robert Klemme CLA 2013-04-09 06:40:16 EDT
Created attachment 229492 [details]
Screenshot of the phenomenon

The screenshow shows that entries are showing up multiple times on the right side.
Comment 2 Robert Klemme CLA 2013-04-09 09:14:19 EDT
Adjusted importance.
Comment 3 Alexander Gurov CLA 2013-04-14 11:39:43 EDT
It seems there are different kinds of XML editors. The one in WTP does not show such behaviour. Could you please specify which XML editor is it?
Comment 4 Robert Klemme CLA 2013-04-15 02:51:33 EDT
Created attachment 229707 [details]
bundles.info file

In reply to comment 3:

Attaching bundles.info for reference.  Please let me know if you need more information about my installation.

I think it's the one from WTP:
Eclipse XML Editors and Tools

Version: 3.4.2.v201211061806-7H7GFeJDxumUrsn5qkiQgOEhsz0p60HAmPyU6VX
Build id: 20130208151217

(c) Copyright Eclipse contributors and others 2005, 2009.  All rights reserved.
Visit http://www.eclipse.org/webtools

At least I am not aware of any other XML editor I have installed.  The only custom items are
- JFormDesigner
- Code Collaborator

Maybe it's a bad interaction between plugins.
Comment 5 count negative CLA 2013-05-16 10:02:15 EDT
Win7-64bit-3.8&4.3m7 without subversion plugins too. 
Checkout XML file with CVS, contextmenu team shows double entries. Clicking on show history produces a stack overflow.
Comment 6 Alexander Gurov CLA 2013-05-19 01:29:47 EDT
Since the problem happens with CVS too it is more likely that it is related to the Platform/UI.
Also it is possbile the problem has something to do with the bug 395839 (but I'm not sure about this one).
It is probably not important, but anyway: I was unable to reproduce the issue in Win32 environment.
Comment 7 count negative CLA 2013-05-19 02:57:43 EDT
yepp, tried it at home on win32 (4.2.2 M20130204-1200) with a subclipse project on a plugin.xml file with 9 tabs. Everythings working fine on win32!
Comment 8 Paul Webster CLA 2013-05-22 13:42:27 EDT
(In reply to comment #5)
> Win7-64bit-3.8&4.3m7 without subversion plugins too. 
> Checkout XML file with CVS, contextmenu team shows double entries. Clicking
> on show history produces a stack overflow.

Do you have the first part of the stack overflow log?

PW
Comment 9 Jörg Thönnes CLA 2013-05-23 03:24:27 EDT
Hello, a colleague of mine has been also hit by this issue.

We are using Eclipse 3.8.2 on Kubunto 12.04 LTS together with Subversive with 20130306-1700 version.
Comment 10 Christian Plätzinger CLA 2013-05-23 03:35:01 EDT
Created attachment 231347 [details]
snapshot of team menu with duplicate entries

I observed this issue too. Occurs only when editing XML files. Could reproduce it with the XML editor as well as with the Maven pom editor.
Comment 11 count negative CLA 2013-05-24 03:15:25 EDT
(In reply to comment #8)
> (In reply to comment #5)
> > Win7-64bit-3.8&4.3m7 without subversion plugins too. 
> > Checkout XML file with CVS, contextmenu team shows double entries. Clicking
> > on show history produces a stack overflow.
> 
> Do you have the first part of the stack overflow log?
> 
> PW


!ENTRY org.eclipse.ui 4 0 2013-05-24 09:12:27.210
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.StackOverflowError
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5825)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2440)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5913)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4989)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2440)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:436)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5825)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2440)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5913)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4989)
	at org.eclipse.swt.internal.win32.OS.SendMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.SendMessage(OS.java:3290)
	at org.eclipse.swt.widgets.Table.setScrollWidth(Table.java:4866)
	at org.eclipse.swt.widgets.Table.setScrollWidth(Table.java:4977)
	at org.eclipse.swt.widgets.Table.setTableEmpty(Table.java:5236)
	at org.eclipse.swt.widgets.Table.removeAll(Table.java:3319)
	at org.eclipse.jface.viewers.TableViewer.doRemoveAll(TableViewer.java:265)
	at org.eclipse.jface.viewers.AbstractTableViewer.internalRefreshAll(AbstractTableViewer.java:745)
	at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:649)
	at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:636)
	at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1508)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1443)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1404)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1506)
	at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:537)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1465)
	at org.eclipse.jface.viewers.ContentViewer.setLabelProvider(ContentViewer.java:311)
	at org.eclipse.jface.viewers.StructuredViewer.setLabelProvider(StructuredViewer.java:2215)
	at org.eclipse.jface.viewers.ColumnViewer.setLabelProvider(ColumnViewer.java:365)
	at org.eclipse.team.internal.ccvs.ui.CVSHistoryPage.createTagTable(CVSHistoryPage.java:359)
	at org.eclipse.team.internal.ccvs.ui.CVSHistoryPage.createControl(CVSHistoryPage.java:239)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.doCreatePage(GenericHistoryView.java:697)
	at org.eclipse.ui.part.PageBookView.createPage(PageBookView.java:408)
	at org.eclipse.ui.part.PageBookView.partActivated(PageBookView.java:760)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.showHistoryPageFor(GenericHistoryView.java:559)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.showHistory(GenericHistoryView.java:818)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.access$3(GenericHistoryView.java:814)
	at org.eclipse.team.internal.ui.history.GenericHistoryView$2.selectionChanged(GenericHistoryView.java:364)
	at org.eclipse.ui.internal.AbstractSelectionService.firePostSelection(AbstractSelectionService.java:179)
	at org.eclipse.ui.internal.AbstractSelectionService$2.selectionChanged(AbstractSelectionService.java:71)
	at org.eclipse.ui.part.MultiPageSelectionProvider$1.run(MultiPageSelectionProvider.java:110)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.part.MultiPageSelectionProvider.fireEventChange(MultiPageSelectionProvider.java:108)
	at org.eclipse.ui.part.MultiPageSelectionProvider.firePostSelectionChanged(MultiPageSelectionProvider.java:102)
	at org.eclipse.ui.part.MultiPageEditorPart.pageChange(MultiPageEditorPart.java:853)
	at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.pageChange(XMLMultiPageEditorPart.java:1079)
	at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:1067)
	at org.eclipse.ui.part.MultiPageEditorPart.setActiveEditor(MultiPageEditorPart.java:1203)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findTextEditorPart(RevisionAnnotationController.java:223)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findTextEditor(RevisionAnnotationController.java:206)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findOpenTextEditorForFile(RevisionAnnotationController.java:200)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findOpenTextEditorFor(RevisionAnnotationController.java:248)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findEditorRevisonRulerColumn(RevisionAnnotationController.java:270)
	at org.eclipse.team.ui.history.RevisionAnnotationController.<init>(RevisionAnnotationController.java:309)
	at org.eclipse.team.internal.ccvs.ui.CVSHistoryPage$CVSRevisionAnnotationController.<init>(CVSHistoryPage.java:1405)
	at org.eclipse.team.internal.ccvs.ui.CVSHistoryPage.linkWithEditor(CVSHistoryPage.java:2016)
	at org.eclipse.team.internal.ccvs.ui.CVSHistoryPage.inputSet(CVSHistoryPage.java:1985)
	at org.eclipse.team.ui.history.HistoryPage.setInput(HistoryPage.java:59)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.doCreatePage(GenericHistoryView.java:698)
	at org.eclipse.ui.part.PageBookView.createPage(PageBookView.java:408)
	at org.eclipse.ui.part.PageBookView.partActivated(PageBookView.java:760)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.showHistoryPageFor(GenericHistoryView.java:559)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.showHistory(GenericHistoryView.java:818)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.access$3(GenericHistoryView.java:814)
	at org.eclipse.team.internal.ui.history.GenericHistoryView$2.selectionChanged(GenericHistoryView.java:364)
	at org.eclipse.ui.internal.AbstractSelectionService.firePostSelection(AbstractSelectionService.java:179)
	at org.eclipse.ui.internal.AbstractSelectionService$2.selectionChanged(AbstractSelectionService.java:71)
	at org.eclipse.ui.part.MultiPageSelectionProvider$1.run(MultiPageSelectionProvider.java:110)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.part.MultiPageSelectionProvider.fireEventChange(MultiPageSelectionProvider.java:108)
	at org.eclipse.ui.part.MultiPageSelectionProvider.firePostSelectionChanged(MultiPageSelectionProvider.java:102)
	at org.eclipse.ui.part.MultiPageEditorPart.pageChange(MultiPageEditorPart.java:853)
	at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.pageChange(XMLMultiPageEditorPart.java:1079)
	at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:1067)
	at org.eclipse.ui.part.MultiPageEditorPart.setActiveEditor(MultiPageEditorPart.java:1203)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findTextEditorPart(RevisionAnnotationController.java:223)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findTextEditor(RevisionAnnotationController.java:206)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findOpenTextEditorForFile(RevisionAnnotationController.java:200)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findOpenTextEditorFor(RevisionAnnotationController.java:248)
	at org.eclipse.team.ui.history.RevisionAnnotationController.findEditorRevisonRulerColumn(RevisionAnnotationController.java:270)
	at org.eclipse.team.ui.history.RevisionAnnotationController.<init>(RevisionAnnotationController.java:309)
	at org.eclipse.team.internal.ccvs.ui.CVSHistoryPage$CVSRevisionAnnotationController.<init>(CVSHistoryPage.java:1405)
	at org.eclipse.team.internal.ccvs.ui.CVSHistoryPage.linkWithEditor(CVSHistoryPage.java:2016)
	at org.eclipse.team.internal.ccvs.ui.CVSHistoryPage.inputSet(CVSHistoryPage.java:1985)
	at org.eclipse.team.ui.history.HistoryPage.setInput(HistoryPage.java:59)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.doCreatePage(GenericHistoryView.java:698)
	at org.eclipse.ui.part.PageBookView.createPage(PageBookView.java:408)
	at org.eclipse.ui.part.PageBookView.partActivated(PageBookView.java:760)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.showHistoryPageFor(GenericHistoryView.java:559)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.showHistory(GenericHistoryView.java:818)
	at org.eclipse.team.internal.ui.history.GenericHistoryView.access$3(GenericHistoryView.java:814)
	at org.eclipse.team.internal.ui.history.GenericHistoryView$2.selectionChanged(GenericHistoryView.java:364)
	at org.eclipse.ui.internal.AbstractSelectionService.firePostSelection(AbstractSelectionService.java:179)
	at org.eclipse.ui.internal.AbstractSelectionService$2.selectionChanged(AbstractSelectionService.java:71)
	at org.eclipse.ui.part.MultiPageSelectionProvider$1.run(MultiPageSelectionProvider.java:110)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
Comment 12 Espen Klæboe CLA 2013-07-04 16:58:25 EDT
Reproduced this with 4.2.3 and Egit today.

See screenshot.
Comment 13 Espen Klæboe CLA 2013-07-04 16:59:42 EDT
Created attachment 233094 [details]
Eclipse-4.3.0-egit
Comment 14 Espen Klæboe CLA 2013-07-04 17:01:31 EDT
(In reply to comment #12)
> Reproduced this with 4.2.3 and Egit today.
> 
> See screenshot.

Sorry; I ment of course 4.3.0
Comment 15 Dani Megert CLA 2013-07-10 07:59:08 EDT
(In reply to comment #5)
> Win7-64bit-3.8&4.3m7 without subversion plugins too. 
> Checkout XML file with CVS, contextmenu team shows double entries. Clicking
> on show history produces a stack overflow.

The StackOverflow is bug bug 404873.
Comment 16 Robin Stocker CLA 2013-07-17 13:05:41 EDT
*** Bug 413176 has been marked as a duplicate of this bug. ***
Comment 17 Robin Stocker CLA 2013-07-17 13:09:19 EDT
I can reproduce this on Linux/GTK2. And it's not only Team menu entries, but also others (e.g. Mylyn, Checkstyle).
Comment 18 Joseph Carroll CLA 2013-07-17 14:43:03 EDT
This is a duplicate of bug 404873.
Comment 19 Joseph Carroll CLA 2013-07-17 14:52:14 EDT
See bug 404873 attachment 232134 [details] for a log with the same exception.
Comment 20 Dani Megert CLA 2013-07-22 09:00:39 EDT
(In reply to comment #18)
> This is a duplicate of bug 404873.

I verified the duplication with the steps from bug 404873 comment 19.

*** This bug has been marked as a duplicate of bug 404873 ***
Comment 21 Robin Stocker CLA 2013-07-22 09:24:59 EDT
Is this really a duplicate? Is the StackOverflowError the reason for the duplicate context menu entries?
Comment 22 Dani Megert CLA 2013-07-22 09:28:00 EDT
(In reply to comment #21)
> Is this really a duplicate? Is the StackOverflowError the reason for the
> duplicate context menu entries?

Well, at least the duplication is there after the stack overflow. If you have other exact steps that lead to the duplication, they are very welcome ;-).
Comment 23 Robin Stocker CLA 2013-07-22 09:41:24 EDT
(In reply to comment #22)
> (In reply to comment #21)
> > Is this really a duplicate? Is the StackOverflowError the reason for the
> > duplicate context menu entries?
> 
> Well, at least the duplication is there after the stack overflow. If you
> have other exact steps that lead to the duplication, they are very welcome
> ;-).

I checked again. Here are the steps, there is no StackOverflowError involved:

1. Download a fresh Eclipse 4.3 (used the RCP version here)
2. Start it with a new workspace
3. Create a new general project
4. Create a file test.xml, switch to the source tab and add this content:

<?xml version='1.0' encoding='UTF-8'?>
<root></root>

5. Right click on the second line (you may have to bring the context menu up a few times)

The context menu now shows some (but not all) entries twice: "Remove from Context" and the entries in "Team", "Compare With" and "Replace With" menus
Comment 24 Dani Megert CLA 2013-07-22 09:43:36 EDT
(In reply to comment #23)
> (In reply to comment #22)
> > (In reply to comment #21)
> > > Is this really a duplicate? Is the StackOverflowError the reason for the
> > > duplicate context menu entries?
> > 
> > Well, at least the duplication is there after the stack overflow. If you
> > have other exact steps that lead to the duplication, they are very welcome
> > ;-).
> 
> I checked again. Here are the steps, there is no StackOverflowError involved:
> 
> 1. Download a fresh Eclipse 4.3 (used the RCP version here)
> 2. Start it with a new workspace
> 3. Create a new general project
> 4. Create a file test.xml, switch to the source tab and add this content:
> 
> <?xml version='1.0' encoding='UTF-8'?>
> <root></root>
> 
> 5. Right click on the second line (you may have to bring the context menu up
> a few times)
> 
> The context menu now shows some (but not all) entries twice: "Remove from
> Context" and the entries in "Team", "Compare With" and "Replace With" menus

Assuming those steps "work" and reopening again. Thanks Robin.
Comment 25 Piotr Tomiak CLA 2013-10-11 11:40:29 EDT
I have just stumbled upon this issue while moving our product to Kepler. The menu item for the following contribution:

<extension point="org.eclipse.ui.popupMenus">
  <objectContribution
      adaptable="true"
      id="com.genuitec.mycontribution"
      objectClass="org.eclipse.core.resources.IResource">
    <action
       class="com.genuitec.MyAction"
       id="com.genuitec.myaction"
       label="My action"
       menubarPath="com.genuitec.mymenu/group0">
    </action>
  </objectContribution>
</extension>

is contributed twice, as this contributor is recognized as an Editor Contributor and an Object Contributor. That's roughly what I've found from debugging Eclipse code. 

I have noticed the issue with contribution to source page (WTP XML Editor) of multi page editor. Note that in that editor, even "Compare With" menu items are contributed twice. Same situation as the original report, error happens only in a middle of the file. 

This looks like a rather big usability bug, many submenus are at least unreadable. Is it possible to get this fixed for 4.3 SR2 ? Is it WTP Editor issue, or something more core?
Comment 26 Paul Webster CLA 2013-10-18 10:59:55 EDT
I can reproduce this in the XML editor from XML Editors and Tools in 4.4, but not in the PDE multi page editor part.

PW
Comment 27 Jörg Thönnes CLA 2013-10-24 11:30:39 EDT
Please, could you also consider this for 4.3 SR2? Thanks.
Comment 28 Henno Vermeulen CLA 2014-02-10 06:19:00 EST
In my RCP app running on 4.3.1 I am seeing the same issue, but only the first time the context menu is opened: all command contributions in the menu are duplicated.

I create the menu programmatically for a View using site.registerContextMenu().
Comment 29 Robin Stocker CLA 2014-02-10 08:51:53 EST
*** Bug 427785 has been marked as a duplicate of this bug. ***
Comment 30 Robert Munteanu CLA 2014-02-10 09:37:32 EST
I've encountered this for both JSP and XML files.
Comment 31 Henno Vermeulen CLA 2014-02-10 11:04:07 EST
In my Eclipse IDE I can always easily reproduce this issue as seen in "snapshot of team menu with duplicate entries" by opening a pom.xml, clicking on the pom.xml tab, right clicking and selecting the Team submenu

(In reply to SlowStrider Mising name from comment #28)
> In my RCP app running on 4.3.1 I am seeing the same issue...

I can reproduce MY duplicate menu item issue in a very simple program. I am not sure if the underlying cause is the same so I have reported this separately as issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=427812

It occurs when a MenuManager is registered with the site (view/editor) before createMenu is called on it to create the actual Menu.
Comment 32 Alexander Gurov CLA 2014-02-26 04:37:45 EST
*** Bug 429117 has been marked as a duplicate of this bug. ***
Comment 33 Jayansh Shinde CLA 2014-03-25 00:37:41 EDT
I have similar issue with CSS file in Eclipse 4.3 Kepler SR1. When I right clicked on Team all menus showed twice. It seems like I have 2 CSS editor plugins in my RCP application:
org.eclipse.e4.tools.css.editor and e4 related plugins
org.eclipse.wst.css.ui and related wtp plugins.

might creating issue. Both plugins are required by my RCP application.

Please suggest some workaround to fix this.

Thanks,
Jay
Comment 34 Paul Webster CLA 2014-03-25 09:35:10 EDT
(In reply to Jayansh Shinde from comment #33)
> I have similar issue with CSS file in Eclipse 4.3 Kepler SR1. When I right
> clicked on Team all menus showed twice. It seems like I have 2 CSS editor
> plugins in my RCP application:
> org.eclipse.e4.tools.css.editor and e4 related plugins
> org.eclipse.wst.css.ui and related wtp plugins.

That's a different problem, please open a new bug.

PW
Comment 35 Wojciech Sudol CLA 2014-04-03 06:45:08 EDT
(In reply to Piotrek Tomiak from comment #25)
> I have just stumbled upon this issue while moving our product to Kepler.

Hi Piotrek,
What is the Eclipse version you were using before moving to Kepler? Could you attach a working plugin/app/snippet that behaves correctly in an older version of Eclipse but is broken in Kepler?
The problem with XML editor is caused by changes in WTP (introduced with Eclipse 3.8), so I want to make sure that the reason of the problem is the same.
Comment 36 Piotr Tomiak CLA 2014-04-03 08:46:50 EDT
Hi Wojtek!

The issue has been confirmed by our team to be specific to WTP editors, we haven't found it anywhere else in our product.

Piotrek

(In reply to Wojciech Sudol from comment #35)
> (In reply to Piotrek Tomiak from comment #25)
> > I have just stumbled upon this issue while moving our product to Kepler.
> 
> Hi Piotrek,
> What is the Eclipse version you were using before moving to Kepler? Could
> you attach a working plugin/app/snippet that behaves correctly in an older
> version of Eclipse but is broken in Kepler?
> The problem with XML editor is caused by changes in WTP (introduced with
> Eclipse 3.8), so I want to make sure that the reason of the problem is the
> same.
Comment 37 Wojciech Sudol CLA 2014-04-07 07:14:34 EDT
The bug is not 4.x regression. It started to be 'visible' because of changes in the WTP 3.4 (default version for eclipse 3.8). The reason of the problem is that some action contributions computed for the editor and active selection are the same. Initially I tried to prevent the duplications as early as possible (in PopupMenuExtender and ObjectActionContributorManager) but I am afraid there are too many factors there to do this safely.
Is there any reason why we allow duplications in MenuManager (based on IDs)? The simplest solution seems to be a duplication check in MenuManager.allowItem(*) or in PluginActionBuilder.contributeMenuAction(*).
Comment 38 Paul Webster CLA 2014-04-07 14:27:15 EDT
(In reply to Wojciech Sudol from comment #37)
> Is there any reason why we allow duplications in MenuManager (based on IDs)?
> The simplest solution seems to be a duplication check in
> MenuManager.allowItem(*) or in PluginActionBuilder.contributeMenuAction(*).

It's required for legacy reasons.  i.e. in Eclipse 3.3 when we did org.eclipse.ui.menus we sought to enforce that IDs were unique withing the menu system.  It's impossible.

PW
Comment 39 Paul Webster CLA 2014-04-17 17:03:25 EDT
I see you can't just compare the IEditorInput to the selProvider.getSelection().  It also looks like the calculations are done for each org.eclipse.ui.internal.ObjectActionContributor.contributeObjectActions(IWorkbenchPart, IMenuManager, ISelectionProvider, List) where they adapt to the contributed objectClass().  That makes it hard to guess where the intersection might be.

One possibility would be to do a simple check, trying to convert the IStructuredSelection first element to an IResource or ResoureMapping, and do the same with the IEditorInput.

This flaw is in the 3.x system as well, so it's an existing problem, not a regression.

PW
Comment 40 Paul Webster CLA 2014-04-22 11:19:50 EDT
I think your solution is the most stable: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=1f2affab064ea79b7b96e2f7bdcb91faf4929163

If a contributor has already been added, don't re-add it.

PW
Comment 41 Wojciech Sudol CLA 2014-04-29 07:15:54 EDT
Verified in I20140428-2000.
Comment 42 Wojciech Sudol CLA 2014-07-08 07:59:24 EDT
*** Bug 405859 has been marked as a duplicate of this bug. ***
Comment 43 Szymon Ptaszkiewicz CLA 2015-03-11 17:04:31 EDT
Backporting to 4.2.2+.
Comment 44 Eclipse Genie CLA 2015-03-11 17:04:32 EDT
New Gerrit change created: https://git.eclipse.org/r/43692
Comment 45 Eclipse Genie CLA 2015-03-19 09:28:31 EDT
New Gerrit change created: https://git.eclipse.org/r/44165