Package org.eclipse.jface.bindings.keys

Examples of org.eclipse.jface.bindings.keys.KeyStroke


          .convertAccelerator(acceleratorText);
      final int modifierMask = lookup.getAlt() | lookup.getCommand()
          | lookup.getCtrl() | lookup.getShift();
      final int modifierKeys = acceleratorInt & modifierMask;
      final int naturalKey = acceleratorInt & ~modifierMask;
      final KeyStroke keyStroke = KeyStroke.getInstance(modifierKeys,
          naturalKey);
      final KeySequence keySequence = KeySequence.getInstance(keyStroke);

      final Scheme activeScheme = bindingService.getActiveScheme();
View Full Code Here


        .getBestActiveBindingFor(commandId);
    if (triggerSequence instanceof KeySequence) {
      final KeySequence keySequence = (KeySequence) triggerSequence;
      final KeyStroke[] keyStrokes = keySequence.getKeyStrokes();
      if (keyStrokes.length == 1) {
        final KeyStroke keyStroke = keyStrokes[0];
        return keyStroke.getModifierKeys() | keyStroke.getNaturalKey();
      }
    }

    return 0;
  }
View Full Code Here

    // Construct the menu to attach to the above button.
    final Menu addKeyMenu = new Menu(addKeyButton);
    final Iterator trappedKeyItr = KeySequenceText.TRAPPED_KEYS.iterator();
    while (trappedKeyItr.hasNext()) {
      final KeyStroke trappedKey = (KeyStroke) trappedKeyItr.next();
      final MenuItem menuItem = new MenuItem(addKeyMenu, SWT.PUSH);
      menuItem.setText(trappedKey.format());
      menuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
          keySequenceText.insert(trappedKey);
          bindingText.setFocus();
View Full Code Here

    // Construct the menu to attach to the above button.
    final Menu menuButtonAddKey = new Menu(buttonAddKey);
    final Iterator trappedKeyItr = KeySequenceText.TRAPPED_KEYS.iterator();
    while (trappedKeyItr.hasNext()) {
      final KeyStroke trappedKey = (KeyStroke) trappedKeyItr.next();
      final MenuItem menuItem = new MenuItem(menuButtonAddKey, SWT.PUSH);
      menuItem.setText(trappedKey.format());
      menuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
          textTriggerSequenceManager.insert(trappedKey);
          textTriggerSequence.setFocus();
View Full Code Here

  /**
   * @param ch the character to convert to {@link KeyStroke}s.
   * @return the {@link KeyStroke}s corresponding to the character.
   */
  static KeyStroke[] create(char ch) {
    KeyStroke keyStroke = defaultKeyboardLayout.keyStrokeFor(ch);
    if (keyStroke.getModifierKeys() == KeyStroke.NO_KEY)
      return new KeyStroke[] { keyStroke };
    KeyStroke modifier = KeyStroke.getInstance(keyStroke.getModifierKeys(), 0);
    KeyStroke key = KeyStroke.getInstance(0, keyStroke.getNaturalKey());
    return new KeyStroke[] { modifier, key };
  }
View Full Code Here

   *
   * @param ch a character.
   * @return the keystroke applicable corresponding to the character.
   */
  public KeyStroke keyStrokeFor(char ch) {
    KeyStroke keyStroke = keyStrokes.getValue(ch);
    if (keyStroke != null) {
      return keyStroke;
    }
    throw new IllegalArgumentException("no stroke available for character '" + ch + "'");
  }
View Full Code Here

  }
 
  private void createSection(Section section, FormToolkit toolkit) {
    section.setText("Package Basic Information");

    KeyStroke assistKeyStroke = null;
    try {
      assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException x) {
      // Ignore
    }
View Full Code Here

    // set up the text box for the "Match" field
    matchText = new Text(matchReplaceArea, SWT.SINGLE | SWT.BORDER);
    matchText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    KeyStroke keyStroke = null;
    try {
      keyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException e) {
      e.printStackTrace();
    }
View Full Code Here

    currentURLText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    currentURLText.setToolTipText("This area displays the current url. Type and press enter to change\n"
        + "the URL. Pressing Ctrl+Space will open a list of previously visited\n"
        + "locations that might complete whatever url has been typed.");

    KeyStroke keyStroke = null;
    try {
      keyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException e) {
      e.printStackTrace();
    }
View Full Code Here

      if (!patterns.isEmpty()) {
        // Content assist is available
        UIUtils.createContentProposalDecorator(patternText,
            Messages.Log4JPatternLayoutWizardPage_dec_contentAssistAvailable);
       
        KeyStroke keyStroke = KeyStroke.getInstance("Ctrl+Space"); //$NON-NLS-1$
        ContentProposalAdapter adapter = new ContentProposalAdapter(patternText,
            new TextContentAdapter(),
            new SimpleContentProposalProvider(patterns.toArray(new String[patterns.size()])),
            keyStroke, null);
        adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
View Full Code Here

TOP

Related Classes of org.eclipse.jface.bindings.keys.KeyStroke

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.