]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypePropertiesResultRequest.java
Merge "Support for creating shared ontology dump to git"
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / ComponentTypePropertiesResultRequest.java
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypePropertiesResultRequest.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypePropertiesResultRequest.java
new file mode 100644 (file)
index 0000000..a1bb4f4
--- /dev/null
@@ -0,0 +1,45 @@
+package org.simantics.modeling.ui.componentTypeEditor;
+
+import java.util.Collection;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.modeling.utils.ComponentTypeViewerPropertyInfo;
+import org.simantics.modeling.utils.HeadlessComponentTypePropertiesResultRequest;
+
+public class ComponentTypePropertiesResultRequest extends HeadlessComponentTypePropertiesResultRequest {
+    
+    private final Collection<ComponentTypeViewerSection> sections;
+
+    /**
+     * @param componentTypeViewer
+     */
+    public ComponentTypePropertiesResultRequest(Resource componentType, Collection<ComponentTypeViewerSection> sections) {
+        super(componentType);
+        this.sections = sections;
+    }
+    
+    @Override
+    protected void readSectionSpecificData(ReadGraph graph, ComponentTypeViewerPropertyInfo info) throws DatabaseException {
+        
+        Object sectionSpecificData = null;
+        double priority = Double.NEGATIVE_INFINITY;
+        if(sections != null) {
+            for(ComponentTypeViewerSection section : sections) {
+                Object temp = section.getSectionSpecificData(graph, info);
+                if(temp != null) {
+                    double sectionPriority = section.getDataPriority();
+                    if(sectionPriority > priority) {
+                        sectionSpecificData = temp;
+                        priority = sectionPriority;
+                    }
+                }
+            }
+        }
+        
+        info.sectionSpecificData = sectionSpecificData;
+
+    }
+
+}
\ No newline at end of file