Package org.eclipse.core.commands.contexts

Examples of org.eclipse.core.commands.contexts.Context


        if (contextTree.containsKey(childContextId)) {
          break;
        }

        // Retrieve the context.
        final Context childContext = contextManager
            .getContext(childContextId);

        // Add the child-parent pair to the tree.
        try {
          final String parentContextId = childContext.getParentId();
          contextTree.put(childContextId, parentContextId);
          childContextId = parentContextId;
        } catch (final NotDefinedException e) {
          break; // stop ascending
        }
View Full Code Here


     * active.
     */
    contextIdItr = contextIds.iterator();
    while (contextIdItr.hasNext()) {
      String contextId = (String) contextIdItr.next();
      Context context = contextManager.getContext(contextId);
      try {
        String parentId = context.getParentId();
        while (parentId != null) {
          if (IContextIds.CONTEXT_ID_DIALOG.equals(parentId)) {
            if (!dialog) {
              contextIdItr.remove();
            }
            break;
          }
          if (IContextIds.CONTEXT_ID_WINDOW.equals(parentId)) {
            if (!window) {
              contextIdItr.remove();
            }
            break;
          }
          if (IContextIds.CONTEXT_ID_DIALOG_AND_WINDOW
              .equals(parentId)) {
            if ((!window) && (!dialog)) {
              contextIdItr.remove();
            }
            break;
          }

          context = contextManager.getContext(parentId);
          parentId = context.getParentId();
        }
      } catch (NotDefinedException e) {
        // since this context was part of an undefined hierarchy,
        // I'm going to yank it out as a bad bet
        contextIdItr.remove();

        // This is a logging optimization, only log the error once.
        if (context == null || !bindingErrors.contains(context.getId())) {
          if (context != null) {
            bindingErrors.add(context.getId());
          }

          // now log like you've never logged before!
          Policy
              .getLog()
View Full Code Here

  /**
   * @param bindingTable
   */
  private void defineBindingTable(MBindingTable bindingTable) {
    final Context bindingContext = contextManager.getContext(bindingTable
        .getBindingContext().getElementId());
    BindingTable table = bindingTables.getTable(bindingTable
        .getBindingContext().getElementId());
    if (table == null) {
      table = new BindingTable(bindingContext);
View Full Code Here

    if (parentObj == null) {
      return;
    }

    MBindingTable bt = (MBindingTable) parentObj;
    final Context bindingContext = contextManager.getContext(bt
        .getBindingContext().getElementId());
    BindingTable table = bindingTables.getTable(bindingContext.getId());
    if (table == null) {
      logger.error("Trying to create \'" + binding //$NON-NLS-1$
          + "\' without binding table " + bindingContext.getId());//$NON-NLS-1$
      return;
    }
    Binding keyBinding = createBinding(bindingContext,
        binding.getCommand(), binding.getParameters(),
        binding.getKeySequence(), binding);
View Full Code Here

              .getProperty(UIEvents.EventTags.NEW_VALUE);
          if (UIEvents.EventTypes.ADD.equals(event
              .getProperty(UIEvents.EventTags.TYPE))
              && newObj instanceof MBindingTable) {
            MBindingTable bt = (MBindingTable) newObj;
            final Context bindingContext = contextManager
                .getContext(bt.getBindingContext()
                    .getElementId());
            final BindingTable table = new BindingTable(
                bindingContext);
            bindingTables.addTable(table);
View Full Code Here

    Binding result = null;
    Binding currentResult = null;
    List<Context> contexts = contextSet.getContexts();
    ListIterator<Context> it = contexts.listIterator(contexts.size());
    while (it.hasPrevious()) {
      Context c = it.previous();
      BindingTable table = getTable(c.getId());
      if (table != null) {
        currentResult = table.getPerfectMatch(triggerSequence);
      }
      if (currentResult != null) {
        if (isMostActiveScheme(currentResult)) {
View Full Code Here

      ParameterizedCommand parameterizedCommand) {
    ArrayList<Binding> bindings = new ArrayList<Binding>();
    List<Context> contexts = contextSet.getContexts();
    ListIterator<Context> it = contexts.listIterator(contexts.size());
    while (it.hasPrevious()) {
      Context c = it.previous();
      BindingTable table = getTable(c.getId());
      if (table != null) {
        Collection<Binding> sequences = table.getSequencesFor(parameterizedCommand);
        if (sequences != null) {
          bindings.addAll(sequences);
        }
View Full Code Here

  public boolean isPartialMatch(ContextSet contextSet, TriggerSequence sequence) {
    List<Context> contexts = contextSet.getContexts();
    ListIterator<Context> it = contexts.listIterator(contexts.size());
    while (it.hasPrevious()) {
      Context c = it.previous();
      BindingTable table = getTable(c.getId());
      if (table != null) {
        if (table.isPartialMatch(sequence)) {
          return true;
        }
      }
View Full Code Here

  public Collection<Binding> getPartialMatches(ContextSet contextSet, TriggerSequence sequence) {
    ArrayList<Binding> bindings = new ArrayList<Binding>();
    List<Context> contexts = contextSet.getContexts();
    ListIterator<Context> it = contexts.listIterator(contexts.size());
    while (it.hasPrevious()) {
      Context c = it.previous();
      BindingTable table = getTable(c.getId());
      if (table != null) {
        Collection<Binding> partialMatches = table.getPartialMatches(sequence);
        if (partialMatches != null) {
          bindings.addAll(partialMatches);
        }
View Full Code Here

      int l = 0;
      try {
        String parentId = c.getParentId();
        while (parentId != null) {
          l++;
          Context context = manager.getContext(parentId);
          parentId = context.getParentId();
        }
      } catch (NotDefinedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
View Full Code Here

TOP

Related Classes of org.eclipse.core.commands.contexts.Context

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.