当前位置: 首页>>代码示例>>Java>>正文


Java PairProcessor类代码示例

本文整理汇总了Java中com.intellij.util.PairProcessor的典型用法代码示例。如果您正苦于以下问题:Java PairProcessor类的具体用法?Java PairProcessor怎么用?Java PairProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PairProcessor类属于com.intellij.util包,在下文中一共展示了PairProcessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: definedInClass

import com.intellij.util.PairProcessor; //导入依赖的package包/类
public PsiMethodPattern definedInClass(final ElementPattern<? extends PsiClass> pattern) {
  return with(new PatternConditionPlus<PsiMethod, PsiClass>("definedInClass", pattern) {

    @Override
    public boolean processValues(PsiMethod t, final ProcessingContext context, final PairProcessor<PsiClass, ProcessingContext> processor) {
      if (!processor.process(t.getContainingClass(), context)) return false;
      final Ref<Boolean> result = Ref.create(Boolean.TRUE);
      SuperMethodsSearch.search(t, null, true, false).forEach(new Processor<MethodSignatureBackedByPsiMethod>() {
        @Override
        public boolean process(final MethodSignatureBackedByPsiMethod signature) {
          if (!processor.process(signature.getMethod().getContainingClass(), context)) {
            result.set(Boolean.FALSE);
            return false;
          }
          return true;
        }
      });
      return result.get();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PsiMethodPattern.java

示例2: filterTree

import com.intellij.util.PairProcessor; //导入依赖的package包/类
static SliceNode filterTree(SliceNode oldRoot,
                            NullableFunction<SliceNode, SliceNode> filter,
                            PairProcessor<SliceNode, List<SliceNode>> postProcessor) {
  SliceNode filtered = filter.fun(oldRoot);
  if (filtered == null) return null;

  List<SliceNode> childrenFiltered = new ArrayList<SliceNode>();
  if (oldRoot.myCachedChildren != null) {
    for (SliceNode child : oldRoot.myCachedChildren) {
      SliceNode childFiltered = filterTree(child, filter,postProcessor);
      if (childFiltered != null) {
        childrenFiltered.add(childFiltered);
      }
    }
  }
  boolean success = postProcessor == null || postProcessor.process(filtered, childrenFiltered);
  if (!success) return null;
  filtered.myCachedChildren = new ArrayList<SliceNode>(childrenFiltered);
  return filtered;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SliceLeafAnalyzer.java

示例3: _do

import com.intellij.util.PairProcessor; //导入依赖的package包/类
public static void _do(@NotNull final ConfigurationError error, @NotNull final Project project,
                       @NotNull final PairProcessor<ConfigurationErrors, ConfigurationError> fun) {
  if (!project.isInitialized()) {
    StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
       @Override
       public void run() {
         fun.process(project.getMessageBus().syncPublisher(TOPIC), error);
       }
     });

    return;
  }

  final MessageBus bus = project.getMessageBus();
  if (EventQueue.isDispatchThread()) fun.process(bus.syncPublisher(TOPIC), error);
  else {
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        fun.process(bus.syncPublisher(TOPIC), error);
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ConfigurationErrors.java

示例4: withSuperParent

import com.intellij.util.PairProcessor; //导入依赖的package包/类
public Self withSuperParent(final int level, @NotNull final ElementPattern<? extends ParentType> pattern) {
  return with(new PatternConditionPlus<T, ParentType>(level == 1 ? "withParent" : "withSuperParent", pattern) {

    @Override
    public boolean processValues(T t,
                                 ProcessingContext context,
                                 PairProcessor<ParentType, ProcessingContext> processor) {
      ParentType parent = t;
      for (int i = 0; i < level; i++) {
        if (parent == null) return true;
        parent = getParent(parent);
      }
      return processor.process(parent, context);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TreeElementPattern.java

示例5: appendParams

import com.intellij.util.PairProcessor; //导入依赖的package包/类
private void appendParams(final StringBuilder builder, final String indent) {
  processParameters(new PairProcessor<String, Object>() {
    int count;
    String prevName;
    int prevOffset;

    @Override
    public boolean process(String name, Object value) {
      count ++;
      if (count == 2) builder.insert(prevOffset, prevName +"=");
      if (count > 1) builder.append(", ");
      prevOffset = builder.length();
      if (count > 1) builder.append(name).append("=");
      appendValue(builder, indent, value);
      prevName = name;
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PatternCondition.java

示例6: processParameters

import com.intellij.util.PairProcessor; //导入依赖的package包/类
public boolean processParameters(final PairProcessor<String, Object> processor) {
  for (Class aClass = getClass(); aClass != null; aClass = aClass.getSuperclass()) {
    for (final Field field : aClass.getDeclaredFields()) {
      if (!Modifier.isStatic(field.getModifiers()) &&
          (((field.getModifiers() & 0x1000 /*Modifer.SYNTHETIC*/) == 0 && !aClass.equals(PatternCondition.class))
           || field.getName().startsWith(PARAMETER_FIELD_PREFIX))) {
        final String name = field.getName();
        final String fixedName = name.startsWith(PARAMETER_FIELD_PREFIX) ?
                                 name.substring(PARAMETER_FIELD_PREFIX.length()) : name;
        final Object value = getFieldValue(field);
        if (!processor.process(fixedName, value)) return false;
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PatternCondition.java

示例7: treeWalkUp

import com.intellij.util.PairProcessor; //导入依赖的package包/类
public static boolean treeWalkUp(@NotNull final PsiElement entrance,
                                 @Nullable final PsiElement maxScope,
                                 PairProcessor<PsiElement, PsiElement> eachScopeAndLastParent) {
  PsiElement prevParent = null;
  PsiElement scope = entrance;

  while (scope != null) {
    if (!eachScopeAndLastParent.process(scope, prevParent)) return false;

    if (scope == maxScope) break;
    prevParent = scope;
    scope = prevParent.getContext();
  }

  return true;

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PsiTreeUtil.java

示例8: apply

import com.intellij.util.PairProcessor; //导入依赖的package包/类
@Override
public void apply(@NotNull List<QuickList> settings) throws ConfigurationException {
  itemPanel.apply();

  editor.ensureNonEmptyNames("Quick list should have non empty name");
  editor.processModifiedItems(new PairProcessor<QuickList, QuickList>() {
    @Override
    public boolean process(QuickList newItem, QuickList oldItem) {
      if (!oldItem.getName().equals(newItem.getName())) {
        keymapListener.quickListRenamed(oldItem, newItem);
      }
      return true;
    }
  });

  if (isModified(settings)) {
    java.util.List<QuickList> result = editor.apply();
    keymapListener.processCurrentKeymapChanged(result.toArray(new QuickList[result.size()]));
    QuickListsManager.getInstance().setQuickLists(result);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:QuickListsUi.java

示例9: setUp

import com.intellij.util.PairProcessor; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  myReloadFromDisk = Boolean.TRUE;
  FileDocumentManagerImpl impl = (FileDocumentManagerImpl)FileDocumentManager.getInstance();
  impl.setAskReloadFromDisk(getTestRootDisposable(), new PairProcessor<VirtualFile, Document>() {
    @Override
    public boolean process(VirtualFile file, Document document) {
      if (myReloadFromDisk == null) {
        fail();
        return false;
      }
      return myReloadFromDisk.booleanValue();
    }
  });
  myDocumentManager = impl;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FileDocumentManagerImplTest.java

示例10: QuerySearchRequest

import com.intellij.util.PairProcessor; //导入依赖的package包/类
public QuerySearchRequest(@NotNull Query<PsiReference> query,
                          @NotNull final SearchRequestCollector collector,
                          boolean inReadAction,
                          @NotNull final PairProcessor<PsiReference, SearchRequestCollector> processor) {
  this.query = query;
  this.collector = collector;
  if (inReadAction) {
    this.processor = new ReadActionProcessor<PsiReference>() {
      @Override
      public boolean processInReadAction(PsiReference psiReference) {
        return processor.process(psiReference, collector);
      }
    };
  }
  else {
    this.processor = new Processor<PsiReference>() {
      @Override
      public boolean process(PsiReference psiReference) {
        return processor.process(psiReference, collector);
      }
    };
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:QuerySearchRequest.java

示例11: getSimiliar

import com.intellij.util.PairProcessor; //导入依赖的package包/类
public void getSimiliar(final Key key, final PairProcessor<Key, Val> consumer) {
  final int idx = Collections.binarySearch(myKeys, key, myComparator);
  if (idx < 0) {
    final int insertionIdx = - idx - 1;
    // take item before
    final int itemBeforeIdx = insertionIdx - 1;
    if (itemBeforeIdx >= 0) {
      for (ListIterator<Key> iterator = myKeys.listIterator(itemBeforeIdx + 1); iterator.hasPrevious(); ) {
        final Key candidate = iterator.previous();
        if (! myKeysResemblance.process(candidate, key)) continue;
        if (consumer.process(candidate, myMap.get(candidate))) break;     // if need only a part of keys
      }
    }
  } else {
    consumer.process(key, myMap.get(key));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AreaMap.java

示例12: optimizeMap

import com.intellij.util.PairProcessor; //导入依赖的package包/类
public void optimizeMap(final PairProcessor<Val, Val> valuesAreas) {
  int i = 0;
  for (Iterator<Key> iterator = myKeys.iterator(); iterator.hasNext();) {
    final Key key = iterator.next();
    final Val value = myMap.get(key);

    // go for parents
    for (int j = i - 1; j >= 0; -- j) {
      final Key innerKey = myKeys.get(j);
      if (myKeysResemblance.process(innerKey, key)) {
        if (valuesAreas.process(myMap.get(innerKey), value)) {
          -- i;
          iterator.remove();
          myMap.remove(key);
        }
        // otherwise we found a "parent", and do not remove the child
        break;
      }
    }
    ++ i;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MembershipMap.java

示例13: run

import com.intellij.util.PairProcessor; //导入依赖的package包/类
@Override
public void run(@NotNull ProgressIndicator indicator) {
  try {
    //indicator.setText2("Checking and possibly creating database");
    indicator.setText2("Updating VCS and roots");
    final MultiMap<String, String> map = new MultiMap<String, String>();
    myCachesHolder.iterateAllRepositoryLocations(new PairProcessor<RepositoryLocation, AbstractVcs>() {
      @Override
      public boolean process(RepositoryLocation location, AbstractVcs vcs) {
        map.putValue(vcs.getName(), location2string(location));
        return true;
      }
    });
    myDbUtil.checkVcsRootsAreTracked(map);
  }
  catch (VcsException e) {
    LOG.info(e);
    myException = e;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HistoryCacheManager.java

示例14: startTemplateWithPrefix

import com.intellij.util.PairProcessor; //导入依赖的package包/类
public void startTemplateWithPrefix(final Editor editor,
                                    final TemplateImpl template,
                                    @Nullable final PairProcessor<String, String> processor,
                                    @Nullable String argument) {
  final int caretOffset = editor.getCaretModel().getOffset();
  String key = template.getKey();
  int startOffset = caretOffset - key.length();
  if (argument != null) {
    if (!isDelimiter(key.charAt(key.length() - 1))) {
      // pass space
      startOffset--;
    }
    startOffset -= argument.length();
  }
  startTemplateWithPrefix(editor, template, startOffset, processor, argument);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TemplateManagerImpl.java

示例15: chooseBetweenHostAndInjected

import com.intellij.util.PairProcessor; //导入依赖的package包/类
@Nullable
public static Pair<PsiFile,Editor> chooseBetweenHostAndInjected(@NotNull PsiFile hostFile, @NotNull Editor hostEditor, @NotNull PairProcessor<PsiFile, Editor> predicate) {
  Editor editorToApply = null;
  PsiFile fileToApply = null;

  int offset = hostEditor.getCaretModel().getOffset();
  PsiFile injectedFile = InjectedLanguageUtil.findInjectedPsiNoCommit(hostFile, offset);
  if (injectedFile != null) {
    Editor injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(hostEditor, injectedFile);
    if (predicate.process(injectedFile, injectedEditor)) {
      editorToApply = injectedEditor;
      fileToApply = injectedFile;
    }
  }

  if (editorToApply == null && predicate.process(hostFile, hostEditor)) {
    editorToApply = hostEditor;
    fileToApply = hostFile;
  }
  if (editorToApply == null) return null;
  return Pair.create(fileToApply, editorToApply);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ShowIntentionActionsHandler.java


注:本文中的com.intellij.util.PairProcessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。