Java 类org.eclipse.swt.events.KeyEvent 实例源码

项目:neoscada    文件:FilterFreeFormComposite.java   
private void createComponents ()
{
    final FillLayout layout = new FillLayout ( SWT.VERTICAL );
    layout.marginHeight = 12;
    layout.marginWidth = 12;
    setLayout ( layout );

    final Text filterTextField = new Text ( this, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL );
    filterTextField.setText ( this.filter );
    filterTextField.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            verifyFilter ( filterTextField.getText () );
        }
    } );
}
项目:neoscada    文件:FilterAdvancedComposite.java   
private Text createAttributeText ( final String attribute )
{
    final Text t = new Text ( this, SWT.BORDER );
    final Fields field = Fields.byField ( attribute );
    if ( field == null )
    {
        t.setEditable ( true );
        t.setMessage ( Messages.custom_field );
    }
    else
    {
        t.setEditable ( false );
        t.setText ( field.getName () );
    }
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        };
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
项目:neoscada    文件:FilterAdvancedComposite.java   
private Text createValueText ()
{
    final Text t = new Text ( this, SWT.BORDER );
    t.setMessage ( Messages.argument );
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
项目:convertigo-eclipse    文件:KTableCellEditorMultilineWrapText.java   
protected Control createControl() {
  m_Text = new Text(m_Table, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
  m_Text.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
      try {
        onKeyPressed(e);
      } catch (Exception ex) {
      }
    }
  });
  m_Text.addTraverseListener(new TraverseListener() {
    public void keyTraversed(TraverseEvent arg0) {
      onTraverse(arg0);
    }
  });
  return m_Text;
}
项目:convertigo-eclipse    文件:KTableCellEditorCombo.java   
protected Control createControl() {
  m_Combo = new CCombo(m_Table, SWT.READ_ONLY);
  m_Combo.setBackground(Display.getCurrent().getSystemColor(
      SWT.COLOR_LIST_BACKGROUND));
  if (m_Items != null)
    m_Combo.setItems(m_Items);
  m_Combo.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
      try {
        onKeyPressed(e);
      } catch (Exception ex) {
      }
    }
  });
  /*
   * m_Combo.addTraverseListener(new TraverseListener() { public void
   * keyTraversed(TraverseEvent arg0) { onTraverse(arg0); } });
   */
  return m_Combo;
}
项目:convertigo-eclipse    文件:KTableCellEditorText.java   
protected Control createControl() {
  // System.out.println("Created a new one.");
  m_Text = new Text(m_Table, SWT.NONE);
  m_Text.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
      try {
        onKeyPressed(e);
      } catch (Exception ex) {
      }
    }
  });
  m_Text.addTraverseListener(new TraverseListener() {
    public void keyTraversed(TraverseEvent arg0) {
      onTraverse(arg0);
    }
  });
  return m_Text;
}
项目:convertigo-eclipse    文件:KTableCellEditorMultilineText.java   
protected Control createControl() {
  m_Text = new Text(m_Table, SWT.MULTI | SWT.V_SCROLL);
  m_Text.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
      try {
        onKeyPressed(e);
      } catch (Exception ex) {
      }
    }
  });
  m_Text.addTraverseListener(new TraverseListener() {
    public void keyTraversed(TraverseEvent arg0) {
      onTraverse(arg0);
    }
  });
  return m_Text;
}
项目:convertigo-eclipse    文件:XpathEvaluatorComposite.java   
public KeyAccelerator makeXPathKeyAccelerator(final boolean overwrite) {
    return new KeyAccelerator() {
        public boolean doAction(TwsDomTree tree, KeyEvent e) {
            boolean doNext = true;
            if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
                if (tree.getSelection().length > 0) {
                    Node node = (Node)tree.getSelection()[0].getData();
                    if ((e.stateMask & SWT.SHIFT) == 0) {//without SHIFT > relative
                        if (canGenerateSelectionXpath(overwrite, node)) {
                            generateSelectionXpath(overwrite, tree);
                            doNext = false;
                        }
                    } else {//with SHIFT > absolute
                        generateAbsoluteXpath(overwrite, node);
                        doNext = false;
                    }
                }
            }
            return doNext;
        }
    };
}
项目:Hydrograph    文件:ComponentSearchUtility.java   
/**
 * Creation of content assist
 * @param event
 * @param viewer
 * @param paletteRoot
 */
public void showComponentCreationOnCanvas(KeyEvent event, GraphicalViewer viewer, PaletteRoot paletteRoot) {
    this.graphicViewer = viewer;
    this.graphicControl = viewer.getControl();
    this.triggerChar = event.character;
    this.paletteRoot = paletteRoot;
    Point cursorRelativePosition = calculatePosition();
    if (cursorRelativePosition == null) {
        return;
    }

    disposeAssistText();

    createAssistText(cursorRelativePosition);

    initializeListneres();

    activateAssist(triggerChar);

}
项目:Hydrograph    文件:ELTGraphicalEditor.java   
protected void getBounds(KeyEvent event,
        org.eclipse.draw2d.geometry.Rectangle bounds) {
    switch (event.keyCode){
    case SWT.ARROW_UP:
        bounds.setLocation(bounds.x , bounds.y - 10);
        break;
    case SWT.ARROW_DOWN:
        bounds.setLocation(bounds.x , bounds.y + 10);
        break;
    case SWT.ARROW_RIGHT:
        bounds.setLocation(bounds.x + 10, bounds.y);
        break;
    case SWT.ARROW_LEFT:
        bounds.setLocation(bounds.x - 10 , bounds.y);
        break;
        }

}
项目:team-explorer-everywhere    文件:Datepicker.java   
@Override
public void keyPressed(final KeyEvent e) {
    if (e.keyCode == SWT.ARROW_LEFT) {
        selectedDate.add(Calendar.DAY_OF_MONTH, -1);
        drawSelectedMonth();
    } else if (e.keyCode == SWT.ARROW_RIGHT) {
        selectedDate.add(Calendar.DAY_OF_MONTH, 1);
        drawSelectedMonth();
    } else if (e.keyCode == SWT.ARROW_UP) {
        selectedDate.add(Calendar.DAY_OF_MONTH, -7);
        drawSelectedMonth();
    } else if (e.keyCode == SWT.ARROW_DOWN) {
        selectedDate.add(Calendar.DAY_OF_MONTH, 7);
        drawSelectedMonth();
    } else if (e.keyCode == '\r') {
        notifyListeners(SWT.Selection, new Event());
    } else {
        final Event notifier = new Event();
        notifier.keyCode = e.keyCode;

        notifyListeners(SWT.KeyUp, notifier);
    }
}
项目:http4e    文件:ParameterizeTextView.java   
private StyledText buildEditorText( Composite parent){
   final SourceViewer sourceViewer = new SourceViewer(parent, null, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
   final HConfiguration sourceConf = new HConfiguration(HContentAssistProcessor.PARAM_PROCESSOR);
   sourceViewer.configure(sourceConf);
   sourceViewer.setDocument(DocumentUtils.createDocument1());

   sourceViewer.getControl().addKeyListener(new KeyAdapter() {

      public void keyPressed( KeyEvent e){
         // if ((e.character == ' ') && ((e.stateMask & SWT.CTRL) != 0)) {
         if (Utils.isAutoAssistInvoked(e)) {
            IContentAssistant ca = sourceConf.getContentAssistant(sourceViewer);
            ca.showPossibleCompletions();
         }
      }
   });

   return sourceViewer.getTextWidget();
}
项目:http4e    文件:Utils.java   
public static boolean isAutoAssistInvoked( KeyEvent e){
   if ((e.keyCode == 32) && ((e.stateMask & SWT.CTRL) != 0)) {
      return true;

   } else if (((e.keyCode == 32) && ((e.stateMask & SWT.COMMAND) != 0))) {
      return true;

   } else if ((e.character == ' ') && ((e.stateMask & SWT.CTRL) != 0)) {
      return true;

   } else if ((e.character == ' ') && ((e.stateMask & SWT.COMMAND) != 0)) {
      return true;

   }
   return false;

}
项目:TuxGuitar-1.3.1-fork    文件:TGLyricEditor.java   
private void loadLyricText(Composite parent){
    Composite composite = new Composite(parent,SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));

    this.text = new Text(composite,SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    this.text.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
    this.text.setFocus();
    this.text.setText(this.track.getLyrics().getLyrics());
    this.text.addModifyListener(this.listener);
    this.text.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent event) {
            for( int i = 0 ; i < KB_ACTIONS.length ; i ++ ){
                if( event.keyCode == KB_ACTIONS[i].getKeyBinding().getKey() && event.stateMask == KB_ACTIONS[i].getKeyBinding().getMask() ){
                    new TGActionProcessorListener(TGLyricEditor.this.context, KB_ACTIONS[i].getAction()).processEvent(event);
                    return;
                }
            }
        }
    });
}
项目:TranskribusSwtGui    文件:LineEditorListener.java   
@Override
    public void keyPressed(KeyEvent e) {
        if (!e.doit)
            return;

//      if (!autocomplete.getAdapter().isProposalPopupOpen()) {
//          Event newEvent = new Event();
//          newEvent.keyCode = SWT.ARROW_DOWN;
//          text.notifyListeners(SWT.KeyDown, newEvent);
//      }

        if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { // enter pressed
            jumpToNeighborLine(CanvasKeys.isCtrlKeyDown(e));
        }
        else if (e.keyCode == SWT.ARROW_DOWN) {
            jumpToNeighborLine(false);
        }
        else if (e.keyCode == SWT.ARROW_UP) {
            jumpToNeighborLine(true);
        }

    }
项目:TranskribusSwtGui    文件:UndoRedoImpl.java   
public void keyPressed(KeyEvent e) {
    if (!enabled) return;

    // Listen to CTRL+Z for Undo, to CTRL+Y or CTRL+SHIFT+Z for Redo
    boolean isCtrl = (e.stateMask & SWT.CTRL) > 0;
    boolean isAlt = (e.stateMask & SWT.ALT) > 0;
    if (isCtrl && !isAlt) {
        boolean isShift = (e.stateMask & SWT.SHIFT) > 0;
        if (!isShift && e.keyCode == 'z') {
            undo();
        } else if (!isShift && e.keyCode == 'y' || isShift
                && e.keyCode == 'z') {
            redo();
        }
    }
}
项目:PDFReporter-Studio    文件:ATextDialogCellEditor.java   
/**
 * Processes a key release event that occurred in this cell editor.
 * <p>
 * The <code>TextCellEditor</code> implementation of this framework method ignores when the RETURN key is pressed
 * since this is handled in <code>handleDefaultSelection</code>. An exception is made for Ctrl+Enter for multi-line
 * texts, since a default selection event is not sent in this case.
 * </p>
 * 
 * @param keyEvent
 *          the key event
 */
protected void keyReleaseOccured(KeyEvent keyEvent) {
    if (keyEvent.character == '\r') { // Return key
        // Enter is handled in handleDefaultSelection.
        // Do not apply the editor value in response to an Enter key event
        // since this can be received from the IME when the intent is -not-
        // to apply the value.
        // See bug 39074 [CellEditors] [DBCS] canna input mode fires bogus event from Text Control
        //
        // An exception is made for Ctrl+Enter for multi-line texts, since
        // a default selection event is not sent in this case.
        if (text != null && !text.isDisposed() && (text.getStyle() & SWT.MULTI) != 0) {
            if ((keyEvent.stateMask & SWT.CTRL) != 0) {
                super.keyReleaseOccured(keyEvent);
            }
        }
        return;
    }
    super.keyReleaseOccured(keyEvent);
}
项目:PDFReporter-Studio    文件:MovableSelectionTool.java   
@Override
protected boolean handleKeyDown(KeyEvent e) {
    if (isInState(STATE_INITIAL) && UIUtil.isArrowKey(e.keyCode)) {
        EditPartViewer viewer = getCurrentViewer();
        if (viewer instanceof GraphicalViewer) {
            JSSCompoundCommand ccmd = new JSSCompoundCommand(null);
            for(Object selectedEditPart : getCurrentViewer().getSelectedEditParts()) {
                if (selectedEditPart instanceof GraphicalEditPart) {
                    Object modelObj = ((EditPart) selectedEditPart).getModel();
                    if(modelObj instanceof MGraphicElement) {
                        MGraphicElement node = (MGraphicElement) modelObj;
                        ccmd.add(getNewXYCommand(e.keyCode,node));
                    }
                }
            }
            if(!ccmd.isEmpty()) {
                getDomain().getCommandStack().execute(ccmd);
                return true;
            }   
        }
    }
    return super.handleKeyDown(e);
}
项目:NEXCORE-UML-Modeler    文件:MultilineCellEditor.java   
/**
 * @see org.eclipse.jface.viewers.TextCellEditor#keyReleaseOccured(org.eclipse.swt.events.KeyEvent)
 */
@Override
protected void keyReleaseOccured(KeyEvent keyEvent) {

    if (keyEvent.character == '\r') { // Return key
        if (text != null && !text.isDisposed() && (text.getStyle() & SWT.MULTI) != 0) {
            if ((keyEvent.stateMask & SWT.CTRL) != 0) {
                if (keyEvent.character == '\u001b') { // Escape character
                    fireCancelEditor();
                }
            }
        }
        return;
    }
    super.keyReleaseOccured(keyEvent);

}
项目:APICloud-Studio    文件:CompletionProposalPopup.java   
/**
 * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
 */
public void keyPressed(KeyEvent e)
{
    if (!Helper.okToUse(fProposalShell))
    {
        return;
    }

    if (e.character == 0 && e.keyCode == SWT.MOD1)
    {
              // http://dev.eclipse.org/bugs/show_bug.cgi?id=34754
        int index = fProposalTable.getSelectionIndex();
        if (index >= 0)
                   {
            selectProposal(index, true, true);
             }
        // else
        // {
        // fProposalTable.setTopIndex(0);
        // }
    }
}
项目:NEXCORE-UML-Modeler    文件:AssociationGeneralSection.java   
/**
 * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
 */
public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
    if (e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER
        || e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER_SECOND) {
        if (association.getName().equals(labelTextName.getText())) {
            return;
        }

        DomainUtil.run(new TransactionalAction() {
            /**
             * @see nexcore.tool.uml.manager.transaction.TransactionalAction#doExecute()
             */
            @Override
            public void doExecute() {
                association.setName(labelTextName.getText());
            }
        });
    }
}
项目:NEXCORE-UML-Modeler    文件:AssociationGeneralSection.java   
public void keyPressed(KeyEvent e) {
    if (e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER
        || e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER_SECOND) {
        CCombo combo = (CCombo) e.getSource();
        String text = combo.getText();

        try {
            final int value = new Integer(text).intValue();
            final Property property = this.property;
            if (value > 0) {

                DomainUtil.run(new TransactionalAction() {
                    @Override
                    public void doExecute() {
                        property.setLower(value);
                        property.setUpper(value);
                    }
                });
            }
        } catch (Exception e2) {
            // TODO: handle exception
        }
    }
}
项目:NEXCORE-UML-Modeler    文件:MultiplicityGeneralSection.java   
/**
 * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
 */
public void keyPressed(KeyEvent e) {
    if (e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER
        || e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER_SECOND) {
        String text = multiplicityCombo.getText();

        try {
            final int value = new Integer(text).intValue();
            final Property property = this.getData();
            if (value > 0) {

                DomainUtil.run(new TransactionalAction() {
                    @Override
                    public void doExecute() {
                        property.setLower(value);
                        property.setUpper(value);
                    }
                });
            }
        } catch (Exception e2) {
            // TODO: handle exception
        }
    }
}
项目:PDFReporter-Studio    文件:JSSGraphicalViewerKeyHandler.java   
@Override
public boolean keyPressed(KeyEvent event) {
    if (UIUtil.isArrowKey(event.keyCode)) {
        EditPartViewer viewer = getViewer();
        if (viewer instanceof GraphicalViewer) {
            JSSCompoundCommand ccmd = new JSSCompoundCommand(null);
            for(Object selectedEditPart : getViewer().getSelectedEditParts()) {
                if (selectedEditPart instanceof GraphicalEditPart) {
                    Object modelObj = ((EditPart) selectedEditPart).getModel();
                    if(modelObj instanceof MGraphicElement) {
                        MGraphicElement node = (MGraphicElement) modelObj;
                        ccmd.add(getNewXYCommand(event.keyCode,node));
                    }
                }
            }
            if(!ccmd.isEmpty()) {
                getViewer().getEditDomain().getCommandStack().execute(ccmd);
                return true;
            }   
        }
    }
    return super.keyPressed(event);
}
项目:APICloud-Studio    文件:CompletionProposalPopup.java   
/**
 * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
 */
public void keyReleased(KeyEvent e)
{
    if (!Helper.okToUse(fProposalShell))
    {
        return;
    }

    if (e.character == 0 && e.keyCode == SWT.MOD1)
    {
        // http://dev.eclipse.org/bugs/show_bug.cgi?id=34754
            int index = fProposalTable.getSelectionIndex();
        if (index >= 0)
        {
                selectProposal(index, false, true);
                }
        // else
        // {
        // fProposalTable.setTopIndex(0);
        // }
    }
}
项目:statecharts    文件:StyledTextCellEditor.java   
/**
 * Processes a key release event that occurred in this cell editor.
 * <p>
 * The <code>TextCellEditor</code> implementation of this framework method
 * ignores when the RETURN key is pressed since this is handled in
 * <code>handleDefaultSelection</code>. An exception is made for Ctrl+Enter
 * for multi-line texts, since a default selection event is not sent in this
 * case.
 * </p>
 * 
 * @param keyEvent
 *            the key event
 */
protected void keyReleaseOccured(KeyEvent keyEvent) {
    if (keyEvent.character == '\r') { // Return key
        // Enter is handled in handleDefaultSelection.
        // Do not apply the editor value in response to an Enter key event
        // since this can be received from the IME when the intent is -not-
        // to apply the value.
        // See bug 39074 [CellEditors] [DBCS] canna input mode fires bogus
        // event from Text Control
        //
        // An exception is made for Ctrl+Enter for multi-line texts, since
        // a default selection event is not sent in this case.
        if (text != null && !text.isDisposed()
                && (text.getStyle() & SWT.MULTI) != 0) {
            if ((keyEvent.stateMask & SWT.CTRL) != 0) {
                super.keyReleaseOccured(keyEvent);
            }
        }
        return;
    }
    super.keyReleaseOccured(keyEvent);
}
项目:mytourbook    文件:DialogMarker.java   
private void createUI_52_Label(final Composite parent) {

        /*
         * Marker name
         */
        {
            // Label
            _lblLabel = new Label(parent, SWT.NONE);
            _firstColumnControls.add(_lblLabel);
            _lblLabel.setText(Messages.Dlg_TourMarker_Label_Label);

            // Combo
            _comboMarkerName = new Combo(parent, SWT.BORDER | SWT.FLAT);
            GridDataFactory.fillDefaults()//
                    // !!! hint must be set because the width is adjusted to the content
                    .hint(CONTENT_DEFAULT_WIDTH, SWT.DEFAULT)
                    .grab(true, false)
                    .applyTo(_comboMarkerName);
            _comboMarkerName.addKeyListener(new KeyAdapter() {
                @Override
                public void keyReleased(final KeyEvent e) {
                    onChangeMarkerUI();
                }
            });
        }
    }
项目:mytourbook    文件:AbstractPrefPage.java   
/**
 * @see org.eclipse.swt.events.KeyAdapter#keyPressed(
 *          org.eclipse.swt.events.KeyEvent)
 */
public void keyReleased(KeyEvent event) {
    Text text = (Text) event.widget;
    String value = text.getText(); 
    event.doit = value.matches("^\\d*$"); //$NON-NLS-1$
    if (event.doit) {
        errors.remove(text);
        if (errors.isEmpty()) {
            setErrorMessage(null);
            setValid(true);
        } else {
            setErrorMessage(
                    (String) errors.values().iterator().next());
        }
    } else {
        errors.put(text, errMsg);
        setErrorMessage(errMsg);
        setValid(false);
    }
}
项目:mytourbook    文件:AbstractPrefPage.java   
/**
 * @see org.eclipse.swt.events.KeyAdapter#keyPressed(
 *          org.eclipse.swt.events.KeyEvent)
 */
public void keyReleased(KeyEvent event) {
    Text text = (Text) event.widget;
    String value = text.getText(); 
    event.doit = value.matches("^\\d*$"); //$NON-NLS-1$
    if (event.doit) {
        errors.remove(text);
        if (errors.isEmpty()) {
            setErrorMessage(null);
            setValid(true);
        } else {
            setErrorMessage(
                    (String) errors.values().iterator().next());
        }
    } else {
        errors.put(text, errMsg);
        setErrorMessage(errMsg);
        setValid(false);
    }
}
项目:EasyShell    文件:MenuPage.java   
private void createSearchField(Composite parent) {
    //Label searchLabel = new Label(parent, SWT.NONE);
    //searchLabel.setText("Search: ");
    filter = new MenuDataFilter();
    searchText = new Text(parent, SWT.BORDER | SWT.SEARCH);
    searchText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
        | GridData.HORIZONTAL_ALIGN_FILL));
    searchText.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent ke) {
          filter.setSearchText(searchText.getText());
          refreshTableViewer();
        }

    });
    searchText.setToolTipText(Activator.getResourceString("easyshell.command.page.text.tooltip.search"));
    // fake
    Label label = new Label(parent, SWT.NONE);
    label.setText("");
}
项目:JFaceUtils    文件:StyledTextConsole.java   
protected MenuItem createSelectAllMenuItem(final StyledText styledText) {
    final MenuItem selectAll = new MenuItem(contextMenu, SWT.PUSH);
    selectAll.setText(JFaceMessages.get("lbl.menu.item.select.all") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_SELECT_ALL));
    selectAll.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {
            styledText.invokeAction(ST.SELECT_ALL);
        }
    });
    styledText.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(final KeyEvent ke) {
            if (ke.stateMask == SWT.MOD1 && ke.keyCode == SwtUtils.KEY_SELECT_ALL) {
                styledText.invokeAction(ST.SELECT_ALL);
            }
        }
    });
    return selectAll;
}
项目:depan    文件:GLPanel.java   
@Override
public void uncaughtKey(KeyEvent event,
    boolean keyCtrlState, boolean keyAltState, boolean keyShiftState) {

  // Does any renderer handle it?
  // Is this obsolete?
  boolean caught = renderer.uncaughtKey(
      event.keyCode, event.character,
      keyCtrlState, keyAltState, keyShiftState);
  if (caught) {
    return;
  }

  if (selectAll(event.keyCode, event.character,
      keyCtrlState, keyAltState, keyShiftState)) {
    return;
  }

  super.uncaughtKey(event, keyCtrlState, keyAltState, keyShiftState);
}
项目:depan    文件:SceneGrip.java   
@Override
public void keyPressed(KeyEvent event) {
  switch (event.keyCode) {
    case SWT.SHIFT:
      this.keyShiftState = true;
      break;
    case SWT.CTRL:
      this.keyCtrlState = true;
      break;
    case SWT.ALT:
      this.keyAltState = true;
      break;
    default:
      // uncaught key, transmit it to lower level for handling.
      scene.uncaughtKey(event, keyCtrlState, keyAltState,
          keyShiftState);
  }
}
项目:scouter    文件:AlertScriptingView.java   
private void addApiDescTableKeyListener() {
    table.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
            if(e.stateMask == SWT.CTRL || e.stateMask == SWT.COMMAND){
                if (e.keyCode == 'c' || e.keyCode == 'C') {
                    StructuredSelection selection = (StructuredSelection)viewer.getSelection();
                    if(selection == null)
                        return;
                    ApiDesc apiObject = (ApiDesc)selection.getFirstElement();
                    if(apiObject != null){
                        clipboard.setContents(new Object[] {apiObject.fullSignature}, new Transfer[] {TextTransfer.getInstance()});
                    }
                }
            }
        }
    });
}
项目:eclipse-batch-editor    文件:BatchBracketInsertionCompleter.java   
@Override
public void keyReleased(KeyEvent e) {
    InsertClosingBracketsSupport insertClosingBracketsSupport = getInsertionSupport(e);
    if (insertClosingBracketsSupport == null) {
        return;
    }
    /*
     * do not use last caret start - because the listener ordering could be
     * different
     */
    ISelectionProvider selectionProvider = this.batchEditor.getSelectionProvider();
    if (selectionProvider == null) {
        return;
    }
    ISelection selection = selectionProvider.getSelection();
    if (!(selection instanceof ITextSelection)) {
        return;
    }
    boolean enabled = getPreferences().getBooleanPreference(P_EDITOR_AUTO_CREATE_END_BRACKETSY);
    if (!enabled) {
        return;
    }
    ITextSelection textSelection = (ITextSelection) selection;
    int offset = textSelection.getOffset();

    try {
        IDocument document = this.batchEditor.getDocument();
        if (document == null) {
            return;
        }
        insertClosingBracketsSupport.insertClosingBrackets(document, selectionProvider, offset);
    } catch (BadLocationException e1) {
        /* ignore */
        return;
    }

}
项目:eclipse-batch-editor    文件:BatchBracketInsertionCompleter.java   
protected InsertClosingBracketsSupport getInsertionSupport(KeyEvent e) {
    if (e.character == '[') {
        return new EdgeBracketInsertionSupport();
    }
    if (e.character == '{') {
        return new CurlyBracketInsertionSupport();
    }
    return null;
}
项目:eclipse-batch-editor    文件:AbstractFilterableTreeQuickDialog.java   
@Override
public void keyPressed(KeyEvent event) {
    if (event.keyCode == SWT.ARROW_DOWN) {
        Tree tree = treeViewer.getTree();
        if (tree.isDisposed()) {
            return;
        }
        if (tree.isFocusControl()) {
            return;
        }
        tree.setFocus();
        return;
    }
    if (event.character == '\r') {
        ISelection selection = treeViewer.getSelection();
        openSelectionAndCloseDialog(selection);
        return;
    }
    boolean allowedChar = false;
    allowedChar = allowedChar || event.character == '*';
    allowedChar = allowedChar || event.character == '(';
    allowedChar = allowedChar || event.character == ')';
    allowedChar = allowedChar || Character.isJavaIdentifierPart(event.character);
    allowedChar = allowedChar || Character.isWhitespace(event.character);
    if (!allowedChar) {
        event.doit = false;
        return;
    }
    if (treeViewer == null) {
        return;
    }

}
项目:convertigo-eclipse    文件:StringComboBoxPropertyDescriptor.java   
protected void keyReleaseOccured(KeyEvent keyEvent) {
    if (keyEvent.character == '\u001b') { // Escape character
        fireCancelEditor();
    } else if (keyEvent.character == '\t') { // tab key
        applyEditorValueAndDeactivate();
    }
}
项目:convertigo-eclipse    文件:ProjectExplorerView.java   
private void hookKeyboardActions() {
    viewer.getControl().addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent event) {
            handleKeyReleased(event);
        }

    });
}
项目:convertigo-eclipse    文件:KTableCellEditor.java   
protected void onKeyPressed(KeyEvent e) {
  if ((e.character == '\r') && ((e.stateMask & SWT.SHIFT) == 0)) {
    close(true);
  } else if (e.character == SWT.ESC) {
    close(false);
  } else {
    m_Table.scrollToFocus();
  }
}