Bug 56423

Summary: [MPE] MultiPageSelectionProvider should take the editor into acount
Product: [Eclipse Project] Platform Reporter: Dejan Glozic <dejan>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P5 CC: daniel_megert, david_williams, pwebster, thatnitind
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dejan Glozic CLA 2004-03-26 16:37:59 EST
MultiPageSelectionProvider currently assumes that only nested editors can 
provide selections. This is unfortunate for FormEditor, where pages 
contributed as controls can also be selection source. 

The proposed fix is to check the active nested editor first. If the result is 
null, go to the multi-page editor site itself and see if it has a selection 
provider.

For example:

public ISelection getSelection() {
	IEditorPart activeEditor = multiPageEditor.getActiveEditor();
	if (activeEditor != null) {
		ISelectionProvider selectionProvider = activeEditor.getSite
().getSelectionProvider();
		if (selectionProvider != null)
			return selectionProvider.getSelection();
	}
	return null;
}

should be rewritten to be

public ISelection getSelection() {
	IEditorPart activeEditor = multiPageEditor.getActiveEditor();
	if (activeEditor != null) {
		ISelectionProvider selectionProvider = activeEditor.getSite
().getSelectionProvider();
		if (selectionProvider != null)
			return selectionProvider.getSelection();
	}
        else {
          ISelectionProvider selectionProvider = multiPageEditor.getSite
().getSelectionProvider();
                if (selectionProvider != null)
                        return selectionProvider.getSelection();
        }
	return null;
}

I didn't check other classes similar to this one, but in general, 
MultiPageEditorPart and its site should be given a try if active nested editor 
is not found.
Comment 1 Paul Webster CLA 2005-10-27 10:29:31 EDT
I was investigating bug 108324 and I looked at this one as well.

MultiPageSelectionProvider is the multiPageEditor.getSite
().getSelectionProvider().

In MultiPageSelectionProvider#getSelection() we could augment API so that
non-editor pages could also supply IPostSelectionProvders ... although that
doesn't look very straightforward.

Later,
PW
Comment 2 Paul Webster CLA 2006-09-28 15:13:22 EDT
Is this still a problem in 3.3?

PW
Comment 3 Denis Roy CLA 2007-06-22 09:32:37 EDT
Changes requested on bug 193523
Comment 4 Eclipse Webmaster CLA 2019-09-06 15:30:58 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.
Comment 5 Eclipse Webmaster CLA 2019-09-06 15:36:41 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.