Skip to main content



      Home
Home » Eclipse Projects » Sirius » Saving style changes(Style change does not get persisted)
Saving style changes [message #1456694] Thu, 30 October 2014 12:28 Go to next message
Eclipse UserFriend
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 03:20] by Moderator

Re: Saving style changes [message #1457365 is a reply to message #1456694] Fri, 31 October 2014 04:48 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Saving style changes [message #1460104 is a reply to message #1457365] Mon, 03 November 2014 02:38 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 16:47:07 EDT 2025

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

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

Back to the top