reference GraphicalEditor from an EditPart [message #195975] |
Wed, 14 September 2005 17:05 |
Eclipse User |
|
|
|
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 #195991 is a reply to message #195983] |
Wed, 14 September 2005 21:02 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.04053 seconds