This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 318856 - Most entries contributed by textual editors are missing in the 'Edit' menu
Summary: Most entries contributed by textual editors are missing in the 'Edit' menu
Status: VERIFIED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 1.0 RC3   Edit
Assignee: Remy Suen CLA
QA Contact: Paul Webster CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-05 05:39 EDT by Dani Megert CLA
Modified: 2010-07-26 09:27 EDT (History)
2 users (show)

See Also:


Attachments
EditorMenuManager hijacking patch v1 (8.18 KB, patch)
2010-07-16 10:05 EDT, Remy Suen CLA
no flags Details | Diff
EditorMenuManager hijacking patch v2 (15.13 KB, patch)
2010-07-16 15:56 EDT, Remy Suen CLA
no flags Details | Diff
EditorMenuManager hijacking patch v3 (17.33 KB, patch)
2010-07-20 14:30 EDT, Remy Suen CLA
no flags Details | Diff
EMM hijacking patch v4 (29.47 KB, patch)
2010-07-21 20:50 EDT, Paul Webster CLA
no flags Details | Diff
EMM hijacking patch v05 (31.49 KB, text/plain)
2010-07-22 14:01 EDT, Paul Webster CLA
no flags Details
EditorMenuManager hijacking patch v6 (31.26 KB, patch)
2010-07-23 08:35 EDT, Remy Suen CLA
no flags Details | Diff
EditorMenuManager hijacking patch v7 (31.51 KB, patch)
2010-07-23 08:55 EDT, Remy Suen CLA
no flags Details | Diff
EditorMenuManager hijacking patch v8 (34.42 KB, patch)
2010-07-23 10:41 EDT, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2010-07-05 05:39:30 EDT
I20100701-1105.

1. start new workspace
2. create a Java project
3. create a file
4. open 'Edit' main menu 
==> most contributed items are missing (e.g. content assist, find actions).
Comment 1 Remy Suen CLA 2010-07-15 14:38:27 EDT
This seems to be what's happening on 3.x.

Thread [main] (Suspended)	
	MenuManager.update(boolean, boolean) line: 819	
	MenuManager.update(boolean) line: 678	
	EditorMenuManager(SubMenuManager).update(boolean) line: 364	
	TextEditorActionContributor.doSetActiveEditor(IEditorPart) line: 118	
	TextEditorActionContributor.setActiveEditor(IEditorPart) line: 144	
	EditorActionBars.partChanged(IWorkbenchPart) line: 343	
	WorkbenchPage$3.run() line: 635	
	SafeRunner.run(ISafeRunnable) line: 42	
	Platform.run(ISafeRunnable) line: 888	
	WorkbenchPage.activatePart(IWorkbenchPart) line: 624	
	WorkbenchPage.setActivePart(IWorkbenchPart, boolean) line: 3533	
	WorkbenchPage.internalActivate(IWorkbenchPart, boolean) line: 617	
	WorkbenchPage.activate(IWorkbenchPart) line: 589	
	WorkbenchPage.busyOpenEditorBatched(IEditorInput, String, boolean, int, IMemento) line: 2875	
	WorkbenchPage.busyOpenEditor(IEditorInput, String, boolean, int, IMemento) line: 2768	
	WorkbenchPage.access$11(WorkbenchPage, IEditorInput, String, boolean, int, IMemento) line: 2760	
	WorkbenchPage$10.run() line: 2711	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int, IMemento) line: 2707	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int) line: 2691	
	WorkbenchPage.openEditor(IEditorInput, String, boolean) line: 2682
Comment 2 Remy Suen CLA 2010-07-15 14:48:09 EDT
The editor adds items _directly_ to the 'Edit' menu's menu manager. However, in 4.0 we have already parsed that manager and transformed its items into model elements so further changes to that manager do not get reflected.
Comment 3 Remy Suen CLA 2010-07-16 10:05:23 EDT
Created attachment 174492 [details]
EditorMenuManager hijacking patch v1

We intercept contributions to the EditorMenuManager and turn them into MMCs. This is _incomplete_. You _will_ get duplicates if you have a Java editor and a text editor up. There are also still some missing entries.
Comment 4 Remy Suen CLA 2010-07-16 15:56:20 EDT
Created attachment 174535 [details]
EditorMenuManager hijacking patch v2

More items are showing. The only one that isn't right now is the 'Set Encoding...' action as it has no action definition id and is a retarget action in the "truest" sense of the word as it directly sets its internal action.

There are also ordering and separator problems but at least things are showing up now.
Comment 5 Remy Suen CLA 2010-07-20 14:30:49 EDT
Created attachment 174775 [details]
EditorMenuManager hijacking patch v3

'Set Encoding...' is still missing and the items are still a little out of place but the 'Content Assist' submenu seems to be showing up consistently now.
Comment 6 Dani Megert CLA 2010-07-21 05:25:05 EDT
>The only one that isn't right now is the 'Set Encoding...' action 
I don't know how you tested this but using SDK 4.0 - I20100720-2028 with these steps:
1. start new workspace
2. Package Explorer > context menu > New > Untitled Text File
3. main menu > Edit
==> I see 10 entries while on on 3.6 there are 18 ==> 8 missing
4. paste this into Package Explorer: class A {}
5. main menu > Edit
==> I see 11 entries while on on 3.6 there are 22 ==> 11 missing
Comment 7 Remy Suen CLA 2010-07-21 06:10:04 EDT
(In reply to comment #6)
> >The only one that isn't right now is the 'Set Encoding...' action 
> I don't know how you tested this but using SDK 4.0 - I20100720-2028

Dani, neither Paul and I have released the patch to HEAD. It sounds to me you are just testing your outer and not the inner (with the patch applied).
Comment 8 Dani Megert CLA 2010-07-21 06:11:24 EDT
Ah, OK! Sometimes Paul commits the patches but doesn't close the bug. I always only test directly on the build. So please ignore my previous comment.
Comment 9 Paul Webster CLA 2010-07-21 08:10:56 EDT
(In reply to comment #8)
> Ah, OK! Sometimes Paul commits the patches but doesn't close the bug. 

Sorry for adding to the confusion :-)

PW
Comment 10 Paul Webster CLA 2010-07-21 20:50:54 EDT
Created attachment 174934 [details]
EMM hijacking patch v4

The plan is to post-process the MenuManagers added.

I'm not sure where the first Expand Selection To is coming from.

PW
Comment 11 Dani Megert CLA 2010-07-22 04:02:46 EDT
>I'm not sure where the first Expand Selection To is coming from.
FYI: The menu is added by BasicJavaEditorActionContributor.contributeToMenu(IMenuManager)
Comment 12 Paul Webster CLA 2010-07-22 14:01:33 EDT
Created attachment 175004 [details]
EMM hijacking patch v05

Work in progress.   Provides editor menus and submenus.

1) 3 items appear out of order

2) there are 3 separators in a row in a text editor

PW
Comment 13 Remy Suen CLA 2010-07-22 14:23:21 EDT
The check state of 'Smart Insert Mode' doesn't seem to stick but I believe that's a duplicate of some other generic bug.
Comment 14 Remy Suen CLA 2010-07-22 14:34:50 EDT
CCE thrown when opening the 'Edit' menu in the "sub text editor" of a build.properties form editor.

java.lang.ClassCastException: org.eclipse.jface.action.SubContributionItem incompatible with org.eclipse.jface.action.ContributionItem
	at org.eclipse.e4.ui.workbench.renderers.swt.RenderedMenuItemRenderer.fill(RenderedMenuItemRenderer.java:79)
	at org.eclipse.e4.ui.workbench.renderers.swt.RenderedMenuItemRenderer.createWidget(RenderedMenuItemRenderer.java:73)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:612)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:403)
	at org.eclipse.e4.ui.workbench.swt.modeling.MenuServiceFilter.render(MenuServiceFilter.java:235)
	at org.eclipse.e4.ui.workbench.swt.modeling.MenuServiceFilter.showMenu(MenuServiceFilter.java:155)
	at org.eclipse.e4.ui.workbench.swt.modeling.MenuServiceFilter.handleMenu(MenuServiceFilter.java:117)
	at org.eclipse.e4.ui.workbench.swt.modeling.MenuServiceFilter.handleEvent(MenuServiceFilter.java:103)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1253)
Comment 15 Remy Suen CLA 2010-07-23 08:35:35 EDT
Created attachment 175061 [details]
EditorMenuManager hijacking patch v6

Added instanceof checks to prevent CCEs.
Comment 16 Remy Suen CLA 2010-07-23 08:55:16 EDT
Created attachment 175064 [details]
EditorMenuManager hijacking patch v7

We were getting doubles with multiple workbench windows. Now we expand our expression to include checking both the editor's id and the active workbench window.
Comment 17 Paul Webster CLA 2010-07-23 10:14:04 EDT
(In reply to comment #16)
> Created an attachment (id=175064) [details]
> EditorMenuManager hijacking patch v7

We need to fix org.eclipse.ui.internal.EditorReference.disposeEditorActionBars(EditorActionBars) so that it only disposes the EAB for that window

We need to scope org.eclipse.ui.internal.EditorMenuManager.disposeManager() to the current EditorActionBars/IWW

We need to make sure our EABs are disposed on shutdown and on window close.

PW
Comment 18 Remy Suen CLA 2010-07-23 10:41:39 EDT
Created attachment 175068 [details]
EditorMenuManager hijacking patch v8

Added more code to consider scenarios during shutdown and multiple workbench windows.
Comment 19 Boris Bokowski CLA 2010-07-23 11:24:41 EDT
Scary patch, but much better than what we've had before. I hope we won't have too much fallout :-)

+1
Comment 20 Paul Webster CLA 2010-07-23 11:28:26 EDT
(In reply to comment #18)
> Created an attachment (id=175068) [details]
> EditorMenuManager hijacking patch v8

+1 

We'll track the behaviour of the build.

Remy, feel free to release.

PW
Comment 21 Remy Suen CLA 2010-07-23 11:34:48 EDT
(In reply to comment #18)
> Created an attachment (id=175068) [details]
> EditorMenuManager hijacking patch v8

Patch released to HEAD. Opened two other known bugs at the moment.

--------

Bug 320739 [Compatibility] 'Content Assist' submenu of the 'Edit' menu appears in the wrong place

Bug 320740 [Compatibility] SubContributionItems and SubMenuManagers do not get contributed to the editor action bars
Comment 22 Dani Megert CLA 2010-07-26 09:27:38 EDT
Verified in SDK 4.0 - I20100722-2038.