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


Java PairProcessor.process方法代码示例

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


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

示例1: 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

示例2: _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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: processTags

import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
private static void processTags(@NotNull Project project,
                                @Nullable String templateText,
                                @NotNull PairProcessor<XmlTag, Boolean> processor) {
  if (StringUtil.isNotEmpty(templateText)) {
    final PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(project);
    XmlFile xmlFile = (XmlFile)psiFileFactory.createFileFromText("dummy.xml", StdFileTypes.HTML, templateText);
    XmlTag tag = xmlFile.getRootTag();
    boolean firstTag = true;

    while (tag != null) {
      processor.process(tag, firstTag);
      firstTag = false;
      tag = PsiTreeUtil.getNextSiblingOfType(tag, XmlTag.class);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:EmmetUpdateTagAction.java

示例10: 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:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:SliceLeafAnalyzer.java

示例11: processParameters

import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public boolean processParameters(final PairProcessor<String, Object> processor) {
  for (Class aClass = getClass(); aClass != null; aClass = ReflectionCache.getSuperClass(aClass)) {
    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:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:PatternCondition.java

示例12: 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:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:QuerySearchRequest.java

示例13: treeWalkUp

import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public static boolean treeWalkUp(@Nonnull 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:consulo,项目名称:consulo,代码行数:18,代码来源:PsiTreeUtil.java

示例14: QuerySearchRequest

import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public QuerySearchRequest(Query<PsiReference> query,
                          final SearchRequestCollector collector,
                          boolean inReadAction, final PairProcessor<PsiReference, SearchRequestCollector> processor) {
  this.query = query;
  this.collector = collector;
  if (inReadAction) {
    this.processor = new ReadActionProcessor<PsiReference>() {
      @RequiredReadAction
      @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:consulo,项目名称:consulo,代码行数:24,代码来源:QuerySearchRequest.java

示例15: chooseBetweenHostAndInjected

import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
@Nullable
public static Pair<PsiFile, Editor> chooseBetweenHostAndInjected(@Nonnull PsiFile hostFile,
                                                                 @Nonnull Editor hostEditor,
                                                                 @Nonnull 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:consulo,项目名称:consulo,代码行数:25,代码来源:ShowIntentionActionsHandler.java


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