Bug 402561 - Duplicate contributions in view menu and toolbar
Summary: Duplicate contributions in view menu and toolbar
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.3 M7   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 402011 403605 403900 405488 (view as bug list)
Depends on:
Blocks: 405460
  Show dependency tree
 
Reported: 2013-03-06 13:05 EST by Markus Keller CLA
Modified: 2019-07-11 15:45 EDT (History)
10 users (show)

See Also:


Attachments
Screenshot (198.06 KB, image/png)
2013-03-06 13:05 EST, Markus Keller CLA
no flags Details
workbench.xmi (296.79 KB, application/octet-stream)
2013-03-06 13:39 EST, Markus Keller CLA
no flags Details
workbench.xmi with dupes (293.12 KB, application/octet-stream)
2013-04-25 14:41 EDT, Michael Rennie CLA
no flags Details
screenshot (25.00 KB, image/png)
2017-10-19 11:54 EDT, Yan Pas CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2013-03-06 13:05:40 EST
Created attachment 228018 [details]
Screenshot

I20130306-0045

Some views have duplicate contributions in the view menu and toolbar, see attachment. The Git Repositories view also has duplicated view menu items. Context menus look OK.

I can't tell exactly what made this appear, but I see it in different workspaces on Mac and Windows, since about 2 weeks. Maybe it only shows up after a workspace crashed.

I could not reproduce in a fresh workspace, but the problem is persisted when I restart the workspace. When I closed the Git Repositories view in all perspectives and then reopened the view, the duplications in the toolbar were gone, but the view menu was still cluttered. And after a restart, the duplications in the toolbar were back as well.
Comment 1 Paul Webster CLA 2013-03-06 13:23:31 EST
Markus, could you please attach your .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi ?

PW
Comment 2 Markus Keller CLA 2013-03-06 13:39:35 EST
Created attachment 228019 [details]
workbench.xmi
Comment 3 Szymon Ptaszkiewicz CLA 2013-04-02 09:29:59 EDT
*** Bug 402011 has been marked as a duplicate of this bug. ***
Comment 4 Eric Moffatt CLA 2013-04-04 14:10:21 EDT
A quick look at the XMI shows that there are three instances of the various TB items under

<toolbar xmi:id="_0cfN_oZ-EeKaSbYBTHyP9w" elementId="org.eclipse.egit.ui.RepositoriesView" visible="false">

If I run an inner using Markus' XMI file I see the duplicate entries...

While this is undoubtedly what's causing the issue I'm still unsuccessful in being able to reproduce this state.
Comment 5 Szymon Ptaszkiewicz CLA 2013-04-05 05:06:17 EDT
(In reply to comment #4)
> While this is undoubtedly what's causing the issue I'm still unsuccessful in
> being able to reproduce this state.

I think in my case it had something to do with Eclipse crashes - after a crash the number of duplicated items increased (see attachments in bug 402011).
Comment 6 Markus Keller CLA 2013-04-05 06:57:26 EDT
I don't see why this information should be persisted at all. A view implementation has to create these contributions when the view is created, so it's not necessary to persist anything.

If you stop persisting state that is not necessary, then you also don't have to deal with issues that only arise in exceptional circumstances like a crash.
Comment 7 Paul Webster CLA 2013-04-12 08:29:17 EDT
*** Bug 405488 has been marked as a duplicate of this bug. ***
Comment 8 Michael Rennie CLA 2013-04-23 16:10:29 EDT
*** Bug 403900 has been marked as a duplicate of this bug. ***
Comment 9 Michael Rennie CLA 2013-04-24 12:18:18 EDT
I was testing a hack that checked for duplicates when the contributions are loaded, and it worked at removing the dupes, but any contribution that had duplicates appeared in the wrong order. For example in problems view the Configure Contents... and Configure Columns... items appeared at the top of the menu instead of the end like normal.

Chatting with Paul, there could be an issue in org.eclipse.ui.internal.Workbench.cleanUpCopy(MApplication) where the contributions are not being cleaned up properly. Another place to check could be org.eclipse.ui.internal.e4.compatibility.CompatibilityView.disposeSite(PartSite)
Comment 10 Michael Rennie CLA 2013-04-25 14:40:01 EDT
Finally nailed down some steps:

1. run eclipsec from a command prompt (using default or new workspace)
2. open the problems view, open its view menu
3. close the view and reopen it
4. close Eclipse from the command line using Ctrl+C (to simulate a crash)
5. restart

After the restart check the problems view menu and there should now be duplicate values. I will attach my XMI file from these steps.
Comment 11 Michael Rennie CLA 2013-04-25 14:41:28 EDT
Created attachment 230141 [details]
workbench.xmi with dupes
Comment 12 Michael Rennie CLA 2013-04-26 16:04:43 EDT
I pushed changes to: https://git.eclipse.org/r/12253

Chatting with Paul, the solution is to clear out all of the model-created items when the compatibility view is first created. The fix removes all the duplicates from menus and toolbars and did not require additional changes to the persistence code as a call to clear out all of the menu contributions is already done.
Comment 14 Paul Webster CLA 2013-04-27 14:31:53 EDT
.
Comment 15 Dani Megert CLA 2013-05-01 05:26:10 EDT
I wanted to verify the fix. So, I first tried the steps from comment 10 against N20130425-2000-win32, but for me those steps did not surface the bug.
Comment 16 Markus Keller CLA 2013-05-01 07:18:07 EDT
Verified in I20130430-0031. I also couldn't reproduce comment 10, but I don't see any duplications any more in the workspaces where they used to show up.
Comment 17 Paul Webster CLA 2013-05-01 07:27:48 EDT
I've also verified it's cleaned up my duplicates in my Git Repositories view.

PW
Comment 18 Paul Webster CLA 2013-05-01 10:27:09 EDT
*** Bug 403605 has been marked as a duplicate of this bug. ***
Comment 19 Henno Vermeulen CLA 2014-02-06 08:08:59 EST
I am seeing this bug again in 4.4M5!

I have a duplicated toolbar contribution inside the main toolbar and duplicated contributions to the right trim bar. I don't have these in Kepler (4.3.1).
Comment 20 Dani Megert CLA 2014-02-06 08:20:08 EST
(In reply to SlowStrider Mising name from comment #19)
> I am seeing this bug again in 4.4M5!
> 
> I have a duplicated toolbar contribution inside the main toolbar and
> duplicated contributions to the right trim bar. I don't have these in Kepler
> (4.3.1).

Please open a new bug with steps to reproduce.
Comment 21 Henno Vermeulen CLA 2014-02-07 08:16:32 EST
@Dani Megert

I investigated the cause. It only happens in a combination of circumstances one of which is a problem in my own code and two of which are related to bugs that have already been reported. I added comments there.

 - root cause is that in Luna 4.4M5 WorkbenchWindowControlContribution.createControl is called twice, the first time with a null value for WorkbenchWindowControlContribution.getWorkbenchWindow() while it is still being created. This is related to what has been reported here https://bugs.eclipse.org/bugs/show_bug.cgi?id=427452
 - second cause is that my createControl(Composite parent) method was calling PlatformUI.getWorkbench().getActiveWorkbenchWindow() instead of WorkbenchWindowControlContribution.getWorkbenchWindow(). This resulted in an attempt to create a new Workbench Window, which recursively calls createControl() again. This has already been reported here https://bugs.eclipse.org/bugs/show_bug.cgi?id=366708

I adjusted my code to use WorkbenchWindowControlContribution.getWorkbenchWindow() instead in my createControl() method and handle the null value on the first call.
Comment 22 Yan Pas CLA 2017-10-19 11:54:58 EDT
Created attachment 271098 [details]
screenshot

Facing this issue in 4.7.1
Comment 23 Ibai U. CLA 2018-01-10 08:26:01 EST
I am facing the same issue with 4.7.0 and do not have Darkest Dark Theme installed.

But what I have noticed is that some icons get duplicated one more time when I change the laptop from place (e.g. bring laptop from work to home, viceversa) so it could be related to something that changes with the place as well, like IP (don't think so), displays connected (amount/models), ...