Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to change a bordered node's label location programmatically?
How to change a bordered node's label location programmatically? [message #1834796] Wed, 18 November 2020 07:17 Go to next message
Yufei Zhou is currently offline Yufei ZhouFriend
Messages: 44
Registered: March 2020
Member
Hi,

I'm working on customizing a sirius diagram, and now I met a problem that I cannot get the access to a bordered node's label's location. I found that SiriusGmfHelper.getLabelNode method can access the associated label node of a given gmf node (in my scene it's the bordered node), and I tried to use labelNode.setLayoutConstraint to set its location, hoping to change the label's location. But the method seems doesn't work, although the label node's layout constraint changed, the label just won't move to the location I appointed.

I don't know what's wrong about my procedure. Is there something I did wrong? Or is there any other methods to change a bordered node's label location programmatically? Any hints or advice would help a lot.

Thanks,
Yufei Zhou
Re: How to change a bordered node's label location programmatically? [message #1834799 is a reply to message #1834796] Wed, 18 November 2020 08:11 Go to previous messageGo to next message
Yufei Zhou is currently offline Yufei ZhouFriend
Messages: 44
Registered: March 2020
Member
After I close the diagram and use DialectUIManager.openEditor opening the editor again, the bordered node's label was sent to the location I assigned in the setLayoutConstraint method. I guess the problem is caused by some unsynchronized mechanics, but I can't figure it out. I suppose there is some way to refresh the diagram according to its base gmf model right after the label node's layout constraint is changed. Need help about this.
Re: How to change a bordered node's label location programmatically? [message #1834811 is a reply to message #1834799] Wed, 18 November 2020 10:21 Go to previous message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 262
Registered: August 2010
Senior Member
Hi,

Are you trying to change the label location once the diagram is opened or at creation time?
the GEF/GMF stack on which Sirius relies on does not expect bounds changes directly in the model. You could try with org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.getCommand(Request) mechanism. [1]
By providing a org.eclipse.gef.requests.ChangeBoundsRequest on the getCommand of the edit part corresponding to the label, it should return a Command to execute.

If you want to refresh the representation, see DialectManager.Instance.refresh.

[1] https://help.eclipse.org/2020-09/index.jsp?topic=%2Forg.eclipse.gef.doc.isv%2Fguide%2Fguide.html&cp%3D40_0_2

Regards,
Florian
Previous Topic:Nesting Sirius Projects
Next Topic:Custom icon for nodes with representations in diagrams
Goto Forum:
  


Current Time: Sun Apr 11 05:27:39 GMT 2021

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

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

Back to the top