Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [gef-dev] Wrapping GraphicalEditor inside another EditorPart


A workbench part may need to do lots of thing which you cannot simulate when you wrapper it inside another part.  Our example was the GraphicalEditor needs to check whether or not it is the active part.  Another example, is that a part may get the IEditorSite, and configure the keybindingService to the scope(s) which apply to that part. If you use MultiPageEditorPart, then the "last one in" wins, and it overwrites the scopes set by the other pages.  Yet another example is to get the site, and call setSelectionProvider(someViewer).  Again, last one in wins.

The JavaDoc for GraphicalEditor recommends that you use our implementation as a template for your own, not as the superclass.

thanks,
randy



"Johnson, Erik J (Erik)" <ejohnson@xxxxxxxxx>
Sent by: gef-dev-admin@xxxxxxxxxxx

12/04/2003 04:01 PM
Please respond to gef-dev

       
        To:        <gef-dev@xxxxxxxxxxx>
        cc:        
        Subject:        RE: [gef-dev] Wrapping GraphicalEditor inside another EditorPart



Randy-
 
I am using a GraphicalEditorWithPalette inside a MultiPageEditorPart and noticed problems with the selection actions.  
Can you go into more detail in what you mean by misusing GraphicalEditor in this way (wrapping the editor in another editor part).  What is the recommended way to use GraphicalEditor?  And what do you mean that "a workbench part is not a convenient unit for composition."
 
Thanks,
Erik
 
 
 
-----Original Message-----
From:
gef-dev-admin@xxxxxxxxxxx [mailto:gef-dev-admin@xxxxxxxxxxx]On Behalf Of Randy Hudson
Sent:
Wednesday, December 03, 2003 8:20 AM
To:
gef-dev@xxxxxxxxxxx
Subject:
[gef-dev] Wrapping GraphicalEditor inside another EditorPart


In GEF 2.1.2, we fixed a bug which required us to check whether an editor was currently active when it received selection notification from the SelectionService.  The do this is to call getSite().getPage().getActiveEditor() == this.


If you are composing/wrapping GraphicalEditor or GraphicalEditorWithPalette inside another EditorPart (such as MultiPageEditorPart), then GraphicalEditor will never think that it is active, and none of your SelectionActions will work.


If you are (mis)using GraphicalEditor in this way, the hack to avoid this problem is to subclass it and override selectionChanged(...) to call:

updateActions(getSelectionActions());

whenever your wrappered editor is active.


We have made an effort to put as little as possible in GraphicalEditor in hopes that people would not feel obligated to reuse it.  We have done this intentionally because a workbench part is not a convenient unit for composition.


Randy Hudson


Back to the top