Package org.eclipse.jface.bindings

Examples of org.eclipse.jface.bindings.Binding


        .getActiveBindingsDisregardingContext().get(
            binding.getTriggerSequence());
    if (matches != null) {
      Iterator i = matches.iterator();
      while (i.hasNext()) {
        Binding b = (Binding) i.next();
        if (binding != b
            && b.getContextId().equals(binding.getContextId())) {
          filteredTree.getViewer().update(b, null);
        }
      }
    }
  }
View Full Code Here


    Set addSystemAll = new HashSet();
    ArrayList removeUser = new ArrayList();
    ArrayList removeBinding = new ArrayList();
    Binding[] bindings = localChangeManager.getBindings();
    for (int i = 0; i < bindings.length; i++) {
      final Binding b = bindings[i];
      if (b.getParameterizedCommand() == null
          && localMatches(b.getLocale())
          && platformMatches(b.getPlatform())) {
        // flat out, a delete marker
        removeBinding.add(b);
      } else if (cmd.equals(b.getParameterizedCommand())) {
        if (b.getType() == Binding.SYSTEM
            && localMatches(b.getLocale())
            && platformMatches(b.getPlatform())) {
          // a system binding for this command
          addSystemAll.add(b);
        } else if (b.getType() == Binding.USER) {
          // a user binding for this command
          removeUser.add(b);
          localChangeManager.removeBinding(b);
        }
      }
    }

    if (!addSystemAll.isEmpty()) {
      String[] activeSchemeIds = getSchemeIds(getSchemeId());
      Binding[] sysArray = (Binding[]) addSystemAll
          .toArray(new Binding[addSystemAll.size()]);
      for (int k = 0; k < sysArray.length; k++) {
        Binding sys = sysArray[k];
        boolean deleted = false;
        for (Iterator i = removeBinding.iterator(); i.hasNext();) {
          Binding del = (Binding) i.next();
          if (deletes(del, sys)) {
            if (del.getType() == Binding.USER) {
              removeUser.add(del);
              localChangeManager.removeBinding(del);
            } else {
              deleted = true;
              addSystemAll.remove(sys);
View Full Code Here

                  Binding.USER);
              localChangeManager.addBinding(deleteBinding);
              if (previousConflictMatches != null) {
                Iterator i = previousConflictMatches.iterator();
                while (i.hasNext()) {
                  Binding b = (Binding) i.next();
                  if (b != keyBinding && deletes(deleteBinding, b)) {
                    extraSystemDeletes.add(b);
                  }
                }
              }
            }
            localChangeManager.addBinding(binding);
            // update the model
            bindingModel.remove(keyBinding);
            bindingModel.add(binding);
            if (!extraSystemDeletes.isEmpty()) {
              Iterator i = extraSystemDeletes.iterator();
              while (i.hasNext()) {
                KeyBinding b = (KeyBinding) i.next();
                KeyBinding newBinding = new KeyBinding(b.getKeySequence(), b
                    .getParameterizedCommand(), b.getSchemeId(), b
                    .getContextId(), null, null, null, Binding.USER);
                localChangeManager.addBinding(newBinding);

                bindingModel.remove(b);
                bindingModel.add(newBinding);
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

  public String getPerfectMatch(KeySequence keySequence) {
    try {
      final org.eclipse.jface.bindings.keys.KeySequence sequence = org.eclipse.jface.bindings.keys.KeySequence
          .getInstance(keySequence.toString());
      final Binding binding = bindingManager.getPerfectMatch(sequence);
      if (binding == null) {
        return null;
      }

      return binding.getParameterizedCommand().getId();

    } catch (final ParseException e) {
      return null;
    }
  }
View Full Code Here

          .getActiveBindingsDisregardingContext().get(
              binding.getTriggerSequence());
      if (matches != null) {
        Iterator i = matches.iterator();
        while (i.hasNext()) {
          Binding b = (Binding) i.next();
          if (binding != b
              && b.getContextId().equals(binding.getContextId())
              && b.getSchemeId().equals(binding.getSchemeId())) {
            return true;
          }
        }
      }
      return false;
View Full Code Here

    public final String getColumnText(final Object element,
        final int columnIndex) {
      final Object value = element;
      if (value instanceof Binding) {
        final Binding binding = (Binding) value;
        switch (columnIndex) {
        case COLUMN_COMMAND:
          try {
            return binding.getParameterizedCommand().getName();

          } catch (final NotDefinedException e) {
            return NewKeysPreferenceMessages.Undefined_Command;
          }
        case COLUMN_TRIGGER_SEQUENCE:
          if (checkConflict(binding)) {
            return "*" + binding.getTriggerSequence().format(); //$NON-NLS-1$
          }
          return binding.getTriggerSequence().format();

        case COLUMN_WHEN:
          try {
            return contextService
                .getContext(binding.getContextId()).getName();
          } catch (NotDefinedException e1) {
            return NewKeysPreferenceMessages.Undefined_Context;
          }
        case COLUMN_CATEGORY:
          try {
            return binding.getParameterizedCommand().getCommand()
                .getCategory().getName();
          } catch (NotDefinedException e) {
            return NewKeysPreferenceMessages.Unavailable_Category;
          }
        default:
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.