Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Saving style changes(Style change does not get persisted)
Saving style changes [message #1456694] Thu, 30 October 2014 16:28 Go to next message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
When double clicking on a bordered node i want to "highlight" connected edges by changing the color and width. However it doesnt get saved. Everytime i double click the node the property red of strokelayout is 0 again.
Any suggestions?


private void showEdgeConnections(DNodeSpec nodeSpec){		
         System.out.println(nodeSpec.getIncomingEdges().get(0).getOwnedStyle().getStrokeColor().getRed());		
	for (DEdge dEdge : nodeSpec.getIncomingEdges()) {					
		changeColor(dEdge);			
	}
	for (DEdge dEdge : nodeSpec.getOutgoingEdges()) {			
		changeColor(dEdge);	
	}	
	System.out.println(nodeSpec.getIncomingEdges().get(0).getOwnedStyle().getStrokeColor().getRed());		
}

private void changeColor(DEdge dEdge) {		
		EdgeStyle style = dEdge.getOwnedStyle();
		style.setSize(5);			
		RGBValues lineColor = style.getStrokeColor();
		lineColor.setRed(255);
		lineColor.setBlue(0);
		lineColor.setGreen(0);
		style.setStrokeColor(lineColor);						
		dEdge.setOwnedStyle(style);				
}

[Updated on: Fri, 31 October 2014 07:20]

Report message to a moderator

Re: Saving style changes [message #1457365 is a reply to message #1456694] Fri, 31 October 2014 08:48 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 522
Registered: July 2009
Senior Member
Le 30/10/2014 17:28, Koen Staal a écrit :
> When double clicking on a bordered node i want to "highlight" connected
> edges by changing the color and width. However it doesnt get saved.
> Everytime i double click the node the property red of strokelayout is 0
> again.
> Any suggestions?

This is because by default when the representation is refreshed Sirius
re-applies all the style attributes as they are defined in the mapping
from the VSM. This is what you want as the default behavior (and part of
what allows instant feedback when you edit the VSM in the workspace).

You can disable this by marking the features your code changes as
"customized", so that the next refresh will keep these as you set them,
and will not overwrite them with the values from the VSM.

To do this you need to add code like this:

style.getCustomFeatures().add(DiagramPackage.Literals.EDGE_STYLE__SIZE.getName());
style.getCustomFeatures().add(DiagramPackage.Literals.EDGE_STYLE__STROKE_COLOR.getName());

The "customFeatures" stores the names of the EStructuralFeatures of the
style which have been explicitly customized and are left alone by the
refresh.

--
Pierre-Charles David - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Saving style changes [message #1460104 is a reply to message #1457365] Mon, 03 November 2014 07:38 Go to previous message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
I figured as much that was either not persisted or set back to default.
Anyway this did the trick, thanks
Previous Topic:Getting container across different resources
Next Topic:Installing Sirius 2.0.0 on Eclipse Modeling
Goto Forum:
  


Current Time: Mon Apr 06 00:24:33 GMT 2020

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

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

Back to the top