Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Model object created in wrong resource when using shortcuts
Model object created in wrong resource when using shortcuts [message #219551] Fri, 20 February 2009 14:11 Go to next message
Marc Moser is currently offline Marc MoserFriend
Messages: 66
Registered: July 2009
Member
Hi,

I have a problem if I'm using shortcuts. The scenario is the following.

I have a class 'Container' which has containment references to classes
'ClassA', 'ClassB' and 'Connector'. Futhermore, class 'Connector' is a
map entry with key of type 'ClassA' and value of type 'ClassB'.

I created the GMF diagram in the following way: 'Container' represents
the diagram, and I can create two types of nodes, 'NodeA' (for
instances of 'ClassA') and 'NodeB' (for instances of 'ClassB').
Instances of class 'Connector' are represented as arrows going from
'NodeA' to 'NodeB'.

When I'm using a single diagram, it all works as expected. The problem
arises if shortcuts are involved.

Example
-----------
Diagram diag_1 contains 'NodeA_1' and 'NodeB_1', which are connected
with an 'arrow'. Furthermore, it contains 'NodeA_2' (which is not
connected to anything). Thus, the underlying resource contains two
instances of 'ClassA', one of 'ClassB' and one of 'Connector'.

Now I create diagram diag_2. In this diagram, I create 'NodeB_2', and I
add a shortcut to 'NodeA_2' which is defined in diag_1. Then I draw the
connection between these two nodes.

PROBLEM: the instance of 'Connector' (the arrow between 'NodeB_2' and
the shortcut of 'NodeA_2' is created in the underlying resource of
diagram diag_1, instead of the underlying resource of diag_2.

Am I missing something? Shouldn't new instances be created in the
diagram in which I 'draw' them?

All the best,
Marc
[solved] Re: Model object created in wrong resource when using shortcuts [message #219561 is a reply to message #219551] Fri, 20 February 2009 14:49 Go to previous message
Marc Moser is currently offline Marc MoserFriend
Messages: 66
Registered: July 2009
Member
Hi,

I've just found the solution. I had to overwrite method

private static MetricLibrary deduceContainer(EObject source, EObject target)

in generated *CreateCommand.java

All the best,
Marc

On 2009-02-20 15:11:44 +0100, Marc Moser <moser@montages.com> said:

> Hi,
>
> I have a problem if I'm using shortcuts. The scenario is the following.
>
> I have a class 'Container' which has containment references to classes
> 'ClassA', 'ClassB' and 'Connector'. Futhermore, class 'Connector' is a
> map entry with key of type 'ClassA' and value of type 'ClassB'.
>
> I created the GMF diagram in the following way: 'Container' represents
> the diagram, and I can create two types of nodes, 'NodeA' (for
> instances of 'ClassA') and 'NodeB' (for instances of 'ClassB').
> Instances of class 'Connector' are represented as arrows going from
> 'NodeA' to 'NodeB'.
>
> When I'm using a single diagram, it all works as expected. The problem
> arises if shortcuts are involved.
>
> Example
> -----------
> Diagram diag_1 contains 'NodeA_1' and 'NodeB_1', which are connected
> with an 'arrow'. Furthermore, it contains 'NodeA_2' (which is not
> connected to anything). Thus, the underlying resource contains two
> instances of 'ClassA', one of 'ClassB' and one of 'Connector'.
>
> Now I create diagram diag_2. In this diagram, I create 'NodeB_2', and I
> add a shortcut to 'NodeA_2' which is defined in diag_1. Then I draw the
> connection between these two nodes.
>
> PROBLEM: the instance of 'Connector' (the arrow between 'NodeB_2' and
> the shortcut of 'NodeA_2' is created in the underlying resource of
> diagram diag_1, instead of the underlying resource of diag_2.
>
> Am I missing something? Shouldn't new instances be created in the
> diagram in which I 'draw' them?
>
> All the best,
> Marc
Previous Topic:Arrange All
Next Topic:Changing a connection's source decoration dynamically
Goto Forum:
  


Current Time: Sun Mar 07 06:13:05 GMT 2021

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

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

Back to the top