Skip to content
Snippets Groups Projects
Commit 1373b4a2 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

put standard keyboard shortcuts in some utils

refs 2563
parent 1844ccac
No related branches found
No related tags found
No related merge requests found
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.util;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.fortiss.tooling.kernel.ui.service.IActionService;
/**
* Utility functions for dealing with actions.
*
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: AE04EB82C7978BEB56EC6615F28F84ED
*/
public class ActionUtils {
/** Key adapter to deal with copy/paste/delete/... done through the keyboard. */
public static class ViewerKeyAdapter extends KeyAdapter {
/** Constructor. */
public ViewerKeyAdapter() {
}
/** {@inheritDoc} */
@Override
public void keyReleased(KeyEvent e) {
if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x63) {
IActionService.INSTANCE.runGlobalCopyAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x76) {
IActionService.INSTANCE.runGlobalPasteAction();
} else if(e.keyCode == SWT.DEL) {
IActionService.INSTANCE.runGlobalDeleteAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x78) {
IActionService.INSTANCE.runGlobalCutAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x7A) {
IActionService.INSTANCE.runGlobalUndoAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x79) {
IActionService.INSTANCE.runGlobalRedoAction();
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment