Skip to main content



      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 02:17 Go to next message
Eclipse UserFriend
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 03:11 Go to previous messageGo to next message
Eclipse UserFriend
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 05:21 Go to previous message
Eclipse UserFriend
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: Wed Jun 18 12:07:47 EDT 2025

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

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

Back to the top