Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » how do I setup link target mapping?
how do I setup link target mapping? [message #220609] Thu, 05 March 2009 16:57 Go to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
I am trying to work out how to setup link mapping so that I can draw a
link on the diagram to setup a reference between two nodes. (i.e. drag the
little square handle on the source to the destination) .

This works fine when I specifically define the reference to be exactly the
destination class, but I want the reference definition to be the
superclass of the destination, if I do this dragging the link no longer
works.

In order to test this out I have defined 4 very simple classes using the
annotated Interfaces below. I want to drag a link from a MSubNodeS
instance to a MSubNodeD instance and for this to put a reference to the
MSubNodeD into MSubNodeS.link.

This won't work as I have it defined below, but it will work if I change:

MSubNode getLink();

to

MSubNodeD getLink();

What I would like is if I drag a link from a MSubNodeS instance to a
MSubNodeD instance then it will set link to be a MSubNodeD reference and
if I drag a link from a MSubNodeS instance to another MSubNodeS instance
then it will set link to be a MSubNodeS reference.

Base class:

/** @model */
public interface MNode extends EObject {
/** @model */
String getName();
/** @model containment="true" */
EList<MSubNodeS> getSubNodeS();
/** @model containment="true" */
EList<MSubNodeD> getSubNodeD();
}


Super Class:

/** @model */
public interface MSubNode extends EObject {
/** @model */
String getName();
}


Destination Class:

/** @model */
public interface MSubNodeD extends MSubNode {
}


Source Class:

/** @model */
public interface MSubNodeS extends MSubNode {
/** @model */
MSubNode getLink();
}


Can I do this? If so can you see what I am doing wrong?

I have tried all combinations that I can think of in enabling and
disabling elements when generating gmfgraph and gmftool but nothing seems
to work as I want.

Its hard to explain this in words so I have put some screen shots of the
configuration here:
http://www.euclideanspace.com/software/development/eclipse/g mf/linkTargetMapping/

Martin
Re: how do I setup link target mapping? [message #221018 is a reply to message #220609] Tue, 10 March 2009 15:10 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

It should be possible to generate functionality you are talking about using
the way you described..
You can try debugging/tracing generated code to see the reason why link cannot
be created. Places to debug/trace:
1. MSubNodeSLinkCreateCommand
2. XXXViewprovider.createEdge()

-----------------
Alex Shatalin
Re: how do I setup link target mapping? [message #221170 is a reply to message #221018] Wed, 11 March 2009 08:44 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
>It should be possible to generate functionality you are talking about using
the way you
> described.. You can try debugging/tracing generated code to see the reason
why link
>cannot be created. Places to debug/trace:
>1. MSubNodeSLinkCreateCommand
>2. XXXViewprovider.createEdge() -----------------
>Alex Shatalin

Hello Alex,

Thank you very much for the reply, I could not find a createEdge() method
but I monitored all the diagram.providers.MathModelViewProvider and
MSubNodeSLinkCreateCommand methods.

When I click on the MSubNodeS 'handle' the following sequence of methods
are called:

diagram.edit.commands.MSubNodeSLinkCreateCommand.constructor
diagram.edit.commands.MSubNodeSLinkCreateCommand.canExecute
diagram.edit.commands.MSubNodeSLinkCreateCommand.getSource
diagram.edit.commands.MSubNodeSLinkCreateCommand.getSource
diagram.edit.commands.MSubNodeSLinkCreateCommand.getTarget
diagram.edit.commands.MSubNodeSLinkCreateCommand.canExecute
diagram.edit.commands.MSubNodeSLinkCreateCommand.getSource
diagram.edit.commands.MSubNodeSLinkCreateCommand.getSource
diagram.edit.commands.MSubNodeSLinkCreateCommand.getTarget
diagram.providers.MathModelViewProvider.getEdgeViewClass
diagram.providers.MathModelViewProvider.getSemanticElementTy pe
diagram.providers.MathModelViewProvider.getEdgeViewClass
diagram.providers.MathModelViewProvider.getEdgeViewClass
diagram.providers.MathModelViewProvider.getSemanticElementTy pe

as I drag the mouse between MSubNodeS and MSubNodeD nodes the following
two methods are called repeatedly:

diagram.providers.MathModelViewProvider.getNodeViewClass(nul l,org.eclipse.gmf.runtime.notation.impl.DiagramImpl@54be8c3e
(visible: true, type: MathModel, mutable: false) (name:
default3.mathmodel_diagram, measurementUnit: Pixel),Note)

diagram.providers.MathModelViewProvider.getSemanticElementTy pe

but when the mouse is dragged over a MSubNodeD node then none of these
methods gets called. While the mouse is being dragged over this potential
destination the cursor remains a 'no entry' symbol so do you know what
sets the cursor as it is being dragged over different items?

Note: I can set the link manually from the property view so the problem
must be something specific to the diagram editor.

Thanks again for you help so far,

Martin
Re: how do I setup link target mapping? [message #221186 is a reply to message #221170] Wed, 11 March 2009 09:58 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

> Thank you very much for the reply, I could not find a createEdge()
> method but I monitored all the diagram.providers.MathModelViewProvider
> and MSubNodeSLinkCreateCommand methods.
Ok. Sorry - in past this method was called "getEdgeViewClass()".

> but when the mouse is dragged over a MSubNodeD node then none of these
> methods gets called. While the mouse is being dragged over this
> potential destination the cursor remains a 'no entry' symbol so do you
> know what sets the cursor as it is being dragged over different items?
The reason should be either in MSubNodeSLinkCreateCommand.canExecute returning
false or in MathModelViewProvider.getEdgeViewClass returning null..
Both these methods should be called once you enter MSubNodeD shape while
dragging the link target and cursor will be "ok" or "no entry" depending
on a reault of these methods execution..

-----------------
Alex Shatalin
Re: how do I setup link target mapping? [message #221200 is a reply to message #221186] Wed, 11 March 2009 11:13 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
>The reason should be either in MSubNodeSLinkCreateCommand.canExecute
>returning false or in MathModelViewProvider.getEdgeViewClass >returning null..
>Both these methods should be called once you enter MSubNodeD shape
>while dragging the link target and cursor will be "ok" or "no entry"
>depending on a reault of these methods execution..


Alex,

Thanks again for your reply, these two methods are only called when I
initially click on the MSubNodeS handle.

That is I put the mouse over the handle and press the left button down,
the following methods are called in quick succession (I have shown what
they return):

MathModelViewProvider.getEdgeViewClass return=null
MSubNodeSLinkCreateCommand.constructor
MSubNodeSLinkCreateCommand.canExecute true
MSubNodeSLinkCreateCommand.canExecute true
MathModelViewProvider.getEdgeViewClass(visual_ID=3001) return=class
mathModel.diagram.view.factories.MSubNodeSLinkViewFactory
MathModelViewProvider.getEdgeViewClass class
mathModel.diagram.view.factories.MSubNodeSLinkViewFactory
MathModelViewProvider.getEdgeViewClass(visual_ID=3001) return=class
mathModel.diagram.view.factories.MSubNodeSLinkViewFactory

I then drag the mouse to the destination and then over the destination,
during this time none of these methods gets called, why would they not get
called?

Martin
Re: how do I setup link target mapping? [message #221208 is a reply to message #221200] Wed, 11 March 2009 11:44 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

Ok. do you have MSubNodeDItemSemanticEditPolicy.getCreateRelationshipCommand ()
method generated? Can you post it here?
BTW, wich exact version of GMf do you use? (this place was changed recently..)

-----------------
Alex Shatalin
Re: how do I setup link target mapping? [message #221236 is a reply to message #221208] Wed, 11 March 2009 15:06 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
Alex,

>Ok. do you have MSubNodeDItemSemanticEditPolicy.getCreateRelationshipCommand ()
>method generated? Can you post it here?

/**
* @generated
*/
protected Command getCreateRelationshipCommand(CreateRelationshipRequest
req) {
Command command = req.getTarget() == null ?
getStartCreateRelationshipCommand(req)
: getCompleteCreateRelationshipCommand(req);
return command != null ? command : super
.getCreateRelationshipCommand(req);
}

>BTW, wich exact version of GMf do you use?
>(this place was changed recently..)

I have recently downloaded and installed Eclipse SP2 with all the plugins
and that is what I used for these tests, although I have seen this problem
before on SP1, I am currently running on:

*** System properties:
eclipse.buildId=M20090211-1700
eclipse.commands=-os linux -ws gtk -arch x86_64 -showsplash -launcher
<snip>
java.version=1.6.0_0
<snip>
org.eclipse.gmf (1.0.0.v20080425-1959) "Graphical Modeling Framework"
[Starting]
org.eclipse.gmf.bridge (1.1.0.v20090212-1755) "GMF Models Bridging
Plug-in" [Starting]
org.eclipse.gmf.bridge.ui (1.1.100.v20080417-1610) "GMF Tooling UI"
[Starting]
org.eclipse.gmf.bridge.ui.dashboard (2.0.0.v20080417-1610) "GMF Dashboard"
[Starting]
org.eclipse.gmf.codegen (2.1.1.v20090212-1755) "GMF GenModel and Code
Generation" [Starting]
org.eclipse.gmf.codegen.edit (2.1.0.v20080718-1700) "GMF GenModel Edit
Support" [Starting]
org.eclipse.gmf.codegen.ui (1.1.0.v20080512-1200) "GMF Code Generation UI"
[Starting]
org.eclipse.gmf.common (1.1.1.v20080610-1132) "GMF Tooling Commons
Plug-in" [Starting]
org.eclipse.gmf.doc (1.2.2.v20080916-2008) "Graphical Modeling Framework
Documentation" [Starting]
org.eclipse.gmf.doc.ui (1.1.0.v20070601-1400) "GMF Documentation
Cheatsheets" [Starting]
org.eclipse.gmf.ecore.editor (2.0.100.v20080610-1132) "ECore Sample
Diagram Plugin" [Starting]
org.eclipse.gmf.examples (1.0.100.v20080425-1959) "Graphical Modeling
Framework Examples" [Starting]
org.eclipse.gmf.examples.ui.pde (1.0.200.v20080425-1959) "GMF Examples
Plug-in" [Starting]
org.eclipse.gmf.graphdef (2.0.100.v20080528-1052) "GMF Graphical
Definition" [Resolved]
org.eclipse.gmf.graphdef.codegen (2.0.100.v20080528-1052) "Graphical
Definition Code Generator" [Starting]
org.eclipse.gmf.graphdef.codegen.ui (1.0.100.v20080425-1959) "Graphical
Definition Code Generator UI Support" [Resolved]
org.eclipse.gmf.graphdef.edit (2.0.100.v20080610-1132) "GMFGraph Edit
Support" [Starting]
org.eclipse.gmf.map (2.1.0.v20080521) "GMF Mapping Model" [Starting]
org.eclipse.gmf.map.edit (2.1.0.v20080716-1600) "GMF Mapping Edit Support"
[Starting]
org.eclipse.gmf.runtime.common.core (1.1.0.v20080425-1959) "GMF Common
Core" [Starting]
org.eclipse.gmf.runtime.common.ui (1.1.3.v20081023-2107) "GMF Common UI"
[Starting]
org.eclipse.gmf.runtime.common.ui.action (1.1.0.v20080425-1959) "GMF
Common UI Action" [Starting]
org.eclipse.gmf.runtime.common.ui.action.ide (1.1.0.v20080425-1959) "GMF
Common UI Action IDE" [Starting]
org.eclipse.gmf.runtime.common.ui.printing (1.1.0.v20080425-1959) "GMF
Printing" [Starting]
org.eclipse.gmf.runtime.common.ui.printing.win32 (1.1.0.v20080612-1355)
"GMF Printing for Win32" [Resolved]
org.eclipse.gmf.runtime.common.ui.services (1.1.1.v20080718-1700) "GMF
Common UI Services" [Starting]
org.eclipse.gmf.runtime.common.ui.services.action (1.1.0.v20080507-2230)
"GMF Common UI Action Services" [Starting]
org.eclipse.gmf.runtime.common.ui.services.dnd (1.1.0.v20080425-1959) "GMF
Common UI DND Services" [Starting]
org.eclipse.gmf.runtime.common.ui.services.dnd.ide (1.1.0.v20080425-1959)
"GMF Common UI DND IDE Services" [Starting]
org.eclipse.gmf.runtime.common.ui.services.properties
(1.1.0.v20080425-1959) "GMF Common UI Properties Service Framework"
[Starting]
org.eclipse.gmf.runtime.diagram.core (1.1.3.v20081015-1755) "GMF Diagram
Core" [Starting]
org.eclipse.gmf.runtime.diagram.ui (1.1.3.v20090114-1755) "GMF Diagram UI"
[Starting]
org.eclipse.gmf.runtime.diagram.ui.actions (1.1.2.v20080916-2008) "GMF
Diagram Actions" [Starting]
org.eclipse.gmf.runtime.diagram.ui.dnd (1.1.0.v20080425-1959) "GMF Diagram
Browse" [Starting]
org.eclipse.gmf.runtime.diagram.ui.geoshapes (1.1.2.v20080911-1506) "GMF
Geometric Shapes" [Starting]
org.eclipse.gmf.runtime.diagram.ui.printing (1.1.2.v20080911-1506) "GMF
Diagram Printing" [Starting]
org.eclipse.gmf.runtime.diagram.ui.printing.render (1.1.2.v20080916-2008)
"GMF Diagram UI Printing Render Plug-In" [Starting]
org.eclipse.gmf.runtime.diagram.ui.properties (1.1.3.v20090122-1525) "GMF
Diagram UI Properties" [Starting]
org.eclipse.gmf.runtime.diagram.ui.providers (1.1.2.v20080916-2008) "GMF
Diagram Providers" [Starting]
org.eclipse.gmf.runtime.diagram.ui.providers.ide (1.1.0.v20080425-1959)
"GMF Diagram Providers IDE" [Starting]
org.eclipse.gmf.runtime.diagram.ui.render (1.1.3.v20090122-1525) "GMF
Diagram UI Render Plug-In" [Starting]
org.eclipse.gmf.runtime.diagram.ui.resources.editor (1.1.1.v20080716-1600)
"GMF Diagram UI Resources Editor Plug-In" [Starting]
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide
(1.1.3.v20090122-1525) "GMF IDE Editor" [Starting]
org.eclipse.gmf.runtime.draw2d.ui (1.1.3.v20090114-1755) "GMF Draw2d
Additions" [Starting]
org.eclipse.gmf.runtime.draw2d.ui.render (1.1.3.v20090122-1525) "GMF
Draw2d Image Rendering Additions" [Starting]
org.eclipse.gmf.runtime.draw2d.ui.render.awt (1.1.2.v20090122-1525) "GMF
Draw2d Image AWT based Rendering Additions" [Starting]
org.eclipse.gmf.runtime.emf.clipboard.core (1.1.0.v20080425-1959) "GMF EMF
Clipboard Support" [Starting]
org.eclipse.gmf.runtime.emf.commands.core (1.1.1.v20080716-1600) "GMF
Commands" [Starting]
org.eclipse.gmf.runtime.emf.core (1.1.1.v20080716-1600) "GMF Modeling
Service Layer" [Starting]
org.eclipse.gmf.runtime.emf.type.core (1.1.1.v20080807-1325) "GMF EMF Type
Core" [Starting]
org.eclipse.gmf.runtime.emf.type.ui (1.1.0.v20080425-1959) "GMF EMF Type
UI" [Starting]
org.eclipse.gmf.runtime.emf.ui (1.1.0.v20080516-1748) "GMF MSL UI"
[Starting]
org.eclipse.gmf.runtime.emf.ui.properties (1.1.0.v20080425-1959) "GMF EMF
UI Properties Providers" [Starting]
org.eclipse.gmf.runtime.gef.ui (1.1.1.v20080813-1510) "GMF GEF Additions"
[Starting]
org.eclipse.gmf.runtime.notation (1.1.1.v20080716-1600) "GMF Notation
Model Support" [Starting]
org.eclipse.gmf.runtime.notation.edit (1.1.0.v20080507-1326) "GMF Notation
Edit Support" [Starting]
org.eclipse.gmf.runtime.notation.providers (1.1.0.v20080425-1959) "GMF
Notation Metamodel" [Starting]
org.eclipse.gmf.sdk (1.0.0.v20080425-1959) "Graphical Modeling Framework
SDK" [Starting]
org.eclipse.gmf.tooldef (2.0.0.v20080417-1610) "GMF Tooling Model"
[Starting]
org.eclipse.gmf.tooldef.edit (2.0.0.v20080610-1132) "GMF Tooling Edit
Support" [Starting]
org.eclipse.gmf.tooling (2.1.0.v20080425-1959) "Graphical Modeling
Framework Tooling" [Starting]
org.eclipse.gmf.validate (1.1.0.v20080603-1553) "GMF Validation" [Starting]
org.eclipse.gmf.xpand (1.1.0.v20080716-1600) "GMF Xpand Template Engine"
[Starting]
org.eclipse.gmf.xpand.editor (1.0.0.v20080812-2100) "GMF Xpand Editor
Plug-in" [Starting]
Re: how do I setup link target mapping? [message #221270 is a reply to message #221236] Thu, 12 March 2009 10:30 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

> Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
: getCompleteCreateRelationshipCommand(req);
Can you check these thwo methods? getStartCreateRelationshipCommand(req)
/ getCompleteCreateRelationshipCommand(req) of MSubNodeDItemSemanticEditPolicy?
They should be called n entering this Node with link creation tool.

Can you post these methods here?

-----------------
Alex Shatalin
Re: how do I setup link target mapping? [message #221278 is a reply to message #221270] Thu, 12 March 2009 11:02 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
>Can you check these thwo methods? getStartCreateRelationshipCommand(req)
> / getCompleteCreateRelationshipCommand(req) of
>MSubNodeDItemSemanticEditPolicy? They should be
>called n entering this Node with link creation tool.
>Can you post these methods here?

Alex,

Methods from generated MSubNodeDItemSemanticEditPolicy as requested, it
seems like getStartCreateRelationshipCommand always returns null.

Martin

/**
* @generated
*/
protected Command getCreateRelationshipCommand(CreateRelationshipRequest
req) {
Command command = req.getTarget() == null ?
getStartCreateRelationshipCommand(req)
: getCompleteCreateRelationshipCommand(req);
return command != null ? command : super
.getCreateRelationshipCommand(req);
}

/**
* @generated
*/
protected Command getStartCreateRelationshipCommand(
CreateRelationshipRequest req) {
if (mathModel.diagram.providers.MathModelElementTypes.MSubNodeS Link_3001
== req
.getElementType()) {
return null;
}
return null;
}

/**
* @generated
*/
protected Command getCompleteCreateRelationshipCommand(
CreateRelationshipRequest req) {
if (mathModel.diagram.providers.MathModelElementTypes.MSubNodeS Link_3001
== req
.getElementType()) {
return getGEFWrapper(new
mathModel.diagram.edit.commands.MSubNodeSLinkCreateCommand(
req, req.getSource(), req.getTarget()));
}
return null;
}
Re: how do I setup link target mapping? [message #221292 is a reply to message #221278] Thu, 12 March 2009 13:43 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

> Methods from generated MSubNodeDItemSemanticEditPolicy as requested,
> it seems like getStartCreateRelationshipCommand always returns null.
This is ok - this method will be called for source link element (MSubNodeDItemSemanticEditPolicy
is a target of the link).

> /**
> * @generated
> */
> protected Command getCompleteCreateRelationshipCommand(
> CreateRelationshipRequest req) {
> if
> (mathModel.diagram.providers.MathModelElementTypes.MSubNodeS Link_3001
> == req
> .getElementType()) {
> return getGEFWrapper(new
> mathModel.diagram.edit.commands.MSubNodeSLinkCreateCommand(
> req, req.getSource(), req.getTarget()));
> }
> return null;
> }
So, can you please debug this method to see the reason why is it not working?
If everything goes right then wrapped instance of MSubNodeSLinkCreateCommand
should be returned from this method and this command will be responsible
for the cursor shape.. If not then the question is why mathModel.diagram.providers.MathModelElementTypes.MSubNodeSL ink_3001
!= req.getElementType()..

-----------------
Alex Shatalin
Re: how do I setup link target mapping? [message #221306 is a reply to message #221292] Thu, 12 March 2009 15:22 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
>So, can you please debug this method to see the reason why is it
>not working? If everything goes right then wrapped instance of
>MSubNodeSLinkCreateCommand should be returned from this method
>and this command will be responsible for the cursor shape..
>If not then the question is why mathModel.diagram.providers.
>MathModelElementTypes.MSubNodeSLink_3001 != req.getElementType()..


Alex,

These methods are not called at all during the lifetime of this program. I
have tried everything I can think of including all combinations of
dragging outgoing and incoming handles from MSubNodeS to MSubNodeD and
visa versa, nothing calls these methods.

The only method that is called is:
MSubNodeDItemSemanticEditPolicy.getDestroyElementCommand
when I deselect MSubNodeD.

I tried the equivalent methods in MSubNodeSItemSemanticEditPolicy and the
following is called when I first click on MSubNodeS handles:

MSubNodeSItemSemanticEditPolicy.getCreateRelationshipCommand
MSubNodeSItemSemanticEditPolicy.getStartCreateRelationshipCo mmand

but nothing seems to happen when I attempt to release over MSubNodeD.

Martin
Re: how do I setup link target mapping? [message #221314 is a reply to message #221306] Thu, 12 March 2009 15:35 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

then you can override public Command getCommand(Request request) method in
MSubNodeDItemSemanticEditPolicy, just calling super implementation from there
and place a breakpoint into this method - this method should be called then
you enter MSubNodeD EditPart with the link creation tool...

-----------------
Alex Shatalin
Re: how do I setup link target mapping? [message #221320 is a reply to message #221314] Thu, 12 March 2009 16:38 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
>then you can override public Command getCommand(Request request)
>method in MSubNodeDItemSemanticEditPolicy, just calling super
>implementation from there and place a breakpoint into this method
>- this method should be called then you enter MSubNodeD EditPart
>with the link creation tool...

Alex,

I added this method to MSubNodeDItemSemanticEditPolicy:

/** override */
public Command getCommand(Request request) {
Command cmd=super.getCommand(request);
System.out.println("MSubNodeDItemSemanticEditPolicy.getCommand( "+request+")
return="+cmd);
return cmd;
}

When the handle from MSubNodeS is dragged into MSubNodeD this method gets
called on every move of the mouse inside MSubNodeD always returning null:

MSubNodeDItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifie dTypeConnectionRequest @145a25f3)
return=null
MSubNodeDItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifie dTypeConnectionRequest @145a25f3)
return=null
...

This request 'CreateUnspecifiedTypeConnectionRequest' is id=107

What seems to happen when I debug is that super gets called ie:
mathModel.diagram.edit.policies.MathModelBaseItemSemanticEdi tPolicy.getCommand(Request
request)

the test (request instanceof ReconnectRequest) fails and so we call super
again this time on:
org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEdit Policy.getCommand(Request
request)

the tests in this method are all false and we call super again on:
org.eclipse.gef.editpolicies.AbstractEditPolicy.getCommand(R equest request)

which returns null.

Martin
Re: how do I setup link target mapping? [message #221447 is a reply to message #221314] Sat, 14 March 2009 09:06 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
>then you can override public Command getCommand(Request request)
>method in MSubNodeDItemSemanticEditPolicy, just calling super
>implementation from there and place a breakpoint into this method
>- this method should be called then you enter MSubNodeD EditPart
>with the link creation tool...

Alex,

In addition to my previous reply to this, I have tried a different method
of investigating the problem, I don't know if this helps? but I have found
some stange things.

Since I have two versions of the program, one that works and one that does
not work, I thought I would compare the files generated by these different
versions and see where they diverge. The source of the difference is one
letter:

In the version which does not work, in MSubNodeS interface I have defined:
MSubNode getLink();

The version which works has:
MSubNodeD getLink();

As expected the only difference in the .ecore file is the link:

from es3 mathModel.ecore (not working):

<eClassifiers xsi:type="ecore:EClass" name="MSubNodeS"
eSuperTypes="#//MSubNode">
<eStructuralFeatures xsi:type="ecore:EReference" name="link"
eType="#//MSubNode"/>
</eClassifiers>

from es5 mathModel.ecore (working):

<eClassifiers xsi:type="ecore:EClass" name="MSubNodeS"
eSuperTypes="#//MSubNode">
<eStructuralFeatures xsi:type="ecore:EReference" name="link"
eType="#//MSubNodeD"/>
</eClassifiers>

There were no differences with gmfgraph or gmftool.

For some reason gmfmap seems to have created the <nodes> entries are in
reverse order, es3 has href="mathModel.ecore#//MNode/subNodeD first but
es5 has href="mathModel.ecore#//MNode/subNodeS first, given that the
inputs are so similar this seems stange? Otherwise I can't see any
differences, even the link entry seems identical (MSubNodeSLink stays the
same):

<links>
<tool
xsi:type="gmftool:CreationTool"
href="mathModel.gmftool#//@palette/@tools.0/@tools.0"/>
<diagramLink
href="mathModel.gmfgraph#MSubNodeSLink"/>
<linkMetaFeature
xsi:type="ecore:EReference"
href="mathModel.ecore#//MSubNodeS/link"/>
</links>


There are a lot of differences in gmfgen and so it is hard to track them
all, these seem to be:
* different package names (es3 and es5) which is just a side effect I
can't avoid.
* various types are swapped between MSubNodeSxxx and MSubNodeDxxx

As far as I know I have answered in the wizards which created these files
in the same way (although its hard to be absolutely sure) in most cases I
have just used the defaults (in both cases I disabled the link entry in
gmftool).

So the versions seem to diverge with gmfmap. What controls the order that
<nodes> entries are created? Does this have any significance for the
program created?

Hopfully others could reproduce the program, I have made the program as
simple as possible to demonstrate the problem and I have put a zip file
with the annotated java interfaces on this web page:
http://www.euclideanspace.com/software/development/eclipse/g mf/linkTargetMapping/

Martin
Re: how do I setup link target mapping? [message #221509 is a reply to message #221320] Mon, 16 March 2009 11:46 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

> I added this method to MSubNodeDItemSemanticEditPolicy:
Well, can you add same method to MSubNodeSItemSemanticEditPolicy, drag a
link from MSubNodeS to MSubNodeS (with this link everything was ok, right?)
and debug generated code to see the difference between these two situations.

If everything goes right then getCreateRelationshipCommand() method should
be called in this case..

-----------------
Alex Shatalin
Re: how do I setup link target mapping? [message #221517 is a reply to message #221447] Mon, 16 March 2009 11:53 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

> For some reason gmfmap seems to have created the <nodes> entries are
> in reverse order, es3 has href="mathModel.ecore#//MNode/subNodeD first
> but es5 has href="mathModel.ecore#//MNode/subNodeS first, given that
> the inputs are so similar this seems stange? Otherwise I can't see any
Well, you are supposed to create .gmfmap file manually so it's up to you
to reorder node mappings in this file..

> So the versions seem to diverge with gmfmap. What controls the order
> that <nodes> entries are created? Does this have any significance for
> the program created?
The sequence of elements in .gmfmap file does not play any role in code generation..
It's strange you have to differently-ordered .gmfmap files (AFAIU these files
was created by GMF wizard, so this can be a wizard side-effect), but you
can still generate code to see what was changed in it..


-----------------
Alex Shatalin
Re: how do I setup link target mapping? [message #221571 is a reply to message #221509] Mon, 16 March 2009 16:15 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
>Well, can you add same method to MSubNodeSItemSemanticEditPolicy,
>drag a link from MSubNodeS to MSubNodeS (with this link everything
>was ok, right?)

Alex,

No, In the version of the program that does not work, it does not work
when I drag to MSubNodeD or to itself.

In both cases it receives an CreateUnspecifiedTypeConnectionRequest which
does not match anything and returns null.

In an attempt to compare this with what it should do I then tried creating
a new program, using the same data model, but when creating .gmfgraph and
gmftool I selected MSubNode instead of MSubNodeD in the hope that it would
recognise this as the destination of the link. However this did not seem
to make much difference to the code generated, and dragging the link did
not work ether.

At least I have the working version of the program that I can compare
against (which has MSubNodeD getLink(); in the data model).

The difference between the working and non-working versions of the program
are not the execution of the getCommand method but what gets passed to it.

The program that does not work gets a
CreateUnspecifiedTypeConnectionRequest which does not match anything and
returns null.

The program that does work gets a CreateConnectionViewAndElementRequest
which returns a null followed by another call to getCommand containing
aEditCommandRequestWrapper which does return a value.

So I need to start debugging at an earlier stage where the program decides
what messages to send to the getCommand method. I don't know enough about
the structure to know where this might be, can you help?

Martin

PS. In case its any help here are the sequences of calls to the getCommand
method for both the non-working and working programs.
------------------------------------------------------------ ------------------------
The program which does not work gives the following sequence:

when I first select MSubNodeS (i.e. before dragging) I get the following
sequence:

MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandReque stWrapper @3c32fb80)
return=org.eclipse.gef.commands.Command$1$ChainedCompoundCommand@734bcb5c
MSubNodeSItemSemanticEditPolicy.getCommand(org.eclipse.gef.requests.GroupRequest@37debcf3)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand(org.eclipse.gef.requests.GroupRequest@39fa487f)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandReque stWrapper @5eada795)
return=org.eclipse.gef.commands.Command$1$ChainedCompoundCommand@5ad557c2
MSubNodeSItemSemanticEditPolicy.getCommand(org.eclipse.gef.requests.GroupRequest@161e14f0)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandReque stWrapper @10f0a3e8)
return=org.eclipse.gef.commands.Command$1$ChainedCompoundCommand@2698dd08
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @26e7127)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @34baf4ae)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @1f18317f)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand(org.eclipse.gef.Request@360b0c5a)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @78d5c653)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @397577f9)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @16793542)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @464cdac8)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @45a8a7e)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @4283874e)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @6e6dcfde)
return=null

when I first click on MSubNodeS handle I get the following sequence:

MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifie dTypeConnectionRequest @1b7adb4a)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandReque stWrapper @1ed2e55e)
return=org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy@27d08e21
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifie dTypeConnectionRequest @1b7adb4a)
return=null

when I drag inside MSubNodeD I get:

MSubNodeDItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifie dTypeConnectionRequest @9d8643e)
return=null

when I drag inside MSubNodeS I get:

MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifie dTypeConnectionRequest @9d8643e)
return=null

------------------------------------------------------------ -------------------
The program which does work gives the following sequence:

when I first select MSubNodeS (i.e. before dragging) I get the following
sequence:

MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandReque stWrapper @ba679e)
return=org.eclipse.gef.commands.Command$1$ChainedCompoundCommand@33d626a4
MSubNodeSItemSemanticEditPolicy.getCommand(org.eclipse.gef.requests.GroupRequest@381172c5)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand(org.eclipse.gef.requests.GroupRequest@47bb2cb)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandReque stWrapper @55172fb9)
return=org.eclipse.gef.commands.Command$1$ChainedCompoundCommand@653e4653
MSubNodeSItemSemanticEditPolicy.getCommand(org.eclipse.gef.requests.GroupRequest@5ade5cd9)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandReque stWrapper @3ca1d92a)
return=org.eclipse.gef.commands.Command$1$ChainedCompoundCommand@25b8737f
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @5b224686)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @1005354a)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @7838c8c5)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand(org.eclipse.gef.Request@3f6ff2d9)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @2f26f304)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @224577f9)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @5f3c6654)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @2dca4eb4)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @1c6cc9c)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @125c99f)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @1f517997)
return=null

when I first click on MSubNodeS handle I get the following sequence:

MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @19e142a5)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @6f7e982f)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyVa lueRequest @5a9c5842)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifie dTypeConnectionRequest @3be67280)
return=null
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandReque stWrapper @314955ec)
return=org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy@45a8123b
MSubNodeSItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifie dTypeConnectionRequest @3be67280)
return=null


when I drag inside MSubNodeD I get:

MSubNodeDItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnection ViewAndElementRequest @5c538b31)
return=null
MSubNodeDItemSemanticEditPolicy.getCommand( org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandReque stWrapper @654481bb)
return=org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy@74a14fed
Re: how do I setup link target mapping? [message #221579 is a reply to message #221517] Mon, 16 March 2009 16:28 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
>The sequence of elements in .gmfmap file does not play
>any role in code generation.. It's strange you have to
>differently-ordered .gmfmap files (AFAIU these files was
>created by GMF wizard, so this can be a wizard side-effect),
>but you can still generate code to see what was changed in it..

Alex,

What seems to happen is that the program that works seems to cause the
nodes in the palette to be incorrectly named, that is MSubNodeS is called
MSubNodeD and MSubNodeD is called MSubNodeS. If I edit the .gmfmap with
the text editor and swap round the <node> entries this is corrected (and
it also makes .gmfmap identical for the working and non-working versions
of the program).

Martin
Re: how do I setup link target mapping? [message #221772 is a reply to message #221509] Wed, 18 March 2009 09:06 Go to previous messageGo to next message
Martin Mising name is currently offline Martin Mising nameFriend
Messages: 32
Registered: July 2009
Member
>Well, can you add same method to MSubNodeSItemSemanticEditPolicy, drag a link
>from MSubNodeS to MSubNodeS (with this link everything was ok, right?) and
>debug generated code to see the difference between these two situations.

Alex,

I think I may have found something that may give a clue to this problem. I
found a difference between the version that works and the version that
does not work in these methods:

mathModel.diagram.providers.MathModelModelingAssistantProvid er.getTypesForTarget
mathModel.diagram.providers.MathModelModelingAssistantProvid er.getTypesForSource

The version that works adds a node to the list but the version that does
not work returns an empty list.

I tries editing the version that did not work to see if I could get it to
work, but this change on its own does not seem to be enough to get it
working, there seem to be other changes between the versions for instance:

MSubNodeS_1001 is changed to MSubNodeS_1002
MSubNodeD_1002 is changed to MSubNodeD_1001

Do you know what factors will affect how these methods are generated?

Martin

------------------------------------------------------------ -------------------------
The version that does not work is:

public List getTypesForTarget(IAdaptable source,
IElementType relationshipType) {
IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source
.getAdapter(IGraphicalEditPart.class);
if (sourceEditPart instanceof
mathModel.diagram.edit.parts.MSubNodeSEditPart) {
List types = new ArrayList();
return types;
}
return Collections.EMPTY_LIST;
}

The version that works is:

public List getTypesForTarget(IAdaptable source,
IElementType relationshipType) {
IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source
.getAdapter(IGraphicalEditPart.class);
if (sourceEditPart instanceof
mathModel.diagram.edit.parts.MSubNodeSEditPart) {
List types = new ArrayList();
if (relationshipType ==
mathModel.diagram.providers.MathModelElementTypes.MSubNodeSL ink_3001) {
types
.add(mathModel.diagram.providers.MathModelElementTypes.MSubN odeD_1002);
}
return types;
}
return Collections.EMPTY_LIST;
}
Re: how do I setup link target mapping? [message #221978 is a reply to message #221571] Thu, 19 March 2009 14:48 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

I suggest you to check org.eclipse.gmf.ecore.editor plugin. This plugin contains
description of EAnnotationReference link and it looks like this link is similar
to the one you have - target feature type is EObject (supertype of all the
diagram elements). At least you can get an idea how the properly generated
code should be working + compare mapping model structure with the model you
have.

I've tried to debug EAnnotationReference link creation process and found
that CreateUnspecifiedTypeConnectionRequest will be transformed to CreateConnectionViewAndElementRequest
inside GraphicalNodeEditPolicy.getConnectionMenuContent() method associated
with link target EditPart..

-----------------
Alex Shatalin
Previous Topic:Prolem with composite figure
Next Topic:[Announce] GMF 2.2.0 I200903190922 is available
Goto Forum:
  


Current Time: Wed Apr 24 22:56:23 GMT 2024

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

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

Back to the top