Package org.eclipse.jface.bindings

Examples of org.eclipse.jface.bindings.Binding


      if (isPartialMatch(sequenceAfterKeyStroke)) {
        incrementState(sequenceAfterKeyStroke);
        return true;

      } else if (isPerfectMatch(sequenceAfterKeyStroke)) {
        final Binding binding = getPerfectMatch(sequenceAfterKeyStroke);
        try {
          return executeCommand(binding, event)
              || !sequenceBeforeKeyStroke.isEmpty();
        } catch (final CommandException e) {
          logException(e, binding.getParameterizedCommand());
          return true;
        }

      } else if ((keyAssistDialog != null)
          && (keyAssistDialog.getShell() != null)
View Full Code Here


      } else {
        widthToRemember = NO_REMEMBERED_WIDTH;
      }

      // Remember the selected command name and key sequence.
      final Binding bindingToRemember;
      if ((completionsTable != null) && (!completionsTable.isDisposed())) {
        final int selectedIndex = completionsTable.getSelectionIndex();
        if (selectedIndex != -1) {
          final TableItem selectedItem = completionsTable
              .getItem(selectedIndex);
View Full Code Here

        SWT.LEFT, 1);
    final Iterator itemsItr = partialMatches.entrySet().iterator();
    while (itemsItr.hasNext()) {
      final Map.Entry entry = (Map.Entry) itemsItr.next();
      final TriggerSequence sequence = (TriggerSequence) entry.getValue();
      final Binding binding = (Binding) entry.getKey();
      final ParameterizedCommand command = binding
          .getParameterizedCommand();
      try {
        final String[] text = { command.getName(), sequence.format() };
        final TableItem item = new TableItem(completionsTable, SWT.NULL);
        item.setText(text);
View Full Code Here

   */
  private final void executeKeyBinding(final Event trigger) {
    // Try to execute the corresponding command.
    final int selectionIndex = completionsTable.getSelectionIndex();
    if (selectionIndex >= 0) {
      final Binding binding = (Binding) bindings.get(selectionIndex);
      try {
        workbenchKeyboard.executeCommand(binding, trigger);
      } catch (final CommandException e) {
        workbenchKeyboard.logException(e, binding
            .getParameterizedCommand());
      }
    }
  }
View Full Code Here

        .getPartialMatches(keyBindingState.getCurrentSequence());

    // Create a sorted map that sorts based on lexicographical order.
    final SortedMap sortedMatches = new TreeMap(new Comparator() {
      public final int compare(final Object a, final Object b) {
        final Binding bindingA = (Binding) a;
        final Binding bindingB = (Binding) b;
        final ParameterizedCommand commandA = bindingA
            .getParameterizedCommand();
        final ParameterizedCommand commandB = bindingB
            .getParameterizedCommand();
        try {
          return commandA.getName().compareTo(commandB.getName());
        } catch (final NotDefinedException e) {
          // should not happen
          return 0;
        }
      }
    });

    /*
     * Remove those partial matches for which either the command is not
     * identified or the activity manager believes the command is not
     * enabled.
     */
    final Iterator partialMatchItr = partialMatches.entrySet().iterator();
    while (partialMatchItr.hasNext()) {
      final Map.Entry entry = (Map.Entry) partialMatchItr.next();
      final Binding binding = (Binding) entry.getValue();
      final Command command = binding.getParameterizedCommand()
          .getCommand();
      if (command.isDefined()
          && activityManager.getIdentifier(command.getId())
              .isEnabled()) {
        sortedMatches.put(binding, entry.getKey());
View Full Code Here

   * @since 3.3
   */
  public final int open(Collection bindings) {
    conflictMatches = new TreeMap(new Comparator() {
      public final int compare(final Object a, final Object b) {
        final Binding bindingA = (Binding) a;
        final Binding bindingB = (Binding) b;
        final ParameterizedCommand commandA = bindingA
            .getParameterizedCommand();
        final ParameterizedCommand commandB = bindingB
            .getParameterizedCommand();
        try {
          return commandA.getName().compareTo(commandB.getName());
        } catch (final NotDefinedException e) {
          // should not happen
          return 0;
        }
      }
    });
    Iterator i = bindings.iterator();
    while (i.hasNext()) {
      Binding b = (Binding) i.next();
      conflictMatches.put(b, b.getTriggerSequence());
    }

    // If the dialog is already open, dispose the shell and recreate it.
    final Shell shell = getShell();
    if (shell != null) {
View Full Code Here

  private final void clearBindings() {
    Iterator i = commandIdToBinding.entrySet().iterator();
    while (i.hasNext()) {
      Map.Entry entry = (Map.Entry) i.next();
      String commandId = (String) entry.getKey();
      Binding binding = (Binding) entry.getValue();
      commandService.getCommand(commandId).removeCommandListener(actionSetListener);
      if (binding!=null && actionSetActiveBindings.contains(binding)) {
        bindingService.removeBinding(binding);
      }
    }
View Full Code Here

      final KeySequence keySequence = KeySequence.getInstance(keyStroke);

      final Scheme activeScheme = bindingService.getActiveScheme();

      try {
        final Binding binding = new KeyBinding(keySequence, command,
            activeScheme.getId(), IContextIds.CONTEXT_ID_WINDOW,
            null, null, null, Binding.SYSTEM);
        commandIdToBinding.put(command.getCommand().getId(), binding);

        if (command.getCommand().isEnabled()) {
View Full Code Here

      // Fix the bindings in the local changes.
      final Binding[] currentBindings = localChangeManager.getBindings();
      final int currentBindingsLength = currentBindings.length;
      final Set trimmedBindings = new HashSet();
      for (int i = 0; i < currentBindingsLength; i++) {
        final Binding binding = currentBindings[i];
        if (binding.getType() != Binding.USER) {
          trimmedBindings.add(binding);
        }
      }
      final Binding[] trimmedBindingArray = (Binding[]) trimmedBindings
          .toArray(new Binding[trimmedBindings.size()]);
View Full Code Here

        .getSelectionIndex();
    if ((selection >= 0)
        && (selection < tableBindingsForTriggerSequence.getItemCount())) {
      final TableItem item = tableBindingsForTriggerSequence
          .getItem(selection);
      final Binding binding = (Binding) item.getData(ITEM_DATA_KEY);
      setContextId(binding.getContextId());
    }

    update();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.bindings.Binding

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.