Java Code Examples for com.intellij.ide.util.treeView.AbstractTreeUi#calculateYieldingToWriteAction()
The following examples show how to use
com.intellij.ide.util.treeView.AbstractTreeUi#calculateYieldingToWriteAction() .
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: ScratchTreeStructureProvider.java From consulo with Apache License 2.0 | 5 votes |
@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 2
Source File: UnityScriptFileProjectViewProvider.java From consulo-unity3d with Apache License 2.0 | 4 votes |
@Override @RequiredUIAccess public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings) { return AbstractTreeUi.calculateYieldingToWriteAction(() -> doModify(children, settings)); }
Example 3
Source File: Unity3dMetaFileProjectViewProvider.java From consulo-unity3d with Apache License 2.0 | 4 votes |
@Override @RequiredUIAccess public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings) { return AbstractTreeUi.calculateYieldingToWriteAction(() -> doModify(children, settings)); }
Example 4
Source File: CSharpProjectViewProvider.java From consulo-csharp with Apache License 2.0 | 4 votes |
@Override @RequiredUIAccess public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> oldNodes, ViewSettings settings) { return AbstractTreeUi.calculateYieldingToWriteAction(() -> doModify(oldNodes, settings)); }
Example 5
Source File: PsiTreeElementBase.java From consulo with Apache License 2.0 | 4 votes |
@Override @Nonnull public final StructureViewTreeElement[] getChildren() { List<StructureViewTreeElement> list = AbstractTreeUi.calculateYieldingToWriteAction(() -> doGetChildren(true)); return list.isEmpty() ? EMPTY_ARRAY : list.toArray(EMPTY_ARRAY); }
Example 6
Source File: PsiTreeElementBase.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public final List<StructureViewTreeElement> getChildrenWithoutCustomRegions() { return AbstractTreeUi.calculateYieldingToWriteAction(() -> doGetChildren(false)); }
Example 7
Source File: BaseProjectViewDirectoryHelper.java From consulo with Apache License 2.0 | 4 votes |
@RequiredReadAction public static Collection<AbstractTreeNode> getDirectoryChildren(final PsiDirectory psiDirectory, final ViewSettings settings, final boolean withSubDirectories) { return AbstractTreeUi.calculateYieldingToWriteAction(() -> doGetDirectoryChildren(psiDirectory, settings, withSubDirectories)); }