Skip to main content



      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 09:28 Go to next message
Eclipse UserFriend
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 03:54 Go to previous messageGo to next message
Eclipse UserFriend
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")

Re: How DDiagram Element can hold color if coloring done Programatically . [message #1810022 is a reply to message #1810011] Mon, 29 July 2019 07:29 Go to previous message
Eclipse UserFriend
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: Mon Jul 14 04:18:19 EDT 2025

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

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

Back to the top