Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » DecorationNode repositioning
DecorationNode repositioning [message #482338] Wed, 26 August 2009 09:49 Go to next message
Eclipse UserFriend
Originally posted by: carl.wannheden.paranor.ch

Hi,

I am implementing a custom provider for the Layout Service using
Graphviz to provide the algorithm. I have no problem repositioning nodes
and edges using SetBoundsCommand and SetConnectionBendpointsCommand,
respectively.

The problem I have is that I am unable to position the edge's label, the
DecorationNode, using absolute coordinates. Using a SetBoundsCommand to
reposition the DecorationNode does not seem to produce a deterministic
result.

The question:
How do I create a command in my Layout Service implementation which
allows absolute positioning of a DecorationNode?

Thanks in advance,

Carl
Show referenced Node name on label [message #482428 is a reply to message #482338] Wed, 26 August 2009 14:07 Go to previous message
Tianhai Liu is currently offline Tianhai LiuFriend
Messages: 4
Registered: July 2009
Junior Member
Hi,

Thank you for your reading.

I have an ecore model.

<eSubpackages name="Some" nsURI="http:///Some.ecore">

<eClassifiers xsi:type="ecore:EClass" name="Sort">
<eStructuralFeatures xsi:type="ecore:EReference" name="scalarAttribute" upperBound="-1"
eType="#//Some/ScalarAttribute" containment="true"/>
</eClassifiers>

<eClassifiers xsi:type="ecore:EClass" name="ScalarAttribute">
<eStructuralFeatures xsi:type="ecore:EReference" name="valueSort" lowerBound="1"
eType="#//Some/ScalarSort"/>
</eClassifiers>

<eClassifiers xsi:type="ecore:EClass" name="ScalarSort">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" defaultValueLiteral="String"/>
</eClassifiers>

</eSubpackages>


I want to generate an editor which looks like this, for example, there are two nodes on the canvas: (ScalarSortB, SortA)

-----------------------------
| ScalarSortB |
-----------------------------
| |
| |
|---------------------------|


-----------------------------
| SortA |
-----------------------------
|attribute : ScalarSortB |
| |
|---------------------------|

To make this goal, I change the view pattern, editorPattern and editPattern on corresponding .gmfmap file by adding {0} : {1}. However, the scalarSort is not a feature of Sort, and it is impossible to change the model. Then I modify the generated code in SomeParserProvider.java (Replacing EAttribute by EStructuralFeature and add a new line "ModelPackage.eINSTANCE.getScalarAttribute_ValueSort()"). However, the text shown on label is:
"attribute : Some.ScalarSortImpl@2ce32ce3 (name: ScalarSortB, description: null, id: _1gaV8JJIEd6WEZ4cXo6aGQ) (type: String)"
But what I want is "attribute : ScalarSortB", how can I make it? :-(

protected IParser createScalarAttribute_3001Parser() {
EStructuralFeature[] features = new EStructuralFeature[] {
ModelPackage.eINSTANCE.getNamedObject_Name(),
//I make change here
ModelPackage.eINSTANCE.getScalarAttribute_ValueSort()};
Editor.Sorts.parsers.MessageFormatParser parser = new Editor.Sorts.parsers.MessageFormatParser(
features);
parser.setViewPattern("{0} : {1}");
parser.setEditorPattern("{0} : {1}");
parser.setEditPattern("{0} : {1}");
return parser;
}

Any help is a great favor for me!

Cheers,
William
Previous Topic:initial position when creation of NodeFigure
Next Topic:Color format in GMF
Goto Forum:
  


Current Time: Thu Mar 28 13:22:49 GMT 2024

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

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

Back to the top