Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Custom style shapes
Custom style shapes [message #1835170] Thu, 26 November 2020 09:57 Go to next message
Jaqueline  Moura is currently offline Jaqueline MouraFriend
Messages: 1
Registered: November 2020
Junior Member

My metamodel have a class with an image path attribute.
I use this attribute to change the shape (workspace image) dynamically with style customizations.

But, as we can do with other styles, I want to:

  • Set the color dynamically based on an attribute;
  • Let the user able to paint the element color;
  • Plus: Besides color, I want to add texture (is that possible?).

So, I think I will need to create custom styles for each shape.

I already read the documentation: Provide custom style.
But, I still a little lost as:

  • Where create the StyleConfiguration implementations?
  • I need to create a GMF project?

Have a tutorial or a similar source code available?
Seeing a full implementation may help me.

Thanks for your time and any contribution!
Re: Custom style shapes [message #1835348 is a reply to message #1835170] Tue, 01 December 2020 10:35 Go to previous message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 570
Registered: May 2011
Senior Member

I don't think you need to create custom styles for the two first at least:

  • Set the color dynamically based on an attribute: You have two options here. The first one is that in your layer, you add Style Customization that will change the color based on an attribute (so 1 Style customization per attribute value). The other option is to create a "Computed Color" (You can create a palette under the root of the odesign) where the red, green and blue fields are expression so you can have a service to determine it based on the attribute value.
  • Let the user able to paint the element color: It is already available, in the tabbar you have a tool with the tooltip "Fill color". You can also find it in the appearance tab of the properties view.
  • Plus: Besides color, I want to add texture (is that possible?). I think for this one I would rather go with the extension point to provide new Bundled Image[1] to provide a SVG with texture you want and you this extension point to change to color of the SVG.

You can implement this extension point (or the custom styles if you still want to try it) in the same project as your odesign.


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
Previous Topic:How to disable the auto triggered arrange action after a new semantic is added to the model?
Next Topic:'Viewpoints selection' option not displayed on right click
Goto Forum:

Current Time: Thu Oct 06 07:26:17 GMT 2022

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

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

Back to the top