Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to change the parent of an edit part
How to change the parent of an edit part [message #210822] Mon, 10 November 2008 19:15 Go to next message
Eclipse UserFriend
Originally posted by: knakov.scopeset.de

Hi,

I have two edit parts with complex semantical relationship - something a
child and an indirect container. If there is no container in the canvas,
the child's parent should be the diagram edit part. If I insert the
container part however, I want all the children of this container to be
re-parented for to the new container part. How can I accomplish this?

Thanks in advance,
Kalin
Re: How to change the parent of an edit part [message #210920 is a reply to message #210822] Tue, 11 November 2008 21:56 Go to previous messageGo to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Hi Kalin,

I assume you want something like this?

<a>
<b>
<c>
</a>

to:

<a>
<d>
<b>
<c>
</d>
</a>

As you can see you are changing the model underneath so one solution
would be to iterate over the children of <a>, remove them, and then
re-add them to <d>.

Hope this helps

Jevon

Kalin Nakov wrote:
> Hi,
>
> I have two edit parts with complex semantical relationship - something a
> child and an indirect container. If there is no container in the canvas,
> the child's parent should be the diagram edit part. If I insert the
> container part however, I want all the children of this container to be
> re-parented for to the new container part. How can I accomplish this?
>
> Thanks in advance,
> Kalin
Re: How to change the parent of an edit part [message #210928 is a reply to message #210920] Wed, 12 November 2008 07:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: knakov.scopeset.de

Hi Jevon,

I want everything to be immediately visible when I drag elements with
the mouse on the diagram. When I just change the underlying diagram
eResource's, would this be enough? I mean will the whole notification
chain get triggered and everything updated on the screen?

Cheers,
Kalin

Jevon Wright wrote:
> Hi Kalin,
>
> I assume you want something like this?
>
> <a>
> <b>
> <c>
> </a>
>
> to:
>
> <a>
> <d>
> <b>
> <c>
> </d>
> </a>
>
> As you can see you are changing the model underneath so one solution
> would be to iterate over the children of <a>, remove them, and then
> re-add them to <d>.
>
> Hope this helps
>
> Jevon
>
> Kalin Nakov wrote:
>> Hi,
>>
>> I have two edit parts with complex semantical relationship - something
>> a child and an indirect container. If there is no container in the
>> canvas, the child's parent should be the diagram edit part. If I
>> insert the container part however, I want all the children of this
>> container to be re-parented for to the new container part. How can I
>> accomplish this?
>>
>> Thanks in advance,
>> Kalin
Re: How to change the parent of an edit part [message #210998 is a reply to message #210928] Wed, 12 November 2008 12:34 Go to previous message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Hi Kalin,

I think if you change the underlying model, the visual model will not be
automatically updated. (I'm not sure about this?)

However if you use some of the GMF commands in your editor, such as
CreateElementCommand, you can create elements visually that represent
new elements in the model. In my project I currently use these kinds of
commands to add/remove elements from the underlying model when the
diagram editor is opened.
http://wiki.eclipse.org/GMF_Tutorial_Part_3#Custom_Actions introduces
how to use these commands in an edit part.

Hope this helps :)

Jevon

Kalin Nakov wrote:
> Hi Jevon,
>
> I want everything to be immediately visible when I drag elements with
> the mouse on the diagram. When I just change the underlying diagram
> eResource's, would this be enough? I mean will the whole notification
> chain get triggered and everything updated on the screen?
>
> Cheers,
> Kalin
>
> Jevon Wright wrote:
>> Hi Kalin,
>>
>> I assume you want something like this?
>>
>> <a>
>> <b>
>> <c>
>> </a>
>>
>> to:
>>
>> <a>
>> <d>
>> <b>
>> <c>
>> </d>
>> </a>
>>
>> As you can see you are changing the model underneath so one solution
>> would be to iterate over the children of <a>, remove them, and then
>> re-add them to <d>.
>>
>> Hope this helps
>>
>> Jevon
>>
>> Kalin Nakov wrote:
>>> Hi,
>>>
>>> I have two edit parts with complex semantical relationship -
>>> something a child and an indirect container. If there is no container
>>> in the canvas, the child's parent should be the diagram edit part. If
>>> I insert the container part however, I want all the children of this
>>> container to be re-parented for to the new container part. How can I
>>> accomplish this?
>>>
>>> Thanks in advance,
>>> Kalin
Previous Topic:How to add Save As Image command
Next Topic:CVS examples
Goto Forum:
  


Current Time: Thu Mar 28 16:40:38 GMT 2024

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

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

Back to the top