Hooking into Sirius font changing [message #1784857] |
Wed, 04 April 2018 20:43 |
Louis Detweiler Messages: 100 Registered: August 2017 |
Senior Member |
|
|
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 21:58] Report message to a moderator
|
|
|
Re: Hooking into Sirius font changing [message #1784978 is a reply to message #1784857] |
Fri, 06 April 2018 13:45 |
|
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,
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Re: Hooking into Sirius font changing [message #1785112 is a reply to message #1785004] |
Mon, 09 April 2018 15:24 |
|
Louis Detweiler wrote on Fri, 06 April 2018 22:46No 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.
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Powered by
FUDForum. Page generated in 0.03726 seconds