Java Code Examples for com.intellij.util.containers.ContainerUtil#addAll()
The following examples show how to use
com.intellij.util.containers.ContainerUtil#addAll() .
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: MoveChangesToAnotherListAction.java From consulo with Apache License 2.0 | 6 votes |
public void actionPerformed(@Nonnull AnActionEvent e) { Project project = e.getRequiredData(CommonDataKeys.PROJECT); List<Change> changesList = ContainerUtil.newArrayList(); Change[] changes = e.getData(VcsDataKeys.CHANGES); if (changes != null) { ContainerUtil.addAll(changesList, changes); } List<VirtualFile> unversionedFiles = ContainerUtil.newArrayList(); final List<VirtualFile> changedFiles = ContainerUtil.newArrayList(); VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); if (files != null) { changesList.addAll(getChangesForSelectedFiles(project, files, unversionedFiles, changedFiles)); } if (changesList.isEmpty() && unversionedFiles.isEmpty()) { VcsBalloonProblemNotifier.showOverChangesView(project, "Nothing is selected that can be moved", MessageType.INFO); return; } if (!askAndMove(project, changesList, unversionedFiles)) return; if (!changedFiles.isEmpty()) { selectAndShowFile(project, changedFiles.get(0)); } }
Example 2
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 3
Source File: RTMergerTreeStructureProvider.java From react-templates-plugin with MIT License | 6 votes |
private static PsiElement[] collectFormPsiElements(Collection<AbstractTreeNode> selected) { Set<PsiElement> result = new HashSet<PsiElement>(); for (AbstractTreeNode node : selected) { if (node.getValue() instanceof RTFile) { RTFile form = (RTFile) node.getValue(); result.add(form.getRtjsFile()); if (form.getController() != null) { result.add(form.getController()); } ContainerUtil.addAll(result, form.getRtFile()); } else if (node.getValue() instanceof PsiElement) { result.add((PsiElement) node.getValue()); } } return PsiUtilCore.toPsiElementArray(result); }
Example 4
Source File: BashLightQuickfixParametrizedTest.java From BashSupport with Apache License 2.0 | 6 votes |
protected void enableInspectionTools(@NotNull Class<?>... classes) { final InspectionProfileEntry[] tools = new InspectionProfileEntry[classes.length]; final List<InspectionEP> eps = ContainerUtil.newArrayList(); ContainerUtil.addAll(eps, Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION)); ContainerUtil.addAll(eps, Extensions.getExtensions(InspectionEP.GLOBAL_INSPECTION)); next: for (int i = 0; i < classes.length; i++) { for (InspectionEP ep : eps) { if (classes[i].getName().equals(ep.implementationClass)) { tools[i] = ep.instantiateTool(); continue next; } } throw new IllegalArgumentException("Unable to find extension point for " + classes[i].getName()); } enableInspectionTools(tools); }
Example 5
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 6
Source File: CompileDriver.java From consulo with Apache License 2.0 | 6 votes |
private boolean validateOutputAndSourcePathsIntersection() { final Module[] allModules = ModuleManager.getInstance(myProject).getModules(); List<VirtualFile> allOutputs = new ArrayList<>(); ContainerUtil.addAll(allOutputs, CompilerPathsImpl.getOutputDirectories(allModules)); for (Artifact artifact : ArtifactManager.getInstance(myProject).getArtifacts()) { ContainerUtil.addIfNotNull(artifact.getOutputFile(), allOutputs); } final Set<VirtualFile> affectedOutputPaths = new HashSet<>(); CompilerUtil.computeIntersectingPaths(myProject, allOutputs, affectedOutputPaths); affectedOutputPaths.addAll(ArtifactCompilerUtil.getArtifactOutputsContainingSourceFiles(myProject)); if (!affectedOutputPaths.isEmpty()) { if (CompilerUtil.askUserToContinueWithNoClearing(myProject, affectedOutputPaths)) { myShouldClearOutputDirectory = false; return true; } else { return false; } } return true; }
Example 7
Source File: SearchUtil.java From consulo with Apache License 2.0 | 6 votes |
public static List<Configurable> expandGroup(final Configurable[] configurables) { List<Configurable> result = new ArrayList<Configurable>(); ContainerUtil.addAll(result, configurables); for (Configurable each : configurables) { addChildren(each, result); } result = ContainerUtil.filter(result, new Condition<Configurable>() { @Override public boolean value(Configurable configurable) { return !(configurable instanceof SearchableConfigurable.Parent) || ((SearchableConfigurable.Parent)configurable).isVisible(); } }); return result; }
Example 8
Source File: DiffManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public DiffTool getDiffTool() { DiffTool[] standardTools; // there is inner check in multiple tool for external viewers as well if (!ENABLE_FILES.value(myProperties) || !ENABLE_FOLDERS.value(myProperties) || !ENABLE_MERGE.value(myProperties)) { DiffTool[] embeddableTools = { INTERNAL_DIFF, new MergeTool(), BinaryDiffTool.INSTANCE }; standardTools = new DiffTool[]{ ExtCompareFolders.INSTANCE, ExtCompareFiles.INSTANCE, ExtMergeFiles.INSTANCE, new MultiLevelDiffTool(Arrays.asList(embeddableTools)), INTERNAL_DIFF, new MergeTool(), BinaryDiffTool.INSTANCE }; } else { standardTools = new DiffTool[]{ ExtCompareFolders.INSTANCE, ExtCompareFiles.INSTANCE, ExtMergeFiles.INSTANCE, INTERNAL_DIFF, new MergeTool(), BinaryDiffTool.INSTANCE }; } if (myAdditionTools.isEmpty()) { return new CompositeDiffTool(standardTools); } else { List<DiffTool> allTools = new ArrayList<DiffTool>(myAdditionTools); ContainerUtil.addAll(allTools, standardTools); return new CompositeDiffTool(allTools); } }
Example 9
Source File: ShelvedChangesViewManager.java From consulo with Apache License 2.0 | 5 votes |
private List<ShelvedChangeList> getLists(final DataContext dataContext) { final ShelvedChangeList[] shelved = dataContext.getData(SHELVED_CHANGELIST_KEY); final ShelvedChangeList[] recycled = dataContext.getData(SHELVED_RECYCLED_CHANGELIST_KEY); final List<ShelvedChangeList> shelvedChangeLists = (shelved == null && recycled == null) ? Collections.<ShelvedChangeList>emptyList() : new ArrayList<ShelvedChangeList>(); if (shelved != null) { ContainerUtil.addAll(shelvedChangeLists, shelved); } if (recycled != null) { ContainerUtil.addAll(shelvedChangeLists, recycled); } return shelvedChangeLists; }
Example 10
Source File: DetailsComponent.java From consulo with Apache License 2.0 | 5 votes |
public void update() { ArrayList<String> strings = new ArrayList<String>(); if (myPrefix != null) { ContainerUtil.addAll(strings, myPrefix); } if (myText != null) { ContainerUtil.addAll(strings, myText); } myBannerText = ArrayUtil.toStringArray(strings); updateBanner(); }
Example 11
Source File: SetEditorSettingsAction.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public AnAction[] getChildren(@Nullable AnActionEvent e) { List<AnAction> result = new ArrayList<>(); ContainerUtil.addAll(result, myActions); result.add(AnSeparator.getInstance()); result.add(ActionManager.getInstance().getAction(IdeActions.GROUP_DIFF_EDITOR_GUTTER_POPUP)); return ContainerUtil.toArray(result, new AnAction[result.size()]); }
Example 12
Source File: TranslationStubIndexTest.java From idea-php-symfony2-plugin with MIT License | 5 votes |
@NotNull private Set<String> getDomainKeys(@NotNull String domain) { Set<String> uniqueKeySet = new ArrayListSet<String>(); for(Set<String> splits: FileBasedIndex.getInstance().getValues(TranslationStubIndex.KEY, domain, GlobalSearchScope.allScope(getProject()))) { ContainerUtil.addAll(uniqueKeySet, splits); } return uniqueKeySet; }
Example 13
Source File: SelectedBlockHistoryTest.java From consulo with Apache License 2.0 | 5 votes |
private static String[] composeVersion(String[] beforeBlock, String[] block, String[] afterBlock) { List<String> beforeList = new ArrayList<>(); ContainerUtil.addAll(beforeList, beforeBlock); ContainerUtil.addAll(beforeList, block); ContainerUtil.addAll(beforeList, afterBlock); return ArrayUtil.toStringArray(beforeList); }
Example 14
Source File: UsageViewImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private AnAction[] createGroupingActions() { final List<UsageGroupingRuleProvider> providers = UsageGroupingRuleProvider.EP_NAME.getExtensionList(); List<AnAction> list = new ArrayList<>(providers.size()); for (UsageGroupingRuleProvider provider : providers) { ContainerUtil.addAll(list, provider.createGroupingActions(this)); } ActionUtil.sortAlphabetically(list); ActionUtil.moveActionTo(list, "Module", "Flatten Modules", true); return list.toArray(AnAction.EMPTY_ARRAY); }
Example 15
Source File: KeymapImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public String[] getActionIds() { ArrayList<String> ids = new ArrayList<String>(); if (myParent != null) { String[] parentIds = getParentActionIds(); ContainerUtil.addAll(ids, parentIds); } String[] ownActionIds = getOwnActionIds(); for (String id : ownActionIds) { if (!ids.contains(id)) { ids.add(id); } } return ArrayUtil.toStringArray(ids); }
Example 16
Source File: TodoTreeHelper.java From consulo with Apache License 2.0 | 5 votes |
private static void addPackagesToChildren0(Project project, ArrayList<AbstractTreeNode> children, Module module, TodoTreeBuilder builder) { final List<VirtualFile> roots = new ArrayList<VirtualFile>(); final List<VirtualFile> sourceRoots = new ArrayList<VirtualFile>(); final PsiManager psiManager = PsiManager.getInstance(project); if (module == null) { final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(project); ContainerUtil.addAll(roots, projectRootManager.getContentRoots()); ContainerUtil.addAll(sourceRoots, projectRootManager.getContentSourceRoots()); } else { ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); ContainerUtil.addAll(roots, moduleRootManager.getContentRoots()); ContainerUtil.addAll(sourceRoots, moduleRootManager.getContentFolderFiles(ContentFolderScopes.productionAndTest())); } roots.removeAll(sourceRoots); for (VirtualFile dir : roots) { final PsiDirectory directory = psiManager.findDirectory(dir); if (directory == null) { continue; } final Iterator<PsiFile> files = builder.getFiles(directory); if (!files.hasNext()) continue; TodoDirNode dirNode = new TodoDirNode(project, directory, builder); if (!children.contains(dirNode)) { children.add(dirNode); } } }
Example 17
Source File: DiffViewerBase.java From consulo with Apache License 2.0 | 4 votes |
protected List<AnAction> createToolbarActions() { List<AnAction> group = new ArrayList<>(); ContainerUtil.addAll(group, ((ActionGroup)ActionManager.getInstance().getAction(IdeActions.DIFF_VIEWER_TOOLBAR)).getChildren(null)); return group; }
Example 18
Source File: TreePrintCondition.java From consulo with Apache License 2.0 | 4 votes |
public SetBased(String... elements) { ContainerUtil.addAll(mySet, elements); }
Example 19
Source File: LanguageCodeStyleSettingsProvider.java From consulo with Apache License 2.0 | 4 votes |
@Override public void showStandardOptions(String... optionNames) { ContainerUtil.addAll(myCollectedFields, optionNames); }
Example 20
Source File: CustomizationUtil.java From consulo with Apache License 2.0 | 4 votes |
static AnAction [] getReordableChildren(ActionGroup group, CustomActionsSchema schema, String defaultGroupName, AnActionEvent e) { String text = group.getTemplatePresentation().getText(); ActionManager actionManager = ActionManager.getInstance(); final ArrayList<AnAction> reorderedChildren = new ArrayList<AnAction>(); ContainerUtil.addAll(reorderedChildren, group.getChildren(e)); final List<ActionUrl> actions = schema.getActions(); for (ActionUrl actionUrl : actions) { if ((actionUrl.getParentGroup().equals(text) || actionUrl.getParentGroup().equals(defaultGroupName) || actionUrl.getParentGroup().equals(actionManager.getId(group)))) { AnAction componentAction = actionUrl.getComponentAction(); if (componentAction != null) { if (actionUrl.getActionType() == ActionUrl.ADDED) { if (componentAction == group) { LOG.error("Attempt to add group to itself; group ID=" + actionManager.getId(group)); continue; } if (reorderedChildren.size() > actionUrl.getAbsolutePosition()) { reorderedChildren.add(actionUrl.getAbsolutePosition(), componentAction); } else { reorderedChildren.add(componentAction); } } else if (actionUrl.getActionType() == ActionUrl.DELETED && reorderedChildren.size() > actionUrl.getAbsolutePosition()) { final AnAction anAction = reorderedChildren.get(actionUrl.getAbsolutePosition()); if (anAction.getTemplatePresentation().getText() == null ? (componentAction.getTemplatePresentation().getText() != null && componentAction.getTemplatePresentation().getText().length() > 0) : !anAction.getTemplatePresentation().getText().equals(componentAction.getTemplatePresentation().getText())) { continue; } reorderedChildren.remove(actionUrl.getAbsolutePosition()); } } } } for (int i = 0; i < reorderedChildren.size(); i++) { if (reorderedChildren.get(i) instanceof ActionGroup) { final ActionGroup groupToCorrect = (ActionGroup)reorderedChildren.get(i); final AnAction correctedAction = correctActionGroup(groupToCorrect, schema, ""); reorderedChildren.set(i, correctedAction); } } return reorderedChildren.toArray(new AnAction[reorderedChildren.size()]); }