Java Code Examples for com.intellij.util.SmartList

The following examples show how to use com.intellij.util.SmartList. These examples are extracted from open source projects. 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 Project: consulo   Source File: LibraryPresentationManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public List<String> getDescriptions(@Nonnull VirtualFile[] classRoots, final Set<LibraryKind> excludedKinds) {
  final SmartList<String> result = new SmartList<>();
  LibraryDetectionManager.getInstance().processProperties(Arrays.asList(classRoots), new LibraryDetectionManager.LibraryPropertiesProcessor() {
    @Override
    public <P extends LibraryProperties> boolean processProperties(@Nonnull LibraryKind kind, @Nonnull P properties) {
      if (!excludedKinds.contains(kind)) {
        final LibraryPresentationProvider<P> provider = getPresentationProvider(kind);
        if (provider != null) {
          ContainerUtil.addIfNotNull(result, provider.getDescription(properties));
        }
      }
      return true;
    }
  });
  return result;
}
 
Example 2
Source Project: IntelliJDeodorant   Source File: ExtractMethodPanel.java    License: MIT License 6 votes vote down vote up
/**
 * Collects statements that can be extracted into a separate method.
 */
public SmartList<PsiStatement> getStatementsToExtract(ASTSlice slice) {
    Set<PDGNode> nodes = slice.getSliceNodes();
    SmartList<PsiStatement> statementsToExtract = new SmartList<>();

    for (PDGNode pdgNode : nodes) {
        boolean isNotChild = true;
        for (PDGNode node : nodes) {
            if (isChild(node.getASTStatement(), pdgNode.getASTStatement())) {
                isNotChild = false;
            }
        }
        if (isNotChild) {
            statementsToExtract.add(pdgNode.getASTStatement());
        }
    }
    return statementsToExtract;
}
 
Example 3
Source Project: consulo   Source File: InjectedLanguageManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@Nullable
public List<Pair<PsiElement, TextRange>> getInjectedPsiFiles(@Nonnull final PsiElement host) {
  if (!(host instanceof PsiLanguageInjectionHost) || !((PsiLanguageInjectionHost)host).isValidHost()) {
    return null;
  }
  final PsiElement inTree = InjectedLanguageUtil.loadTree(host, host.getContainingFile());
  final List<Pair<PsiElement, TextRange>> result = new SmartList<>();
  enumerate(inTree, (injectedPsi, places) -> {
    for (PsiLanguageInjectionHost.Shred place : places) {
      if (place.getHost() == inTree) {
        result.add(new Pair<>(injectedPsi, place.getRangeInsideHost()));
      }
    }
  });
  return result.isEmpty() ? null : result;
}
 
Example 4
Source Project: consulo   Source File: RunContentManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@Nonnull
public List<RunContentDescriptor> getAllDescriptors() {
  if (myToolwindowIdToContentManagerMap.isEmpty()) {
    return Collections.emptyList();
  }

  List<RunContentDescriptor> descriptors = new SmartList<>();
  for (String id : myToolwindowIdToContentManagerMap.keySet()) {
    for (Content content : myToolwindowIdToContentManagerMap.get(id).getContents()) {
      RunContentDescriptor descriptor = getRunContentDescriptorByContent(content);
      if (descriptor != null) {
        descriptors.add(descriptor);
      }
    }
  }
  return descriptors;
}
 
Example 5
@RequiredReadAction
@Nullable
@Override
public CSharpElementGroup<CSharpIndexMethodDeclaration> indexMethodGroup(boolean deep)
{
	List<CSharpElementGroup<CSharpIndexMethodDeclaration>> groups = new SmartList<CSharpElementGroup<CSharpIndexMethodDeclaration>>();
	for(CSharpResolveContext context : myContexts)
	{
		CSharpElementGroup<CSharpIndexMethodDeclaration> elementGroup = context.indexMethodGroup(deep);
		if(elementGroup != null)
		{
			groups.add(elementGroup);
		}
	}
	return groups.isEmpty() ? null : new CSharpCompositeElementGroupImpl<CSharpIndexMethodDeclaration>(myProject, groups);
}
 
Example 6
@RequiredReadAction
@Nullable
@Override
public CSharpElementGroup<CSharpConstructorDeclaration> constructorGroup()
{
	List<CSharpElementGroup<CSharpConstructorDeclaration>> groups = new SmartList<CSharpElementGroup<CSharpConstructorDeclaration>>();
	for(CSharpResolveContext context : myContexts)
	{
		CSharpElementGroup<CSharpConstructorDeclaration> elementGroup = context.constructorGroup();
		if(elementGroup != null)
		{
			groups.add(elementGroup);
		}
	}
	return groups.isEmpty() ? null : new CSharpCompositeElementGroupImpl<CSharpConstructorDeclaration>(myProject, groups);
}
 
Example 7
Source Project: consulo   Source File: StubTreeBuilder.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Order is deterministic. First element matches {@link FileViewProvider#getStubBindingRoot()}
 */
@Nonnull
public static List<Pair<IStubFileElementType, PsiFile>> getStubbedRoots(@Nonnull FileViewProvider viewProvider) {
  final List<Trinity<Language, IStubFileElementType, PsiFile>> roots = new SmartList<>();
  final PsiFile stubBindingRoot = viewProvider.getStubBindingRoot();
  for (Language language : viewProvider.getLanguages()) {
    final PsiFile file = viewProvider.getPsi(language);
    if (file instanceof PsiFileImpl) {
      final IElementType type = ((PsiFileImpl)file).getElementTypeForStubBuilder();
      if (type != null) {
        roots.add(Trinity.create(language, (IStubFileElementType)type, file));
      }
    }
  }

  ContainerUtil.sort(roots, (o1, o2) -> {
    if (o1.third == stubBindingRoot) return o2.third == stubBindingRoot ? 0 : -1;
    else if (o2.third == stubBindingRoot) return 1;
    else return StringUtil.compare(o1.first.getID(), o2.first.getID(), false);
  });

  return ContainerUtil.map(roots, trinity -> Pair.create(trinity.second, trinity.third));
}
 
Example 8
@RequiredReadAction
@Nullable
@Override
public CSharpElementGroup<CSharpMethodDeclaration> findOperatorGroupByTokenType(@Nonnull IElementType type, boolean deep)
{
	List<CSharpElementGroup<CSharpMethodDeclaration>> groups = new SmartList<CSharpElementGroup<CSharpMethodDeclaration>>();
	for(CSharpResolveContext context : myContexts)
	{
		CSharpElementGroup<CSharpMethodDeclaration> elementGroup = context.findOperatorGroupByTokenType(type, deep);
		if(elementGroup != null)
		{
			groups.add(elementGroup);
		}
	}
	return groups.isEmpty() ? null : new CSharpCompositeElementGroupImpl<CSharpMethodDeclaration>(myProject, groups);
}
 
Example 9
@RequiredReadAction
@Nullable
@Override
public CSharpElementGroup<CSharpConversionMethodDeclaration> findConversionMethodGroup(@Nonnull CSharpCastType castType, boolean deep)
{
	List<CSharpElementGroup<CSharpConversionMethodDeclaration>> groups = new SmartList<CSharpElementGroup<CSharpConversionMethodDeclaration>>();
	for(CSharpResolveContext context : myContexts)
	{
		CSharpElementGroup<CSharpConversionMethodDeclaration> elementGroup = context.findConversionMethodGroup(castType, deep);
		if(elementGroup != null)
		{
			groups.add(elementGroup);
		}
	}
	return groups.isEmpty() ? null : new CSharpCompositeElementGroupImpl<CSharpConversionMethodDeclaration>(myProject, groups);
}
 
Example 10
Source Project: consulo-csharp   Source File: CSharpBaseResolveContext.java    License: Apache License 2.0 6 votes vote down vote up
@Nullable
private static CSharpElementGroup<CSharpMethodDeclaration> filterElementGroupToExtensionGroup(CSharpElementGroup<PsiElement> elementGroup)
{
	final List<CSharpMethodDeclaration> extensions = new SmartList<>();
	elementGroup.process(element ->
	{
		if(element instanceof CSharpMethodDeclaration && ((CSharpMethodDeclaration) element).isExtension())
		{
			extensions.add((CSharpMethodDeclaration) element);
		}
		return true;
	});
	if(extensions.isEmpty())
	{
		return null;
	}
	return new CSharpElementGroupImpl<>(elementGroup.getProject(), elementGroup.getKey(), extensions);
}
 
Example 11
Source Project: consulo   Source File: StateStorageManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
private Collection<VfsFileBasedStorage> getCachedFileStorages(@Nonnull Collection<String> fileSpecs) {
  if (fileSpecs.isEmpty()) {
    return Collections.emptyList();
  }

  List<VfsFileBasedStorage> result = null;
  for (String fileSpec : fileSpecs) {
    StateStorage storage = myStorages.get(fileSpec);
    if (storage instanceof VfsFileBasedStorage) {
      if (result == null) {
        result = new SmartList<>();
      }
      result.add((VfsFileBasedStorage)storage);
    }
  }
  return result == null ? Collections.<VfsFileBasedStorage>emptyList() : result;
}
 
Example 12
Source Project: consulo-csharp   Source File: CSharpVisibilityUtil.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@RequiredReadAction
private static List<DotNetTypeDeclaration> collectAllTypes(@Nonnull PsiElement place)
{
	List<DotNetTypeDeclaration> typeDeclarations = new SmartList<>();
	if(place instanceof CSharpTypeDeclaration)
	{
		typeDeclarations.add((DotNetTypeDeclaration) place);
	}
	PsiElement type = place;
	while((type = PsiTreeUtil.getContextOfType(type, DotNetTypeDeclaration.class)) != null)
	{
		typeDeclarations.add((DotNetTypeDeclaration) type);
	}
	return typeDeclarations;
}
 
Example 13
Source Project: consulo   Source File: PsiTreeUtil.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
public static <T extends PsiElement> List<T> getStubChildrenOfTypeAsList(@Nullable PsiElement element, @Nonnull Class<T> aClass) {
  if (element == null) return Collections.emptyList();
  StubElement<?> stub = element instanceof StubBasedPsiElement ? ((StubBasedPsiElement)element).getStub() : null;
  if (stub == null) {
    return getChildrenOfTypeAsList(element, aClass);
  }

  List<T> result = new SmartList<>();
  for (StubElement childStub : stub.getChildrenStubs()) {
    PsiElement child = childStub.getPsi();
    if (aClass.isInstance(child)) {
      result.add(aClass.cast(child));
    }
  }
  return result;
}
 
Example 14
Source Project: consulo   Source File: SemServiceImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
private List<SemElement> createSemElements(SemKey key, PsiElement psi) {
  List<SemElement> result = null;
  final Collection<NullableFunction<PsiElement, ? extends SemElement>> producers = myProducers.get(key);
  if (!producers.isEmpty()) {
    for (final NullableFunction<PsiElement, ? extends SemElement> producer : producers) {
      myCreatingSem.incrementAndGet();
      try {
        final SemElement element = producer.fun(psi);
        if (element != null) {
          if (result == null) result = new SmartList<>();
          result.add(element);
        }
      }
      finally {
        myCreatingSem.decrementAndGet();
      }
    }
  }
  return result == null ? Collections.emptyList() : Collections.unmodifiableList(result);
}
 
Example 15
Source Project: consulo   Source File: PermanentLinearGraphImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public List<GraphEdge> getAdjacentEdges(int nodeIndex, @Nonnull EdgeFilter filter) {
  List<GraphEdge> result = new SmartList<>();

  boolean hasUpSimpleEdge = nodeIndex != 0 && mySimpleNodes.get(nodeIndex - 1);
  if (hasUpSimpleEdge && filter.upNormal) result.add(new GraphEdge(nodeIndex - 1, nodeIndex, null, USUAL));

  for (int i = myNodeToEdgeIndex.get(nodeIndex); i < myNodeToEdgeIndex.get(nodeIndex + 1); i++) {
    int adjacentNode = myLongEdges.get(i);

    if (adjacentNode < 0 && filter.special) {
      result.add(GraphEdge.createEdgeWithTargetId(nodeIndex, adjacentNode, GraphEdgeType.NOT_LOAD_COMMIT));
    }
    if (adjacentNode < 0) continue;

    if (nodeIndex > adjacentNode && filter.upNormal) result.add(new GraphEdge(adjacentNode, nodeIndex, null, USUAL));
    if (nodeIndex < adjacentNode && filter.downNormal) result.add(new GraphEdge(nodeIndex, adjacentNode, null, USUAL));
  }

  if (mySimpleNodes.get(nodeIndex) && filter.downNormal) result.add(new GraphEdge(nodeIndex, nodeIndex + 1, null, USUAL));

  return result;
}
 
Example 16
Source Project: consulo   Source File: RunManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public final void setBeforeRunTasks(final RunConfiguration runConfiguration, @Nonnull List<BeforeRunTask> tasks, boolean addEnabledTemplateTasksIfAbsent) {
  List<BeforeRunTask> result = new SmartList<>(tasks);
  if (addEnabledTemplateTasksIfAbsent) {
    List<BeforeRunTask> templates = getTemplateBeforeRunTasks(runConfiguration);
    Set<Key<BeforeRunTask>> idsToSet = new THashSet<>();
    for (BeforeRunTask task : tasks) {
      idsToSet.add(task.getProviderId());
    }
    int i = 0;
    for (BeforeRunTask template : templates) {
      if (!idsToSet.contains(template.getProviderId())) {
        result.add(i, template);
        i++;
      }
    }
  }
  myConfigurationToBeforeTasksMap.put(runConfiguration, ContainerUtil.notNullize(result));
  fireBeforeRunTasksUpdated();
}
 
Example 17
Source Project: consulo   Source File: StaticPathReferenceProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@Nullable
public PathReference getPathReference(@Nonnull final String path, @Nonnull final PsiElement element) {
  final List<PsiReference> list = new SmartList<PsiReference>();
  createReferences(element, list, true);
  if (list.isEmpty()) return null;

  final PsiElement target = list.get(list.size() - 1).resolve();
  if (target == null) return null;

  return new PathReference(path, PathReference.ResolveFunction.NULL_RESOLVE_FUNCTION) {
    @Override
    public PsiElement resolve() {
      return target;
    }
  };

}
 
Example 18
Source Project: consulo   Source File: LossyEncodingInspection.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@Nullable
public ProblemDescriptor[] checkFile(@Nonnull PsiFile file, @Nonnull InspectionManager manager, boolean isOnTheFly) {
  if (InjectedLanguageManager.getInstance(file.getProject()).isInjectedFragment(file)) return null;
  if (!file.isPhysical()) return null;
  FileViewProvider viewProvider = file.getViewProvider();
  if (viewProvider.getBaseLanguage() != file.getLanguage()) return null;
  VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return null;
  if (!virtualFile.isInLocalFileSystem()) return null;
  CharSequence text = viewProvider.getContents();
  Charset charset = LoadTextUtil.extractCharsetFromFileContent(file.getProject(), virtualFile, text);

  // no sense in checking transparently decoded file: all characters there are already safely encoded
  if (charset instanceof Native2AsciiCharset) return null;

  List<ProblemDescriptor> descriptors = new SmartList<ProblemDescriptor>();
  boolean ok = checkFileLoadedInWrongEncoding(file, manager, isOnTheFly, virtualFile, charset, descriptors);
  if (ok) {
    checkIfCharactersWillBeLostAfterSave(file, manager, isOnTheFly, text, charset, descriptors);
  }

  return descriptors.toArray(new ProblemDescriptor[descriptors.size()]);
}
 
Example 19
Source Project: consulo   Source File: PathMappingValidator.java    License: Apache License 2.0 6 votes vote down vote up
public static String validatePathMappings(@Nonnull Project project, @Nonnull RemoteSdkAdditionalData data) {
  boolean found = false;
  final List<String> locations = new SmartList<>();
  for (PathMappingProvider mappingProvider : PathMappingProvider.getSuitableMappingProviders(data)) {
    found = found || !mappingProvider.getPathMappingSettings(project, data).isEmpty();
    locations.add(mappingProvider.getProviderPresentableName(data));
  }

  if (!found) {
    final StringBuilder builder = new StringBuilder();
    builder.append("No path mappings were found.");
    if (!locations.isEmpty()) {
      builder.append(" Please, configure them at ").append(StringUtil.join(locations, " or "));
    }
    return builder.toString();
  }
  return null;
}
 
Example 20
@Override
protected CachedValue<PsiReference[]> compute(final PsiElement element, Object p) {
  return CachedValuesManager.getManager(element.getProject()).createCachedValue(() -> {
    IssueNavigationConfiguration navigationConfiguration = IssueNavigationConfiguration.getInstance(element.getProject());
    if (navigationConfiguration == null) {
      return CachedValueProvider.Result.create(PsiReference.EMPTY_ARRAY, element);
    }

    List<PsiReference> refs = null;
    GlobalPathReferenceProvider provider = myReferenceProvider.get();
    CharSequence commentText = StringUtil.newBombedCharSequence(element.getText(), 500);
    for (IssueNavigationConfiguration.LinkMatch link : navigationConfiguration.findIssueLinks(commentText)) {
      if (refs == null) refs = new SmartList<>();
      if (provider == null) {
        provider = (GlobalPathReferenceProvider)PathReferenceManager.getInstance().getGlobalWebPathReferenceProvider();
        myReferenceProvider.lazySet(provider);
      }
      provider.createUrlReference(element, link.getTargetUrl(), link.getRange(), refs);
    }
    PsiReference[] references = refs != null ? refs.toArray(new PsiReference[refs.size()]) : PsiReference.EMPTY_ARRAY;
    return new CachedValueProvider.Result<>(references, element, navigationConfiguration);
  }, false);
}
 
Example 21
Source Project: consulo   Source File: LibraryImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public List<String> getInvalidRootUrls(@Nonnull OrderRootType type) {
  if (myDisposed) return Collections.emptyList();

  VirtualFilePointerContainer container = myRoots.get(type);
  final List<VirtualFilePointer> pointers = container == null ? Collections.emptyList() : container.getList();
  List<String> invalidPaths = null;
  for (VirtualFilePointer pointer : pointers) {
    if (!pointer.isValid()) {
      if (invalidPaths == null) {
        invalidPaths = new SmartList<>();
      }
      invalidPaths.add(pointer.getUrl());
    }
  }
  return ContainerUtil.notNullize(invalidPaths);
}
 
Example 22
Source Project: consulo   Source File: ExtensibleQueryFactory.java    License: Apache License 2.0 6 votes vote down vote up
protected ExtensibleQueryFactory(@NonNls final String epNamespace) {
  myPoint = new NotNullLazyValue<SimpleSmartExtensionPoint<QueryExecutor<Result, Parameters>>>() {
    @Override
    @Nonnull
    protected SimpleSmartExtensionPoint<QueryExecutor<Result, Parameters>> compute() {
      return new SimpleSmartExtensionPoint<QueryExecutor<Result, Parameters>>(new SmartList<QueryExecutor<Result, Parameters>>()){
        @Override
        @Nonnull
        protected ExtensionPoint<QueryExecutor<Result, Parameters>> getExtensionPoint() {
          String epName = ExtensibleQueryFactory.this.getClass().getName();
          int pos = epName.lastIndexOf('.');
          if (pos >= 0) {
            epName = epName.substring(pos+1);
          }
          epName = epNamespace + "." + StringUtil.decapitalize(epName);
          return Application.get().getExtensionPoint(ExtensionPointName.create(epName));
        }
      };
    }
  };
}
 
Example 23
Source Project: consulo   Source File: RunManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Template configuration is not included
 */
@Override
@Nonnull
public List<RunConfiguration> getConfigurationsList(@Nonnull ConfigurationType type) {
  List<RunConfiguration> result = null;
  for (RunnerAndConfigurationSettings settings : getSortedConfigurations()) {
    RunConfiguration configuration = settings.getConfiguration();
    if (type.getId().equals(configuration.getType().getId())) {
      if (result == null) {
        result = new SmartList<>();
      }
      result.add(configuration);
    }
  }
  return ContainerUtil.notNullize(result);
}
 
Example 24
Source Project: consulo   Source File: EditorFactoryImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public Editor[] getEditors(@Nonnull Document document, Project project) {
  List<Editor> list = null;
  for (Editor editor : myEditors) {
    if (editor.getDocument().equals(document) && (project == null || project.equals(editor.getProject()))) {
      if (list == null) list = new SmartList<>();
      list.add(editor);
    }
  }
  return list == null ? Editor.EMPTY_ARRAY : list.toArray(Editor.EMPTY_ARRAY);
}
 
Example 25
Source Project: consulo   Source File: PermanentLinearGraphBuilder.java    License: Apache License 2.0 5 votes vote down vote up
private void addUnderdoneEdge(int upNodeIndex, CommitId downCommitId) {
  List<Integer> upNodes = upAdjacentNodes.get(downCommitId);
  if (upNodes == null) {
    upNodes = new SmartList<>();
    upAdjacentNodes.put(downCommitId, upNodes);
  }
  upNodes.add(upNodeIndex);
}
 
Example 26
Source Project: consulo   Source File: RunManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
private List<BeforeRunTask> getHardcodedBeforeRunTasks(@Nonnull RunConfiguration settings) {
  List<BeforeRunTask> _tasks = new SmartList<>();
  for (BeforeRunTaskProvider<? extends BeforeRunTask> provider : BeforeRunTaskProvider.EP_NAME.getExtensionList(myProject)) {
    BeforeRunTask task = provider.createTask(settings);
    if (task != null && task.isEnabled()) {
      Key<? extends BeforeRunTask> providerID = provider.getId();
      settings.getFactory().configureBeforeRunTaskDefaults(providerID, task);
      if (task.isEnabled()) {
        _tasks.add(task);
      }
    }
  }
  return _tasks;
}
 
Example 27
Source Project: IntelliJDeodorant   Source File: TryStatementObject.java    License: MIT License 5 votes vote down vote up
public List<TryStatementObject> getTryStatements() {
    SmartList<TryStatementObject> tryStatements = new SmartList<>(super.getTryStatements());
    for (CatchClauseObject catchClause : catchClauses) {
        tryStatements.addAll(catchClause.getTryStatements());
    }
    if (finallyClause != null) {
        tryStatements.addAll(finallyClause.getTryStatements());
    }
    return tryStatements;
}
 
Example 28
Source Project: consulo   Source File: ObjectNode.java    License: Apache License 2.0 5 votes vote down vote up
void addChild(@Nonnull ObjectNode child) {
  List<ObjectNode> children = myChildren;
  if (children == null) {
    myChildren = new SmartList<>(child);
  }
  else {
    children.add(child);
  }
  child.myParent = this;
}
 
Example 29
public DartStaticFieldsGroup(@NotNull final DartVmServiceDebugProcess debugProcess,
                             @NotNull final String isolateId,
                             @NotNull final String className,
                             @NotNull final SmartList<FieldRef> fieldsRefs) {
  super("static");
  myDebugProcess = debugProcess;
  myIsolateId = isolateId;
  myClassName = className;
  myFieldRefs = fieldsRefs;
}
 
Example 30
private void updateNodesContaining(@Nonnull Collection<VirtualFile> filesToRefresh, @Nonnull DefaultMutableTreeNode rootNode) {
  if (!(rootNode.getUserObject() instanceof ProjectViewNode)) {
    return;
  }
  ProjectViewNode node = (ProjectViewNode) rootNode.getUserObject();
  Collection<VirtualFile> containingFiles = null;
  for (VirtualFile virtualFile : filesToRefresh) {
    if (!virtualFile.isValid()) {
      addSubtreeToUpdate(rootNode); // file must be deleted
      return;
    }
    if (node.contains(virtualFile)) {
      if (containingFiles == null) {
        containingFiles = new SmartList<VirtualFile>();
      }
      containingFiles.add(virtualFile);
    }
  }
  if (containingFiles != null) {
    updateNode(rootNode);
    Enumeration children = rootNode.children();
    while (children.hasMoreElements()) {
      DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement();
      updateNodesContaining(containingFiles, child);
    }
  }
}