Package org.eclipse.swt.events

Examples of org.eclipse.swt.events.KeyAdapter


        hideParseErrors();
      }
    }
        );

    wScript.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        updateEditingPosition();

      }
View Full Code Here


    {
        lbl = toolkit.createLabel(parent, title);
        lbl.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

        txt = toolkit.createText(parent, "", SWT.SINGLE | SWT.BORDER);
        txt.addKeyListener(new KeyAdapter()
        {
            @Override
            public void keyPressed(KeyEvent e)
            {
                if (freeText)
View Full Code Here

    private Text createSelectionBox(Composite parent)
    {
        final Text txtSelection = new Text(parent, SWT.SEARCH);

        txtSelection.addKeyListener(new KeyAdapter()
        {
            @Override
            public void keyReleased(KeyEvent e)
            {
                txt = txtSelection.getText();
View Full Code Here

        formText = new Text(configurationView, SWT.BORDER);

        // layout
        formText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

        formText.addKeyListener(new KeyAdapter()
        {
            @Override
            public void keyReleased(KeyEvent e)
            {
                updateLocation();
View Full Code Here

                            consoleOutputText.setBackground(color);
                            consoleInputText.setBackground(color);
                        }
                    }
                });
        consoleOutputText.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(final KeyEvent e) {
                if (e.stateMask == 0 && e.character != '\0') {
                    consoleInputText.setFocus();
                    consoleInputText.append("" + e.character);
                    consoleInputText.setCaretOffset(consoleInputText.getText().length());
                }
                e.doit = true;
            }

        });

        final IPreferenceStore store = ErlideUIPlugin.getDefault().getPreferenceStore();
        final IColorManager colorManager = new ColorManager();
        consoleOutputViewer.setDocument(fDoc);
        consoleOutputViewer.configure(new ErlangConsoleSourceViewerConfiguration(store,
                colorManager, backend));

        consoleInputViewer = new SourceViewer(sashForm, null, SWT.MULTI | SWT.WRAP
                | SWT.V_SCROLL);
        consoleInputText = consoleInputViewer.getTextWidget();
        consoleInputViewer.setDocument(new Document());
        consoleInputViewer.configure(new ErlangConsoleSourceViewerConfiguration(store,
                colorManager, backend));

        sashForm.setWeights(new int[] { 2, 1 });

        final Label helpLabel = new Label(composite, SWT.NONE);
        helpLabel
                .setText("To send the input to the console: press Enter at the end of an expression."
                        + "Ctrl/Cmd-arrows navigate the input history.");
        helpLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        final ModifyListener modifyListener = new ModifyListener() {
            @Override
            public void modifyText(final ModifyEvent e) {
                final String consoleText = trimInput(consoleInputText.getText());
                final boolean atEndOfInput = consoleText.endsWith(".")
                        && consoleInputText.getCaretOffset() >= consoleText.length();

                if (atEndOfInput) {
                    final boolean inputComplete = isInputComplete();
                    if (inputComplete) {
                        consoleInputText.setBackground(bgColor_Ok);
                    }
                } else {
                    consoleInputText.setBackground(bgcolor);
                }
            }
        };
        // consoleInput.addModifyListener(modifyListener);
        consoleInputText.addCaretListener(new CaretListener() {
            @Override
            public void caretMoved(final CaretEvent event) {
                modifyListener.modifyText(null);
            }
        });
        consoleInputText.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(final KeyEvent e) {
                final boolean ctrlOrCommandPressed = (e.stateMask & SWT.MOD1) == SWT.MOD1;
                final String conText = trimInput(consoleInputText.getText());
                final boolean atEndOfInput = consoleInputText.getCaretOffset() >= conText
View Full Code Here

                if (!fRuntimeList.getSelection().isEmpty()) {
                    editRuntime();
                }
            }
        });
        table.addKeyListener(new KeyAdapter() {

            @Override
            public void keyPressed(final KeyEvent event) {
                if (event.character == SWT.DEL && event.stateMask == 0) {
                    removeSelectedRuntimes();
View Full Code Here

    }

    private void hookGlobalActions() {
        final IActionBars bars = getViewSite().getActionBars();
        bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), fRemoveAction);
        viewer.getControl().addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(final KeyEvent event) {
                if (event.character == SWT.DEL && event.stateMask == 0
                        && fRemoveAction.isEnabled()) {
                    fRemoveAction.run();
View Full Code Here

                        column.setText(fTableColumns.fHeaders[i]);
                    }
                }
            }

            fTable.getTable().addKeyListener(new KeyAdapter() {

                @Override
                public void keyPressed(final KeyEvent e) {
                    handleKeyPressed(e);
                }
View Full Code Here

        if (textField == null) {
            textField = new Text(parent, SWT.SINGLE | SWT.BORDER);
            textField.setFont(parent.getFont());
            switch (validateStrategy) {
            case VALIDATE_ON_KEY_STROKE:
                textField.addKeyListener(new KeyAdapter() {

                    /* (non-Javadoc)
                     * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent)
                     */
                    public void keyReleased(KeyEvent e) {
                        valueChanged();
                    }
                });
                textField.addFocusListener(new FocusAdapter() {
                  // Ensure that the value is checked on focus loss in case we
                  // missed a keyRelease or user hasn't released key.
                  // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=214716
                    public void focusLost(FocusEvent e) {
                        valueChanged();
                    }
                });

                break;
            case VALIDATE_ON_FOCUS_LOST:
                textField.addKeyListener(new KeyAdapter() {
                    public void keyPressed(KeyEvent e) {
                        clearErrorMessage();
                    }
                });
                textField.addFocusListener(new FocusAdapter() {
View Full Code Here

        text.addSelectionListener(new SelectionAdapter() {
            public void widgetDefaultSelected(SelectionEvent e) {
                handleDefaultSelection(e);
            }
        });
        text.addKeyListener(new KeyAdapter() {
            // hook key pressed - see PR 14201 
            public void keyPressed(KeyEvent e) {
                keyReleaseOccured(e);

                // as a result of processing the above call, clients may have
View Full Code Here

TOP

Related Classes of org.eclipse.swt.events.KeyAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.