]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/profile/ResourceSCLTextGridStyle.java
Fix diagram profiles to work with latest DB changes
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / profile / ResourceSCLTextGridStyle.java
index 3bbbf8081dea77cfbb7792d0c1ecbd97d3e2a1ed..224e767c2792956f83cb52399a54a2b8e16fce6c 100644 (file)
@@ -23,11 +23,10 @@ import org.simantics.utils.datastructures.Pair;
  */
 public class ResourceSCLTextGridStyle extends TextGridStyle {
 
-       final Resource style;
        final Font font;
 
        public ResourceSCLTextGridStyle(ReadGraph graph, Resource style) throws DatabaseException {
-               this.style = style;
+           super(style);
                G2DResource G2D = G2DResource.getInstance(graph);
         Resource fontR = graph.getPossibleObject(style, G2D.HasFont);
                if(fontR != null) {
@@ -51,7 +50,7 @@ public class ResourceSCLTextGridStyle extends TextGridStyle {
 
        @Override
        protected Object getIdentity(Resource entry) {
-               return new Pair<Resource, Resource>(style, entry);
+               return new Pair<Resource, Resource>(getResource(), entry);
        }
 
        @Override
@@ -63,7 +62,7 @@ public class ResourceSCLTextGridStyle extends TextGridStyle {
        public MonitorTextGridResult calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource element, Variable configuration) throws DatabaseException {
                DiagramResource DIA = DiagramResource.getInstance(graph);
 
-               Variable styleVariable = Variables.getVariable(graph, style);
+               Variable styleVariable = Variables.getVariable(graph, getResource());
                Function1<Resource,Tuple3> function = styleVariable.getPossiblePropertyValue(graph, DIA.ResourceSCLTextGridStyle_texts);
                Tuple3 result = Simantics.applySCLRead(graph, function, element);
                
@@ -79,7 +78,7 @@ public class ResourceSCLTextGridStyle extends TextGridStyle {
 
        @Override
        public String getNodeName() {
-               return "" + style.getResourceId();
+               return "" + getResource().getResourceId();
        }
 
 }