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

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

Introduction

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

Prototype

String F2_NAME

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

Click Source Link

Document

The formal name of the 'F2' key.

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 w w  w . 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:org.sonar.ide.eclipse.ui.internal.wizards.associate.ConfigureProjectsPage.java

License:Open Source License

private ColumnViewerEditorActivationStrategy createActivationSupport() {
    ColumnViewerEditorActivationStrategy activationSupport = new ColumnViewerEditorActivationStrategy(viewer) {
        @Override/*from   w ww  .  ja v a  2 s . c  o m*/
        protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
            return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
                    || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION
                    || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC
                    || event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED
                            && event.keyCode == KeyLookupFactory.getDefault()
                                    .formalKeyLookup(IKeyLookup.F2_NAME);
        }
    };
    activationSupport.setEnableEditorActivationWithKeyboard(true);
    return activationSupport;
}

From source file:org.sonarlint.eclipse.ui.internal.bind.BindProjectsPage.java

License:Open Source License

private ColumnViewerEditorActivationStrategy createActivationSupport() {
    ColumnViewerEditorActivationStrategy activationSupport = new ColumnViewerEditorActivationStrategy(viewer) {
        @Override/*  w  w  w.  j a  v  a 2 s.  co  m*/
        protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
            return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
                    || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION
                    || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC
                    || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED
                            && event.keyCode == KeyLookupFactory.getDefault()
                                    .formalKeyLookup(IKeyLookup.F2_NAME));
        }
    };
    activationSupport.setEnableEditorActivationWithKeyboard(true);
    return activationSupport;
}