Java 类com.intellij.util.containers.HashSet 实例源码

项目:manifold-ij    文件:ManShortNamesCache.java   
private void findClassFqns( @NotNull HashSet<String> dest, ManModule start, ManModule module )
{
  for( ITypeManifold tm: module.getTypeManifolds() )
  {
    if( tm.getProducerKind() == ITypeManifold.ProducerKind.Supplemental )
    {
      continue;
    }
    dest.addAll( tm.getAllTypeNames().stream().map( ClassUtil::extractClassName ).collect( Collectors.toList() ) );
  }
  for( Dependency d : module.getDependencies() )
  {
    if( module == start || d.isExported() )
    {
      findClassFqns( dest, start, (ManModule)d.getModule() );
    }
  }
}
项目:ADB-Duang    文件:MyDeviceChooser.java   
private void resetSelection(@NotNull String[] selectedSerials) {
  MyDeviceTableModel model = (MyDeviceTableModel)myDeviceTable.getModel();
  Set<String> selectedSerialsSet = new HashSet<String>();
  Collections.addAll(selectedSerialsSet, selectedSerials);
  IDevice[] myDevices = model.myDevices;
  ListSelectionModel selectionModel = myDeviceTable.getSelectionModel();
  boolean cleared = false;

  for (int i = 0, n = myDevices.length; i < n; i++) {
    String serialNumber = myDevices[i].getSerialNumber();
    if (selectedSerialsSet.contains(serialNumber)) {
      if (!cleared) {
        selectionModel.clearSelection();
        cleared = true;
      }
      selectionModel.addSelectionInterval(i, i);
    }
  }
}
项目:intellij-ce-playground    文件:AndroidCompileUtil.java   
private static void excludeAllBuildConfigsFromCompilation(AndroidFacet facet, VirtualFile sourceRoot) {
  final Module module = facet.getModule();
  final Project project = module.getProject();
  final Set<String> packages = new HashSet<String>();

  final Manifest manifest = facet.getManifest();
  final String aPackage = manifest != null ? manifest.getPackage().getStringValue() : null;

  if (aPackage != null) {
    packages.add(aPackage);
  }
  packages.addAll(AndroidUtils.getDepLibsPackages(module));

  for (String p : packages) {
    excludeFromCompilation(project, sourceRoot, p);
  }
}
项目:intellij-ce-playground    文件:ScopeTreeViewPanel.java   
@NotNull
private PsiElement[] getSelectedPsiElements() {
  final TreePath[] treePaths = myTree.getSelectionPaths();
  if (treePaths != null) {
    Set<PsiElement> result = new HashSet<PsiElement>();
    for (TreePath path : treePaths) {
      final Object component = path.getLastPathComponent();
      if (component instanceof PackageDependenciesNode) {
        PackageDependenciesNode node = (PackageDependenciesNode)component;
        final PsiElement psiElement = node.getPsiElement();
        if (psiElement != null && psiElement.isValid()) {
          result.add(psiElement);
        }
      }
    }
    return PsiUtilCore.toPsiElementArray(result);
  }
  return PsiElement.EMPTY_ARRAY;
}
项目:intellij-ce-playground    文件:JavaFunctionalExpressionSearcher.java   
@NotNull
private static Set<Module> getJava8Modules(Project project) {
  final boolean projectLevelIsHigh = PsiUtil.getLanguageLevel(project).isAtLeast(LanguageLevel.JDK_1_8);

  final Set<Module> highLevelModules = new HashSet<Module>();
  for (Module module : ModuleManager.getInstance(project).getModules()) {
    final LanguageLevelModuleExtension extension = ModuleRootManager.getInstance(module).getModuleExtension(LanguageLevelModuleExtension.class);
    if (extension != null) {
      final LanguageLevel level = extension.getLanguageLevel();
      if (level == null && projectLevelIsHigh || level != null && level.isAtLeast(LanguageLevel.JDK_1_8)) {
        highLevelModules.add(module);
      }
    }
  }
  return highLevelModules;
}
项目:intellij-ce-playground    文件:JavaFunctionalExpressionSearcher.java   
@NotNull
private static GlobalSearchScope convertToGlobalScope(Project project, SearchScope useScope) {
  final GlobalSearchScope scope;
  if (useScope instanceof GlobalSearchScope) {
    scope = (GlobalSearchScope)useScope;
  }
  else if (useScope instanceof LocalSearchScope) {
    final Set<VirtualFile> files = new HashSet<VirtualFile>();
    addAllNotNull(files, map(((LocalSearchScope)useScope).getScope(), new Function<PsiElement, VirtualFile>() {
      @Override
      public VirtualFile fun(PsiElement element) {
        return PsiUtilCore.getVirtualFile(element);
      }
    }));
    scope = GlobalSearchScope.filesScope(project, files);
  }
  else {
    scope = new EverythingGlobalScope(project);
  }
  return scope;
}
项目:intellij-ce-playground    文件:PsiClassImplUtil.java   
public static boolean isMethodEquivalentTo(@NotNull PsiMethod method1, PsiElement another) {
  if (method1 == another) return true;
  if (!(another instanceof PsiMethod)) return false;
  PsiMethod method2 = (PsiMethod)another;
  if (!another.isValid()) return false;
  if (!method1.getName().equals(method2.getName())) return false;
  PsiClass aClass1 = method1.getContainingClass();
  PsiClass aClass2 = method2.getContainingClass();
  PsiManager manager = method1.getManager();
  if (!(aClass1 != null && aClass2 != null && manager.areElementsEquivalent(aClass1, aClass2))) return false;

  PsiParameter[] parameters1 = method1.getParameterList().getParameters();
  PsiParameter[] parameters2 = method2.getParameterList().getParameters();
  if (parameters1.length != parameters2.length) return false;
  for (int i = 0; i < parameters1.length; i++) {
    PsiParameter parameter1 = parameters1[i];
    PsiParameter parameter2 = parameters2[i];
    PsiType type1 = parameter1.getType();
    PsiType type2 = parameter2.getType();
    if (!compareParamTypes(manager, type1, type2, new HashSet<String>())) return false;
  }
  return true;
}
项目:intellij-ce-playground    文件:CloudModuleWizardStep.java   
public CloudModuleWizardStep(CloudModuleBuilder moduleBuilder, Project project, Disposable parentDisposable) {
  myModuleBuilder = moduleBuilder;
  myProject = project;
  myParentDisposable = parentDisposable;

  myApplicationConfigurableTypes = new HashSet<ServerType<?>>();

  List<ServerType<?>> cloudTypes = new ArrayList<ServerType<?>>();
  for (CloudModuleBuilderContributionFactory contribution : CloudModuleBuilderContributionFactory.EP_NAME.getExtensions()) {
    cloudTypes.add(contribution.getCloudType());
  }

  myAccountSelectionPanel = new CloudAccountSelectionEditor(cloudTypes);
  myAccountPanelPlaceHolder.add(myAccountSelectionPanel.getMainPanel());

  myAccountSelectionPanel.setAccountSelectionListener(new Runnable() {

    @Override
    public void run() {
      onAccountSelectionChanged();
    }
  });
  onAccountSelectionChanged();
}
项目:intellij-ce-playground    文件:Combined.java   
final Equation<Key, Value> notNullParamEquation(int i, boolean stable) {
  final Key key = new Key(method, new In(i, In.NOT_NULL_MASK), stable);
  final Result<Key, Value> result;
  if (interpreter.dereferencedParams[i]) {
    result = new Final<Key, Value>(Value.NotNull);
  }
  else {
    Set<ParamKey> calls = interpreter.parameterFlow[i];
    if (calls == null || calls.isEmpty()) {
      result = new Final<Key, Value>(Value.Top);
    }
    else {
      Set<Key> keys = new HashSet<Key>();
      for (ParamKey pk: calls) {
        keys.add(new Key(pk.method, new In(pk.i, In.NOT_NULL_MASK), pk.stable));
      }
      result = new Pending<Key, Value>(new SingletonSet<Product<Key, Value>>(new Product<Key, Value>(Value.Top, keys)));
    }
  }
  return new Equation<Key, Value>(key, result);
}
项目:intellij-ce-playground    文件:Combined.java   
final Equation<Key, Value> nullableParamEquation(int i, boolean stable) {
  final Key key = new Key(method, new In(i, In.NULLABLE_MASK), stable);
  final Result<Key, Value> result;
  if (interpreter.dereferencedParams[i] || interpreter.notNullableParams[i] || returnValue instanceof NthParamValue && ((NthParamValue)returnValue).n == i) {
    result = new Final<Key, Value>(Value.Top);
  }
  else {
    Set<ParamKey> calls = interpreter.parameterFlow[i];
    if (calls == null || calls.isEmpty()) {
      result = new Final<Key, Value>(Value.Null);
    }
    else {
      Set<Product<Key, Value>> sum = new HashSet<Product<Key, Value>>();
      for (ParamKey pk: calls) {
        sum.add(new Product<Key, Value>(Value.Top, Collections.singleton(new Key(pk.method, new In(pk.i, In.NULLABLE_MASK), pk.stable))));
      }
      result = new Pending<Key, Value>(sum);
    }
  }
  return new Equation<Key, Value>(key, result);
}
项目:intellij-ce-playground    文件:Combined.java   
final Equation<Key, Value> contractEquation(int i, Value inValue, boolean stable) {
  final Key key = new Key(method, new InOut(i, inValue), stable);
  final Result<Key, Value> result;
  HashSet<Key> keys = new HashSet<Key>();
  for (int argI = 0; argI < conditionValue.args.size(); argI++) {
    BasicValue arg = conditionValue.args.get(argI);
    if (arg instanceof NthParamValue) {
      NthParamValue npv = (NthParamValue)arg;
      if (npv.n == i) {
        keys.add(new Key(conditionValue.method, new InOut(argI, inValue), conditionValue.stableCall, true));
      }
    }
  }
  if (keys.isEmpty()) {
    result = new Final<Key, Value>(Value.Top);
  } else {
    result = new Pending<Key, Value>(new SingletonSet<Product<Key, Value>>(new Product<Key, Value>(Value.Top, keys)));
  }
  return new Equation<Key, Value>(key, result);
}
项目:intellij-ce-playground    文件:AndroidJpsUtil.java   
@NotNull
public static File[] getSourceRootsForModuleAndDependencies(@NotNull JpsModule rootModule) {
  final Set<File> result = new HashSet<File>();

  for (JpsModule module : getRuntimeModuleDeps(rootModule)) {
    final JpsAndroidModuleExtension extension = getExtension(module);
    File resDir = null;
    File resDirForCompilation = null;

    if (extension != null) {
      resDir = extension.getResourceDir();
      resDirForCompilation = extension.getResourceDirForCompilation();
    }

    for (JpsModuleSourceRoot root : module.getSourceRoots()) {
      final File rootDir = JpsPathUtil.urlToFile(root.getUrl());

      if ((JavaSourceRootType.SOURCE.equals(root.getRootType())
           || JavaSourceRootType.TEST_SOURCE.equals(root.getRootType()) && extension != null && extension.isPackTestCode())
          && !FileUtil.filesEqual(rootDir, resDir) && !rootDir.equals(resDirForCompilation)) {
        result.add(rootDir);
      }
    }
  }
  return result.toArray(new File[result.size()]);
}
项目:intellij-ce-playground    文件:AutomaticTestRenamerFactory.java   
private void appendTestClass(PsiClass aClass, String testSuffix, final GlobalSearchScope moduleScope) {
  PsiShortNamesCache cache = PsiShortNamesCache.getInstance(aClass.getProject());

  String klassName = aClass.getName();
  Pattern pattern = Pattern.compile(".*" + klassName + ".*" + testSuffix);

  HashSet<String> names = new HashSet<String>();
  cache.getAllClassNames(names);
  for (String eachName : names) {
    if (pattern.matcher(eachName).matches()) {
      for (PsiClass eachClass : cache.getClassesByName(eachName, moduleScope)) {
        if (TestFrameworks.getInstance().isTestClass(eachClass)) {
          myElements.add(eachClass);
        }
      }
    }
  }
}
项目:intellij-ce-playground    文件:FileTreeModelBuilder.java   
@Nullable
public static PackageDependenciesNode[] findNodeForPsiElement(PackageDependenciesNode parent, PsiElement element){
  final Set<PackageDependenciesNode> result = new HashSet<PackageDependenciesNode>();
  for (int i = 0; i < parent.getChildCount(); i++){
    final TreeNode treeNode = parent.getChildAt(i);
    if (treeNode instanceof PackageDependenciesNode){
      final PackageDependenciesNode node = (PackageDependenciesNode)treeNode;
      if (element instanceof PsiDirectory && node.getPsiElement() == element){
        return new PackageDependenciesNode[] {node};
      }
      if (element instanceof PsiFile) {
        PsiFile psiFile = null;
        if (node instanceof BasePsiNode) {
          psiFile = ((BasePsiNode)node).getContainingFile();
        }
        else if (node instanceof FileNode) { //non java files
          psiFile = ((PsiFile)node.getPsiElement());
        }
        if (psiFile != null && Comparing.equal(psiFile.getVirtualFile(), ((PsiFile)element).getVirtualFile())) {
          result.add(node);
        }
      }
    }
  }
  return result.isEmpty() ? null : result.toArray(new PackageDependenciesNode[result.size()]);
}
项目:intellij-ce-playground    文件:HgTestChangeListManager.java   
/**
 * Updates the change list manager and checks that the given files are in the default change list.
 * @param only Set this to true if you want ONLY the specified files to be in the change list.
 *             If set to false, the change list may contain some other files apart from the given ones.
 * @param files Files to be checked.
 */
public void checkFilesAreInList(boolean only, VirtualFile... files) {
  ensureUpToDate();

  final Collection<Change> changes = peer.getDefaultChangeList().getChanges();
  if (only) {
    Assert.assertEquals(changes.size(), files.length);
  }
  final Collection<VirtualFile> filesInChangeList = new HashSet<VirtualFile>();
  for (Change c : changes) {
    filesInChangeList.add(c.getVirtualFile());
  }
  for (VirtualFile f : files) {
    Assert.assertTrue(filesInChangeList.contains(f));
  }
}
项目:intellij-ce-playground    文件:RefactoringHierarchyUtil.java   
public static PsiClass[] findImplementingClasses(PsiClass anInterface) {
  Set<PsiClass> result = new HashSet<PsiClass>();
  _findImplementingClasses(anInterface, new HashSet<PsiClass>(), result);
  boolean classesRemoved = true;
  while(classesRemoved) {
    classesRemoved = false;
    loop1:
    for (Iterator<PsiClass> iterator = result.iterator(); iterator.hasNext();) {
      final PsiClass psiClass = iterator.next();
      for (final PsiClass aClass : result) {
        if (psiClass.isInheritor(aClass, true)) {
          iterator.remove();
          classesRemoved = true;
          break loop1;
        }
      }
    }
  }
  return result.toArray(new PsiClass[result.size()]);
}
项目:intellij-ce-playground    文件:DissociateResourceBundleAction.java   
public static void dissociate(final Collection<ResourceBundle> resourceBundles, final Project project) {
  final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
  final Set<PsiFileSystemItem> toUpdateInProjectView = new HashSet<PsiFileSystemItem>();
  for (ResourceBundle resourceBundle : resourceBundles) {
    fileEditorManager.closeFile(new ResourceBundleAsVirtualFile(resourceBundle));
    for (final PropertiesFile propertiesFile : resourceBundle.getPropertiesFiles()) {
      fileEditorManager.closeFile(propertiesFile.getVirtualFile());
      PsiDirectory containingDirectory = propertiesFile.getContainingFile().getContainingDirectory();
      if (containingDirectory != null) {
        toUpdateInProjectView.add(containingDirectory);
      }
    }
    ResourceBundleManager.getInstance(project).dissociateResourceBundle(resourceBundle);
  }
  AbstractProjectViewPane currentProjectViewPane = ProjectView.getInstance(project).getCurrentProjectViewPane();
  if (currentProjectViewPane == null) {
    return;
  }
  AbstractTreeBuilder treeBuilder = currentProjectViewPane.getTreeBuilder();
  if (treeBuilder != null) {
    for (PsiFileSystemItem item : toUpdateInProjectView) {
      treeBuilder.queueUpdateFrom(item, false);
    }
  }
}
项目:intellij-ce-playground    文件:AndroidUnknownAttributeInspection.java   
static boolean isMyFile(@NotNull AndroidFacet facet, XmlFile file) {
  String resourceType = facet.getLocalResourceManager().getFileResourceType(file);
  if (resourceType != null) {
    if (ourSupportedResourceTypes == null) {
      ourSupportedResourceTypes = new HashSet<String>();
      for (DomFileDescription description : DomFileDescription.EP_NAME.getExtensions()) {
        if (description instanceof AndroidResourceDomFileDescription) {
          String[] resourceTypes = ((AndroidResourceDomFileDescription)description).getResourceTypes();
          Collections.addAll(ourSupportedResourceTypes, resourceTypes);
        }
      }
    }
    if (!ourSupportedResourceTypes.contains(resourceType)) {
      return false;
    }
    if (ResourceType.XML.getName().equals(resourceType)) {
      final XmlTag rootTag = file.getRootTag();
      return rootTag != null && AndroidXmlResourcesUtil.isSupportedRootTag(facet, rootTag.getName());
    }
    return true;
  }
  return ManifestDomFileDescription.isManifestFile(file, facet);
}
项目:intellij-ce-playground    文件:GradleProjectDependencyParser.java   
@NotNull
private static Set<String> parse(VirtualFile moduleRoot, Project project) {
  VirtualFile buildGradle = moduleRoot.findChild(SdkConstants.FN_BUILD_GRADLE);
  if (buildGradle == null) {
    return Collections.emptySet();
  }
  else {
    Set<String> result = new HashSet<String>();
    GradleBuildFile buildFile = new GradleBuildFile(buildGradle, project);
    for (Dependency dependency : Iterables.filter(buildFile.getDependencies(), Dependency.class)) {
      if (dependency.type == Dependency.Type.MODULE) {
        String moduleName = dependency.getValueAsString();
        result.add(moduleName);
      }
    }
    return result;
  }
}
项目:intellij-ce-playground    文件:LibraryRootsComponent.java   
private Set<VirtualFile> getNotExcludedRoots() {
  Set<VirtualFile> roots = new LinkedHashSet<VirtualFile>();
  String[] excludedRootUrls = getLibraryEditor().getExcludedRootUrls();
  Set<VirtualFile> excludedRoots = new HashSet<VirtualFile>();
  for (String url : excludedRootUrls) {
    ContainerUtil.addIfNotNull(excludedRoots, VirtualFileManager.getInstance().findFileByUrl(url));
  }
  for (PersistentOrderRootType type : OrderRootType.getAllPersistentTypes()) {
    VirtualFile[] files = getLibraryEditor().getFiles(type);
    for (VirtualFile file : files) {
      if (!VfsUtilCore.isUnder(file, excludedRoots)) {
        roots.add(PathUtil.getLocalFile(file));
      }
    }
  }
  return roots;
}
项目:intellij-ce-playground    文件:ControlFlowUtils.java   
public static Set<GrExpression> getAllReturnValues(@NotNull final GrControlFlowOwner block) {
  return CachedValuesManager.getCachedValue(block, new CachedValueProvider<Set<GrExpression>>() {
    @Override
    public Result<Set<GrExpression>> compute() {
      final Set<GrExpression> result = new HashSet<GrExpression>();
      visitAllExitPoints(block, new ExitPointVisitor() {
        @Override
        public boolean visitExitPoint(Instruction instruction, @Nullable GrExpression returnValue) {
          ContainerUtil.addIfNotNull(result, returnValue);
          return true;
        }
      });
      return Result.create(result, block);
    }
  });
}
项目:intellij-ce-playground    文件:DeclareStyleableNameConverter.java   
@NotNull
@Override
public Object[] getVariants() {
  final PsiClass viewClass = JavaPsiFacade.getInstance(myElement.getProject())
    .findClass(AndroidUtils.VIEW_CLASS_NAME, myFacet.getModule().getModuleWithDependenciesAndLibrariesScope(false));
  if (viewClass == null) {
    return EMPTY_ARRAY;
  }
  final Set<Object> shortNames = new HashSet<Object>();

  ClassInheritorsSearch.search(viewClass, myFacet.getModule().getModuleWithDependenciesScope(), true).
    forEach(new Processor<PsiClass>() {
      @Override
      public boolean process(PsiClass aClass) {
        final String name = aClass.getName();

        if (name != null) {
          shortNames.add(JavaLookupElementBuilder.forClass(aClass, name, true));
        }
        return true;
      }
    });
  return shortNames.toArray();
}
项目:intellij-ce-playground    文件:AndroidJpsUtil.java   
@NotNull
public static Set<String> getProvidedLibraries(@NotNull BuildDataPaths paths,
                                               @NotNull JpsModule module) {
  final Set<String> result = new HashSet<String>();
  processClasspath(paths, module, new AndroidDependencyProcessor() {
    @Override
    public void processProvidedLibrary(@NotNull File file) {
      result.add(file.getPath());
    }

    @Override
    public boolean isToProcess(@NotNull AndroidDependencyType type) {
      return type == AndroidDependencyType.PROVIDED_LIBRARY;
    }
  }, false, false);
  return result;
}
项目:intellij-ce-playground    文件:VisiblePackBuilder.java   
@Nullable
private Set<Integer> getMatchingHeads(@NotNull VcsLogRefs refs, @NotNull Set<VirtualFile> roots, @NotNull VcsLogFilterCollection filters) {
  VcsLogBranchFilter branchFilter = filters.getBranchFilter();
  VcsLogRootFilter rootFilter = filters.getRootFilter();
  VcsLogStructureFilter structureFilter = filters.getStructureFilter();

  if (branchFilter == null && rootFilter == null && structureFilter == null) return null;

  Set<Integer> filteredByBranch = null;

  if (branchFilter != null) {
    filteredByBranch = getMatchingHeads(refs, branchFilter);
  }

  Set<Integer> filteredByFile = getMatchingHeads(refs, VcsLogUtil
    .getAllVisibleRoots(roots, rootFilter, structureFilter));

  if (filteredByBranch == null) return filteredByFile;
  if (filteredByFile == null) return filteredByBranch;

  return new HashSet<Integer>(ContainerUtil.intersection(filteredByBranch, filteredByFile));
}
项目:intellij-ce-playground    文件:LocalVarAnalyzer.java   
public static Result searchForVarsToWrap(GroovyPsiElement root, Result analyzedVars, ExpressionContext context) {
  LocalVarAnalyzer visitor = new LocalVarAnalyzer();
  root.accept(visitor);

  Map<PsiVariable, String> varToName = analyzedVars == null ? new HashMap<PsiVariable, String>() : analyzedVars.varToName;
  Set<PsiVariable> toWrap = analyzedVars == null ? new HashSet<PsiVariable>() : analyzedVars.toWrap;
  Set<PsiVariable> toMakeFinal = analyzedVars == null ? new HashSet<PsiVariable>() : analyzedVars.toMakeFinal;
  for (PsiVariable v : visitor.touched) {
    if (visitor.rewritten.contains(v)) {
      toWrap.add(v);
      if (v instanceof PsiParameter) {
        varToName.put(v, GenerationUtil.suggestVarName(v.getType(), root, context));
      }
      else {
        varToName.put(v, v.getName());
      }
    }
    else {
      toMakeFinal.add(v);
      varToName.put(v, v.getName());
    }
  }
  return analyzedVars == null ? new Result(toMakeFinal, toWrap, varToName) : analyzedVars;
}
项目:intellij-ce-playground    文件:ChangeList.java   
public void setChanges(@NotNull ArrayList<Change> changes) {
  if (myChanges != null) {
    HashSet<Change> newChanges = new HashSet<Change>(changes);
    LOG.assertTrue(newChanges.size() == changes.size());
    for (Iterator<Change> iterator = myChanges.iterator(); iterator.hasNext();) {
      Change oldChange = iterator.next();
      if (!newChanges.contains(oldChange)) {
        iterator.remove();
        oldChange.onRemovedFromList();
      }
    }
  }
  for (Change change : changes) {
    LOG.assertTrue(change.isValid());
  }
  myChanges = new ArrayList<Change>(changes);
  myAppliedChanges = new ArrayList<Change>();
}
项目:intellij-ce-playground    文件:SymlinkHandlingTest.java   
private void assertVisitedPaths(File from, String... expected) {
  VirtualFile vDir = refreshAndFind(from);
  assertNotNull(vDir);

  Set<String> expectedSet = ContainerUtil.map2Set(expected, new Function<String, String>() {
    @Override
    public String fun(String path) {
      return FileUtil.toSystemIndependentName(path);
    }
  });
  expectedSet.add(vDir.getPath());

  final Set<String> actualSet = new HashSet<String>();
  VfsUtilCore.visitChildrenRecursively(vDir, new VirtualFileVisitor() {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      actualSet.add(file.getPath());
      return true;
    }
  });

  assertEquals(expectedSet, actualSet);
}
项目:hybris-integration-intellij-idea-plugin    文件:TSMetaClassImpl.java   
/**
 * Iteratively applies given consumer for this class and all its super-classes.
 * Every super is visited only once, so this method takes care of inheritance cycles and rhombs
 */
private void walkInheritance(
    @NotNull final Consumer<TSMetaClassImpl> visitor
) {
    final Set<String> visited = new HashSet<>();
    visited.add(getName());
    visitor.accept(this);
    doWalkInheritance(visited, visitor);
}
项目:manifold-ij    文件:ManShortNamesCache.java   
@NotNull
@Override
public PsiClass[] getClassesByName( @NotNull @NonNls String name, @NotNull GlobalSearchScope scope )
{
  Set<PsiClass> psiClasses = new HashSet<>();
  for( ManModule module: ManTypeFinder.findModules( scope ) )
  {
    findPsiClasses( name, scope, psiClasses, module );
  }
  return psiClasses.toArray( new PsiClass[psiClasses.size()] );
}
项目:manifold-ij    文件:ManShortNamesCache.java   
@NotNull
@Override
public String[] getAllClassNames()
{
  HashSet<String> names = new HashSet<>();
  getAllClassNames( names );
  return names.toArray( new String[names.size()] );
}
项目:manifold-ij    文件:ManShortNamesCache.java   
@Override
public void getAllClassNames( @NotNull HashSet<String> dest )
{
  final ManProject manProject = ManProject.manProjectFrom( _psiManager.getProject() );
  for( ManModule module: manProject.findRootModules() )
  {
    findClassFqns( dest, module );
  }
}
项目:intellij-ce-playground    文件:ResourceManager.java   
@NotNull
protected Set<VirtualFile> getAllValueResourceFiles() {
  final Set<VirtualFile> files = new HashSet<VirtualFile>();

  for (VirtualFile valueResourceDir : getResourceSubdirs("values")) {
    for (VirtualFile valueResourceFile : valueResourceDir.getChildren()) {
      if (!valueResourceFile.isDirectory() && valueResourceFile.getFileType().equals(StdFileTypes.XML)) {
        files.add(valueResourceFile);
      }
    }
  }
  return files;
}
项目:intellij-ce-playground    文件:OnClickConverter.java   
@NotNull
@Override
public Object[] getVariants() {
  final Module module = ModuleUtilCore.findModuleForPsiElement(myElement);

  if (module == null) {
    return ResolveResult.EMPTY_ARRAY;
  }
  final PsiClass activityClass = AndroidMissingOnClickHandlerInspection.findActivityClass(module);
  if (activityClass == null) {
    return EMPTY_ARRAY;
  }

  final List<Object> result = new ArrayList<Object>();
  final Set<String> methodNames = new HashSet<String>();

  ClassInheritorsSearch.search(activityClass, module.getModuleWithDependenciesScope(), true).forEach(new Processor<PsiClass>() {
    @Override
    public boolean process(PsiClass c) {
      for (PsiMethod method : c.getMethods()) {
        if (checkSignature(method) && methodNames.add(method.getName())) {
          result.add(createLookupElement(method));
        }
      }
      return true;
    }
  });
  return ArrayUtil.toObjectArray(result);
}
项目:intellij-ce-playground    文件:ScopeChooserConfigurable.java   
private void obtainCurrentScopes(final HashSet<String> scopes) {
  for (int i = 0; i < myRoot.getChildCount(); i++) {
    final MyNode node = (MyNode)myRoot.getChildAt(i);
    final NamedScope scope = (NamedScope)node.getConfigurable().getEditableObject();
    scopes.add(scope.getName());
  }
}
项目:intellij-ce-playground    文件:CaptureService.java   
private static Set<VirtualFile> findCaptureFiles(@NotNull VirtualFile[] files, @NotNull CaptureType type) {
  Set<VirtualFile> set = new HashSet<VirtualFile>();
  for (VirtualFile file : files) {
    if (type.isValidCapture(file)) {
      set.add(file);
    }
  }
  return set;
}
项目:intellij-ce-playground    文件:GithubShareAction.java   
@Nullable
private static GithubInfo loadGithubInfoWithModal(@NotNull final GithubAuthDataHolder authHolder, @NotNull final Project project) {
  try {
    return GithubUtil
      .computeValueInModal(project, "Access to GitHub", new ThrowableConvertor<ProgressIndicator, GithubInfo, IOException>() {
        @NotNull
        @Override
        public GithubInfo convert(ProgressIndicator indicator) throws IOException {
          // get existing github repos (network) and validate auth data
          return GithubUtil.runTask(project, authHolder, indicator, new ThrowableConvertor<GithubConnection, GithubInfo, IOException>() {
            @NotNull
            @Override
            public GithubInfo convert(@NotNull GithubConnection connection) throws IOException {
              // check access to private repos (network)
              GithubUserDetailed userInfo = GithubApiUtil.getCurrentUserDetailed(connection);

              HashSet<String> names = new HashSet<String>();
              for (GithubRepo info : GithubApiUtil.getUserRepos(connection)) {
                names.add(info.getName());
              }
              return new GithubInfo(userInfo, names);
            }
          });
        }
      });
  }
  catch (IOException e) {
    GithubNotifications.showErrorDialog(project, "Failed to Connect to GitHub", e);
    return null;
  }
}
项目:intellij-ce-playground    文件:SearchResults.java   
private void updateExcluded() {
  Set<RangeMarker> invalid = new HashSet<RangeMarker>();
  for (RangeMarker marker : myExcluded) {
    if (!marker.isValid()) {
      invalid.add(marker);
      marker.dispose();
    }
  }
  myExcluded.removeAll(invalid);
}
项目:intellij-ce-playground    文件:ScrubberCellRenderer.java   
public ScrubberCellRenderer() {
  myScrubberLabel = new ScrubberLabel();

  myOutstandingIconFetches = new HashSet<Integer>();
  myCachedImages = new HashMap<Integer, ImageIcon>();

  myRenderSettings = new RenderSettings();
  myRenderSettings.setMaxWidth(MAX_WIDTH);
  myRenderSettings.setMaxHeight(MAX_HEIGHT);
  myRenderSettings.setWireframe(false);

  myBlankIcon = new ImageIcon(createBlankImage(DEFAULT_IMAGE_SIZE));
}
项目:intellij-ce-playground    文件:GenericsHighlightUtil.java   
static HighlightInfo checkInterfaceMultipleInheritance(PsiClass aClass) {
  final PsiClassType[] types = aClass.getSuperTypes();
  if (types.length < 2) return null;
  Map<PsiClass, PsiSubstitutor> inheritedClasses = new HashMap<PsiClass, PsiSubstitutor>();
  final TextRange textRange = HighlightNamesUtil.getClassDeclarationTextRange(aClass);
  return checkInterfaceMultipleInheritance(aClass,
                                           aClass,
                                           PsiSubstitutor.EMPTY, inheritedClasses,
                                           new HashSet<PsiClass>(), textRange);
}
项目:intellij-ce-playground    文件:BrShortNamesCache.java   
@Override
public void getAllClassNames(@NotNull HashSet<String> dest) {
  if (!myComponent.hasAnyDataBindingEnabledFacet()) {
    return;
  }
  dest.add(DataBindingUtil.BR);
}