]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Allow repeated single clicks to activate property editing 36/3636/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Mon, 25 Nov 2019 11:51:50 +0000 (13:51 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 28 Nov 2019 15:19:40 +0000 (15:19 +0000)
gitlab #58

Change-Id: I34c98ec258b08e25cd2aa6305644437804a1cf94
(cherry picked from commit 32b0d23669bb57c4869ea4b761ae821892a14be5)

org.simantics.g3d/src/org/simantics/g3d/property/AnnotatedPropertyTabContributorFactory.java

index 73526d1c3a60c7216b2d2e18efbea12a64278b5d..344dd8cabc1be4805f46f07d46d3025252b880a7 100644 (file)
@@ -599,10 +599,22 @@ public class AnnotatedPropertyTabContributorFactory implements PropertyTabContri
                        }
                        ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(
                                        viewer) {
                        }
                        ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(
                                        viewer) {
+                               Object lastSource = null;
+                               int clickCount = 0;
+                               
                                protected boolean isEditorActivationEvent(
                                                ColumnViewerEditorActivationEvent event) {
                                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
                                        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;
                                }
                                                        || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
                                                        || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
                                }