本文整理汇总了Java中com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode类的典型用法代码示例。如果您正苦于以下问题:Java PsiDirectoryNode类的具体用法?Java PsiDirectoryNode怎么用?Java PsiDirectoryNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PsiDirectoryNode类属于com.intellij.ide.projectView.impl.nodes包,在下文中一共展示了PsiDirectoryNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modifyExternalLibrariesNodes
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@NotNull
protected Collection<AbstractTreeNode> modifyExternalLibrariesNodes(
@NotNull final Collection<AbstractTreeNode> children
) {
Validate.notNull(children);
final Collection<AbstractTreeNode> treeNodes = new ArrayList<AbstractTreeNode>();
for (AbstractTreeNode child : children) {
if (child instanceof PsiDirectoryNode) {
final VirtualFile virtualFile = ((PsiDirectoryNode) child).getVirtualFile();
if (null == virtualFile) {
continue;
}
if (!HybrisConstants.CLASSES_DIRECTORY.equalsIgnoreCase(virtualFile.getName())) {
treeNodes.add(child);
}
} else {
treeNodes.add(child);
}
}
return treeNodes;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:HybrisProjectView.java
示例2: createChildDirectoryNode
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@Override
public PsiDirectoryNode createChildDirectoryNode(StudyItem item, PsiDirectory directory) {
final List<Lesson> lessons = myCourse.getLessons();
final Lesson lesson = (Lesson)item;
if (directory.getChildren().length > 0 && lessons.size() == 1) {
final List<Task> tasks = lesson.getTaskList();
if (tasks.size() == 1) {
PsiDirectory taskDirectory = (PsiDirectory)directory.getChildren()[0];
PsiDirectory srcDir = taskDirectory.findSubdirectory(EduNames.SRC);
if (srcDir != null) {
taskDirectory = srcDir;
}
return new TaskDirectoryNode(myProject, taskDirectory, myViewSettings, tasks.get(0));
}
}
return new LessonDirectoryNode(myProject, directory, myViewSettings, lesson);
}
示例3: compare
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@Override
public int compare(NodeDescriptor nodeDescriptor1, NodeDescriptor nodeDescriptor2) {
int weight1 = getWeight(nodeDescriptor1);
int weight2 = getWeight(nodeDescriptor2);
if (weight1 != weight2) {
return weight1 - weight2;
}
if (!(nodeDescriptor1.getParentDescriptor() instanceof ProjectViewProjectNode)){
if (nodeDescriptor1 instanceof PsiDirectoryNode || nodeDescriptor1 instanceof PsiFileNode){
return nodeDescriptor1.toString().compareToIgnoreCase(nodeDescriptor2.toString());
}
if (nodeDescriptor1 instanceof ClassTreeNode && nodeDescriptor2 instanceof ClassTreeNode){
if (((ClassTreeNode)nodeDescriptor1).isTopLevel()){
return nodeDescriptor1.toString().compareToIgnoreCase(nodeDescriptor2.toString());
}
}
}
int index1 = nodeDescriptor1.getIndex();
int index2 = nodeDescriptor2.getIndex();
if (index1 == index2) return 0;
return index1 < index2 ? -1 : +1;
}
示例4: modify
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull final AbstractTreeNode parent, @NotNull final Collection<AbstractTreeNode> children, final ViewSettings settings) {
if (parent instanceof PsiDirectoryNode) {
final VirtualFile vFile = ((PsiDirectoryNode)parent).getVirtualFile();
if (vFile != null && Comparing.equal(ProjectFileIndex.SERVICE.getInstance(myProject).getContentRootForFile(vFile), vFile)) {
final Collection<AbstractTreeNode> moduleChildren = ((PsiDirectoryNode) parent).getChildren();
Collection<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
for (AbstractTreeNode moduleChild : moduleChildren) {
if (moduleChild instanceof PsiDirectoryNode) {
final PsiDirectory value = ((PsiDirectoryNode)moduleChild).getValue();
if (value.getName().equals(Project.DIRECTORY_STORE_FOLDER) && Registry.is("projectView.hide.dot.idea")) {
continue;
}
}
result.add(moduleChild);
}
return result;
}
}
return children;
}
示例5: isMatchingElement
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@Override
protected boolean isMatchingElement(Object element, String pattern) {
Object userObject = ((DefaultMutableTreeNode)((TreePath)element).getLastPathComponent()).getUserObject();
if (userObject instanceof PsiDirectoryNode) {
String str = getElementText(element);
if (str == null) return false;
str = str.toLowerCase();
if (pattern.indexOf('.') >= 0) {
return compare(str, pattern);
}
StringTokenizer tokenizer = new StringTokenizer(str, ".");
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (compare(token, pattern)) {
return true;
}
}
return false;
}
else {
return super.isMatchingElement(element, pattern);
}
}
示例6: modify
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
if (!ApplicationManager.getApplication().isInternal()) {
return children;
}
if (parent instanceof PsiDirectoryNode) {
PsiDirectory directory = ((PsiDirectoryNode)parent).getValue();
if (!directory.getName().equals("res")) {
return children;
}
Module module = ModuleUtil.findModuleForPsiElement(directory);
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null) {
return children;
}
return mergeResourceDirectories(children, settings);
}
return children;
}
示例7: decorate
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof PsiDirectoryNode)) {
return;
}
final PsiDirectoryNode psiDirectoryNode = (PsiDirectoryNode)node;
PsiDirectory psiDirectory = psiDirectoryNode.getValue();
Project project = psiDirectory.getProject();
if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
return;
}
VirtualFile folder = psiDirectory.getVirtualFile();
Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(folder);
if (module != null && ModuleUtilCore.isModuleDir(module, folder)) {
data.setIcon(GradleUtil.getModuleIcon(module));
}
}
示例8: annotateWithSourceProvider
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
private Collection<AbstractTreeNode> annotateWithSourceProvider(Collection<AbstractTreeNode> directoryChildren) {
List<AbstractTreeNode> children = Lists.newArrayListWithExpectedSize(directoryChildren.size());
for (AbstractTreeNode child : directoryChildren) {
if (child instanceof PsiDirectoryNode) {
PsiDirectory directory = ((PsiDirectoryNode)child).getValue();
children.add(new AndroidPsiDirectoryNode(myProject, directory, getSettings(), findSourceProvider(directory.getVirtualFile())));
} else if (child instanceof PsiFileNode) {
PsiFile file = ((PsiFileNode)child).getValue();
children.add(new AndroidPsiFileNode(myProject, file, getSettings(), findSourceProvider(file.getVirtualFile())));
} else {
children.add(child);
}
}
return children;
}
示例9: isMatchingElement
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@Override
protected boolean isMatchingElement(Object element, String pattern) {
Object userObject = ((DefaultMutableTreeNode) ((TreePath) element).getLastPathComponent()).getUserObject();
if (userObject instanceof PsiDirectoryNode) {
String str = getElementText(element);
if (str == null)
return false;
str = str.toLowerCase();
if (pattern.indexOf('.') >= 0) {
return compare(str, pattern);
}
StringTokenizer tokenizer = new StringTokenizer(str, ".");
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (compare(token, pattern)) {
return true;
}
}
return false;
}
else {
return super.isMatchingElement(element, pattern);
}
}
示例10: modify
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings) {
ArrayList<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>();
children.stream().filter(child -> child instanceof PsiFileNode).forEach(child -> {
BucketNode psiFileNode = new BucketNode(child.getProject(), ((PsiFileNode) child).getValue(), settings);
psiFileNode.setHasComment(true);
nodes.add(psiFileNode);
});
children.stream().filter(child -> child instanceof PsiDirectoryNode).forEach(child -> {
BucketDirectoryNode bucketDirectoryNode = new BucketDirectoryNode(child.getProject(), ((PsiDirectoryNode) child).getValue(), settings);
child = bucketDirectoryNode;
});
return children;
}
示例11: update
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@Override
protected void update(PresentationData presentation) {
final PsiManager psiManager = PsiManager.getInstance(myProject);
final VirtualFile virtualFile = getValue();
final PsiFile psiElement = virtualFile.isValid() ? psiManager.findFile(virtualFile) : null;
if (psiElement instanceof PsiDirectory) {
new PsiDirectoryNode(myProject, (PsiDirectory)psiElement, getSettings()).update(presentation);
}
else if (psiElement != null) {
new PsiFileNode(myProject, psiElement, getSettings()).update(presentation);
}
else {
presentation.setPresentableText(virtualFile.getName());
presentation.setIcon(virtualFile.isDirectory() ? AllIcons.Nodes.Folder : virtualFile.getFileType().getIcon());
}
}
示例12: getChildren
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@NotNull
@Override
public Collection<? extends AbstractTreeNode> getChildren() {
final PsiManager psiManager = PsiManager.getInstance(myProject);
final VirtualFile virtualFile = getValue();
return ContainerUtil.mapNotNull(
virtualFile.isValid() && virtualFile.isDirectory() ? virtualFile.getChildren() : VirtualFile.EMPTY_ARRAY,
new Function<VirtualFile, AbstractTreeNode>() {
@Override
public AbstractTreeNode fun(VirtualFile file) {
final PsiElement psiElement = file.isDirectory() ? psiManager.findDirectory(file) : psiManager.findFile(file);
if (psiElement instanceof PsiDirectory && ModuleUtil.findModuleForPsiElement(psiElement) != null) {
// PsiDirectoryNode doesn't render files outside of a project
// let's use PsiDirectoryNode only for folders in a modules
return new PsiDirectoryNode(myProject, (PsiDirectory)psiElement, getSettings());
}
else if (psiElement instanceof PsiFile) {
return new PsiFileNode(myProject, (PsiFile)psiElement, getSettings());
}
else {
return shouldShow(file) ? new VirtualFileTreeNode(myProject, file, getSettings()) : null;
}
}
}
);
}
示例13: compare
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
public int compare(NodeDescriptor nodeDescriptor1, NodeDescriptor nodeDescriptor2) {
int weight1 = getWeight(nodeDescriptor1);
int weight2 = getWeight(nodeDescriptor2);
if (weight1 != weight2) {
return weight1 - weight2;
}
if (!(nodeDescriptor1.getParentDescriptor() instanceof ProjectViewProjectNode)){
if (nodeDescriptor1 instanceof PsiDirectoryNode || nodeDescriptor1 instanceof PsiFileNode){
return nodeDescriptor1.toString().compareToIgnoreCase(nodeDescriptor2.toString());
}
if (nodeDescriptor1 instanceof ClassTreeNode && nodeDescriptor2 instanceof ClassTreeNode){
if (((ClassTreeNode)nodeDescriptor1).isTopLevel()){
return nodeDescriptor1.toString().compareToIgnoreCase(nodeDescriptor2.toString());
}
}
}
int index1 = nodeDescriptor1.getIndex();
int index2 = nodeDescriptor2.getIndex();
if (index1 == index2) return 0;
return index1 < index2 ? -1 : +1;
}
示例14: modify
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@Override
public Collection<AbstractTreeNode> modify(final AbstractTreeNode parent, final Collection<AbstractTreeNode> children, final ViewSettings settings) {
if (parent instanceof PsiDirectoryNode) {
final VirtualFile vFile = ((PsiDirectoryNode)parent).getVirtualFile();
if (vFile != null && Comparing.equal(ProjectFileIndex.SERVICE.getInstance(myProject).getContentRootForFile(vFile), vFile)) {
final Collection<AbstractTreeNode> moduleChildren = ((PsiDirectoryNode) parent).getChildren();
Collection<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
for (AbstractTreeNode moduleChild : moduleChildren) {
if (moduleChild instanceof PsiDirectoryNode) {
final PsiDirectory value = ((PsiDirectoryNode)moduleChild).getValue();
if (value.getName().equals(Project.DIRECTORY_STORE_FOLDER) && Registry.is("projectView.hide.dot.idea")) {
continue;
}
}
result.add(moduleChild);
}
return result;
}
}
return children;
}
示例15: compactEmptyMiddlePackages
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; //导入依赖的package包/类
@NotNull
protected Collection<AbstractTreeNode> compactEmptyMiddlePackages(
@NotNull final AbstractTreeNode parent,
@NotNull final Collection<AbstractTreeNode> children
) {
Validate.notNull(parent);
Validate.notNull(children);
if (CollectionUtils.isEmpty(children)) {
return children;
}
if (parent instanceof PsiDirectoryNode) {
final PsiDirectoryNode parentPsiDirectoryNode = (PsiDirectoryNode) parent;
final VirtualFile parentVirtualFile = parentPsiDirectoryNode.getVirtualFile();
if (null != parentVirtualFile && this.isFileInRoots(parentVirtualFile)) {
return children;
}
}
final Collection<AbstractTreeNode> compactedChildren = new ArrayList<AbstractTreeNode>();
for (AbstractTreeNode child : children) {
final AbstractTreeNode compactedChild = this.recursivelyCompactEmptyMiddlePackages(
child, child.getChildren()
);
compactedChildren.add(compactedChild);
}
return compactedChildren;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:35,代码来源:HybrisProjectView.java