How to change the parent of an edit part [message #210822] |
Mon, 10 November 2008 19:15 |
Eclipse User |
|
|
|
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 #210928 is a reply to message #210920] |
Wed, 12 November 2008 07:26 |
Eclipse User |
|
|
|
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 |
Jevon 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
|
|
|
Powered by
FUDForum. Page generated in 0.03268 seconds