Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Drag&Drop selection of xyEditPart.java
Drag&Drop selection of xyEditPart.java [message #416758] Sat, 16 February 2008 19:25 Go to next message
Eclipse UserFriend
Originally posted by: manja.wolf.web.de

Dear all,

the model I created with gmf has 2 kinds of subnets (I call them preNet
and doNet). They are both refinements of a net. The net has nodes as
childreferences. These nodes should have different behaviour depending
on the parentnet. In case of creation everything is fine. But if the
user drags the node for instance from preNet and drops it to doNet, the
node keeps its visualID and so it is again called with
NodePreNetEditPart.java and not with NodeDoNetEditPart.java. I
implemented the special behaviour of the nodes (set the attributes of
nodes to default-values) in xyEditPart.java.

The ecore-definition looks like this:

DoNet -> Net
PreNet -> Net

Net
(0-*) Nodes

In diagram/edit/part there exit:
NodesPreNetEditPart.java
NodesDoNetEditPart.java

So I debugged the sources and found "protected Set
getFeaturesToSynchronize()" in
" diagram/edit/policies/PreNetCompartmentCanonicalEditPolicy.j ava ".

Please help me: Is this the right point to change the creation of the
node with the (in my case) right NodeXYEditPart.java?

Is it enough to change (somehow ... [how???]) the visualId? I can
resolve the object (node) with "this.getHost().getChildren()" in the
method "getFeaturesToSynchronize()". It is the list of all child-nodes
in the PreNet (or DoNEt).

But I don't see where to change the visualID or to redirect the node to
the constructor of the other subnet. The method
"getFeaturesToSynchrinze()" saves a reference to a node (the node that
should be moved?). Is there somewhere a possibility to set the change?
Or is it hidden deep in the gmf or emf-classes (CanonicalEditPolicy.java
?) ?

Or should I write routines to delete the graphical element, save
temporarily the semantic element and add the new graphical element with
right constructor?

Or is there any way on model level to define it??

I hope my explanation was not too confusing. Please tell me, whether I
should give some additional input.

Thanks for your help.
Manja
Re: Drag&Drop selection of xyEditPart.java [message #416759 is a reply to message #416758] Sun, 17 February 2008 10:52 Go to previous message
Eclipse UserFriend
Originally posted by: manja.wolf.web.de

hello,

i found it:
in "NodeXYEditPart.java" the parent object can be achieve with
"this.getParent()". I can proof it with

if(this.getParent() instanceof ...diagram.edit.parts.XYParentEditPart) {
....
}

I'm sorry for this newbie-question.

Manja


Manja schrieb:
> Dear all,
>
> the model I created with gmf has 2 kinds of subnets (I call them preNet
> and doNet). They are both refinements of a net. The net has nodes as
> childreferences. These nodes should have different behaviour depending
> on the parentnet. In case of creation everything is fine. But if the
> user drags the node for instance from preNet and drops it to doNet, the
> node keeps its visualID and so it is again called with
> NodePreNetEditPart.java and not with NodeDoNetEditPart.java. I
> implemented the special behaviour of the nodes (set the attributes of
> nodes to default-values) in xyEditPart.java.
>
> The ecore-definition looks like this:
>
> DoNet -> Net
> PreNet -> Net
>
> Net
> (0-*) Nodes
>
> In diagram/edit/part there exit:
> NodesPreNetEditPart.java
> NodesDoNetEditPart.java
>
> So I debugged the sources and found "protected Set
> getFeaturesToSynchronize()" in
> " diagram/edit/policies/PreNetCompartmentCanonicalEditPolicy.j ava ".
>
> Please help me: Is this the right point to change the creation of the
> node with the (in my case) right NodeXYEditPart.java?
>
> Is it enough to change (somehow ... [how???]) the visualId? I can
> resolve the object (node) with "this.getHost().getChildren()" in the
> method "getFeaturesToSynchronize()". It is the list of all child-nodes
> in the PreNet (or DoNEt).
>
> But I don't see where to change the visualID or to redirect the node to
> the constructor of the other subnet. The method
> "getFeaturesToSynchrinze()" saves a reference to a node (the node that
> should be moved?). Is there somewhere a possibility to set the change?
> Or is it hidden deep in the gmf or emf-classes (CanonicalEditPolicy.java
> ?) ?
>
> Or should I write routines to delete the graphical element, save
> temporarily the semantic element and add the new graphical element with
> right constructor?
>
> Or is there any way on model level to define it??
>
> I hope my explanation was not too confusing. Please tell me, whether I
> should give some additional input.
>
> Thanks for your help.
> Manja
Previous Topic:JMerge with FreeMarker or Velocity generation?
Next Topic:A few questions about EMF
Goto Forum:
  


Current Time: Thu Apr 25 12:39:59 GMT 2024

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

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

Back to the top