]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d/src/org/simantics/g3d/property/AnnotatedPropertyTabContributorFactory.java
Allow repeated single clicks to activate property editing
[simantics/3d.git] / org.simantics.g3d / src / org / simantics / g3d / property / AnnotatedPropertyTabContributorFactory.java
index 65b267cb6b96017eb49cf3ece8a92650433c025f..344dd8cabc1be4805f46f07d46d3025252b880a7 100644 (file)
@@ -76,7 +76,6 @@ import org.simantics.g3d.property.annotations.GetPropertyValue;
 import org.simantics.g3d.property.annotations.PropertyTabBlacklist;
 import org.simantics.g3d.property.annotations.SetComboPropertyValue;
 import org.simantics.g3d.property.annotations.SetPropertyValue;
-import org.simantics.g3d.scenegraph.IG3DNode;
 import org.simantics.g3d.scenegraph.NodeMap;
 import org.simantics.g3d.scenegraph.NodeMapProvider;
 import org.simantics.g3d.scenegraph.base.INode;
@@ -600,10 +599,22 @@ public class AnnotatedPropertyTabContributorFactory implements PropertyTabContri
                        }
                        ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(
                                        viewer) {
+                               Object lastSource = null;
+                               int clickCount = 0;
+                               
                                protected boolean isEditorActivationEvent(
                                                ColumnViewerEditorActivationEvent event) {
+                                       if (!event.getSource().equals(lastSource))
+                                               clickCount = 0;
+                                       
+                                       lastSource = event.getSource();
+                                       
+                                       if (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION)
+                                               clickCount += 1;
+                                               
                                        return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
                                                        || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
+                                                       || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION && clickCount >= 2
                                                        || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
                                                        || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
                                }
@@ -682,7 +693,7 @@ public class AnnotatedPropertyTabContributorFactory implements PropertyTabContri
                                        if (nodeMap != null)
                                                break;
                                }
-                               n = (IG3DNode)n.getParent();
+                               n = (INode)n.getParent();
                        }
                        boolean readOnly =  (node instanceof IStructuralNode && ((IStructuralNode)node).isPartOfInstantiatedModel() && !((IStructuralNode)node).isInstantiatedModelRoot());