| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.runtime.common.keystroke; |
| |
| import java.util.Arrays; |
| |
| // TODO: Auto-generated Javadoc |
| /** |
| * The Class KeyStrokeDefinition. |
| */ |
| public class KeyStrokeDefinition { |
| |
| /** The caption. */ |
| private final String caption; |
| |
| /** The key code. */ |
| private final int keyCode; |
| |
| /** The modifier keys. */ |
| private final int[] modifierKeys; |
| |
| /** |
| * Instantiates a new key stroke definition. |
| * |
| * @param caption the caption |
| * @param keyCode the key code |
| * @param modifierKeys the modifier keys |
| */ |
| public KeyStrokeDefinition(String caption, int keyCode, int[] modifierKeys) { |
| super(); |
| this.caption = caption; |
| this.keyCode = keyCode; |
| this.modifierKeys = modifierKeys != null ? Arrays.copyOf(modifierKeys, |
| modifierKeys.length) : new int[0]; |
| } |
| |
| /** |
| * Returns the caption of the keystroke definition. Later it may use special |
| * characters to define keystrokes like <code>^&R</code> which may define |
| * CRTL+ALT+R. But this feature is not supported yet. |
| * |
| * @return the caption |
| */ |
| public String getCaption() { |
| return caption; |
| } |
| |
| /** |
| * Returns the key code. See See {@link KeyCode}. |
| * |
| * @return the key code |
| */ |
| public int getKeyCode() { |
| return keyCode; |
| } |
| |
| /** |
| * Returns the modifier keys. See See {@link ModifierKey}. |
| * |
| * @return the modifier keys |
| */ |
| public int[] getModifierKeys() { |
| return Arrays.copyOf(modifierKeys, modifierKeys.length); |
| } |
| |
| } |