]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/profile/SCLTextGridStyle.java
Fix diagram profiles to work with latest DB changes
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / profile / SCLTextGridStyle.java
index 4401f2213c51aa0a58b0b0c8170ab5e9636d281c..16b205388733c0ba5f3d86fea0b22b6781632012 100644 (file)
@@ -25,13 +25,12 @@ import org.simantics.utils.datastructures.Pair;
  */
 public class SCLTextGridStyle extends TextGridStyle {
 
-       final Resource style;
        final Font font;
 
        public SCLTextGridStyle(ReadGraph graph, Resource style) throws DatabaseException {
-               this.style = style;
+               super(style);
                G2DResource G2D = G2DResource.getInstance(graph);
-        Resource fontR = graph.getPossibleObject(style, G2D.HasFont);
+               Resource fontR = graph.getPossibleObject(style, G2D.HasFont);
                if(fontR != null) {
                        font = G2DUtils.getFont(graph, fontR);
                } else {
@@ -53,7 +52,7 @@ public class SCLTextGridStyle extends TextGridStyle {
 
        @Override
        protected Object getIdentity(Resource entry) {
-               return new Pair<Resource, Resource>(style, entry);
+               return new Pair<Resource, Resource>(getResource(), entry);
        }
 
        @Override
@@ -81,7 +80,7 @@ public class SCLTextGridStyle extends TextGridStyle {
                if (moduleVariable == null)
                        return null;
 
-               Variable styleVariable = Variables.getVariable(graph, style);
+               Variable styleVariable = Variables.getVariable(graph, getResource());
                Function1<Variable,Tuple3> function = styleVariable.getPossiblePropertyValue(graph, DIA.SCLTextGridStyle_texts);
                Tuple3 result = Simantics.applySCLRead(graph, function, moduleVariable);
                
@@ -97,7 +96,7 @@ public class SCLTextGridStyle extends TextGridStyle {
 
        @Override
        public String getNodeName() {
-               return "" + style.getResourceId();
+               return "" + getResource().getResourceId();
        }
 
 }