Example usage for org.eclipse.jface.bindings.keys KeyLookupFactory getSWTKeyLookup

List of usage examples for org.eclipse.jface.bindings.keys KeyLookupFactory getSWTKeyLookup

Introduction

In this page you can find the example usage for org.eclipse.jface.bindings.keys KeyLookupFactory getSWTKeyLookup.

Prototype

public static final IKeyLookup getSWTKeyLookup() 

Source Link

Document

Provides an instance of SWTKeyLookup.

Usage

From source file:ca.uvic.cs.tagsea.editing.InlineTreeItemRenamer.java

License:Open Source License

/**
 * Adds a key listener to watch for rename (F2) events.
 *///from www  .  j  a  v  a 2  s . c o  m
private void addKeyListener() {
    final IKeyLookup lookup = KeyLookupFactory.getSWTKeyLookup();
    final int F2 = lookup.formalKeyLookup(IKeyLookup.F2_NAME);

    tree.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
            int code = e.keyCode;
            if (code == F2) {
                TreeItem[] selection = tree.getSelection();
                if (selection.length == 1) {
                    renameTreeItem(selection[0]);
                }
            }
        }
    });
}

From source file:ca.uvic.cs.tagsea.editing.TreeItemWorker.java

License:Open Source License

/**
 * Adds a key listener to watch for delete events.
 *//*from   w w  w.j a  v  a 2s .  c  o m*/
private void addKeyListener() {
    final IKeyLookup lookup = KeyLookupFactory.getSWTKeyLookup();
    final int DEL = lookup.formalKeyLookup(IKeyLookup.DEL_NAME);
    final int DEL2 = lookup.formalKeyLookup(IKeyLookup.DELETE_NAME);

    tree.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
            int code = e.keyCode;
            if (code == DEL || code == DEL2) {
                TreeItem[] selection = tree.getSelection();
                deleteTreeItems(selection, true);
            }
        }
    });
}

From source file:org.gemoc.execution.concurrent.ccsljavaxdsml.ui.dashboard.utils.AbstractKeyAdapter.java

License:Open Source License

/**
 * Is CTRL pressed for specified key event.
 * //from  w w w . ja v a  2  s  .  c  o  m
 * @param event_p
 * @return
 */
protected boolean isCtrlPressed(KeyEvent event_p) {
    IKeyLookup keyLookup = KeyLookupFactory.getSWTKeyLookup();
    return keyLookup.getCtrl() == event_p.stateMask || keyLookup.getCtrl() == event_p.keyCode;
}