ktmprabhu / spray

Automatically exported from code.google.com/p/spray
0 stars 0 forks source link

Wrong default style is generated when there are multiple Spray projects #212

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Have multiple Spray projects in your workspace
2. Save a spray DSL file (associated with shapes and directly/indirectly with 
styles, where the style does not inherit from another style)

What is the expected output? 
The generated Add feature base class should use the correct default style class.

What do you see instead?
The generated Add feature base class imports and uses the default shape class 
from a different (without being listed in the dependencies of the current 
plug-in project) Spray project.

Where it has appeared:
I had all existing example projects imported and did save the fowler.spray 
file, the generated StatemachineAddStateFeatureBase includes the call final 
ISprayStyle style = new PetrinetDefaultStyle(); instead of final ISprayStyle 
style = new DefaultSprayStyle();

Workaround:
Close all other Spray and restart workspace and the regenerate for the Spray 
DSL again.

Possible cause:
AddShapeFromDslFeature.xtend uses SprayStyleRef styleRef as global variable 
that is set by the call of  def setAttributes(MetaClass cls, SprayStyleRef 
ssr), maybe this is done not only for the current project but for the hole 
workspace?

Original issue reported on code.google.com by de.abg.r...@gmail.com on 1 Dec 2012 at 8:40

GoogleCodeExporter commented 8 years ago
The styleRef is not a global variable,  but as the AddShapeFromDsl is injected 
,  it probably acts as a singleton,  even over multiple projects.  This is 
clearly not the intention. An unwated side effect from the use of injection I 
am afraid. 
Solved it by changing the setAttributes in AddShapeFromDsl and 
AddConnectionFromDsl.

Original comment by joswar...@gmail.com on 2 Dec 2012 at 12:40

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 1344069fecf0.

Original comment by joswar...@gmail.com on 2 Dec 2012 at 12:41