]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ProfileCheckContributor.java
Better support for ontological profiles
[simantics/platform.git] / bundles / org.simantics.diagram.profile / src / org / simantics / diagram / profile / view / ProfileCheckContributor.java
index 2bc9f320fc84b49dd911f906bd627a086be71758..544c394c52714373d7746b71d1e8b3f60d4667a8 100644 (file)
@@ -35,22 +35,22 @@ public class ProfileCheckContributor implements CheckedStateRule {
             throws DatabaseException {
 
         ResourcePair entry = (ResourcePair)parent;
+        Resource activeProfile = entry.getFirst();
         DiagramResource DIA = DiagramResource.getInstance(graph);
         SimulationResource SIMU = SimulationResource.getInstance(graph);
 
         if(graph.isInstanceOf(entry.getSecond(), DIA.Profile)) {
-
             Resource list = graph.getPossibleObject(entry.getSecond(), DIA.HasEntries);
-            Collection<Resource> activeEntries = graph.syncRequest( new ProfileActiveEntryResources(entry.getFirst(), list) );
+            Collection<Resource> activeEntries = graph.syncRequest( new ProfileActiveEntryResources(activeProfile, list) );
             if (activeEntries.isEmpty()) {
                 return CheckedState.NOT_CHECKED;
             } else {
-                Collection<Resource> entries = graph.syncRequest( new ProfileEntryResources(entry.getFirst(), list) );
+                Collection<Resource> entries = graph.syncRequest( new ProfileEntryResources(activeProfile, list) );
                 return entries.equals(activeEntries) ? CheckedState.CHECKED : CheckedState.GRAYED;
             }
 
         } else if(graph.isInstanceOf(entry.getSecond(), DIA.ProfileEntry)) {
-            if(graph.hasStatement(entry.getFirst(), SIMU.IsActive, entry.getSecond())) return CheckedState.CHECKED;    
+            if(graph.hasStatement(activeProfile, SIMU.IsActive, entry.getSecond())) return CheckedState.CHECKED;       
         }
 
         return CheckedState.NOT_CHECKED;