SelectionActions and MultiPageEditorPart [message #127815] |
Fri, 16 April 2004 14:22  |
Eclipse User |
|
|
|
If a GraphicalEditor is embedded within a MultiPageEditorPart the registered
SelectionsAction actions do not get updated when the selection changes.
This is due to the fact that the following code exists in
org.eclipse.gef.ui.parts.GraphicalEditor:
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
// If not the active editor, ignore selection changed.
if
(this.equals(getSite().getWorkbenchWindow().getActivePage(). getActiveEditor(
)))
updateActions(selectionActions);
}
In this case the active editor returned by ...getActiveEditor() is the
MultiPageEditor not the the GraphicalEditor, one way to fix it would be to
change the above method to:
public void selectionChanged(IWorkbenchPart part, ISelection selection)
{
// If not the active editor, ignore selection changed.
IEditorPart editorPart =
getSite().getWorkbenchWindow().getActivePage().getActiveEdit or();
if (editorPart instanceof MultiPageEditorPart)
editorPart = ((MultiPageEditorPart)editorPart).getActiveEditor();
if (this.equals(editorPart))
updateActions(getSelectionActions());
}
Unfortunately MultiPageEditorPart#.getActiveEditor() is not public so this
fix cannot be done in the GraphicalEditor code but need to be done in the
subclasses.
Any other suggestion?
Jose M Beleta
|
|
|
|
Re: SelectionActions and MultiPageEditorPart [message #134699 is a reply to message #127815] |
Fri, 28 May 2004 07:44  |
Eclipse User |
|
|
|
Hi I have the same problem with the MultiPageEditorPart and
the PropertySheet.
I have seen an example called "NetworkEditor" (WorkflowEditor)
which have multiple EditorPages in one MultiPageEditorPart AND
the PropertySheet works fine. If I select an Element in the
NetworkEditor the corresponding properties of the EditorPart
(or Model) will be display in the PropertySheet.
I have try to implement the SelectionListener, Action, ....code
like the NetworkEditor -> no result. The properties of my Model
will only be display if I instantiate the Editor not in a
MultiPageEditorPart.
The NetworkEditor is explained in the
redbook:http://publib-b.boulder.ibm.com/Redbooks.nsf/Redbook Abstracts/sg246302.html?Open
code: ftp://www.redbooks.ibm.com/redbooks/SG246302/sg246302.zip
How can do the same - multiple pages with selection and the corresponding
propety sheet?
Greetings
Andreas Herz
Jose M Beleta wrote:
> If a GraphicalEditor is embedded within a MultiPageEditorPart the registered
> SelectionsAction actions do not get updated when the selection changes.
>
> This is due to the fact that the following code exists in
> org.eclipse.gef.ui.parts.GraphicalEditor:
>
> public void selectionChanged(IWorkbenchPart part, ISelection selection) {
> // If not the active editor, ignore selection changed.
> if
> (this.equals(getSite().getWorkbenchWindow().getActivePage(). getActiveEditor(
> )))
> updateActions(selectionActions);
> }
>
> In this case the active editor returned by ...getActiveEditor() is the
> MultiPageEditor not the the GraphicalEditor, one way to fix it would be to
> change the above method to:
>
> public void selectionChanged(IWorkbenchPart part, ISelection selection)
> {
> // If not the active editor, ignore selection changed.
> IEditorPart editorPart =
> getSite().getWorkbenchWindow().getActivePage().getActiveEdit or();
> if (editorPart instanceof MultiPageEditorPart)
> editorPart = ((MultiPageEditorPart)editorPart).getActiveEditor();
> if (this.equals(editorPart))
> updateActions(getSelectionActions());
> }
>
> Unfortunately MultiPageEditorPart#.getActiveEditor() is not public so this
> fix cannot be done in the GraphicalEditor code but need to be done in the
> subclasses.
>
> Any other suggestion?
>
> Jose M Beleta
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03758 seconds