Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How DDiagram Element can hold color if coloring done Programatically .(How DDiagram Element can hold color if coloring done Programatically)
How DDiagram Element can hold color if coloring done Programatically . [message #1809959] Fri, 26 July 2019 13:28 Go to next message
Sharmila D is currently offline Sharmila DFriend
Messages: 81
Registered: June 2018
Member
Hii

I have applied color for some DDiagram element programtaically through services .Again when I create new DDiagram elemnt the color what I have done Previous is setting to default. can anyone Please give me suggestion

Ex: By default Man color is of Gray from design.Programatically I have given man color to green. again when i create man type it is setting previous one (which is in green ) also to gray.

Color local_color = new Color(Display.getCurrent(), 255, 0, 0);
RGB local_rgb= local_color.getRGB();
//RGB rgb= new RGB(255, 225, 135);
final UserFixedColor newColor = DescriptionFactory.eINSTANCE.createUserFixedColor();
newColor.setName(Messages.AnonymousUserFixedColorName);
newColor.setBlue(local_rgb.blue);
newColor.setGreen(local_rgb.green);
newColor.setRed(local_rgb.red);
//EdgeStyle ownedstyle = ((DEdgeSpec) from).getOwnedStyle();
//ownedstyle.setStrokeColor(new RGBValuesProvider().getRGBValues(newColor));
((FlatContainerStyleImpl) local_style).setForegroundColor(new RGBValuesProvider().getRGBValues(newColor));
Re: How DDiagram Element can hold color if coloring done Programatically . [message #1810011 is a reply to message #1809959] Mon, 29 July 2019 07:54 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
The whole point of Sirius's refresh/synchronisation (which would be invoked when the create a new DDiagram element) is to make sure the DDiagram model (and all its children) are in sync with the current state of the semantic model and the rules defined in the odesign. So it is completely normal that any "manual" change you made previously which does not matches what the mappings/styles definitions say is reverted.

If you want your customizations to be kept, you must add the name of the customized feature(s) to the style's customFeatures properties. In your case something like:

 ((FlatContainerStyleImpl) local_style).getCustomFeatures().add("foregroundColor")



Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How DDiagram Element can hold color if coloring done Programatically . [message #1810022 is a reply to message #1810011] Mon, 29 July 2019 11:29 Go to previous message
Sharmila D is currently offline Sharmila DFriend
Messages: 81
Registered: June 2018
Member
Hi Pierre-Charles David,

Thank you so much .It is working now.
Previous Topic:How to add color for DDiagramElement in Preferences Page
Next Topic:ArrangeAll is not working as expected if we create the instances programatically
Goto Forum:
  


Current Time: Thu Apr 25 15:11:15 GMT 2024

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

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

Back to the top