Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/keyboardlistener/KeyboardListener.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/keyboardlistener/KeyboardListener.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/keyboardlistener/KeyboardListener.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/keyboardlistener/KeyboardListener.java
new file mode 100644
index 00000000000..e05f395ab42
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/keyboardlistener/KeyboardListener.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.keyboardlistener;
+
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * This listener listen keyboard and affect the behavior of the grid
+ *
+ */
+public class KeyboardListener implements Listener {
+
+ protected IKeyPressState keyPressState;
+ protected boolean state;
+ protected int keyboard;
+
+ /**
+ * Constructor.
+ *
+ */
+ public KeyboardListener(IKeyPressState keyPressState, int keyboard, boolean state) {
+ this.keyPressState = keyPressState;
+ this.state = state;
+ this.keyboard = keyboard;
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ if (event.keyCode == keyboard) {
+ keyPressState.setKeyPressState(state);
+ }
+ }
+}

Back to the top