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


Java ContainerUtil.process方法代码示例

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


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

示例1: processSameNamedClasses

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static boolean processSameNamedClasses(Processor<PsiClass> consumer, List<PsiClass> sameNamedClasses, final VirtualFile jarFile) {
  // if there is a class from the same jar, prefer it
  boolean sameJarClassFound = false;

  if (jarFile != null && sameNamedClasses.size() > 1) {
    for (PsiClass sameNamedClass : sameNamedClasses) {
      ProgressManager.checkCanceled();
      boolean fromSameJar = Comparing.equal(getJarFile(sameNamedClass), jarFile);
      if (fromSameJar) {
        sameJarClassFound = true;
        if (!consumer.process(sameNamedClass)) return false;
      }
    }
  }

  return sameJarClassFound || ContainerUtil.process(sameNamedClasses, consumer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaDirectInheritorsSearcher.java

示例2: processAbbreviations

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private boolean processAbbreviations(final String pattern, Processor<MatchedValue> consumer, DataContext context) {
  List<String> actions = AbbreviationManager.getInstance().findActions(pattern);
  if (actions.isEmpty()) return true;
  List<ActionWrapper> wrappers = ContainerUtil.newArrayListWithCapacity(actions.size());
  for (String actionId : actions) {
    AnAction action = myActionManager.getAction(actionId);
    wrappers.add(new ActionWrapper(action, myModel.myActionGroups.get(action), MatchMode.NAME, context));
  }
  return ContainerUtil.process(ContainerUtil.map(wrappers, new Function<ActionWrapper, MatchedValue>() {
    @Override
    public MatchedValue fun(@NotNull ActionWrapper w) {
      return new MatchedValue(w, pattern) {
        @Nullable
        @Override
        public String getValueText() {
          return pattern;
        }
      };
    }
  }), consumer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GotoActionItemProvider.java

示例3: compare

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public int compare(@NotNull final VirtualFile file1, @NotNull final VirtualFile file2) {
  final int[] result = {0};
  ContainerUtil.process(myScopes, new Processor<GlobalSearchScope>() {
    @Override
    public boolean process(GlobalSearchScope scope) {
      int res1 = scope.contains(file1) && scope.contains(file2) ? scope.compare(file1, file2) : 0;
      if (result[0] == 0) {
        result[0] = res1;
        return true;
      }
      if ((result[0] > 0) != (res1 > 0)) {
        result[0] = 0;
        return false;
      }
      return true;
    }
  });
  return result[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GlobalSearchScope.java

示例4: visitMethods

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private boolean visitMethods(Processor<PyFunction> processor,
                            boolean inherited,
                            boolean skipClassObj, TypeEvalContext context) {
  PyFunction[] methods = getMethods(false);
  if (!ContainerUtil.process(methods, processor)) return false;
  if (inherited) {
    for (PyClass ancestor : getAncestorClasses(context)) {
      if (skipClassObj && PyNames.FAKE_OLD_BASE.equals(ancestor.getName())) {
        continue;
      }
      if (!ancestor.visitMethods(processor, false, null)) {
        return false;
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PyClassImpl.java

示例5: processItems

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static boolean processItems(final String pattern, Collection<? extends Comparable> items, Processor<MatchedValue> consumer) {
  List<MatchedValue> matched = ContainerUtil.map(items, new Function<Comparable, MatchedValue>() {
    @Override
    public MatchedValue fun(Comparable comparable) {
      return new MatchedValue(comparable, pattern);
    }
  });
  Collections.sort(matched);
  return ContainerUtil.process(matched, consumer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GotoActionItemProvider.java

示例6: processImplementations

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static boolean processImplementations(final PsiMethod psiMethod, final Processor<PsiElement> consumer,
                                             final SearchScope searchScope) {
  if (!FunctionalExpressionSearch.search(psiMethod, searchScope).forEach(new Processor<PsiFunctionalExpression>() {
    @Override
    public boolean process(PsiFunctionalExpression expression) {
      return consumer.process(expression);
    }
  })) {
    return false;
  }
  List<PsiMethod> methods = new ArrayList<PsiMethod>();
  getOverridingMethods(psiMethod, methods, searchScope);
  return ContainerUtil.process(methods, consumer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MethodImplementationsSearch.java

示例7: processDirectories

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private boolean processDirectories(@NotNull String qualifiedName,
                                   @NotNull final GlobalSearchScope scope,
                                   @NotNull final Processor<VirtualFile> processor) {
  return ContainerUtil.process(getCache(scope).getDirectoriesByPackageName(qualifiedName), new Processor<VirtualFile>() {
    @Override
    public boolean process(VirtualFile file) {
      return !scope.contains(file) || processor.process(file);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:NonClasspathClassFinder.java

示例8: process

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public boolean process(final T t) {
  final boolean merged = t instanceof MergedObject;
  if ((!merged || myProcessMerged) && !myProcessor.process(t)) {
    return false;
  }
  if (merged && !ContainerUtil.process(((MergedObject<T>)t).getImplementations(), this)) {
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ModelMergerUtil.java

示例9: visitNestedClasses

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public boolean visitNestedClasses(Processor<PyClass> processor, boolean inherited) {
  PyClass[] nestedClasses = getNestedClasses();
  if (!ContainerUtil.process(nestedClasses, processor)) return false;
  if (inherited) {
    for (PyClass ancestor : getAncestorClasses(null)) {
      if (!((PyClassImpl)ancestor).visitNestedClasses(processor, false)) {
        return false;
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PyClassImpl.java

示例10: execute

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public boolean execute(@NotNull final PySuperMethodsSearch.SearchParameters queryParameters, @NotNull final Processor<PsiElement> consumer) {
  PyFunction func = queryParameters.getDerivedMethod();
  PyClass containingClass = func.getContainingClass();
  if (containingClass != null) {
    for (PyClassLikeType type : containingClass.getSuperClassTypes(TypeEvalContext.codeInsightFallback(containingClass.getProject()))) {
      if (type instanceof PyJavaClassType) {
        final PsiClass psiClass = ((PyJavaClassType)type).getPsiClass();
        PsiMethod[] methods = psiClass.findMethodsByName(func.getName(), true);
        // the Python method actually does override/implement all of Java super methods with the same name
        if (!ContainerUtil.process(methods, consumer)) return false;
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PyJavaSuperMethodsSearchExecutor.java

示例11: updateAllRepositories

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void updateAllRepositories() {
  ContainerUtil.process(getRepositories(), new Processor<T>() {
    @Override
    public boolean process(T repo) {
      repo.update();
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AbstractRepositoryManager.java

示例12: filterNonValidShelvedChangeLists

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void filterNonValidShelvedChangeLists() {
  final List<ShelvedChangeList> allSchemes = ContainerUtil.newArrayList(mySchemeManager.getAllSchemes());
  ContainerUtil.process(allSchemes, new Processor<ShelvedChangeList>() {

    @Override
    public boolean process(ShelvedChangeList shelvedChangeList) {
      if (!shelvedChangeList.checkValid()) {
        mySchemeManager.removeScheme(shelvedChangeList);
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ShelveChangesManager.java

示例13: startMiddleMatchVariants

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static boolean startMiddleMatchVariants(@NotNull List<Object> qualifierMiddleMatched,
                                                @NotNull Processor<Object> consumer) {
  if (!consumer.process(ChooseByNameBase.NON_PREFIX_SEPARATOR)) return false;
  if (!ContainerUtil.process(qualifierMiddleMatched, consumer)) return false;
  qualifierMiddleMatched.clear();
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:DefaultChooseByNameItemProvider.java

示例14: createReferences

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public boolean createReferences(@NotNull final PsiElement psiElement,
                                int offset,
                                String text,
                                @NotNull List<PsiReference> references,
                                boolean soft) {
  FileReferenceSet set = new FileReferenceSet(text, psiElement, offset, null,
                                              true, true,
                                              new FileType[]{XmlFileType.INSTANCE}) {

    private final Condition<PsiFileSystemItem> PLUGIN_XML_CONDITION = new Condition<PsiFileSystemItem>() {
      @Override
      public boolean value(PsiFileSystemItem item) {
        return !item.isDirectory() &&
               !item.equals(getContainingFile()) &&
               (item instanceof XmlFile && DescriptorUtil.isPluginXml((PsiFile)item)) &&
               !isAlreadyUsed((XmlFile)item);
      }
    };

    private boolean isAlreadyUsed(final XmlFile xmlFile) {
      final PsiFile file = getContainingFile();
      if (!(file instanceof XmlFile)) return false;
      final DomFileElement<IdeaPlugin> ideaPlugin = DescriptorUtil.getIdeaPlugin((XmlFile)file);
      if (ideaPlugin == null) return false;
      return !ContainerUtil.process(ideaPlugin.getRootElement().getDependencies(), new Processor<Dependency>() {
        @Override
        public boolean process(Dependency dependency) {
          final GenericAttributeValue<PathReference> configFileAttribute = dependency.getConfigFile();
          if (!DomUtil.hasXml(configFileAttribute)) return true;
          final PathReference pathReference = configFileAttribute.getValue();
          if (pathReference == null) return true;
          return !xmlFile.equals(pathReference.resolve());
        }
      });
    }

    @NotNull
    @Override
    public Collection<PsiFileSystemItem> computeDefaultContexts() {
      final PsiFile containingFile = getContainingFile();
      if (containingFile == null) {
        return Collections.emptyList();
      }

      final Module module = ModuleUtilCore.findModuleForPsiElement(getElement());
      if (module == null) {
        return Collections.emptyList();
      }

      final Set<VirtualFile> roots = new HashSet<VirtualFile>();
      final VirtualFile parent = containingFile.getVirtualFile().getParent();
      roots.add(parent);

      for (VirtualFile sourceRoot : ModuleRootManager.getInstance(module).getSourceRoots(JavaModuleSourceRootTypes.PRODUCTION)) {
        roots.add(sourceRoot.findChild("META-INF"));
      }
      return toFileSystemItems(roots);
    }

    @Override
    protected boolean isSoft() {
      return true;
    }

    @Override
    protected Condition<PsiFileSystemItem> getReferenceCompletionFilter() {
      return PLUGIN_XML_CONDITION;
    }
  };
  Collections.addAll(references, set.getAllReferences());
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:74,代码来源:DependencyConfigFileConverter.java

示例15: processAllFieldNames

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public boolean processAllFieldNames(Processor<String> processor, GlobalSearchScope scope, IdFilter filter) {
  return ContainerUtil.process(getAllFieldNames(), processor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PsiShortNamesCache.java


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