Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Hooking into Sirius font changing
Hooking into Sirius font changing [message #1784857] Wed, 04 April 2018 20:43 Go to next message
Louis Detweiler is currently offline Louis DetweilerFriend
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 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
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 #1785004 is a reply to message #1784978] Fri, 06 April 2018 20:46 Go to previous messageGo to next message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 100
Registered: August 2017
Senior Member
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 15:24 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
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.



Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Hooking into Sirius font changing [message #1785129 is a reply to message #1785112] Mon, 09 April 2018 19:52 Go to previous message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 100
Registered: August 2017
Senior Member
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: Fri Apr 26 18:23:48 GMT 2024

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

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

Back to the top