]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.selectionview/src/org/simantics/selectionview/VariablePropertyCategoryRule.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.selectionview / src / org / simantics / selectionview / VariablePropertyCategoryRule.java
index 307c2e750f452c7348b13bb7a6bb93609013cb9e..de2d2b57d3eb71f61a50290de1df4d2a24abc265 100644 (file)
@@ -1,75 +1,75 @@
-package org.simantics.selectionview;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.HashSet;\r
-\r
-import org.simantics.browsing.ui.model.children.ChildRule;\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.modeling.ModelingResources;\r
-\r
-public class VariablePropertyCategoryRule implements ChildRule {\r
-\r
-       final private ArrayList<String> requiredProperties = new ArrayList<String>();\r
-       final Resource rule;\r
-       \r
-       public VariablePropertyCategoryRule(ReadGraph graph, Resource rule) throws DatabaseException {\r
-\r
-               ModelingResources MOD = ModelingResources.getInstance(graph);\r
-               for(Resource r : graph.getObjects(rule, MOD.ModelingBrowseContext_VariablePropertyRule_RequireProperty)) {\r
-                       String name = graph.getValue(r, Bindings.STRING);\r
-                       requiredProperties.add(name);\r
-               }\r
-               \r
-               this.rule = rule;\r
-               \r
-       }\r
-       \r
-    @Override\r
-    public boolean isCompatible(Class<?> contentType) {\r
-        return contentType.equals(Variable.class);\r
-    }\r
-\r
-    @Override\r
-    public Collection<?> getChildren(ReadGraph graph, Object parent) throws DatabaseException {\r
-       \r
-       HashSet<CategoryNode> result = new HashSet<CategoryNode>();\r
-\r
-       props: for(Variable property : ((Variable)parent).getProperties(graph)) {\r
-\r
-               for(String req : requiredProperties) {\r
-                       if(property.getPossibleProperty(graph, req) == null) continue props;\r
-               }\r
-               \r
-               Variable info = property.getPossibleProperty(graph, SelectionVariables.PROPERTY_INFO);\r
-               if(info != null) {\r
-                       \r
-                       Variable special = SelectionViewUtils.getSpecialCategory(graph, rule, info);\r
-                       if(special != null) info = special;\r
-                       \r
-                       Boolean hidden = info.getPossiblePropertyValue(graph, SelectionVariables.CATEGORY_HIDDEN, Bindings.BOOLEAN);\r
-                       if(hidden != null && hidden) continue;\r
-                       String name = info.getPossiblePropertyValue(graph, SelectionVariables.CATEGORY_NAME, Bindings.STRING);\r
-                       if(name == null) continue;\r
-                       String sortName = info.getPossiblePropertyValue(graph, SelectionVariables.CATEGORY_SORTING_NAME, Bindings.STRING);\r
-                       result.add(new CategoryNodeImpl(name, sortName));\r
-                       \r
-               }\r
-                               \r
-       }\r
-       \r
-        return result;\r
-        \r
-    }\r
-\r
-    @Override\r
-    public Collection<?> getParents(ReadGraph graph, Object child)\r
-            throws DatabaseException {\r
-       return null;\r
-    }\r
-\r
-}\r
+package org.simantics.selectionview;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.simantics.browsing.ui.model.children.ChildRule;
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.modeling.ModelingResources;
+
+public class VariablePropertyCategoryRule implements ChildRule {
+
+       final private ArrayList<String> requiredProperties = new ArrayList<String>();
+       final Resource rule;
+       
+       public VariablePropertyCategoryRule(ReadGraph graph, Resource rule) throws DatabaseException {
+
+               ModelingResources MOD = ModelingResources.getInstance(graph);
+               for(Resource r : graph.getObjects(rule, MOD.ModelingBrowseContext_VariablePropertyRule_RequireProperty)) {
+                       String name = graph.getValue(r, Bindings.STRING);
+                       requiredProperties.add(name);
+               }
+               
+               this.rule = rule;
+               
+       }
+       
+    @Override
+    public boolean isCompatible(Class<?> contentType) {
+        return contentType.equals(Variable.class);
+    }
+
+    @Override
+    public Collection<?> getChildren(ReadGraph graph, Object parent) throws DatabaseException {
+       
+       HashSet<CategoryNode> result = new HashSet<CategoryNode>();
+
+       props: for(Variable property : ((Variable)parent).getProperties(graph)) {
+
+               for(String req : requiredProperties) {
+                       if(property.getPossibleProperty(graph, req) == null) continue props;
+               }
+               
+               Variable info = property.getPossibleProperty(graph, SelectionVariables.PROPERTY_INFO);
+               if(info != null) {
+                       
+                       Variable special = SelectionViewUtils.getSpecialCategory(graph, rule, info);
+                       if(special != null) info = special;
+                       
+                       Boolean hidden = info.getPossiblePropertyValue(graph, SelectionVariables.CATEGORY_HIDDEN, Bindings.BOOLEAN);
+                       if(hidden != null && hidden) continue;
+                       String name = info.getPossiblePropertyValue(graph, SelectionVariables.CATEGORY_NAME, Bindings.STRING);
+                       if(name == null) continue;
+                       String sortName = info.getPossiblePropertyValue(graph, SelectionVariables.CATEGORY_SORTING_NAME, Bindings.STRING);
+                       result.add(new CategoryNodeImpl(name, sortName));
+                       
+               }
+                               
+       }
+       
+        return result;
+        
+    }
+
+    @Override
+    public Collection<?> getParents(ReadGraph graph, Object child)
+            throws DatabaseException {
+       return null;
+    }
+
+}