Example usage for org.eclipse.jface.bindings.keys IKeyLookup DEL_NAME

List of usage examples for org.eclipse.jface.bindings.keys IKeyLookup DEL_NAME

Introduction

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

Prototype

String DEL_NAME

To view the source code for org.eclipse.jface.bindings.keys IKeyLookup DEL_NAME.

Click Source Link

Document

The formal name of the delete (U+007F) key

Usage

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

License:Open Source License

/**
 * Adds a key listener to watch for delete events.
 *///w w w.j  av  a2s  . 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);
            }
        }
    });
}