From 21eebeb55f772659955f5fc96c4ad1c855a7eb66 Mon Sep 17 00:00:00 2001 From: lempinen Date: Mon, 23 Aug 2010 14:00:10 +0000 Subject: [PATCH] Better handling of the shortcut keys. Now works only with SHIFT down git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17476 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../participant/CreateVariablesShortcutParticipant.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/CreateVariablesShortcutParticipant.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/CreateVariablesShortcutParticipant.java index 1e775965..950a6cb9 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/CreateVariablesShortcutParticipant.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/CreateVariablesShortcutParticipant.java @@ -110,8 +110,10 @@ public class CreateVariablesShortcutParticipant extends AbstractDiagramParticipa KeyPressedEvent kpe; if (ke instanceof KeyPressedEvent) { + kpe = (KeyPressedEvent) ke; + if (kpe.stateMask != java.awt.event.KeyEvent.SHIFT_DOWN_MASK) return false; if (kpe.keyCode == java.awt.event.KeyEvent.VK_A) { variableInformation = new VariableInformation( java.awt.event.KeyEvent.VK_A, @@ -153,8 +155,9 @@ public class CreateVariablesShortcutParticipant extends AbstractDiagramParticipa KeyReleasedEvent kre; if (ke instanceof KeyReleasedEvent) { kre = (KeyReleasedEvent) ke; - - if (variableInformation != null && kre.keyCode == variableInformation.shortcutKey) { + + if (variableInformation != null + && (kre.keyCode == variableInformation.shortcutKey || kre.keyCode == java.awt.event.KeyEvent.VK_SHIFT)) { if (node != null) { variableInformation = null; removeSG(); @@ -196,7 +199,7 @@ public class CreateVariablesShortcutParticipant extends AbstractDiagramParticipa ( mce.button == MouseEvent.LEFT_BUTTON && variableInformation != null && - (mce.stateMask == 0 || mce.stateMask == MouseEvent.SHIFT_MASK) + mce.stateMask == MouseEvent.SHIFT_MASK )) { return false; -- 2.47.1