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

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

Introduction

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

Prototype

String CR_NAME

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

Click Source Link

Document

The formal name of the carriage return (U+000D)

Usage

From source file:com.cisco.yangide.ext.refactoring.ui.RenameInformationPopup.java

License:Open Source License

private static String getEnterBinding() {
    return KeyStroke.getInstance(KeyLookupFactory.getDefault().formalKeyLookup(IKeyLookup.CR_NAME)).format();
}

From source file:org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringPopup.java

License:Open Source License

protected static String getEnterBinding() {
    return KeyStroke.getInstance(KeyLookupFactory.getDefault().formalKeyLookup(IKeyLookup.CR_NAME)).format();
}

From source file:org.gemoc.execution.concurrent.ccsljavaxdsml.ui.dashboard.form.tree.FilteredTree.java

License:Open Source License

/**
 * Creates the filter text and adds listeners. This method calls {@link #doCreateFilterText(Composite)} to
 * create the text control. Subclasses should override {@link #doCreateFilterText(Composite)} instead of
 * overriding this method./*  w  w w.  ja va  2s .  c om*/
 * 
 * @param parent_p
 *            <code>Composite</code> of the filter text
 */
protected void createFilterText(Composite parent_p) {
    filterText = doCreateFilterText(parent_p);
    filterText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
        /**
         * @see org.eclipse.swt.accessibility.AccessibleListener#getName(org.eclipse.swt.accessibility.AccessibleEvent)
         */
        @Override
        public void getName(AccessibleEvent e) {
            String filterTextString = filterText.getText();
            if (filterTextString.length() == 0) {
                e.result = initialText;
            } else {
                e.result = filterTextString;
            }
        }
    });

    filterText.addFocusListener(new FocusAdapter() {
        /**
         * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
         */
        @Override
        public void focusGained(FocusEvent e) {
            /**
             * Running in an asyncExec because the selectAll() does not appear to work when using mouse to
             * give focus to text.
             */
            Display display = filterText.getDisplay();
            display.asyncExec(new Runnable() {
                public void run() {
                    if (!filterText.isDisposed()) {
                        if (getInitialText().equals(filterText.getText().trim())) {
                            filterText.selectAll();
                        }
                    }
                }
            });
        }
    });
    filterText.addKeyListener(new AbstractKeyAdapter() {
        /**
         * @see org.eclipse.swt.events.KeyAdapter#keyPressed(org.eclipse.swt.events.KeyEvent)
         */
        @Override
        public void keyPressed(KeyEvent event_p) {
            boolean hasItems = getViewer().getTree().getItemCount() > 0;
            if (hasItems && (event_p.keyCode == SWT.ARROW_DOWN)) {
                treeViewer.getTree().setFocus();
            } else if ((event_p.character == SWT.CR) && handle(event_p, IKeyLookup.CR_NAME)
                    && !isAutoFiltering()) {
                handleCRKeyStoke();
            }
        }
    });

    if (isAutoFiltering()) {
        filterText.addModifyListener(new ModifyListener() {
            /*
             * (non-Javadoc)
             * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
             */
            public void modifyText(ModifyEvent e) {
                textChanged();
            }
        });
    } else {
        filterText.setToolTipText("FilteredTree_Tooltip");
    }
    GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);

    // if the text widget supported cancel then it will have it's own
    // integrated button. We can take all of the space.
    if ((filterText.getStyle() & SWT.CANCEL) != 0) {
        gridData.horizontalSpan = 2;
    }
    filterText.setLayoutData(gridData);
}