Package org.eclipse.jface.bindings.keys

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


      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


        } else {
          parameterizedCommand = readParameters(memento,
              warningsToLog, command);
        }

        final Binding binding = new KeyBinding(keySequence,
            parameterizedCommand, schemeId, contextId, locale,
            platform, null, Binding.USER);
        bindingManager.addBinding(binding);
      }
    }
View Full Code Here

      } else {
        parameterizedCommand = readParameters(configurationElement,
            warningsToLog, command);
      }

      final Binding binding = new KeyBinding(keySequence,
          parameterizedCommand, schemeId, contextId, locale,
          platform, null, Binding.SYSTEM);
      bindings.add(binding);
    }
View Full Code Here

    } else {
      // TODO This should be the user's personal scheme.
      Collection previousConflictMatches = (Collection) localChangeManager
          .getActiveBindingsDisregardingContext().get(
              binding.getTriggerSequence());
      KeyBinding deleteBinding = new KeyBinding(triggerSequence, null,
          schemeId, contextId, null, null, null, Binding.USER);
      localChangeManager.addBinding(deleteBinding);
      if (previousConflictMatches != null) {
        Iterator i = previousConflictMatches.iterator();
        while (i.hasNext()) {
          Binding b = (Binding) i.next();
          if (b != binding && deletes(deleteBinding, b)) {
            extraSystemDeletes.add(b);
          }
        }
      }
    }

    // update the model
    bindingModel.remove(binding);
    bindingAdd(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);
View Full Code Here

          }
        } else {
          contextId = IContextIds.CONTEXT_ID_WINDOW;
        }
        if (object instanceof KeyBinding) {
          KeyBinding keyBinding = (KeyBinding) object;
          if (!keyBinding.getContextId().equals(contextId)
              || !keyBinding.getKeySequence().equals(keySequence)) {
            final KeyBinding binding = new KeyBinding(
                keySequence,
                keyBinding.getParameterizedCommand(),
                getSchemeId(),
                contextId, null, null, null, Binding.USER);

            ArrayList extraSystemDeletes = new ArrayList();
            if (keyBinding.getType() == Binding.USER) {
              localChangeManager.removeBinding(keyBinding);
            } else {             
              // TODO This should be the user's personal scheme.
              Collection previousConflictMatches = (Collection) localChangeManager
                  .getActiveBindingsDisregardingContext().get(
                      keyBinding.getTriggerSequence());
              KeyBinding deleteBinding = new KeyBinding(
                  keyBinding.getKeySequence(), null,
                  keyBinding.getSchemeId(), keyBinding
                      .getContextId(), null, null, null,
                  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);
              }
            }
            updateConflicts(keyBinding);
            updateConflicts(binding);
            // end update the model
            update();
            filteredTree.getViewer().setSelection(
                new StructuredSelection(binding), true);
          }
        } else if (object instanceof ParameterizedCommand) {
          // TODO This should use the user's personal scheme.
          final KeyBinding binding = new KeyBinding(keySequence,
              (ParameterizedCommand) object,
              getSchemeId(),
              contextId, null, null, null, Binding.USER);
          localChangeManager.addBinding(binding);
          // update the model
View Full Code Here

      final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
      final Object node = structuredSelection.getFirstElement();
      if (node != null) {
        final Object object = node;
        if (object instanceof KeyBinding) {
          final KeyBinding binding = (KeyBinding) object;
          try {
            commandNameValueLabel.setText(binding
                .getParameterizedCommand().getName());
            String description = binding.getParameterizedCommand()
                .getCommand().getDescription();
            if (description == null) {
              description = Util.ZERO_LENGTH_STRING;
            }
            descriptionValueText.setText(description);
          } catch (final NotDefinedException e) {
            // It's probably okay to just let this one slide.
          }
          whenCombo.setSelection(new StructuredSelection(
              contextService.getContext(binding.getContextId())));
          keySequenceText.setKeySequence(binding.getKeySequence());

        } else if (object instanceof ParameterizedCommand) {
          final ParameterizedCommand command = (ParameterizedCommand) object;
          try {
            commandNameValueLabel.setText(command.getName());
View Full Code Here

          }
        } else {
          contextId = IContextIds.CONTEXT_ID_WINDOW;
        }
        if (object instanceof KeyBinding) {
          KeyBinding keyBinding = (KeyBinding) object;
          if (!keyBinding.getContextId().equals(contextId)) {
            final KeyBinding binding = new KeyBinding(
                keyBinding.getKeySequence(),
                keyBinding.getParameterizedCommand(),
                getSchemeId(),
                contextId, null, null, null, Binding.USER);

            if (keyBinding.getType() == Binding.USER) {
              localChangeManager.removeBinding(keyBinding);
            } else {
              localChangeManager.addBinding(new KeyBinding(
                  keyBinding.getKeySequence(), null,
                  keyBinding.getSchemeId(), keyBinding
                      .getContextId(), null, null, null,
                  Binding.USER));
            }
View Full Code Here

    final String contextId = getContextId();
    final String schemeId = getSchemeId();
    final KeySequence keySequence = getKeySequence();
    localChangeManager.removeBindings(keySequence, schemeId, contextId,
        null, null, null, Binding.USER);
    localChangeManager.addBinding(new KeyBinding(keySequence, command,
        schemeId, contextId, null, null, null, Binding.USER));
    update(true);
  }
View Full Code Here

    final String contextId = getContextId();
    final String schemeId = getSchemeId();
    final KeySequence keySequence = getKeySequence();
    localChangeManager.removeBindings(keySequence, schemeId, contextId,
        null, null, null, Binding.USER);
    localChangeManager.addBinding(new KeyBinding(keySequence, null,
        schemeId, contextId, null, null, null, Binding.USER));
    update(true);
  }
View Full Code Here

  private final void selectedTableBindingsForCommand() {
    final int selection = tableBindingsForCommand.getSelectionIndex();
    if ((selection >= 0)
        && (selection < tableBindingsForCommand.getItemCount())) {
      final TableItem item = tableBindingsForCommand.getItem(selection);
      final KeyBinding binding = (KeyBinding) item.getData(ITEM_DATA_KEY);
      setContextId(binding.getContextId());
      setKeySequence(binding.getKeySequence());
    }

    update();
  }
View Full Code Here

TOP

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

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.