Bug 32666 - [EditorMgmt] [Services] MultiEditor does not enable global actions
Summary: [EditorMgmt] [Services] MultiEditor does not enable global actions
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-24 10:01 EST by Rodrigo Peretti CLA
Modified: 2019-09-06 15:35 EDT (History)
5 users (show)

See Also:


Attachments
Patch to 3.0.1 WorkbenchPage (4.45 KB, patch)
2004-10-25 13:56 EDT, Sean Kirby CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rodrigo Peretti CLA 2003-02-24 10:01:40 EST
build I20030218

If you create a MultiEditor that opens various text editors, the global 
actions on the Edit menu (copy, cut, paste, undo, etc...) are disabled and the 
user cannot access them.
Comment 1 Eduardo Pereira CLA 2003-02-24 11:07:20 EST
This is a bug in WorkbenchPage.getReference().
Should delete the lines:
	if(pane instanceof MultiEditorInnerPane) {
		MultiEditorInnerPane innerPane = (MultiEditorInnerPane)pane;
		return innerPane.getParentPane().getPartReference();
	}
Comment 2 Nick Edgar CLA 2003-03-03 15:33:31 EST
Rodrigo, do you need this for 2.1?
Comment 3 Rodrigo Peretti CLA 2003-03-03 15:41:26 EST
It seems we will not need it anymore. We are taking a different approach that 
does not use the MultiEditor. You can defer this one.
Comment 4 Douglas Pollock CLA 2004-07-15 14:55:08 EDT
This is still a problem in M200407150800.  Checked using the TiledEditor 
example. 
Comment 5 Sean Kirby CLA 2004-10-23 19:44:07 EDT
I'm having this exact same problem with the MultiEditor in 3.0.1.  

The root of the problem lies in the fact that when one of the inner editors is
activated, the IPartListener2 implementors receive PartReferences for the outer
editor that implements MultiEditor, not to the inner editor that was actually
activated/deactivated/etc.  The reason for this is indeed because of
WorkbenchPage.getReference(IWorkbenchPart) just as Eduardo suggests (because
getReference() returns a reference to the outer editor given an inner editor)  

The actual cause for this bug is because the RetargetActions attempt to connect
to the currently activated workbench part whenever a new one gets activated. 
The RetargetActions created in the ActionFactory are notified of part
activations via the IPartService of the IWorkbenchWindow.  The IPartService is
implemented by the WWinPartService which uses an IPartListener2 to capture part
activations from the active IWorkbenchPage.  Therefore, whenever an inner editor
is activated, the global RetargetActions only see that the outer editor has been
activated (which won't have any action handlers) so they will always be disabled.
Comment 6 Sean Kirby CLA 2004-10-25 13:56:29 EDT
Created attachment 15362 [details]
Patch to 3.0.1 WorkbenchPage

i have attached a patch to the WorkbenchPage that fixes this bug for me.  The
version of the WorkbenchPage that i used to make the patch was from 3.0.1.

Please let me know if this patch is acceptable.  Thanks.
Comment 7 Douglas Pollock CLA 2004-11-08 16:18:51 EST
Another services bug.... 
 
Marking as 3.1, so I remember to come back and look at this patch when I have 
more time. 
Comment 8 Douglas Pollock CLA 2005-02-21 16:38:11 EST
I don't think I'll have time to look at this for 3.1.  Sorry.
Comment 9 Stefan Xenos CLA 2005-04-28 17:08:55 EDT
Sadly, the WorkbenchPage code has changed a lot since 3.0 and this patch no
longer applies.
Comment 10 Stefan Xenos CLA 2005-04-28 17:28:34 EDT
Just rolled back to 3.0.2 (version 1.154.2.3) and applied the patch. I like the
approach this patch takes (the split into getContainerReference() and
getReference() isolates those nasty instanceof checks).

I think it shouldn't be too hard to use the same technique on the 3.1 version...
but I wouldn't want to try it without any regression tests.
Comment 11 Michael Van Meekeren CLA 2006-04-21 13:19:48 EDT
Moving Dougs bugs
Comment 12 Boris Bokowski CLA 2008-07-31 11:10:07 EDT
Adding Nikolay to the cc list.
Comment 13 Nikolay Botev CLA 2008-08-11 22:56:01 EDT
AbstractMultiEditor does not exhibit problems with global actions (such as cut/copy/paste). I am not 100% certain but if I remember correctly this problem was sitll present with MultiEditor in 3.4.

The fix in AbstractMultiEditor, however, which fixes the global actions problem is different from the one described here. Even though there are only 33 references to the getReference() method, and all of them (except for 12 uses in test classes) are concentrated in the o.e.ui.workbench project, getReference() is a public API and I would not advocate changing its behavior. If at all necessary, I would prefer adding a different method with the capability of returning inner editor references.
Comment 14 Boris Bokowski CLA 2009-11-17 13:07:57 EST
Remy is now responsible for watching the [EditorMgmt] component area.
Comment 15 Eclipse Webmaster CLA 2019-09-06 15:35:31 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.