This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 384354 - Compatibility: Editor actions registered via extension point org.eclipse.ui.editorActions are shown twice in the toolbar.
Summary: Compatibility: Editor actions registered via extension point org.eclipse.ui.e...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 major with 4 votes (vote)
Target Milestone: 4.4 RC1   Edit
Assignee: Daniel Rolka CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 428802 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-07-05 07:40 EDT by Martin Hentschel CLA
Modified: 2019-07-12 17:36 EDT (History)
12 users (show)

See Also:
emoffatt: review+


Attachments
Sample editor with duplications in the toolbar (12.64 KB, application/octet-stream)
2013-05-08 06:14 EDT, Daniel Rolka CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Hentschel CLA 2012-07-05 07:40:17 EDT
Build Identifier: 20120614-1722

In Eclipse 3 an action registered via extension point "org.eclipse.ui.editorActions" is correctly shown once in the toolbar and once as main menu entry. But in Eclipse 4.2 (Juno) the action is shown twice in the toolbar (same icon, same behavior) and once in the main menu.

This is ugly and has the problem that the same action now can have  different checked states at the same time (checked or radio button).

Reproducible: Always
Comment 1 Gellule Xg CLA 2012-08-06 17:00:23 EDT
Confirmed. Affects the TeXlipse plugin. See: http://sourceforge.net/tracker/?func=detail&aid=3542507&group_id=133306&atid=726818
Comment 2 Arnaud Brunet CLA 2013-04-04 16:52:48 EDT
The org.eclipse.ui.editorActions extension is deprecated. Using the command / menus extensions solves the pb.
Comment 3 Paul Webster CLA 2013-04-05 08:04:30 EDT
(In reply to comment #2)
> The org.eclipse.ui.editorActions extension is deprecated. Using the command
> / menus extensions solves the pb.

This is true, but we still need to make sure editorActions is behaving correctly.

PW
Comment 4 Wei Huang CLA 2013-04-09 11:59:37 EDT
+1 on Eclipse 4.2 of Windows 7.

Is there a way to work around this without totally changing the API to command/menu?
Comment 5 Paul Webster CLA 2013-05-06 08:19:45 EDT
https://git.eclipse.org/r/#/c/12177/
Comment 6 Paul Webster CLA 2013-05-06 08:22:23 EDT
Daniel, could you please attach a sample plugin that shows the duplication in the latest Kepler?

PW
Comment 7 Daniel Rolka CLA 2013-05-08 06:14:48 EDT
Created attachment 230639 [details]
Sample editor with duplications in the toolbar

Paul,

Maybe we should eliminate the duplications during populating the extension registry (the IExtensionRegistry service)

thanks,
Daniel
Comment 8 Paul Webster CLA 2013-05-09 07:45:20 EDT
(In reply to comment #7)
> Created attachment 230639 [details]
> Sample editor with duplications in the toolbar

Thanks for this.


> Maybe we should eliminate the duplications during populating the extension
> registry (the IExtensionRegistry service)

That's probably the correct place to target them.  We need to narrow down which part of the code is adding the duplicate.  Is it that org.eclipse.ui.internal.EditorActionBuilder contributes them in the EditorReference and MenuPersistence is still reading them?  What happens if we comment them out of MenuPersistence like we did for actionSets?

PW
Comment 9 Daniel Rolka CLA 2013-05-14 07:54:56 EDT
> That's probably the correct place to target them.  We need to narrow down
> which part of the code is adding the duplicate.  Is it that
> org.eclipse.ui.internal.EditorActionBuilder contributes them in the
> EditorReference and MenuPersistence is still reading them?  What happens if
> we comment them out of MenuPersistence like we did for actionSets?
> 
> PW

Commenting the readAdditions method invocation in the MenuPersistence class does not help. 
So there are two places that add the actions defined by the 'org.eclipse.ui.editorActions' extension point:
1) The EditorReference.createEditorActionBars method and processing the action extensions in the EditorActionBuilder class
2) Processing the contributions in the ToolbarManager.processContribution method that uses the ContributionsAnalyzer helper class.

It looks for me like some 'org.eclipse.ui.editorActions' extension point parsing issue and we process the actions of the extension point twice and add it to the editor extension list as well as the contribution one and next render both lists generating duplicates.

Preparing the original fix for that I was trying to disable the code mentioned in the point 1 and it solves the issue too. However I've skipped this approach since I was concerning some potential regression issues regarding it.

thanks,
Daniel
Comment 10 Paul Webster CLA 2013-05-14 08:12:23 EDT
(In reply to comment #9)
> 2) Processing the contributions in the ToolbarManager.processContribution
> method that uses the ContributionsAnalyzer helper class.

That's where they get added to the coolbar, not where they come from.  What is adding them as an MToolBarContribution to the MApplication.getToolBarContributions() if it's not MenuPersistence ?  I thought that was what org.eclipse.ui.internal.menus.MenuPersistence.readEditorActions() was doing.

We want to make sure they don't make it into the MToolBarContribution list, since we want the EditorReference.createEditorActionBars to be the primary mechanism for legacy editor actions for Kepler.

PW
Comment 11 Daniel Rolka CLA 2013-05-14 09:35:14 EDT
> (In reply to comment #9)
What
> is adding them as an MToolBarContribution to the
> MApplication.getToolBarContributions() if it's not MenuPersistence ?  I
> thought that was what
> org.eclipse.ui.internal.menus.MenuPersistence.readEditorActions() was doing.

Yes, You are correct. I've followed this clue and prepared the new patch - http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=d988dbaa9ac808aa1c8f359128c1bc07cbd9ad0b

thanks in advance for review,
Daniel
Comment 12 Aniruddha Shevade CLA 2013-07-10 17:43:25 EDT
Hi
  After upgrading to eclipse 4.3 we are seeing the same issue mentioned here. Is there a way we can use the fix attached (In reply to comment #11)
> > (In reply to comment #9)
> What
> > is adding them as an MToolBarContribution to the
> > MApplication.getToolBarContributions() if it's not MenuPersistence ?  I
> > thought that was what
> > org.eclipse.ui.internal.menus.MenuPersistence.readEditorActions() was doing.
> 
> Yes, You are correct. I've followed this clue and prepared the new patch -
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=d988dbaa9ac808aa1c8f359128c1bc07cbd9ad0b
> 
> thanks in advance for review,
> Daniel

Hi Daniel
  Is there a way we can use this patch. If so would you let us know how? I am seeing the same issue after upgrading to eclipse 4.3. And it is pretty annoying to see duplicate editor actions.

  Thanks or your help
Ani
Comment 13 Daniel Rolka CLA 2013-08-13 08:19:24 EDT
Paul,

Are you able to review the latest path for that and push it to master when it is OK?

thanks,
Daniel
Comment 14 Paul Webster CLA 2013-08-13 08:23:43 EDT
(In reply to comment #13)
> Paul,
> 
> Are you able to review the latest path for that and push it to master when
> it is OK?

When I get to this I'll rebase the commit to bring it up to snuff.

PW
Comment 16 Daniel Horrisberger CLA 2013-10-10 11:01:29 EDT
The same code condition isEditorAction() for method addToolBarContribution() is necessary to add to addContribution() method to prevent duplication in contributions in subMenues.
Comment 17 Daniel Rolka CLA 2013-10-29 09:10:19 EDT
Verified in the build: I20131028-2000
Comment 18 Paul Webster CLA 2014-02-24 10:17:06 EST
*** Bug 428802 has been marked as a duplicate of this bug. ***
Comment 19 Daniel Rolka CLA 2014-04-30 13:16:19 EDT
Released to the 'R4_2_maintenance' branch as: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=83314600616bd0d21cfa1306a6707c30286c8af5

Daniel
Comment 20 Paul Webster CLA 2014-05-01 16:32:03 EDT
See comment #16

PW
Comment 21 Paul Webster CLA 2014-05-02 17:00:41 EDT
If we're filtering out both menu and toolbar contributions, we should probably get rid of the whole thing.

https://git.eclipse.org/r/25894

PW
Comment 24 Wojciech Sudol CLA 2014-06-03 06:48:46 EDT
Verified in I20140528-2000.