com.intellij.util.containers.HashSet Java Examples
The following examples show how to use
com.intellij.util.containers.HashSet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalFileSystemImpl.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @Override public Set<WatchRequest> replaceWatchedRoots(@Nonnull Collection<WatchRequest> watchRequests, @Nullable Collection<String> recursiveRoots, @Nullable Collection<String> flatRoots) { recursiveRoots = ObjectUtil.notNull(recursiveRoots, Collections.emptyList()); flatRoots = ObjectUtil.notNull(flatRoots, Collections.emptyList()); Set<WatchRequest> result = new HashSet<>(); synchronized (myLock) { boolean update = doAddRootsToWatch(recursiveRoots, flatRoots, result) | doRemoveWatchedRoots(watchRequests); if (update) { myNormalizedTree = null; setUpFileWatcher(); } } return result; }
Example #2
Source File: SpecIndexer.java From intellij-swagger with MIT License | 6 votes |
private Set<String> getReferencedFilesJson(final PsiFile file, final VirtualFile specDirectory) { final Set<String> result = new HashSet<>(); file.accept( new JsonRecursiveElementVisitor() { @Override public void visitProperty(@NotNull JsonProperty property) { if (ApiConstants.REF_KEY.equals(property.getName()) && property.getValue() != null) { final String refValue = StringUtils.removeAllQuotes(property.getValue().getText()); if (SwaggerFilesUtils.isFileReference(refValue)) { getReferencedFileIndexValue(property.getValue(), refValue, specDirectory) .ifPresent(result::add); } } super.visitProperty(property); } }); return result; }
Example #3
Source File: MasterDetailsComponent.java From consulo with Apache License 2.0 | 6 votes |
protected void checkApply(Set<MyNode> rootNodes, String prefix, String title) throws ConfigurationException { for (MyNode rootNode : rootNodes) { final Set<String> names = new HashSet<String>(); for (int i = 0; i < rootNode.getChildCount(); i++) { final MyNode node = (MyNode)rootNode.getChildAt(i); final NamedConfigurable scopeConfigurable = node.getConfigurable(); final String name = scopeConfigurable.getDisplayName(); if (name.trim().length() == 0) { selectNodeInTree(node); throw new ConfigurationException("Name should contain non-space characters"); } if (names.contains(name)) { final NamedConfigurable selectedConfigurable = getSelectedConfigurable(); if (selectedConfigurable == null || !Comparing.strEqual(selectedConfigurable.getDisplayName(), name)) { selectNodeInTree(node); } throw new ConfigurationException(CommonBundle.message("smth.already.exist.error.message", prefix, name), title); } names.add(name); } } }
Example #4
Source File: SwaggerFileIndex.java From intellij-swagger with MIT License | 6 votes |
@Override public Set<String> read(@NotNull DataInput in) throws IOException { final int size = in.readInt(); if (size < 0) { // Something is very wrong (corrupt index); trigger an index rebuild. throw new IOException("Corrupt Index: Size " + size); } final Set<String> result = new HashSet<>(size); for (int i = 0; i < size; i++) { final String s = in.readUTF(); result.add(s); } return result; }
Example #5
Source File: ScopeTreeViewPanel.java From consulo with Apache License 2.0 | 6 votes |
@Nullable private Module[] getSelectedModules() { final TreePath[] treePaths = myTree.getSelectionPaths(); if (treePaths != null) { Set<Module> result = new HashSet<Module>(); for (TreePath path : treePaths) { PackageDependenciesNode node = (PackageDependenciesNode)path.getLastPathComponent(); if (node instanceof ModuleNode) { result.add(((ModuleNode)node).getModule()); } else if (node instanceof ModuleGroupNode) { final ModuleGroupNode groupNode = (ModuleGroupNode)node; final ModuleGroup moduleGroup = groupNode.getModuleGroup(); result.addAll(moduleGroup.modulesInGroup(myProject, true)); } } return result.isEmpty() ? null : result.toArray(new Module[result.size()]); } return null; }
Example #6
Source File: MyDeviceChooser.java From ADBWIFI with Apache License 2.0 | 6 votes |
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); } } }
Example #7
Source File: ConfigIndex.java From idea-php-shopware-plugin with MIT License | 6 votes |
@NotNull @Override public DataIndexer<String, Set<String>, FileContent> getIndexer() { return inputData -> { Map<String, Set<String>> map = new THashMap<>(); map.putIfAbsent("all", new java.util.HashSet<>()); FileType fileType = inputData.getFileType(); if (fileType == SmartyFileType.INSTANCE && inputData.getPsiFile() instanceof SmartyFile) { for (String name : ConfigUtil.getConfigsInFile((SmartyFile) inputData.getPsiFile())) { map.get("all").add(name); } } else { PsiFile psiFile = inputData.getPsiFile(); if(!Symfony2ProjectComponent.isEnabled(psiFile.getProject())) { return Collections.emptyMap(); } psiFile.accept(new MyPsiRecursiveElementWalkingVisitor(map)); } return map; }; }
Example #8
Source File: ModuleRootCompileScope.java From consulo with Apache License 2.0 | 6 votes |
public ModuleRootCompileScope(Project project, final Module[] modules, boolean includeDependentModules) { myProject = project; myScopeModules = new HashSet<Module>(); for (Module module : modules) { if (module == null) { continue; // prevent NPE } if (includeDependentModules) { buildScopeModulesSet(module); } else { myScopeModules.add(module); } } myModules = ModuleManager.getInstance(myProject).getModules(); }
Example #9
Source File: SimpleDuplicatesFinder.java From consulo with Apache License 2.0 | 6 votes |
public SimpleDuplicatesFinder(@Nonnull final PsiElement statement1, @Nonnull final PsiElement statement2, Collection<String> variables, AbstractVariableData[] variableData) { myOutputVariables = variables; myParameters = new HashSet<>(); for (AbstractVariableData data : variableData) { myParameters.add(data.getOriginalName()); } myPattern = new ArrayList<>(); PsiElement sibling = statement1; do { myPattern.add(sibling); if (sibling == statement2) break; sibling = PsiTreeUtil.skipSiblingsForward(sibling, PsiWhiteSpace.class, PsiComment.class); } while (sibling != null); }
Example #10
Source File: HaskellCompletionTestBase.java From intellij-haskforce with Apache License 2.0 | 6 votes |
protected void loadModuleSymbols(final Map<String, List<LookupElement>> m) { cacheLoaders.add(new Function<HaskellCompletionCacheLoader.Cache, Void>() { @Override public Void fun(HaskellCompletionCacheLoader.Cache cache) { Map<String, Set<LookupElementWrapper>> syms = cache.moduleSymbols(); for (Map.Entry<String, List<LookupElement>> kvp : m.entrySet()) { Set<LookupElementWrapper> v = syms.get(kvp.getKey()); if (v == null) { v = new HashSet<LookupElementWrapper>(kvp.getValue().size()); syms.put(kvp.getKey(), v); } for (LookupElement e : kvp.getValue()) { v.add(new LookupElementWrapper(e)); } } return null; } }); }
Example #11
Source File: SymlinkHandlingTest.java From consulo with Apache License 2.0 | 6 votes |
private void assertVisitedPaths(String... expected) { VirtualFile vDir = myFileSystem.findFileByIoFile(myTempDir); assertNotNull(vDir); Set<String> expectedSet = new HashSet<String>(expected.length + 1, 1); ContainerUtil.addAll(expectedSet, FileUtil.toSystemIndependentName(myTempDir.getPath())); ContainerUtil.addAll(expectedSet, ContainerUtil.map(expected, new Function<String, String>() { @Override public String fun(String path) { return FileUtil.toSystemIndependentName(path); } })); final Set<String> actualSet = new HashSet<String>(); VfsUtilCore.visitChildrenRecursively(vDir, new VirtualFileVisitor() { @Override public boolean visitFile(@Nonnull VirtualFile file) { actualSet.add(file.getPath()); return true; } }); assertEquals(expectedSet, actualSet); }
Example #12
Source File: ScopeChooserConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void checkApply(Set<MyNode> rootNodes, String prefix, String title) throws ConfigurationException { super.checkApply(rootNodes, prefix, title); final Set<String> predefinedScopes = new HashSet<String>(); for (CustomScopesProvider scopesProvider : myProject.getExtensions(CustomScopesProvider.CUSTOM_SCOPES_PROVIDER)) { for (NamedScope namedScope : scopesProvider.getCustomScopes()) { predefinedScopes.add(namedScope.getName()); } } for (MyNode rootNode : rootNodes) { for (int i = 0; i < rootNode.getChildCount(); i++) { final MyNode node = (MyNode)rootNode.getChildAt(i); final NamedConfigurable scopeConfigurable = node.getConfigurable(); final String name = scopeConfigurable.getDisplayName(); if (predefinedScopes.contains(name)) { selectNodeInTree(node); throw new ConfigurationException("Scope name equals to predefined one", ProjectBundle.message("rename.scope.title")); } } } }
Example #13
Source File: CompileContextImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void assignModule(@Nonnull VirtualFile root, @Nonnull Module module, final boolean isTestSource, @Nullable Compiler compiler) { try { myRootToModuleMap.put(root, module); Set<VirtualFile> set = myModuleToRootsMap.get(module); if (set == null) { set = new HashSet<VirtualFile>(); myModuleToRootsMap.put(module, set); } set.add(root); if (isTestSource) { myGeneratedTestRoots.add(root); } if (compiler instanceof SourceGeneratingCompiler) { myOutputRootToSourceGeneratorMap.put(root, new Pair<SourceGeneratingCompiler, Module>((SourceGeneratingCompiler)compiler, module)); } } finally { myModuleToRootsCache.remove(module); } }
Example #14
Source File: FileTreeModelBuilder.java From consulo with Apache License 2.0 | 6 votes |
@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()]); }
Example #15
Source File: GotoCustomRegionAction.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @RequiredReadAction private static Collection<FoldingDescriptor> getCustomFoldingDescriptors(@Nonnull Editor editor, @Nonnull Project project) { Set<FoldingDescriptor> foldingDescriptors = new HashSet<>(); final Document document = editor.getDocument(); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); PsiFile file = documentManager != null ? documentManager.getPsiFile(document) : null; if (file != null) { final FileViewProvider viewProvider = file.getViewProvider(); for (final Language language : viewProvider.getLanguages()) { final PsiFile psi = viewProvider.getPsi(language); final FoldingBuilder foldingBuilder = LanguageFolding.INSTANCE.forLanguage(language); if (psi != null) { for (FoldingDescriptor descriptor : LanguageFolding.buildFoldingDescriptors(foldingBuilder, psi, document, false)) { CustomFoldingBuilder customFoldingBuilder = getCustomFoldingBuilder(foldingBuilder, descriptor); if (customFoldingBuilder != null) { if (customFoldingBuilder.isCustomRegionStart(descriptor.getElement())) { foldingDescriptors.add(descriptor); } } } } } } return foldingDescriptors; }
Example #16
Source File: VisiblePackBuilder.java From consulo with Apache License 2.0 | 6 votes |
@Nullable private Set<Integer> getMatchingHeads(@Nonnull VcsLogRefs refs, @Nonnull Collection<VirtualFile> roots, @Nonnull 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, roots); if (filteredByBranch == null) return filteredByFile; if (filteredByFile == null) return filteredByBranch; return new HashSet<>(ContainerUtil.intersection(filteredByBranch, filteredByFile)); }
Example #17
Source File: ChangeList.java From consulo with Apache License 2.0 | 6 votes |
public void setChanges(@Nonnull 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>(); }
Example #18
Source File: GotoCustomRegionDialog.java From consulo with Apache License 2.0 | 6 votes |
@RequiredReadAction private Collection<FoldingDescriptor> getCustomFoldingDescriptors() { Set<FoldingDescriptor> foldingDescriptors = new HashSet<FoldingDescriptor>(); final Document document = myEditor.getDocument(); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject); PsiFile file = documentManager != null ? documentManager.getPsiFile(document) : null; if (file != null) { final FileViewProvider viewProvider = file.getViewProvider(); for (final Language language : viewProvider.getLanguages()) { final PsiFile psi = viewProvider.getPsi(language); final FoldingBuilder foldingBuilder = LanguageFolding.INSTANCE.forLanguage(language); if (psi != null) { for (FoldingDescriptor descriptor : LanguageFolding.buildFoldingDescriptors(foldingBuilder, psi, document, false)) { CustomFoldingBuilder customFoldingBuilder = getCustomFoldingBuilder(foldingBuilder, descriptor); if (customFoldingBuilder != null) { if (customFoldingBuilder.isCustomRegionStart(descriptor.getElement())) { foldingDescriptors.add(descriptor); } } } } } } return foldingDescriptors; }
Example #19
Source File: ApplicationStatisticsPersistenceComponent.java From consulo with Apache License 2.0 | 6 votes |
@Override public void loadState(final Element element) { List<Element> groups = element.getChildren(GROUP_TAG); for (Element groupElement : groups) { String groupName = groupElement.getAttributeValue(GROUP_NAME_ATTR); List<Element> projectsList = groupElement.getChildren(PROJECT_TAG); for (Element projectElement : projectsList) { String projectId = projectElement.getAttributeValue(PROJECT_ID_ATTR); String frameworks = projectElement.getAttributeValue(VALUES_ATTR); if (!StringUtil.isEmptyOrSpaces(projectId) && !StringUtil.isEmptyOrSpaces(frameworks)) { Set<UsageDescriptor> frameworkDescriptors = new HashSet<UsageDescriptor>(); for (String key : StringUtil.split(frameworks, TOKENIZER)) { final UsageDescriptor descriptor = getUsageDescriptor(key); if (descriptor != null) frameworkDescriptors.add(descriptor); } getApplicationData(groupName).put(projectId, frameworkDescriptors); } } } }
Example #20
Source File: BasicSentUsagesPersistenceComponent.java From consulo with Apache License 2.0 | 6 votes |
@Override public void persistPatch(@Nonnull Map<String, Set<PatchedUsage>> patchedDescriptorMap) { for (Map.Entry<String, Set<PatchedUsage>> entry : patchedDescriptorMap.entrySet()) { final String groupDescriptor = entry.getKey(); for (PatchedUsage patchedUsage : entry.getValue()) { UsageDescriptor usageDescriptor = StatisticsUploadAssistant.findDescriptor(mySentDescriptors, Pair.create(groupDescriptor, patchedUsage.getKey())); if (usageDescriptor != null) { usageDescriptor.setValue(usageDescriptor.getValue() + patchedUsage.getDelta()); } else { if (!mySentDescriptors.containsKey(groupDescriptor)) { mySentDescriptors.put(groupDescriptor, new HashSet<>()); } mySentDescriptors.get(groupDescriptor).add(new UsageDescriptor(patchedUsage.getKey(), patchedUsage.getValue())); } } } setSentTime(System.currentTimeMillis()); }
Example #21
Source File: CloseAllUnpinnedEditorsAction.java From consulo with Apache License 2.0 | 6 votes |
@Override protected boolean isActionEnabled(final Project project, final AnActionEvent event) { final List<Pair<EditorComposite, EditorWindow>> filesToClose = getFilesToClose(event); if (filesToClose.isEmpty()) return false; Set<EditorWindow> checked = new HashSet<>(); for (Pair<EditorComposite, EditorWindow> pair : filesToClose) { final EditorWindow window = pair.second; if (!checked.contains(window)) { checked.add(window); if (hasPinned(window)) { return true; } } } return false; }
Example #22
Source File: AbstractRunConfigurationTypeUsagesCollector.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @Override public final Set<UsageDescriptor> getProjectUsages(@Nonnull final Project project) { final Set<String> runConfigurationTypes = new HashSet<String>(); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { if (project.isDisposed()) return; final RunManager runManager = RunManager.getInstance(project); for (RunConfiguration runConfiguration : runManager.getAllConfigurationsList()) { if (runConfiguration != null && isApplicable(runManager, runConfiguration)) { final ConfigurationFactory configurationFactory = runConfiguration.getFactory(); final ConfigurationType configurationType = configurationFactory.getType(); final StringBuilder keyBuilder = new StringBuilder(); keyBuilder.append(configurationType.getId()); if (configurationType.getConfigurationFactories().length > 1) { keyBuilder.append(".").append(configurationFactory.getName()); } runConfigurationTypes.add(keyBuilder.toString()); } } } }); return ContainerUtil.map2Set(runConfigurationTypes, runConfigurationType -> new UsageDescriptor(runConfigurationType, 1)); }
Example #23
Source File: LibraryRootsComponent.java From consulo with Apache License 2.0 | 6 votes |
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 (OrderRootType type : OrderRootType.getAllTypes()) { VirtualFile[] files = getLibraryEditor().getFiles(type); for (VirtualFile file : files) { if (!VfsUtilCore.isUnder(file, excludedRoots)) { roots.add(PathUtil.getLocalFile(file)); } } } return roots; }
Example #24
Source File: MyDeviceChooser.java From ADB-Duang with MIT License | 6 votes |
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); } } }
Example #25
Source File: ContentRevisionCache.java From consulo with Apache License 2.0 | 6 votes |
public void clearCurrent(Set<String> paths) { final HashSet<String> converted = new HashSet<>(); for (String path : paths) { converted.add(FilePathsHelper.convertPath(path)); } synchronized (myLock) { final Set<CurrentKey> toRemove = new HashSet<>(); myCurrentRevisionsCache.iterateKeys(new Consumer<CurrentKey>() { @Override public void consume(CurrentKey currentKey) { if (converted.contains(FilePathsHelper.convertPath(currentKey.getPath().getPath()))) { toRemove.add(currentKey); } } }); for (CurrentKey key : toRemove) { myCurrentRevisionsCache.remove(key); } } }
Example #26
Source File: DefaultInspectionToolPresentation.java From consulo with Apache License 2.0 | 6 votes |
@Override @Nonnull public FileStatus getProblemStatus(@Nonnull final CommonProblemDescriptor descriptor) { final GlobalInspectionContextImpl context = getContext(); if (!isDisposed() && context.getUIOptions().SHOW_DIFF_WITH_PREVIOUS_RUN){ if (myOldProblemElements != null){ final Set<CommonProblemDescriptor> allAvailable = new HashSet<CommonProblemDescriptor>(); for (CommonProblemDescriptor[] descriptors : myOldProblemElements.values()) { if (descriptors != null) { ContainerUtil.addAll(allAvailable, descriptors); } } final boolean old = containsDescriptor(descriptor, allAvailable); final boolean current = containsDescriptor(descriptor, getProblemToElements().keySet()); return calcStatus(old, current); } } return FileStatus.NOT_CHANGED; }
Example #27
Source File: DefaultInspectionToolPresentation.java From consulo with Apache License 2.0 | 6 votes |
@Override public Map<String, Set<RefEntity>> getOldContent() { if (myOldProblemElements == null) return null; final com.intellij.util.containers.HashMap<String, Set<RefEntity>> oldContents = new com.intellij.util.containers.HashMap<String, Set<RefEntity>>(); final Set<RefEntity> elements = myOldProblemElements.keySet(); for (RefEntity element : elements) { String groupName = element instanceof RefElement ? element.getRefManager().getGroupName((RefElement)element) : element.getName(); final Set<RefEntity> collection = myContents.get(groupName); if (collection != null) { final Set<RefEntity> currentElements = new HashSet<RefEntity>(collection); if (RefUtil.contains(element, currentElements)) continue; } Set<RefEntity> oldContent = oldContents.get(groupName); if (oldContent == null) { oldContent = new HashSet<RefEntity>(); oldContents.put(groupName, oldContent); } oldContent.add(element); } return oldContents; }
Example #28
Source File: DefaultInspectionToolPresentation.java From consulo with Apache License 2.0 | 6 votes |
@Override public void updateContent() { myContents = new com.intellij.util.containers.HashMap<String, Set<RefEntity>>(); myModulesProblems = new HashSet<RefModule>(); final Set<RefEntity> elements = getProblemElements().keySet(); for (RefEntity element : elements) { if (getContext().getUIOptions().FILTER_RESOLVED_ITEMS && getIgnoredElements().containsKey(element)) continue; if (element instanceof RefModule) { myModulesProblems.add((RefModule)element); } else { String groupName = element instanceof RefElement ? element.getRefManager().getGroupName((RefElement)element) : null; Set<RefEntity> content = myContents.get(groupName); if (content == null) { content = new HashSet<RefEntity>(); myContents.put(groupName, content); } content.add(element); } } }
Example #29
Source File: ModuleDependencyTabContext.java From consulo with Apache License 2.0 | 6 votes |
private List<Module> getNotAddedModules() { final ModifiableRootModel rootModel = myClasspathPanel.getRootModel(); Set<Module> addedModules = new HashSet<Module>(Arrays.asList(rootModel.getModuleDependencies(true))); addedModules.add(rootModel.getModule()); final Module[] modules = myClasspathPanel.getModuleConfigurationState().getModulesProvider().getModules(); final List<Module> elements = new ArrayList<Module>(); for (final Module module : modules) { if (!addedModules.contains(module)) { elements.add(module); } } ContainerUtil.sort(elements, new Comparator<Module>() { @Override public int compare(Module o1, Module o2) { return StringUtil.compare(o1.getName(), o2.getName(), false); } }); return elements; }
Example #30
Source File: OfflineInspectionRVContentProvider.java From consulo with Apache License 2.0 | 6 votes |
private static void excludeProblem(final String externalName, final Map<String, Set<OfflineProblemDescriptor>> content) { for (Iterator<String> iter = content.keySet().iterator(); iter.hasNext();) { final String packageName = iter.next(); final Set<OfflineProblemDescriptor> excluded = new HashSet<OfflineProblemDescriptor>(content.get(packageName)); for (Iterator<OfflineProblemDescriptor> it = excluded.iterator(); it.hasNext();) { final OfflineProblemDescriptor ex = it.next(); if (Comparing.strEqual(ex.getFQName(), externalName)) { it.remove(); } } if (excluded.isEmpty()) { iter.remove(); } else { content.put(packageName, excluded); } } }