From c158180424a6366164e24ce17705e3f2124b1fb5 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Mon, 25 Nov 2019 13:51:50 +0200 Subject: [PATCH] Allow repeated single clicks to activate property editing gitlab #58 Change-Id: I34c98ec258b08e25cd2aa6305644437804a1cf94 (cherry picked from commit 32b0d23669bb57c4869ea4b761ae821892a14be5) --- .../AnnotatedPropertyTabContributorFactory.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/org.simantics.g3d/src/org/simantics/g3d/property/AnnotatedPropertyTabContributorFactory.java b/org.simantics.g3d/src/org/simantics/g3d/property/AnnotatedPropertyTabContributorFactory.java index 73526d1c..344dd8ca 100644 --- a/org.simantics.g3d/src/org/simantics/g3d/property/AnnotatedPropertyTabContributorFactory.java +++ b/org.simantics.g3d/src/org/simantics/g3d/property/AnnotatedPropertyTabContributorFactory.java @@ -599,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; } -- 2.47.1