Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » reference GraphicalEditor from an EditPart
reference GraphicalEditor from an EditPart [message #195975] Wed, 14 September 2005 17:05 Go to next message
Eclipse UserFriend
Originally posted by: pbeagan.yahoo_dontspamme_.com

I need to be able to get a reference to my GraphicalEditor from an EditPart.
Is there a way to do this?

I wrote a custom view which is a ISelectionListener listening for EditPart
selections. It makes updates to my model without using the command stack.
I need to be able to setDirty() on my GraphicalEditor.
Re: reference GraphicalEditor from an EditPart [message #195983 is a reply to message #195975] Wed, 14 September 2005 18:16 Go to previous messageGo to next message
Martijn van Steenbergen is currently offline Martijn van SteenbergenFriend
Messages: 16
Registered: July 2009
Junior Member
Why don't you use the command stack?

Patrick wrote:
> I need to be able to get a reference to my GraphicalEditor from an EditPart.
> Is there a way to do this?
>
> I wrote a custom view which is a ISelectionListener listening for EditPart
> selections. It makes updates to my model without using the command stack.
> I need to be able to setDirty() on my GraphicalEditor.
Re: reference GraphicalEditor from an EditPart [message #195991 is a reply to message #195983] Wed, 14 September 2005 21:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pbeagan.yahoo_dontspamme_.com

Well My view knows nothing about the command stack or the GraphicalEditor,
it only knows about selected objects that implement my interface. I will
look into hooking it into using the command stack, but right now I'm really
not sure how to do this as loading the view does not seem to pass through
the GraphicalEditor.getAdapter() method. If it did, I would be able to
grab the reference to the GraphicalEditor.



Martijn van Steenbergen wrote:

> Why don't you use the command stack?
>
> Patrick wrote:
>> I need to be able to get a reference to my GraphicalEditor from an
>> EditPart. Is there a way to do this?
>>
>> I wrote a custom view which is a ISelectionListener listening for
>> EditPart
>> selections. It makes updates to my model without using the command
>> stack. I need to be able to setDirty() on my GraphicalEditor.
Re: reference GraphicalEditor from an EditPart [message #196007 is a reply to message #195991] Thu, 15 September 2005 06:12 Go to previous message
Eclipse UserFriend
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl

You can register your view as a part listener to the current workbench
page. Then you get notified whenever an editor get (de)activated (or
more generally, whenever a part (=editor/view) gets (de)activated). Use
this to track the active editor. Whenever the active editor changes, ask
the new active editor for a command stack:

editor.getAdapter(CommandStack.class)

Then it doesn't really matter anymore whether the editor is an instance
of your GraphicalEditor so you won't even have to cast to
(YourGraphicalEditor). Make sure your GraphicalEditor returns its
command stack in its getAdapter() method. It might already do this (I'm
not sure); else you'll have to override.

Regards,

Martijn.

Patrick wrote:
> Well My view knows nothing about the command stack or the GraphicalEditor,
> it only knows about selected objects that implement my interface. I will
> look into hooking it into using the command stack, but right now I'm really
> not sure how to do this as loading the view does not seem to pass through
> the GraphicalEditor.getAdapter() method. If it did, I would be able to
> grab the reference to the GraphicalEditor.
Previous Topic:Getting abolute path
Next Topic:Gradient fill for ovals
Goto Forum:
  


Current Time: Fri Jan 24 17:51:28 GMT 2025

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

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

Back to the top