Java Code Examples for com.intellij.util.containers.ContainerUtil#collect()

The following examples show how to use com.intellij.util.containers.ContainerUtil#collect() . 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: ApplyNonConflicts.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
  DataContext dataContext = e.getDataContext();
  List<Change> notConflicts = ContainerUtil.collect(getNotConflicts(dataContext));
  for (Change change : notConflicts) {
    Change.apply(change, MergeList.BRANCH_SIDE);
  }
  if (myDiffPanel != null) {
    myDiffPanel.requestScrollEditors();
  }
}
 
Example 2
Source File: IJSwingUtilitiesTest.java    From consulo with Apache License 2.0 4 votes vote down vote up
private List<Component> getChildren() {
  return ContainerUtil.collect(IJSwingUtilities.getChildren(myPanel));
}
 
Example 3
Source File: DefaultHighlightVisitorBasedInspection.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void visitFile(final PsiFile file) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) {
    return;
  }

  final Project project = file.getProject();
  Document document = PsiDocumentManager.getInstance(project).getDocument(file);
  if (document == null) return;
  DaemonProgressIndicator progress = new DaemonProgressIndicator();
  progress.start();
  try {
    TextEditorHighlightingPassManager passRegistrarEx = TextEditorHighlightingPassManager.getInstance(project);
    List<TextEditorHighlightingPass> passes = passRegistrarEx.instantiateMainPasses(file, document, HighlightInfoProcessor.getEmpty());
    List<GeneralHighlightingPass> gpasses = ContainerUtil.collect(passes.iterator(), FilteringIterator.instanceOf(GeneralHighlightingPass.class));
    for (final GeneralHighlightingPass gpass : gpasses) {
      gpass.setHighlightVisitorProducer(() -> {
        gpass.incVisitorUsageCount(1);

        HighlightVisitor visitor = new DefaultHighlightVisitor(project, highlightErrorElements, runAnnotators, true,
                                                               ServiceManager.getService(project, CachedAnnotators.class));
        return new HighlightVisitor[]{visitor};
      });
    }


    for (TextEditorHighlightingPass pass : gpasses) {
      pass.doCollectInformation(progress);
      List<HighlightInfo> infos = pass.getInfos();
      for (HighlightInfo info : infos) {
        if (info == null) continue;
        //if (info.type == HighlightInfoType.INJECTED_LANGUAGE_FRAGMENT) continue;
        if (info.getSeverity().compareTo(HighlightSeverity.INFORMATION) <= 0) continue;
        result.add(Pair.create(file, info));
      }
    }
  }
  finally {
    progress.stop();
  }
}