Skip to main content



      Home
Home » Eclipse Projects » Sirius » Hooking into Sirius font changing
Hooking into Sirius font changing [message #1784857] Wed, 04 April 2018 16:43 Go to next message
Eclipse UserFriend
Hello,

In my use case we have custom edit parts and figures for nodes, and each node has a Label for their "name" and a FlowPage for their "description". Currently the font attributes (size, font type, color, etc) are hard coded. We would like for these attributes to be customizeable by the user via the appearance properties tab, sirius tabbar, diagram menu, etc.

How would I hook into these things to change the font attributes of the nodes when these things are selected/changed by the user?

Thanks,

Louis

[Updated on: Wed, 04 April 2018 17:58] by Moderator

Re: Hooking into Sirius font changing [message #1784978 is a reply to message #1784857] Fri, 06 April 2018 09:45 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

IIRC, even when using custom edit parts, at the model level you should have the same kinds of elements as for a normal Sirius node, i.e. a GMF Notation 'Node', a Sirius 'DNode' and a style, which in this case would be a 'org.eclipse.sirius.diagram.CustomStyle' (that inherits from the normal NodeStyle and thus have all the usual properties). When you select your edit part do you have the usual properties tabs (notably 'Style' and 'Appearance') available? They should be wired to the model elements mentioned. To take into account the current values you need to override your edit part's refreshVisuals() method, read the current values configured on the model side, and reconfigure your Figure accordingly. See for example how it's done in UML Designer.

Regards,
Re: Hooking into Sirius font changing [message #1785004 is a reply to message #1784978] Fri, 06 April 2018 16:46 Go to previous messageGo to next message
Eclipse UserFriend
Thank you. I have another question though, about changing the fill style. No matter what color I choose from the button, the color retrieved from the style FillStyle style = (FillStyle)getPrimaryView().getStyle(NotationPackage.Literals.FILL_STYLE); in the refreshBackgroundColor() method is always {255, 255, 255, 255}. Do you know why this could be the case?
Re: Hooking into Sirius font changing [message #1785112 is a reply to message #1785004] Mon, 09 April 2018 11:24 Go to previous messageGo to next message
Eclipse UserFriend
Louis Detweiler wrote on Fri, 06 April 2018 22:46
No matter what color I choose from the button


Which button are you using? GMF Notation and Sirius itself both have their own notion of styling and colors which are not always in sync.

An easy way to determine what model element you have to look into:

  • Open your diagram on the element whose color you want to change and save your session (if needed).
  • Copy the current .aird file corresponding to the "before" state somewhere outside of the Eclipse workspace.
  • Make your style change, save again.
  • Compare the two files. If you only changed the background color of an element, it should be easy to find in which part of the model the color you're interested is stored.

Re: Hooking into Sirius font changing [message #1785129 is a reply to message #1785112] Mon, 09 April 2018 15:52 Go to previous message
Eclipse UserFriend
Thanks I did not think of that. Turns out the color pallet was changing the parent of the primaryView's style, as opposed to the primaryView's style itself, which was causing the issue.
Previous Topic:View/Open Diagram in a SWT shell
Next Topic:Export a Sirius project as a jar file.
Goto Forum:
  


Current Time: Wed Jul 23 19:26:23 EDT 2025

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

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

Back to the top