Package org.eclipse.swt.events

Examples of org.eclipse.swt.events.KeyListener


            //
            // TODO: This is really l&f-dependent. Find a way to query the l&f for the popup key
            addConsumedKeystroke(new SwtKeystroke(SWT.KeyUp, SWT.F10, SWT.SHIFT));
        }
       
        borderlessChild.addKeyListener(new KeyListener() {
            public void keyPressed(KeyEvent e) {
                handleKeyEvent(SWT.KeyDown, e);
            }
            public void keyReleased(KeyEvent e) {
                handleKeyEvent(SWT.KeyUp, e);
View Full Code Here


  data.grabExcessHorizontalSpace = true;
  data.grabExcessVerticalSpace = true;
  editor.setLayoutData(data);
 
  // editor must quit on ESC
  editor.addKeyListener(new KeyListener() {
    public void keyReleased(KeyEvent e) {
      if( e.keyCode == SWT.ESC ) {
        controller.stopApplication();
      }
    }
View Full Code Here

/**
* make application stop on ESC key
*/
private void makeKeyListeners(Shell shell) {
  shell.addKeyListener(new KeyListener() {
    public void keyReleased(KeyEvent e) {
      if( e.keyCode == SWT.ESC ) {
        controller.stopApplication();
      }
    }
View Full Code Here

    // Text field for default modifier string
    label= TextEditorMessages.HyperlinkDefaultKeyModifier_label;
    fHyperlinkDefaultKeyModifierText= (Text)addTextField(composite, label, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER, 15, 20, pixelConverter)[1];

    fHyperlinkDefaultKeyModifierText.addKeyListener(new KeyListener() {
      private boolean isModifierCandidate;
      public void keyPressed(KeyEvent e) {
        isModifierCandidate= e.keyCode > 0 && e.character == 0 && e.stateMask == 0;
      }

      public void keyReleased(KeyEvent e) {
        if (isModifierCandidate && e.stateMask > 0 && e.stateMask == e.stateMask && e.character == 0) {// && e.time -time < 1000) {
          String modifierString= fHyperlinkDefaultKeyModifierText.getText();
          Point selection= fHyperlinkDefaultKeyModifierText.getSelection();
          int i= selection.x - 1;
          while (i > -1 && Character.isWhitespace(modifierString.charAt(i))) {
            i--;
          }
          boolean needsPrefixDelimiter= i > -1 && !String.valueOf(modifierString.charAt(i)).equals(MODIFIER_DELIMITER);

          i= selection.y;
          while (i < modifierString.length() && Character.isWhitespace(modifierString.charAt(i))) {
            i++;
          }
          boolean needsPostfixDelimiter= i < modifierString.length() && !String.valueOf(modifierString.charAt(i)).equals(MODIFIER_DELIMITER);

          String insertString;

          if (needsPrefixDelimiter && needsPostfixDelimiter)
            insertString= NLSUtility.format(TextEditorMessages.HyperlinkKeyModifier_insertDelimiterAndModifierAndDelimiter, Action.findModifierString(e.stateMask));
          else if (needsPrefixDelimiter)
            insertString= NLSUtility.format(TextEditorMessages.HyperlinkKeyModifier_insertDelimiterAndModifier, Action.findModifierString(e.stateMask));
          else if (needsPostfixDelimiter)
            insertString= NLSUtility.format(TextEditorMessages.HyperlinkKeyModifier_insertModifierAndDelimiter, Action.findModifierString(e.stateMask));
          else
            insertString= Action.findModifierString(e.stateMask);

          fHyperlinkDefaultKeyModifierText.insert(insertString);
        }
      }
    });

    fHyperlinkDefaultKeyModifierText.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        handleHyperlinkDefaultKeyModifierModified();
      }
    });
   
    addFiller(composite, 2);

    Composite editorComposite= new Composite(composite, SWT.NONE);
    GridData gd;
   
    // XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=178097
    if ("gtk".equals(SWT.getPlatform())) //$NON-NLS-1$
        gd= new GridData(SWT.FILL, SWT.FILL, true, true);
      else
        gd= new GridData(SWT.FILL, SWT.TOP, true, false);
   
    gd.horizontalSpan= 2;
    gd.horizontalIndent= 20;
    editorComposite.setLayoutData(gd);
    TableColumnLayout tableColumnlayout= new TableColumnLayout();
    editorComposite.setLayout(tableColumnlayout);
   
    // Hyperlink detector table
    Table hyperlinkDetectorTable= new Table(editorComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
    hyperlinkDetectorTable.setHeaderVisible(true);
    hyperlinkDetectorTable.setLinesVisible(true);
    hyperlinkDetectorTable.setFont(parent.getFont());
   
    hyperlinkDetectorTable.addSelectionListener(new SelectionListener() {
      public void widgetSelected(SelectionEvent e) {
        handleListSelection();
      }
      public void widgetDefaultSelected(SelectionEvent e) {
      }
    });
   
    ColumnLayoutData columnLayoutData= new ColumnWeightData(1);
   
    TableColumn nameColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 0);
    nameColumn.setText(TextEditorMessages.HyperlinkDetectorTable_nameColumn);
    tableColumnlayout.setColumnData(nameColumn, columnLayoutData);
   
    TableColumn modifierKeysColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 1);
    modifierKeysColumn.setText(TextEditorMessages.HyperlinkDetectorTable_modifierKeysColumn);
    tableColumnlayout.setColumnData(modifierKeysColumn, columnLayoutData);
   
    TableColumn targetNameColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 2);
    targetNameColumn.setText(TextEditorMessages.HyperlinkDetectorTable_targetNameColumn);
    tableColumnlayout.setColumnData(targetNameColumn, columnLayoutData);

    fHyperlinkDetectorsViewer= new CheckboxTableViewer(hyperlinkDetectorTable);
    fHyperlinkDetectorsViewer.setUseHashlookup(true);
   
    fHyperlinkDetectorsViewer.addCheckStateListener(new ICheckStateListener() {
      /*
       * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
       */
      public void checkStateChanged(CheckStateChangedEvent event) {
        String id= ((ListItem)event.getElement()).id;
        if (id == null)
          return;
        fStore.setValue(id, !event.getChecked());
      }
    });
   
    fHyperlinkDetectorsViewer.setLabelProvider(new ItemLabelProvider());
    fHyperlinkDetectorsViewer.setContentProvider(new ItemContentProvider());
    gd= new GridData(SWT.FILL, SWT.FILL, true , false);
    gd.heightHint= pixelConverter.convertHeightInCharsToPixels(10);
    fHyperlinkDetectorsViewer.getControl().setLayoutData(gd);
   
//    addFiller(composite, 2);
   
    // Text field for modifier string
    label= TextEditorMessages.HyperlinkKeyModifier_label;
    fHyperlinkKeyModifierText= (Text)addTextField(composite, label, null, 15, 20, pixelConverter)[1];

    fHyperlinkKeyModifierText.addKeyListener(new KeyListener() {
      private boolean isModifierCandidate;
      public void keyPressed(KeyEvent e) {
        isModifierCandidate= e.keyCode > 0 && e.character == 0 && e.stateMask == 0;
      }

View Full Code Here

    fText.setLayoutData(gd);
    fText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
    fText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    fText.setFont(JFaceResources.getFont(symbolicFontName));

    fText.addKeyListener(new KeyListener() {

      public void keyPressed(KeyEvent e)  {
        if (e.character == 0x1B) // ESC
          fShell.dispose();
      }
View Full Code Here

    chatMessageComposite.setLayout(new GridLayout(2, false));
    chatMessageComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    chatMessageText = new Text(chatMessageComposite, SWT.BORDER);
    chatMessageText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    chatMessageText.addKeyListener(new KeyListener() {

      public void keyPressed(KeyEvent e) {
        if (e.keyCode == SWT.CR) {
          sendMessage();
        }
View Full Code Here

    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;

    _imgArea.setLayoutData(gd);

    _imgArea.addKeyListener(new KeyListener()
      {
        @Override
        public void keyPressed(KeyEvent e)
          {
          }
View Full Code Here

        labelN.setText("The size of the n-Grams (typically 3):");       
        labelN.setLayoutData(new GridData())
       
        N = new Text(container, SWT.BORDER | SWT.SINGLE);
        N.setText("" + Activator.getRuleEngine().getN());
        N.addKeyListener(new KeyListener()
        {
            @Override
            public void keyPressed(KeyEvent e)
            {
            }

            @Override
            public void keyReleased(KeyEvent e)
            {
                try
                {
                    Integer.valueOf(N.getText());
                    int val = Integer.valueOf(N.getText()).intValue();
                    if( val < 1 )
                    {
                        setErrorMessage("Value for parameter \"N\" must be greater than 0");
                        inputNValid = false;
                        setPageComplete(inputNValid & inputCValid);
                    }
                    else
                    {
                        inputNValid = true;
                        setErrorMessage(null);
                        setPageComplete(inputNValid & inputCValid);
                    }
                   
                }
                catch(NumberFormatException exception)
                {
                    setErrorMessage("Integer value expected for parameter \"N\"");
                    inputNValid = false;
                    setPageComplete(inputNValid & inputCValid);
                }
            }
        });

        N.setLayoutData(new GridData(50, 20));
       
        Label labelCorrelation = new Label(container, SWT.NULL);
        labelCorrelation.setText("The minimum correlation for two items to match (min. 0, max. 1):");       
        labelCorrelation.setLayoutData(new GridData())
              
        correlation = new Text(container, SWT.BORDER | SWT.SINGLE);
        correlation.setText("" + Activator.getRuleEngine().getCorrelation());
        correlation.addKeyListener(new KeyListener()
        {
            @Override
            public void keyPressed(KeyEvent e)
            {
            }
View Full Code Here

    gridData.horizontalAlignment = SWT.FILL;
    gridData.horizontalSpan = 2;
    gridData.grabExcessHorizontalSpace = true;
    captionText.setLayoutData(gridData);
    final IWizard wizard = getWizard();
    captionText.addKeyListener( new KeyListener() {
     
      @Override
      public void keyReleased(KeyEvent e) {
        setErrorMessage();
        wizard.getContainer().updateButtons(); // updates
View Full Code Here

    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;
    filterText.setLayoutData(gridData);

    filterText.setText(filterWord);
    filterText.addKeyListener(new KeyListener() {

      @Override
      public void keyReleased(KeyEvent e) {
        updateLists(false);
      }
View Full Code Here

TOP

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

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.