Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » SelectionActions and MultiPageEditorPart
SelectionActions and MultiPageEditorPart [message #127815] Fri, 16 April 2004 18:22 Go to next message
Jose M Beleta is currently offline Jose M BeletaFriend
Messages: 70
Registered: July 2009
Member
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 #127870 is a reply to message #127815] Sat, 17 April 2004 23:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This is just one of several problems you will have when you embed
GraphicalEditor inside multipage editor. It is not supported.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=46207

"Jose M Beleta" <beleta@attglobal.net> wrote in message
news:c5p7u6$k4$1@eclipse.org...
> 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 11:44 Go to previous message
Andreas Herz is currently offline Andreas HerzFriend
Messages: 196
Registered: July 2009
Senior Member
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
>
>
Previous Topic:Newbie: GEF standalone
Next Topic:Generating XML presentation of my model (similar to XMI)
Goto Forum:
  


Current Time: Thu Sep 26 03:37:33 GMT 2024

Powered by FUDForum. Page generated in 0.02821 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top