Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to get editPart from notation.Diagram
How to get editPart from notation.Diagram [message #171083] Fri, 01 February 2008 13:04 Go to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

I have a gmf.runtime.notation.Diagram - Is there a way to get it's editPart?


Tomas
Re: How to get editPart from notation.Diagram [message #171092 is a reply to message #171083] Fri, 01 February 2008 13:12 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
Hi Tomas,

EditParts exist only in the context of an EditPartViewer showing them.
If you have an EditPartViewer, then
viewer.getEditPartRegistry().get(notationalElement) will return the edit
part associated with this notational element. For the diagram itself,
viewer.getContents() is a shorter alternative.
If you don't have any viewer, then the concept of edit part makes little
sense. One notational element may correspond to many different edit
parts, they don't even need to be of the same or related classes (e.g.,
a subclass of GraphicalEditPart vs. subclass of TreeEditPart).

Hope that helps.
Best regards,
Boris


Tomas Zijdemans wrote:
> I have a gmf.runtime.notation.Diagram - Is there a way to get it's
> editPart?
>
>
> Tomas
Re: How to get editPart from notation.Diagram [message #171106 is a reply to message #171092] Fri, 01 February 2008 13:22 Go to previous message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Boris Blajer wrote:
> Hi Tomas,
>
> EditParts exist only in the context of an EditPartViewer showing them.
> If you have an EditPartViewer, then
> viewer.getEditPartRegistry().get(notationalElement) will return the edit
> part associated with this notational element. For the diagram itself,
> viewer.getContents() is a shorter alternative.
> If you don't have any viewer, then the concept of edit part makes little
> sense. One notational element may correspond to many different edit
> parts, they don't even need to be of the same or related classes (e.g.,
> a subclass of GraphicalEditPart vs. subclass of TreeEditPart).
>
> Hope that helps.
> Best regards,
> Boris

Thanks for clarifying.

What I'm trying to achieve is to run a create command after a diagram
gets created. ...EditorUtil's doExecuteWithResult seems like the best
place. A create command needs a DiagramEditPart to create a node. Simply
adding them to the diagram.getElement()'s collection seems to initialize
the node incorrectly... Hmm.. Anyways, Thanks for helping!


Tomas


>
>
> Tomas Zijdemans wrote:
>> I have a gmf.runtime.notation.Diagram - Is there a way to get it's
>> editPart?
>>
>>
>> Tomas
Previous Topic:accessign properties from IAction
Next Topic:Rotate border figure
Goto Forum:
  


Current Time: Thu Apr 25 04:06:11 GMT 2024

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

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

Back to the top