]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/property/P3DSelectionProcessor.java
Allow property tab contribution from all INodes.
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / property / P3DSelectionProcessor.java
index 4970d0e961c18e01389d7f874f8fde631e85ff1b..b78fac4e1bb58e020fa4e6dfe159a3ea98655024 100644 (file)
@@ -19,7 +19,7 @@ import org.simantics.db.management.ISessionContext;
 import org.simantics.db.request.Read;
 import org.simantics.g3d.property.PropertyTabContributor;
 import org.simantics.g3d.property.PropertyTabUtil;
-import org.simantics.g3d.scenegraph.IG3DNode;
+import org.simantics.g3d.scenegraph.base.INode;
 import org.simantics.g3d.tools.AdaptationUtils;
 import org.simantics.g3d.vtk.property.VTKPropertyTabContributor;
 import org.simantics.objmap.structural.StructuralResource;
@@ -43,7 +43,7 @@ public class P3DSelectionProcessor implements SelectionProcessor<Object, ReadGra
                Collection<Resource> resourceCollection = AdaptationUtils.adaptToCollection(selection, Resource.class);
                Collection<StructuralResource> structuralResourceCollection = AdaptationUtils.adaptToCollection(selection, StructuralResource.class);
                Collection<vtkProp> propCollection = AdaptationUtils.adaptToCollection(selection, vtkProp.class);
-               Collection<IG3DNode> nodeCollection = AdaptationUtils.adaptToCollection(selection, IG3DNode.class);
+               Collection<INode> nodeCollection = AdaptationUtils.adaptToCollection(selection, INode.class);
                boolean readOnly = false;
                if (resourceCollection.size() == 0 && structuralResourceCollection.size() > 0) {
                        for (StructuralResource sr : structuralResourceCollection) {
@@ -55,7 +55,7 @@ public class P3DSelectionProcessor implements SelectionProcessor<Object, ReadGra
 
 
                if (nodeCollection.size() == 1) {
-                       IG3DNode node = nodeCollection.iterator().next();
+                       INode node = nodeCollection.iterator().next();
                        List<PropertyTabContributor> contributors = PropertyTabUtil.getContributors(node);
                        int i = 100;
                        for (PropertyTabContributor c : contributors) {
@@ -70,7 +70,7 @@ public class P3DSelectionProcessor implements SelectionProcessor<Object, ReadGra
                                        throw new NullPointerException();
                                result.add(new ComparableTabContributor(new VTKPropertyTabContributor(SWTThread.getThreadAccess()), -2, prop, "VTK"));
                        }
-
+                       
                        if (resourceCollection.size() > 0) {
                                if (resourceCollection.size() > 1)
                                        result.add(new ComparableTabContributor(new MultiSelectionTabContibutor(),0, resourceCollection, "Graph"));
@@ -83,9 +83,18 @@ public class P3DSelectionProcessor implements SelectionProcessor<Object, ReadGra
                                                e.printStackTrace();
                                        }
                                }
-                       }  
+                       }
                }
 
+               if (resourceCollection.size() == 1){
+                       try {
+                               Resource r = resourceCollection.iterator().next();
+                               result.add(new ComparableTabContributor(new P3DBasicPropertyTab(!readOnly), 0, r, "Properties"));
+                       } catch (Exception e) {
+                               e.printStackTrace();
+                       }
+               }
+               
                if(result.size() == 0) {
                        result.add(new ComparableTabContributor(new NoneSelectionTabContributor(),0, resourceCollection, "Empty"));
                }
@@ -99,6 +108,8 @@ public class P3DSelectionProcessor implements SelectionProcessor<Object, ReadGra
                public P3DBasicPropertyTab(boolean enabled) {
                        this.enabled = enabled;
                }
+               
+               
 
                @Override
                public void updatePartName(ISelection forSelection, Consumer<String> updateCallback) {