Bug 509371 - Shortcut icons multiply on toolbar at bottom
Summary: Shortcut icons multiply on toolbar at bottom
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P4 normal with 3 votes (vote)
Target Milestone: 4.13 M3   Edit
Assignee: Rolf Theunissen CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 444216 527896 534325 (view as bug list)
Depends on: 378815
Blocks: 549902 511846 528152 534325
  Show dependency tree
 
Reported: 2016-12-16 16:59 EST by Niko Humalamäki CLA
Modified: 2020-07-23 07:19 EDT (History)
14 users (show)

See Also:


Attachments
Screenshots showing the problem and installation details (256.90 KB, application/force-download)
2016-12-16 16:59 EST, Niko Humalamäki CLA
no flags Details
oxygen before kill (198.34 KB, image/png)
2017-06-29 04:26 EDT, Niko Humalamäki CLA
no flags Details
oxygen after kill 1 (754.65 KB, image/png)
2017-06-29 04:27 EDT, Niko Humalamäki CLA
no flags Details
oxygen after kill 2 (277.84 KB, image/png)
2017-06-29 04:28 EDT, Niko Humalamäki CLA
no flags Details
Icons multiply (53.78 KB, image/png)
2019-06-20 03:46 EDT, Jouni Koistinen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Niko Humalamäki CLA 2016-12-16 16:59:00 EST
Created attachment 265920 [details]
Screenshots showing the problem and installation details

At some point eclipse 4.6.1 has started multiplying icons at one action set in my workspace. First I thought it was a problem in oomph, but now it repeated with console at same location that it happened with oomph. The version information and two different workspaces with the problem are attached. If you need more information please ask what you need to know. Or if this is dublicate, I'm sorry.

This is on debian 64bit, gnome 3, installed with eclipse installer and I think it is always updating to the newest neon release.
Comment 1 Niko Humalamäki CLA 2016-12-16 17:05:44 EST
Also from Perspective --> Customize perspective... 

and on the first tab activetaing/deactivating Terminal or Setup has no effect on the icons.
Comment 2 Patrik Suzzi CLA 2016-12-19 20:07:42 EST
Nico, could you please provide a sequence of steps we can use to reproduce the issue?
Comment 3 Niko Humalamäki CLA 2016-12-20 06:43:41 EST
I try to pick them up, but it's difficult to pin point. I have hidden the "search all" search box and pulled all the toolbars to left, bottom and right sides of the workspace (so top bar is empty). I don't know at which point the icons multiply, but since friday the have breeded on more "open terminal" button to the bottom bar. The reproducing icons have been the rightmost entry on the left side of the bottom bar.

Is there some xml file, where the toolbars are loaded on startup, I could try to follow that to see when it happens?
Comment 4 Patrik Suzzi CLA 2016-12-20 06:58:41 EST
Nico, it would be great if you could give us a sequence of steps to reproduce, along with the exact version of Eclipse you're using. Otherwise, we don't have enough information we could use to start an investigation. 

Also, I don't understand what the 'search box search bar is' (sorry for that). Perhaps you can provide a screenshot? 

Thanks!
Comment 5 Niko Humalamäki CLA 2016-12-20 08:54:17 EST
See the attached three screenshots, that are in the attached zip file. The version information is also included in the attached file.

I mean the "Quick Access" field at top right, which one can hide by right clicking and selecting hide.

I will provide the sequence of steps if I can pin point them (other steps that I have already provided).
Comment 6 Niko Humalamäki CLA 2017-01-05 06:23:10 EST
I have now made a fresh installation of neon.2 with eclipse installer. I removed the .metadata from my workspace before updating. Today I noticed first time that icons have multiplied. It's oomph -icons at the same location. I suspect that it happens between restarts (of eclipse) but can't be sure, since I have not noticed exactly when they appeared. I have updated on monday and now is thursday.

Version information with copy paste from Eclipse Platform Installation Details:

  API Tools Execution Environment Descriptions	1.0.1.v20160419-1303	org.eclipse.pde.api.tools.ee.feature.feature.group	Eclipse.org
  Eclipse CVS Client	1.4.301.v20161124-1400	org.eclipse.cvs.feature.group	Eclipse.org
  Eclipse Java Development Tools	3.12.2.v20161124-1400	org.eclipse.jdt.feature.group	Eclipse.org
  Eclipse Platform	4.6.2.v20161124-1529	org.eclipse.platform.feature.group	Eclipse.org
  Eclipse Platform	4.6.2.M20161124-1400	org.eclipse.platform.ide	Eclipse.org
  Eclipse Plug-in Development Environment	3.12.2.v20161124-1400	org.eclipse.pde.feature.group	Eclipse.org
  Eclipse RCP	4.6.2.v20161124-1400	org.eclipse.rcp.feature.group	Eclipse.org
  Eclipse Web Developer Tools	3.8.1.v201609072018	org.eclipse.wst.web_ui.feature.feature.group	Eclipse Web Tools Platform
  Ecore Diagram Editor (SDK)	3.2.0.201610181347	org.eclipse.emf.ecoretools.sdk.feature.group	Eclipse Modeling Project
  EMF - Eclipse Modeling Framework SDK	2.13.0.v20161220-0315	org.eclipse.emf.sdk.feature.group	Eclipse Modeling Project
  Git integration for Eclipse	4.6.1.201612262335	org.eclipse.egit.feature.group	Eclipse EGit
  m2e - Maven Integration for Eclipse (includes Incubating components)	1.7.0.20160603-1933	org.eclipse.m2e.feature.feature.group	Eclipse.org - m2e
  Oomph Project Copier	1.6.0.v20161019-0656	org.eclipse.oomph.projectcopy.feature.group	Eclipse Oomph Project
  Oomph Setup	1.6.0.v20161128-0928	org.eclipse.oomph.setup.feature.group	Eclipse Oomph Project
  Oomph Setup Git	1.6.0.v20161019-0656	org.eclipse.oomph.setup.git.feature.group	Eclipse Oomph Project
  Oomph Setup JDT	1.6.0.v20161019-0656	org.eclipse.oomph.setup.jdt.feature.group	Eclipse Oomph Project
  Oomph Setup PDE	1.6.0.v20161019-0656	org.eclipse.oomph.setup.pde.feature.group	Eclipse Oomph Project
  Oomph Setup Targlets	1.6.0.v20161019-0656	org.eclipse.oomph.setup.targlets.feature.group	Eclipse Oomph Project
  Oomph Setup Working Sets	1.6.0.v20161019-0656	org.eclipse.oomph.setup.workingsets.feature.group	Eclipse Oomph Project
  Oomph Targlets	1.6.0.v20161104-0635	org.eclipse.oomph.targlets.feature.group	Eclipse Oomph Project
  Oomph Version Management	1.6.0.v20161019-0656	org.eclipse.oomph.version.feature.group	Eclipse Oomph Project
  SWTBot IDE Features	2.6.0.201612081710	org.eclipse.swtbot.ide.feature.group	Eclipse.org - SWTBot
  SWTBot JUnit Headless launchers for Eclipse	2.6.0.201612081710	org.eclipse.swtbot.eclipse.test.junit.feature.group	Eclipse.org - SWTBot
Comment 7 Niko Humalamäki CLA 2017-01-05 06:27:40 EST
btw. there are two icons in the toolbar "group" and they have both multiplied so it propably repeats the content of the whole toolbar "group"  not just the last icon (oomph icons).
Comment 8 Niko Humalamäki CLA 2017-01-05 19:32:11 EST
As a workaround I removed from .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi dublicate items by grepping the tooltip text from the icon(s):

$ grep -r "Perform Setup Tasks" .metadata/
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi:        <children xsi:type="menu:HandledToolItem" xmi:id="_p
:/plugin/org.eclipse.oomph.setup.editor/icons/update.gif" tooltip="Perform Setup Tasks..." command="_pZ4tftOlEea8QYokd
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi:        <children xsi:type="menu:HandledToolItem" xmi:id="_p
:/plugin/org.eclipse.oomph.setup.editor/icons/update.gif" tooltip="Perform Setup Tasks..." command="_pZ4tftOlEea8QYokd
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi:        <children xsi:type="menu:HandledToolItem" xmi:id="_p
:/plugin/org.eclipse.oomph.setup.editor/icons/update.gif" tooltip="Perform Setup Tasks..." command="_pZ4tftOlEea8QYokd
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi:        <children xsi:type="menu:HandledToolItem" xmi:id="_p
:/plugin/org.eclipse.oomph.setup.editor/icons/update.gif" tooltip="Perform Setup Tasks..." command="_pZ4tftOlEea8QYokd
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi:  <commands xmi:id="_pZ4uRNOlEea8QYokdejG6w" elementId="org.
w"/>
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi:  <commands xmi:id="_pZ4vWtOlEea8QYokdejG6w" elementId="org.
Comment 9 Niko Humalamäki CLA 2017-01-20 07:49:01 EST
Ok, this is how it happens here:

0. Eclipse is open
1. Laptop goes to hibernate
2. Laptop won't wake up (sometimes does that)
3. I force it to shutdown with power button
4. Restart
5. Start eclipse
6. Have new entry on toolbar
Comment 10 François Armand CLA 2017-05-18 05:48:01 EDT
I have also the problem for two sets of icons (terminal and scala ide). 

On eclipse neon.3 (fresh installed from scala-ide.org bundle for ScalaIDE 4.6). 

I don't know how it happens, but it seem linked to times where eclipse is killed. 

I can confirm that the entries are duplicated in .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi, ex:

% grep -ri "org.scala-ide.sdt.core/org.scalaide.core.handler.RunSelectionInInterpreter" .metadata | wc -l
5
Comment 11 François Armand CLA 2017-05-18 06:19:10 EDT
Some more information: the problems appear when I'm closing and restarting eclipse normally, so it is not (directly) linked to killing it. 

I can confirm that deleting duplicates entries in .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi (when eclipse is not started) correct the display of the toolbar - but, and this is strange, for the ducplicated entries, there is always one more entry than what is in the file. 

For example, if I let only one terminal editor entry, then 2 are displayed. And of course, when Eclipse save workbench, it saves 2. And the next starts, it displays 3. 

If I remove all children entries of a "menu:ToolBar" which is ducplicated, then one is still shown. 

For now, I will try to see if setting "chattr +i .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi" breaks to many other things (but at least, no new entries are added for ever).
Comment 12 François Armand CLA 2017-06-12 06:42:12 EDT
So, just a follow up: the bug is still present, and it is *really* unerving. 
For now, I have "chattr +i .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi" which does the work, at the price of not having my workbench saved when eclipse restart (bad. But for now, better than having tens of identical icons in the bar).
Comment 13 Lars Vogel CLA 2017-06-12 07:05:24 EDT
(In reply to François Armand from comment #12)
> So, just a follow up: the bug is still present, and it is *really* unerving. 
> For now, I have "chattr +i
> .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi" which does the
> work, at the price of not having my workbench saved when eclipse restart
> (bad. But for now, better than having tens of identical icons in the bar).

eclipse -clearPersistedState will also remove the workbench.xmi file.
Comment 14 François Armand CLA 2017-06-12 07:14:11 EDT
(In reply to Lars Vogel from comment #13)
> eclipse -clearPersistedState will also remove the workbench.xmi file.

I'm aware of that, but it reset it all. With the chattr "immutable", I can:

1/ configure an workbench layout, set options and editors and bar etc where I want ; 
2/ close eclipse so that my "default" workbench is saved ;
3/ remove duplicated icons ;
4/ set the file immutable. 

With that, I still have a workbench that mostly fills my need (I don't use AT ALL the default eclipse, which is horrible and wastes a lot of space, everywhere). But of course, the opened files / projets / states of editors and windows are still lost at each restart. Yes, it demonstrates at what point the icon multiplication is bad for me, for I prefer that other disastrous UX.
Comment 15 Niko Humalamäki CLA 2017-06-12 08:47:14 EDT
I have made at some point this python script as a workaround to remove the repeated xml. I run it from the script I use to startup eclipse. You may need to modify for it to work for your case:

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import xml.etree.ElementTree as ET
import os

DEBUG = False

for WS in "/PATH/TO/WORKSPACE/ROOT":
    WS_FILE = WS + \
            "/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi"

    WS_FILE_TEST = WS + "/cleaned_workbench.xmi"

    ET.register_namespace('application',
                          'http://www.eclipse.org/ui/2010/UIModel/application')
    ET.register_namespace('xmi',
                          'http://www.omg.org/XMI')
    tree = ET.parse(WS_FILE)

    # add non detected namespaces
    root = tree.getroot()

    root.set('xmlns:advanced',
             'http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced')
    root.set('xmlns:basic',
             "http://www.eclipse.org/ui/2010/UIModel/application/ui/basic")
    root.set('xmlns:menu',
             "http://www.eclipse.org/ui/2010/UIModel/application/ui/menu")
    root.set('xmlns:ui',
             "http://www.eclipse.org/ui/2010/UIModel/application/ui")

    trimbars = root.findall("./children/trimBars")
    found = False

    for trimbar in trimbars:
        for item in trimbar:
            if item.attrib['elementId'] == 'org.eclipse.oomph.setup.toolbar':
                trimbar.remove(item)
                found = True

    print("found and removed" if found else "not found")

    if found:
        tree.write(WS_FILE_TEST if DEBUG else WS_FILE,
                   encoding="ASCII",
                   xml_declaration='<?xml version="1.0" encoding="ASCII"?>')
Comment 16 Niko Humalamäki CLA 2017-06-29 04:26:46 EDT
Created attachment 269112 [details]
oxygen before kill

Reproduced in oxygen
Comment 17 Niko Humalamäki CLA 2017-06-29 04:27:28 EDT
Created attachment 269113 [details]
oxygen after kill 1

bug reproduced in oxygen
Comment 18 Niko Humalamäki CLA 2017-06-29 04:28:08 EDT
Created attachment 269114 [details]
oxygen after kill 2

bug reproduced in oxygen
Comment 19 Niko Humalamäki CLA 2017-06-29 04:31:35 EDT
I have updated to Eclipse Oxygen.

Deleted .metadata in project folder, imported preferences, reset Perspectives by draggin icons to my preferred location, did a test from commandline:

> kill -9 PID_OF_JAVA_INSTANCE_RUNNING_ECLIPSE

and restarted eclipse:

- Oomph icons had multiplied and the new "Eclipse User Storage" icons too.

retested the thing, it reproduced.

Attached new screenshots of the multiplied icons.

Installation details:

  API Tools Execution Environment Descriptions	1.0.200.v20170515-0910	org.eclipse.pde.api.tools.ee.feature.feature.group	Eclipse.org
  Eclipse CVS Client	1.4.400.v20170612-0950	org.eclipse.cvs.feature.group	Eclipse.org
  Eclipse Java Development Tools	3.13.0.v20170612-0950	org.eclipse.jdt.feature.group	Eclipse.org
  Eclipse Platform	4.7.0.v20170612-1255	org.eclipse.platform.feature.group	Eclipse.org
  Eclipse Platform	4.7.0.I20170612-0950	org.eclipse.platform.ide	Eclipse.org
  Eclipse Plug-in Development Environment	3.13.0.v20170612-0950	org.eclipse.pde.feature.group	Eclipse.org
  Eclipse RCP	4.7.0.v20170612-1255	org.eclipse.rcp.feature.group	Eclipse.org
  Eclipse XML Editors and Tools	3.9.0.v201706011851	org.eclipse.wst.xml_ui.feature.feature.group	Eclipse Web Tools Platform
  Ecore Diagram Editor (SDK)	3.3.0.201706121316	org.eclipse.emf.ecoretools.sdk.feature.group	Eclipse Modeling Project
  EMF - Eclipse Modeling Framework SDK	2.13.0.v20170619-0814	org.eclipse.emf.sdk.feature.group	Eclipse Modeling Project
  Git integration for Eclipse	4.8.1.201706252349	org.eclipse.egit.feature.group	Eclipse EGit
  JavaScript Development Tools	2.1.0.v201706011953	org.eclipse.wst.jsdt.feature.feature.group	Eclipse Web Tools Platform
  m2e - Maven Integration for Eclipse (includes Incubating components)	1.8.0.20170516-2043	org.eclipse.m2e.feature.feature.group	Eclipse.org - m2e
  Memory Analyzer	1.7.0.201706130745	org.eclipse.mat.feature.feature.group	Eclipse Memory Analyzer
  Memory Analyzer (Charts) [optional]	1.7.0.201706130745	org.eclipse.mat.chart.feature.feature.group	Eclipse Memory Analyzer
  Oomph Project Copier	1.7.0.v20170201-1645	org.eclipse.oomph.projectcopy.feature.group	Eclipse Oomph Project
  Oomph Setup	1.8.0.v20170531-0903	org.eclipse.oomph.setup.feature.group	Eclipse Oomph Project
  Oomph Setup Git	1.8.0.v20170327-1117	org.eclipse.oomph.setup.git.feature.group	Eclipse Oomph Project
  Oomph Setup JDT	1.8.0.v20170318-0419	org.eclipse.oomph.setup.jdt.feature.group	Eclipse Oomph Project
  Oomph Setup PDE	1.8.0.v20170327-1117	org.eclipse.oomph.setup.pde.feature.group	Eclipse Oomph Project
  Oomph Setup Targlets	1.8.0.v20170318-0624	org.eclipse.oomph.setup.targlets.feature.group	Eclipse Oomph Project
  Oomph Setup Working Sets	1.8.0.v20170318-0419	org.eclipse.oomph.setup.workingsets.feature.group	Eclipse Oomph Project
  Oomph Targlets	1.8.0.v20170327-1117	org.eclipse.oomph.targlets.feature.group	Eclipse Oomph Project
  Oomph Version Management	1.8.0.v20170318-0624	org.eclipse.oomph.version.feature.group	Eclipse Oomph Project
  SWTBot IDE Features	2.7.0.201706281947	org.eclipse.swtbot.ide.feature.group	Eclipse.org - SWTBot
  SWTBot JUnit Headless launchers for Eclipse	2.7.0.201706281947	org.eclipse.swtbot.eclipse.test.junit.feature.group	Eclipse.org - SWTBot

So the bug related to un clean shutdown of eclipse seems to be present in oxygen
Comment 20 Jouni Koistinen CLA 2019-06-20 03:46:04 EDT
Created attachment 279014 [details]
Icons multiply

Bottom bar action icons keeps multiplying
Comment 21 Jouni Koistinen CLA 2019-06-20 03:49:33 EDT
This bug still remains, can reproduce with version 2019/03. Exist also several colleagues.

Version: 2019-03 (4.11.0)
Build id: 20190314-1200
Comment 22 Rolf Theunissen CLA 2019-07-11 15:46:18 EDT
*** Bug 527896 has been marked as a duplicate of this bug. ***
Comment 23 Rolf Theunissen CLA 2019-07-11 15:54:47 EDT
The bug is caused by differences in the persisted state (workbench.xmi) for a running eclipse and after it is shutdown.

On shutdown contributions are removed from the model. However, when the workbench crashes (e.g. CTRL-C on the command line) the model is not cleaned, and the persisted state still contains the contributed items. When eclipse is started again, this results in duplicate items.
Probably, somebody who is always doing clean shutdowns never sees the issue. Somebody who regularly forces eclipse to exit, sees a number of growing items.

For some situations workarounds are already in place, e.g. Bug 402561.
Comment 24 Rolf Theunissen CLA 2019-07-12 19:01:50 EDT
Workbench#persistWorkbenchModel and Workbench#cleanUpCopy make a copy of the current model and try to do a clean up of the model before the copy is persisted, this results in 2 problems with the auto-saved models:
1. The cleanUpCopy does not clean in the same way as the cleaning of the model when Eclipse is shutdown some elements remain, this causes the issues in this bug.
2. A copy of the model is persisted, this results in all different xmi:id in the persisted model. Probably this can cause issues with merging model-fragments on restart after a crash.

Problem 1 can be resolved by A) making the cleanup action do the same as when Eclipse is shutdown, or B) by marking all elements that should not be persisted transient (IWorkbench.PERSIST_STATE), see Bug 378815.
When option B) is chosen, the clean up can be removed all together, this would also remove the need to copy the model, which would solve Problem 2 too.

My preference is to choose option B.
Comment 25 Rolf Theunissen CLA 2019-07-16 14:26:58 EDT
WORKAROUND:

To disable automatic saving of the workbench, set the interval to zero:
Set Preferences > General > Workbench save interval (in minutes) to 0
Comment 26 Rolf Theunissen CLA 2019-07-17 16:32:53 EDT
Another clean action that causes difference in auto-save and final-save: Bug 316348 disposes WorkbenchMenuService before saving on exit.
Comment 27 Eclipse Genie CLA 2019-08-09 11:33:04 EDT
New Gerrit change created: https://git.eclipse.org/r/147385
Comment 28 Eclipse Genie CLA 2019-08-09 11:33:07 EDT
New Gerrit change created: https://git.eclipse.org/r/147384
Comment 31 Rolf Theunissen CLA 2019-08-11 14:12:23 EDT
The two commits should fix the issue, icons should not multiply after a crash.

Do we need automatic clean actions? Or do we let users clean-up their broken workspaces? Either by '-clearPersistedState' or from Bug 413492 Comment 5:
"Save all your perspectives and then open a new workbench window. The new window will be in good shape. You can then close the old bogus window and all is good ;-)"
Comment 32 Mickael Istria CLA 2019-08-12 06:22:18 EDT
*** Bug 534325 has been marked as a duplicate of this bug. ***
Comment 33 Lars Vogel CLA 2019-08-15 05:04:01 EDT
Jonas, please test the latest I-build if Rolfs fix also fixes your multiplied toolbar issue.
Comment 34 Jonas Hungershausen CLA 2019-08-15 05:29:52 EDT
(In reply to Lars Vogel from comment #33)
> Jonas, please test the latest I-build if Rolfs fix also fixes your
> multiplied toolbar issue.

Thank you, this indeed fixes my problem with multiple markers, I've had for several months/years.
Comment 35 Lars Vogel CLA 2019-08-16 01:14:39 EDT
Rolf, can this be closed? I would say cleanup actions are not required. Maybe a N&N entry with the workaround?
Comment 36 Rolf Theunissen CLA 2019-08-16 01:32:33 EDT
A note on the N&N sounds like a good idea. This bug can be closed

Any other issues with differences in auto-saved and after-shutdown are tracked in Bug 549902.
Comment 37 Lars Vogel CLA 2020-07-23 07:19:20 EDT
*** Bug 444216 has been marked as a duplicate of this bug. ***