Adding a listener to a diagram after opening it in an edtor [message #56403] |
Wed, 27 September 2006 13:42 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: daniel-p.gmx.de
Hi everybody,
I need to add a listener to a digram after I opened it programmatically. I
first create a FileInput which I then pass to the IEditorPart
IDE.openEditor method.
I tried adding a listener to the underlying domain model before calling
IDE.openEditor, but as I expected this does not work.
Does anybody know how to accomplish that task?
Thanks,
Dan
|
|
|
|
Re: Adding a listener to a diagram after opening it in an edtor [message #56922 is a reply to message #56871] |
Thu, 28 September 2006 10:42 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: daniel-p.gmx.de
Sorry, that does not work in my case, since I have to add the listener
from inside another plug-in and set up the listener with some generic
information.
Dan
On Thu, 28 Sep 2006 11:12:51 +0200, Alex Shatalin <vano@borland.com> wrote:
> Hello Daniel,
>
> Please take a loot on generated ???EditPart class for your diagram.
> (this class extends DiagramEditPart). You can override
> addNotationalListeners() method in this class and attach your listener
> to the Diagram instance there.
>
> -----------------
> Alex Shatalin
>
>
|
|
|
|
|
Re: Adding a listener to a diagram after opening it in an edtor [message #58359 is a reply to message #57675] |
Mon, 02 October 2006 14:02 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Mohammed Mostafa![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mmostafa%40ca.ibm.com) Messages: 143 Registered: July 2009 |
Senior Member |
|
|
Daniel :
I don not think View Factories are the way to go here; since view
factories will be invoked only during view creation; which means if your
diagram view is serialized in the resource, the next time you open it no
view factory will be called to create the diagram.
Now , regarding adding listeners, when you say you open the diagram
programatically do you mean you just opened the resource or did you
render the diagram on the screen ?
If you just loaded the resource, then Edit parts or edit policies
will not help since they exist only if the diagram is rendered, an you
might need a resource listener instead which you should install after
you load the resource
If you rendered the diagram then your diagram edit part is already
listening to the diagram, you can modify it to add listeners as you
like, check addSemanticListeners, or you can create a speciallied edit
policy that does the listening and install it on your edit part
> Daniel,
>
> Depending on what you want to do, it might make more sense to install an
> editpolicy on your diagram editpart and add the listener in here. Search
> the GMF docs for info on the editpolicy service to learn how to install
> an editpolicy from another plugin.
>
> Regards,
> Cherie
>
> Alex Shatalin wrote:
>> Hello Daniel,
>>
>> Then take a look on generated ???ViewProvider class. This class return
>> ???ViewFactory.class from getDiagramViewClass(). You can:
>> - create your own ViewProvider and register it with higher priority
>> then generated one
>> - implement only getDiagramViewClass in this provider and return
>> custom factory class from there.
>> - custom factory class could subclass generated factory class and
>> attach desired listener by overriding createDiagram() method.
>>
>> -----------------
>> Alex Shatalin
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04812 seconds