com.intellij.ide.util.treeView.AbstractTreeUi Java Examples

The following examples show how to use com.intellij.ide.util.treeView.AbstractTreeUi. 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: HierarchyBrowserBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public final void actionPerformed(final AnActionEvent e) {
  final HierarchyTreeBuilder builder = getCurrentBuilder();
  final AbstractTreeUi treeUi = builder != null ? builder.getUi() : null;
  final ProgressIndicator progress = treeUi != null ? treeUi.getProgress() : null;
  if (progress != null) {
    progress.cancel();
  }
  myContent.getManager().removeContent(myContent, true);
}
 
Example #2
Source File: ScratchTreeStructureProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
static Collection<AbstractTreeNode> getDirectoryChildrenImpl(@Nonnull Project project, @Nullable PsiDirectory directory, @Nonnull ViewSettings settings, @Nonnull PsiFileSystemItemFilter filter) {
  final List<AbstractTreeNode> result = new ArrayList<>();
  PsiElementProcessor<PsiFileSystemItem> processor = new PsiElementProcessor<PsiFileSystemItem>() {
    @Override
    public boolean execute(@Nonnull PsiFileSystemItem element) {
      if (!filter.shouldShow(element)) {
        // skip
      }
      else if (element instanceof PsiDirectory) {
        result.add(new PsiDirectoryNode(project, (PsiDirectory)element, settings, filter) {
          @Override
          public Collection<AbstractTreeNode> getChildrenImpl() {
            //noinspection ConstantConditions
            return getDirectoryChildrenImpl(getProject(), getValue(), getSettings(), getFilter());
          }
        });
      }
      else if (element instanceof PsiFile) {
        result.add(new PsiFileNode(project, (PsiFile)element, settings) {
          @Override
          public Comparable<ExtensionSortKey> getTypeSortKey() {
            PsiFile value = getValue();
            Language language = value == null ? null : value.getLanguage();
            LanguageFileType fileType = language == null ? null : language.getAssociatedFileType();
            return fileType == null ? null : new ExtensionSortKey(fileType.getDefaultExtension());
          }
        });
      }
      return true;
    }
  };

  return AbstractTreeUi.calculateYieldingToWriteAction(() -> {
    if (directory == null || !directory.isValid()) return Collections.emptyList();
    directory.processChildren(processor);
    return result;
  });
}
 
Example #3
Source File: UnityScriptFileProjectViewProvider.java    From consulo-unity3d with Apache License 2.0 4 votes vote down vote up
@Override
@RequiredUIAccess
public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings)
{
	return AbstractTreeUi.calculateYieldingToWriteAction(() -> doModify(children, settings));
}
 
Example #4
Source File: Unity3dMetaFileProjectViewProvider.java    From consulo-unity3d with Apache License 2.0 4 votes vote down vote up
@Override
@RequiredUIAccess
public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings)
{
	return AbstractTreeUi.calculateYieldingToWriteAction(() -> doModify(children, settings));
}
 
Example #5
Source File: CSharpProjectViewProvider.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Override
@RequiredUIAccess
public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> oldNodes, ViewSettings settings)
{
	return AbstractTreeUi.calculateYieldingToWriteAction(() -> doModify(oldNodes, settings));
}
 
Example #6
Source File: PsiTreeElementBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public final StructureViewTreeElement[] getChildren() {
  List<StructureViewTreeElement> list = AbstractTreeUi.calculateYieldingToWriteAction(() -> doGetChildren(true));
  return list.isEmpty() ? EMPTY_ARRAY : list.toArray(EMPTY_ARRAY);
}
 
Example #7
Source File: PsiTreeElementBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public final List<StructureViewTreeElement> getChildrenWithoutCustomRegions() {
  return AbstractTreeUi.calculateYieldingToWriteAction(() -> doGetChildren(false));
}
 
Example #8
Source File: BaseProjectViewDirectoryHelper.java    From consulo with Apache License 2.0 4 votes vote down vote up
@RequiredReadAction
public static Collection<AbstractTreeNode> getDirectoryChildren(final PsiDirectory psiDirectory, final ViewSettings settings, final boolean withSubDirectories) {
  return AbstractTreeUi.calculateYieldingToWriteAction(() -> doGetDirectoryChildren(psiDirectory, settings, withSubDirectories));
}