Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Set Node Visible when initialized
Set Node Visible when initialized [message #198528] Wed, 23 July 2008 11:38 Go to next message
Guillaume Gauffre is currently offline Guillaume GauffreFriend
Messages: 65
Registered: July 2009
Member
Hi,

I have one connection of type X between two nodes of type A.
When I create such a link, I initialize a reference of this connection
which refers to a node of type B.
The resulted figure is a connection X between the 2 nodes of type A and
another connection between the link X previsouly created and the node of
type B. So the 2nd connection doesn't map an EClass of my ecore model,
just a reference between classes X and B.
My problem is that when I create my connection X, the connection appears
but the figure B doesn't, except if I create a node or if I reopen the
diagram.
And if I delete the connection X, the node B is always displayed, except
if I reopen the diagram or create a new node.
How could I resolve this problem, what kind of action is realized during
the creation of a node which make my node B visible ?

Thanks.

Guillaume
Re: Set Node Visible when initialized [message #198554 is a reply to message #198528] Wed, 23 July 2008 12:54 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Guillaume,

The easy wasy is to call diagram update in these cases. See generated ???DiagramUpdateCommand.

-----------------
Alex Shatalin
Re: Set Node Visible when initialized [message #198614 is a reply to message #198528] Wed, 23 July 2008 14:12 Go to previous messageGo to next message
Guillaume Gauffre is currently offline Guillaume GauffreFriend
Messages: 65
Registered: July 2009
Member
I have another problem concerning these parts of my editor :

I also need to set visible node B and its link to the connection X when
the connection X is selected, and set unvisible the others.

To do that I extend the SelectionEditPolicy class and override the
showPrimarySelection() :

I find the Edge and Node elements that I need to set visible or not but
when I try to use setVisible(), I have an exception like this :

java.lang.IllegalStateException: Cannot modify resource set without a
write transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:338)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:300)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:282)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:238)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
at
org.eclipse.gmf.runtime.notation.impl.ViewImpl.setVisible(Vi ewImpl.java:228)


Does anybody know why ?

Many thanks !

Guillaume a écrit :
> Hi,
>
> I have one connection of type X between two nodes of type A.
> When I create such a link, I initialize a reference of this connection
> which refers to a node of type B.
> The resulted figure is a connection X between the 2 nodes of type A and
> another connection between the link X previsouly created and the node of
> type B. So the 2nd connection doesn't map an EClass of my ecore model,
> just a reference between classes X and B.
> My problem is that when I create my connection X, the connection appears
> but the figure B doesn't, except if I create a node or if I reopen the
> diagram.
> And if I delete the connection X, the node B is always displayed, except
> if I reopen the diagram or create a new node.
> How could I resolve this problem, what kind of action is realized during
> the creation of a node which make my node B visible ?
>
> Thanks.
>
> Guillaume
Re: Set Node Visible when initialized [message #198655 is a reply to message #198554] Wed, 23 July 2008 14:54 Go to previous messageGo to next message
Guillaume Gauffre is currently offline Guillaume GauffreFriend
Messages: 65
Registered: July 2009
Member
Thanks, your trick works, I use the canonicalEditPolicy of the element
containing my connections !
thanks again

Alex Shatalin a écrit :
> Hello Guillaume,
>
> The easy wasy is to call diagram update in these cases. See generated
> ???DiagramUpdateCommand.
>
> -----------------
> Alex Shatalin
>
>
Re: Set Node Visible when initialized [message #198750 is a reply to message #198614] Thu, 24 July 2008 07:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.[REMOVE]stefan-kuhn.eu

use a AbstractTransactionalCommand to do changes to the domain or
notation model.

-stefan


Guillaume schrieb:
> I have another problem concerning these parts of my editor :
>
> I also need to set visible node B and its link to the connection X when
> the connection X is selected, and set unvisible the others.
>
> To do that I extend the SelectionEditPolicy class and override the
> showPrimarySelection() :
>
> I find the Edge and Node elements that I need to set visible or not but
> when I try to use setVisible(), I have an exception like this :
>
> java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:338)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:300)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:282)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:238)
>
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
>
> at
> org.eclipse.gmf.runtime.notation.impl.ViewImpl.setVisible(Vi ewImpl.java:228)
>
>
>
> Does anybody know why ?
>
> Many thanks !
>
> Guillaume a écrit :
>> Hi,
>>
>> I have one connection of type X between two nodes of type A.
>> When I create such a link, I initialize a reference of this
>> connection which refers to a node of type B.
>> The resulted figure is a connection X between the 2 nodes of type A
>> and another connection between the link X previsouly created and the
>> node of type B. So the 2nd connection doesn't map an EClass of my
>> ecore model, just a reference between classes X and B.
>> My problem is that when I create my connection X, the connection
>> appears but the figure B doesn't, except if I create a node or if I
>> reopen the diagram.
>> And if I delete the connection X, the node B is always displayed,
>> except if I reopen the diagram or create a new node.
>> How could I resolve this problem, what kind of action is realized
>> during the creation of a node which make my node B visible ?
>>
>> Thanks.
>>
>> Guillaume
Re: Set Node Visible when initialized [message #198784 is a reply to message #198750] Thu, 24 July 2008 09:32 Go to previous messageGo to next message
Guillaume Gauffre is currently offline Guillaume GauffreFriend
Messages: 65
Registered: July 2009
Member
Thanks,
I've just found the trick !

Another quick question : is it possible to get the View object
corresponding to a model element ?



Stefan Kuhn a écrit :
> use a AbstractTransactionalCommand to do changes to the domain or
> notation model.
>
> -stefan
>
>
> Guillaume schrieb:
>> I have another problem concerning these parts of my editor :
>>
>> I also need to set visible node B and its link to the connection X
>> when the connection X is selected, and set unvisible the others.
>>
>> To do that I extend the SelectionEditPolicy class and override the
>> showPrimarySelection() :
>>
>> I find the Edge and Node elements that I need to set visible or not
>> but when I try to use setVisible(), I have an exception like this :
>>
>> java.lang.IllegalStateException: Cannot modify resource set without a
>> write transaction
>> at
>> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:338)
>>
>> at
>> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:300)
>>
>> at
>> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:282)
>>
>> at
>> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:238)
>>
>> at
>> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
>>
>> at
>> org.eclipse.gmf.runtime.notation.impl.ViewImpl.setVisible(Vi ewImpl.java:228)
>>
>>
>>
>> Does anybody know why ?
>>
>> Many thanks !
>>
>> Guillaume a écrit :
>>> Hi,
>>>
>>> I have one connection of type X between two nodes of type A.
>>> When I create such a link, I initialize a reference of this
>>> connection which refers to a node of type B.
>>> The resulted figure is a connection X between the 2 nodes of type A
>>> and another connection between the link X previsouly created and the
>>> node of type B. So the 2nd connection doesn't map an EClass of my
>>> ecore model, just a reference between classes X and B.
>>> My problem is that when I create my connection X, the connection
>>> appears but the figure B doesn't, except if I create a node or if I
>>> reopen the diagram.
>>> And if I delete the connection X, the node B is always displayed,
>>> except if I reopen the diagram or create a new node.
>>> How could I resolve this problem, what kind of action is realized
>>> during the creation of a node which make my node B visible ?
>>>
>>> Thanks.
>>>
>>> Guillaume
>
Re: Set Node Visible when initialized [message #198879 is a reply to message #198784] Fri, 25 July 2008 05:57 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse.[REMOVE]stefan-kuhn.eu

you can use the CrossReferenceAdapter (or GMFCrossRef... or similar).
But I wouldn't do that.

-stefan


Guillaume schrieb:
> Thanks,
> I've just found the trick !
>
> Another quick question : is it possible to get the View object
> corresponding to a model element ?
>
>
>
> Stefan Kuhn a écrit :
>> use a AbstractTransactionalCommand to do changes to the domain or
>> notation model.
>>
>> -stefan
>>
>>
>> Guillaume schrieb:
>>> I have another problem concerning these parts of my editor :
>>>
>>> I also need to set visible node B and its link to the connection X
>>> when the connection X is selected, and set unvisible the others.
>>>
>>> To do that I extend the SelectionEditPolicy class and override the
>>> showPrimarySelection() :
>>>
>>> I find the Edge and Node elements that I need to set visible or not
>>> but when I try to use setVisible(), I have an exception like this :
>>>
>>> java.lang.IllegalStateException: Cannot modify resource set without a
>>> write transaction
>>> at
>>> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:338)
>>>
>>> at
>>> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:300)
>>>
>>> at
>>> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:282)
>>>
>>> at
>>> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:238)
>>>
>>> at
>>> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
>>>
>>> at
>>> org.eclipse.gmf.runtime.notation.impl.ViewImpl.setVisible(Vi ewImpl.java:228)
>>>
>>>
>>>
>>> Does anybody know why ?
>>>
>>> Many thanks !
>>>
>>> Guillaume a écrit :
>>>> Hi,
>>>>
>>>> I have one connection of type X between two nodes of type A.
>>>> When I create such a link, I initialize a reference of this
>>>> connection which refers to a node of type B.
>>>> The resulted figure is a connection X between the 2 nodes of type A
>>>> and another connection between the link X previsouly created and the
>>>> node of type B. So the 2nd connection doesn't map an EClass of my
>>>> ecore model, just a reference between classes X and B.
>>>> My problem is that when I create my connection X, the connection
>>>> appears but the figure B doesn't, except if I create a node or if I
>>>> reopen the diagram.
>>>> And if I delete the connection X, the node B is always displayed,
>>>> except if I reopen the diagram or create a new node.
>>>> How could I resolve this problem, what kind of action is realized
>>>> during the creation of a node which make my node B visible ?
>>>>
>>>> Thanks.
>>>>
>>>> Guillaume
>>
Previous Topic:Showing an icon on property change
Next Topic:Disable drag resizing when laying out nodes
Goto Forum:
  


Current Time: Mon May 25 06:22:36 GMT 2020

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

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

Back to the top