Package org.eclipse.jface.bindings

Examples of org.eclipse.jface.bindings.Scheme


      final int naturalKey = acceleratorInt & ~modifierMask;
      final KeyStroke keyStroke = KeyStroke.getInstance(modifierKeys,
          naturalKey);
      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()) {
          bindingService.addBinding(binding);
View Full Code Here


          parentId = null;
        }
      }

      // Define the scheme.
      final Scheme scheme = bindingManager.getScheme(id);
      scheme.define(name, description, parentId);
    }

    logWarnings(
        warningsToLog,
        "Warnings while parsing the key bindings from the 'org.eclipse.ui.bindings', 'org.eclipse.ui.acceleratorConfigurations' and 'org.eclipse.ui.commands' extension point"); //$NON-NLS-1$
View Full Code Here

    localChangeManager = new BindingManager(new ContextManager(),
        new CommandManager());
    final Scheme[] definedSchemes = bindingService.getDefinedSchemes();
    try {
      for (int i = 0; i < definedSchemes.length; i++) {
        final Scheme scheme = definedSchemes[i];
        final Scheme copy = localChangeManager
            .getScheme(scheme.getId());
        copy.define(scheme.getName(), scheme.getDescription(), scheme
            .getParentId());
      }
      localChangeManager
          .setActiveScheme(bindingService.getActiveScheme());
    } catch (final NotDefinedException e) {
View Full Code Here

        message);

    if (confirmed) {
      // Fix the scheme in the local changes.
      final String defaultSchemeId = bindingService.getDefaultSchemeId();
      final Scheme defaultScheme = localChangeManager
          .getScheme(defaultSchemeId);
      try {
        localChangeManager.setActiveScheme(defaultScheme);
      } catch (final NotDefinedException e) {
        // At least we tried....
View Full Code Here

    final ISelection selection = event.getSelection();
    if (selection instanceof IStructuredSelection) {
      final Object firstElement = ((IStructuredSelection) selection)
          .getFirstElement();
      if (firstElement instanceof Scheme) {
        final Scheme newScheme = (Scheme) firstElement;
        if (newScheme != localChangeManager.getActiveScheme()) {
          try {
            localChangeManager.setActiveScheme(newScheme);
            busyRefillTree();
          } catch (final NotDefinedException e) {
View Full Code Here

        message);

    if (confirmed) {
      // Fix the scheme in the local changes.
      final String defaultSchemeId = bindingService.getDefaultSchemeId();
      final Scheme defaultScheme = localChangeManager
          .getScheme(defaultSchemeId);
      try {
        localChangeManager.setActiveScheme(defaultScheme);
      } catch (final NotDefinedException e) {
        // At least we tried....
View Full Code Here

  /**
   * Updates the local managers active scheme, and then updates the interface.
   */
  private final void selectedComboScheme() {
    final String activeSchemeId = getSchemeId();
    final Scheme activeScheme = localChangeManager
        .getScheme(activeSchemeId);
    try {
      localChangeManager.setActiveScheme(activeScheme);
    } catch (final NotDefinedException e) {
      // Oh, well.
View Full Code Here

      Map schemesByName = new HashMap();

      final Scheme[] definedSchemes = bindingService.getDefinedSchemes();
      for (int i = 0; i < definedSchemes.length; i++) {
        final Scheme scheme = definedSchemes[i];
        try {
          String name = scheme.getName();
          Collection schemes = (Collection) schemesByName.get(name);

          if (schemes == null) {
            schemes = new HashSet();
            schemesByName.put(name, schemes);
          }

          schemes.add(scheme);
        } catch (final NotDefinedException e) {
          // Do nothing.
        }
      }

      contextIdsByUniqueName = new HashMap();
      contextUniqueNamesById = new HashMap();

      for (Iterator iterator = contextsByName.entrySet().iterator(); iterator
          .hasNext();) {
        Map.Entry entry = (Map.Entry) iterator.next();
        String name = (String) entry.getKey();
        Set contexts = (Set) entry.getValue();
        Iterator iterator2 = contexts.iterator();

        if (contexts.size() == 1) {
          Context context = (Context) iterator2.next();
          contextIdsByUniqueName.put(name, context.getId());
          contextUniqueNamesById.put(context.getId(), name);
        } else {
          while (iterator2.hasNext()) {
            Context context = (Context) iterator2.next();
            String uniqueName = MessageFormat.format(
                Util.translateString(RESOURCE_BUNDLE,
                    "uniqueName"), new Object[] { name, //$NON-NLS-1$
                    context.getId() });
            contextIdsByUniqueName.put(uniqueName, context.getId());
            contextUniqueNamesById.put(context.getId(), uniqueName);
          }
        }
      }

      categoryIdsByUniqueName = new HashMap();
      categoryUniqueNamesById = new HashMap();

      for (Iterator iterator = categoriesByName.entrySet().iterator(); iterator
          .hasNext();) {
        Map.Entry entry = (Map.Entry) iterator.next();
        String name = (String) entry.getKey();
        Set categories = (Set) entry.getValue();
        Iterator iterator2 = categories.iterator();

        if (categories.size() == 1) {
          Category category = (Category) iterator2.next();
          categoryIdsByUniqueName.put(name, category.getId());
          categoryUniqueNamesById.put(category.getId(), name);
        } else {
          while (iterator2.hasNext()) {
            Category category = (Category) iterator2.next();
            String uniqueName = MessageFormat.format(
                Util.translateString(RESOURCE_BUNDLE,
                    "uniqueName"), new Object[] { name, //$NON-NLS-1$
                    category.getId() });
            categoryIdsByUniqueName.put(uniqueName, category
                .getId());
            categoryUniqueNamesById.put(category.getId(),
                uniqueName);
          }
        }
      }

      schemeIdsByUniqueName = new HashMap();
      schemeUniqueNamesById = new HashMap();

      for (Iterator iterator = schemesByName.entrySet().iterator(); iterator
          .hasNext();) {
        Map.Entry entry = (Map.Entry) iterator.next();
        String name = (String) entry.getKey();
        Set keyConfigurations = (Set) entry.getValue();
        Iterator iterator2 = keyConfigurations.iterator();

        if (keyConfigurations.size() == 1) {
          Scheme scheme = (Scheme) iterator2.next();
          schemeIdsByUniqueName.put(name, scheme.getId());
          schemeUniqueNamesById.put(scheme.getId(), name);
        } else {
          while (iterator2.hasNext()) {
            Scheme scheme = (Scheme) iterator2.next();
            String uniqueName = MessageFormat.format(
                Util.translateString(RESOURCE_BUNDLE,
                    "uniqueName"), new Object[] { name, //$NON-NLS-1$
                    scheme.getId() });
            schemeIdsByUniqueName.put(uniqueName, scheme.getId());
            schemeUniqueNamesById.put(scheme.getId(), uniqueName);
          }
        }
      }

      Scheme activeScheme = bindingService.getActiveScheme();

      // Make an internal copy of the binding manager, for local changes.
      try {
        for (int i = 0; i < definedSchemes.length; i++) {
          final Scheme scheme = definedSchemes[i];
          final Scheme copy = localChangeManager.getScheme(scheme
              .getId());
          copy.define(scheme.getName(), scheme.getDescription(),
              scheme.getParentId());
        }
        localChangeManager.setActiveScheme(bindingService
            .getActiveScheme());
      } catch (final NotDefinedException e) {
View Full Code Here

   */
  private final void updateLabelSchemeExtends() {
    final String schemeId = getSchemeId();

    if (schemeId != null) {
      final Scheme scheme = bindingService.getScheme(schemeId);
      try {
        final String name = (String) schemeUniqueNamesById.get(scheme
            .getParentId());
        if (name != null) {
          labelSchemeExtends.setText(MessageFormat.format(Util
              .translateString(RESOURCE_BUNDLE, "extends"), //$NON-NLS-1$
              new Object[] { name }));
View Full Code Here

  public final void bindingManagerChanged(final BindingManagerEvent event) {
    final boolean schemeDefinitionsChanged = event.getScheme() != null;
    final Set previousSchemes;
    if (schemeDefinitionsChanged) {
      previousSchemes = new HashSet();
      final Scheme scheme = event.getScheme();
      final Scheme[] definedSchemes = event.getManager()
          .getDefinedSchemes();
      final int definedSchemesCount = definedSchemes.length;
      for (int i = 0; i < definedSchemesCount; i++) {
        final Scheme definedScheme = definedSchemes[0];
        if ((definedScheme == scheme) && (event.isSchemeDefined())) {
          continue; // skip this one, it was just defined.
        }
        previousSchemes.add(definedSchemes[0].getId());
      }
View Full Code Here

TOP

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

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.