• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BasePsiNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.ide.projectView.impl.nodes.BasePsiNode的典型用法代码示例。如果您正苦于以下问题:Java BasePsiNode类的具体用法?Java BasePsiNode怎么用?Java BasePsiNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BasePsiNode类属于com.intellij.ide.projectView.impl.nodes包,在下文中一共展示了BasePsiNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findViewsIn

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
private static Collection<BasePsiNode<? extends PsiElement>> findViewsIn(Collection<AbstractTreeNode> children, List<PsiFile> views) {
    if (children.isEmpty() || views.isEmpty()) {
        return Collections.emptyList();
    }
    ArrayList<BasePsiNode<? extends PsiElement>> result = new ArrayList<>();
    HashSet<PsiFile> psiFiles = new HashSet<>(views);
    for (final AbstractTreeNode child : children) {
        if (child instanceof BasePsiNode) {
            BasePsiNode<? extends PsiElement> treeNode = (BasePsiNode<? extends PsiElement>) child;
            if (psiFiles.contains(treeNode.getValue())) {
                result.add(treeNode);
            }
        }
    }
    return result;
}
 
开发者ID:Tolc,项目名称:IntelliJ_Jahia_plugin,代码行数:17,代码来源:ViewMergerTreeStructureProvider.java


示例2: modify

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
/**
 * If {@link IgnoreSettings#hideIgnoredFiles} is set to <code>true</code>, checks if specific
 * nodes are ignored and filters them out.
 *
 * @param parent   the parent node
 * @param children the list of child nodes according to the default project structure
 * @param settings the current project view settings
 * @return the modified collection of child nodes
 */
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent,
                                           @NotNull Collection<AbstractTreeNode> children,
                                           @NotNull ViewSettings settings) {
    if (!ignoreSettings.isHideIgnoredFiles() || children.isEmpty()) {
        return children;
    }

    return ContainerUtil.filter(children, new Condition<AbstractTreeNode>() {
        @Override
        public boolean value(AbstractTreeNode node) {
            if (node instanceof BasePsiNode) {
                final VirtualFile file = ((BasePsiNode) node).getVirtualFile();
                if (file == null || (ignoreManager.isFileIgnored(file) && !ignoreManager.isFileTracked(file))) {
                    return false;
                }
            }
            return true;
        }
    });
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:32,代码来源:HideIgnoredFilesTreeStructureProvider.java


示例3: findFormsIn

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
private static Collection<BasePsiNode<? extends PsiElement>> findFormsIn(Collection<AbstractTreeNode> children, List<PsiFile> forms)
{
	if(children.isEmpty() || forms.isEmpty())
	{
		return Collections.emptyList();
	}
	ArrayList<BasePsiNode<? extends PsiElement>> result = new ArrayList<>();
	HashSet<PsiFile> psiFiles = new HashSet<>(forms);
	for(final AbstractTreeNode child : children)
	{
		if(child instanceof BasePsiNode)
		{
			//noinspection unchecked
			BasePsiNode<? extends PsiElement> treeNode = (BasePsiNode<? extends PsiElement>) child;
			//noinspection SuspiciousMethodCalls
			if(psiFiles.contains(treeNode.getValue()))
			{
				result.add(treeNode);
			}
		}
	}
	return result;
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:24,代码来源:FormMergerTreeStructureProvider.java


示例4: getFiles

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
public static VirtualFile[] getFiles(AbstractTreeNode kid, Function<AbstractTreeNode, VirtualFile[]> converterFunction) {
  if (kid instanceof BasePsiNode) {
    Object value = kid.getValue();
    VirtualFile virtualFile = PsiUtilCore.getVirtualFile((PsiElement)value);
    return new VirtualFile[]{virtualFile};
  }
  if (converterFunction != null) {
    final VirtualFile[] result = converterFunction.fun(kid);
    if (result != null) {
      return result;
    }
  }
  return new VirtualFile[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ProjectViewTestUtil.java


示例5: getFileStatus

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
@Override
public FileStatus getFileStatus() {
  for(BasePsiNode<? extends PsiElement> child: myChildren) {
    final PsiElement value = child.getValue();
    if (value == null || !value.isValid()) continue;
    final FileStatus fileStatus = NavigationItemFileStatus.get(child);
    if (fileStatus != FileStatus.NOT_CHANGED) {
      return fileStatus;
    }
  }
  return FileStatus.NOT_CHANGED;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:FormNode.java


示例6: canHaveChildrenMatching

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
@Override
public boolean canHaveChildrenMatching(final Condition<PsiFile> condition) {
  for(BasePsiNode<? extends PsiElement> child: myChildren) {
    if (condition.value(child.getValue().getContainingFile())) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FormNode.java


示例7: getChildren

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
private static Collection<BasePsiNode<? extends PsiElement>> getChildren(final Project project, final Form form, final ViewSettings settings) {
  final Set<BasePsiNode<? extends PsiElement>> children = new LinkedHashSet<BasePsiNode<? extends PsiElement>>();
  children.add(new ClassTreeNode(project, form.getClassToBind(), settings));
  for (PsiFile formBoundToClass : form.getFormFiles()) {
    children.add(new PsiFileNode(project, formBoundToClass, settings));
  }
  return children;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FormNode.java


示例8: convertToFiles

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
private static Collection<PsiFile> convertToFiles(Collection<BasePsiNode<? extends PsiElement>> formNodes) {
  ArrayList<PsiFile> psiFiles = new ArrayList<PsiFile>();
  for (AbstractTreeNode treeNode : formNodes) {
    psiFiles.add((PsiFile)treeNode.getValue());
  }
  return psiFiles;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:FormMergerTreeStructureProvider.java


示例9: findFormsIn

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
private static Collection<BasePsiNode<? extends PsiElement>> findFormsIn(Collection<AbstractTreeNode> children, List<PsiFile> forms) {
  if (children.isEmpty() || forms.isEmpty()) return Collections.emptyList();
  ArrayList<BasePsiNode<? extends PsiElement>> result = new ArrayList<BasePsiNode<? extends PsiElement>>();
  HashSet<PsiFile> psiFiles = new HashSet<PsiFile>(forms);
  for (final AbstractTreeNode child : children) {
    if (child instanceof BasePsiNode) {
      //noinspection unchecked
      BasePsiNode<? extends PsiElement> treeNode = (BasePsiNode<? extends PsiElement>)child;
      //noinspection SuspiciousMethodCalls
      if (psiFiles.contains(treeNode.getValue())) result.add(treeNode);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:FormMergerTreeStructureProvider.java


示例10: convertToFiles

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
private static Collection<PsiFile> convertToFiles(Collection<BasePsiNode<? extends PsiElement>> formNodes) {
    List<PsiFile> psiFiles = new ArrayList<PsiFile>();
    for (AbstractTreeNode treeNode : formNodes) {
        psiFiles.add((PsiFile) treeNode.getValue());
    }
    return psiFiles;
}
 
开发者ID:idok,项目名称:react-templates-plugin,代码行数:8,代码来源:RTMergerTreeStructureProvider.java


示例11: findFormsIn

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
private static Collection<BasePsiNode<? extends PsiElement>> findFormsIn(Collection<AbstractTreeNode> children, List<PsiFile> forms) {
    if (children.isEmpty() || forms.isEmpty()) return Collections.emptyList();
    List<BasePsiNode<? extends PsiElement>> result = new ArrayList<BasePsiNode<? extends PsiElement>>();
    Set<PsiFile> psiFiles = new HashSet<PsiFile>(forms);
    for (final AbstractTreeNode child : children) {
        if (child instanceof BasePsiNode) {
            //noinspection unchecked
            BasePsiNode<? extends PsiElement> treeNode = (BasePsiNode<? extends PsiElement>) child;
            //noinspection SuspiciousMethodCalls
            if (psiFiles.contains(treeNode.getValue())) result.add(treeNode);
        }
    }
    return result;
}
 
开发者ID:idok,项目名称:react-templates-plugin,代码行数:15,代码来源:RTMergerTreeStructureProvider.java


示例12: convertToFiles

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
private static Collection<PsiFile> convertToFiles(Collection<BasePsiNode<? extends PsiElement>> viewNodes) {
    ArrayList<PsiFile> psiFiles = new ArrayList<>();
    for (AbstractTreeNode treeNode : viewNodes) {
        psiFiles.add((PsiFile) treeNode.getValue());
    }
    return psiFiles;
}
 
开发者ID:Tolc,项目名称:IntelliJ_Jahia_plugin,代码行数:8,代码来源:ViewMergerTreeStructureProvider.java


示例13: getFiles

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
public static VirtualFile[] getFiles(AbstractTreeNode kid, Function<AbstractTreeNode, VirtualFile[]> converterFunction) {
  if (kid instanceof BasePsiNode) {
    Object value = kid.getValue();
    VirtualFile virtualFile = PsiUtilBase.getVirtualFile((PsiElement)value);
    return new VirtualFile[]{virtualFile};
  }
  if (converterFunction != null) {
    final VirtualFile[] result = converterFunction.fun(kid);
    if (result != null) {
      return result;
    }
  }
  return new VirtualFile[0];
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:ProjectViewTestUtil.java


示例14: convertToFiles

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
private static Collection<PsiFile> convertToFiles(Collection<BasePsiNode<? extends PsiElement>> formNodes)
{
	ArrayList<PsiFile> psiFiles = new ArrayList<>();
	for(AbstractTreeNode treeNode : formNodes)
	{
		psiFiles.add((PsiFile) treeNode.getValue());
	}
	return psiFiles;
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:10,代码来源:FormMergerTreeStructureProvider.java


示例15: processJunkFiles

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
@NotNull
protected Collection<AbstractTreeNode> processJunkFiles(
    @NotNull final Collection<AbstractTreeNode> children,
    @Nullable final ViewSettings settings
) {
    Validate.notNull(children);

    final List<String> junkFileNames = this.getJunkFileNames();

    if (junkFileNames == null || junkFileNames.isEmpty()) {
        return children;
    }

    final List<AbstractTreeNode> junkTreeNodes = new ArrayList<AbstractTreeNode>();
    final Collection<AbstractTreeNode> treeNodes = new ArrayList<AbstractTreeNode>();

    for (AbstractTreeNode child : children) {
        if (child instanceof BasePsiNode) {
            final VirtualFile virtualFile = ((BasePsiNode) child).getVirtualFile();

            if (null == virtualFile) {
                continue;
            }

            if (this.isJunk(virtualFile, junkFileNames)) {
                junkTreeNodes.add(child);
            } else {
                treeNodes.add(child);
            }

        } else {
            treeNodes.add(child);
        }
    }

    if (!junkTreeNodes.isEmpty()) {
        treeNodes.add(new JunkProjectViewNode(this.project, junkTreeNodes, settings));
    }

    return treeNodes;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:42,代码来源:HybrisProjectView.java


示例16: FormNode

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
public FormNode(Project project, Form value, ViewSettings viewSettings, Collection<BasePsiNode<? extends PsiElement>> children) {
  super(project, value, viewSettings);
  myChildren = children;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:FormNode.java


示例17: constructFormNode

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
public static AbstractTreeNode constructFormNode(final PsiClass classToBind, final Project project, final ViewSettings settings) {
  final Form form = new Form(classToBind);
  final Collection<BasePsiNode<? extends PsiElement>> children = getChildren(project, form, settings);
  return new FormNode(project, form, settings, children);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:FormNode.java


示例18: modify

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
@NotNull
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
  if (parent.getValue() instanceof Form) return children;

  // Optimization. Check if there are any forms at all.
  boolean formsFound = false;
  for (AbstractTreeNode node : children) {
    if (node.getValue() instanceof PsiFile) {
      PsiFile file = (PsiFile)node.getValue();
      if (file.getFileType() == StdFileTypes.GUI_DESIGNER_FORM) {
        formsFound = true;
        break;
      }
    }
  }

  if (!formsFound) return children;

  Collection<AbstractTreeNode> result = new LinkedHashSet<AbstractTreeNode>(children);
  ProjectViewNode[] copy = children.toArray(new ProjectViewNode[children.size()]);
  for (ProjectViewNode element : copy) {
    PsiClass psiClass = null;
    if (element.getValue() instanceof PsiClass) {
      psiClass = (PsiClass)element.getValue();
    }
    else if (element.getValue() instanceof PsiClassOwner) {
      final PsiClass[] psiClasses = ((PsiClassOwner) element.getValue()).getClasses();
      if (psiClasses.length == 1) {
        psiClass = psiClasses[0];
      }
    }
    if (psiClass == null) continue;
    String qName = psiClass.getQualifiedName();
    if (qName == null) continue;
    List<PsiFile> forms;
    try {
      forms = FormClassIndex.findFormsBoundToClass(myProject, qName);
    }
    catch (ProcessCanceledException e) {
      continue;
    }
    Collection<BasePsiNode<? extends PsiElement>> formNodes = findFormsIn(children, forms);
    if (!formNodes.isEmpty()) {
      Collection<PsiFile> formFiles = convertToFiles(formNodes);
      Collection<BasePsiNode<? extends PsiElement>> subNodes = new ArrayList<BasePsiNode<? extends PsiElement>>();
      //noinspection unchecked
      subNodes.add((BasePsiNode<? extends PsiElement>) element);
      subNodes.addAll(formNodes);
      result.add(new FormNode(myProject, new Form(psiClass, formFiles), settings, subNodes));
      result.remove(element);
      result.removeAll(formNodes);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:56,代码来源:FormMergerTreeStructureProvider.java


示例19: modify

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
@NotNull
    public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
        if (children.isEmpty() 
            || !(parent.getValue() instanceof PsiDirectory)
            || parent.getValue() instanceof View) {
            return children;
        }


        return ApplicationManager.getApplication().runReadAction(new Computable<Collection<AbstractTreeNode>>() {
            @Override
            public Collection<AbstractTreeNode> compute() {
                if (!CndProjectFilesUtil.isNodeTypeFolderChildFolder(((PsiDirectory) parent.getValue()).getVirtualFile())) {
                    return children;
                }

                Collection<AbstractTreeNode> result = new LinkedHashSet<AbstractTreeNode>(children);
                ProjectViewNode[] copy = children.toArray(new ProjectViewNode[children.size()]);
                List<String> alreadyDoneViews = new ArrayList<String>();

                for (ProjectViewNode element : copy) {
                    if (element.getValue() instanceof PsiFile) {
                        PsiFile file = (PsiFile) element.getValue();
                        if (file.getFileType() != StdFileTypes.PROPERTIES) {
                            VirtualFile virtualFile = file.getVirtualFile();

                            ViewModel viewModel = CndProjectFilesUtil.getViewModelFromPotentialViewFile(virtualFile);
                            if (viewModel != null && !alreadyDoneViews.contains(viewModel.getName())) {
                                List<PsiFile> views = CndProjectFilesUtil.findViewFiles(CndProjectFilesUtil.getModuleForFile(file.getProject(), virtualFile), viewModel);

                                Collection<BasePsiNode<? extends PsiElement>> viewNodes = findViewsIn(children, views);
                                if (!viewNodes.isEmpty()) {
                                    Collection<PsiFile> viewFiles = convertToFiles(viewNodes);
//                                    Collection<BasePsiNode<? extends PsiElement>> subNodes = new ArrayList<>();
//                                    subNodes.add((BasePsiNode<? extends PsiElement>) element);
//                                    subNodes.addAll(viewNodes);
                                    result.add(new ViewNode(project, new View(viewModel, viewFiles), settings));
//                                    result.remove(element);
                                    result.removeAll(viewNodes);

                                    alreadyDoneViews.add(viewModel.getName());
                                }
                            }
                        }
                    }
                }

                //TODO: have default at the top of the view. Below sort is sorting right but it does not sort in projectView
                //        if (!alreadyDoneViews.isEmpty()) {
                //            Collection<AbstractTreeNode> sortedResult = new TreeSet<AbstractTreeNode>(new Comparator<AbstractTreeNode>() {
                //                @Override
                //                public int compare(AbstractTreeNode o1, AbstractTreeNode o2) {
                //                    if (o1 instanceof ViewNode && o2 instanceof ViewNode) {
                //                        View view1 = ((ViewNode) o1).getValue();
                //                        View view2 = ((ViewNode) o2).getValue();
                //                        if ("default".equals(view1.getName())) {
                //                            return -1;
                //                        }
                //                        if ("default".equals(view2.getName())) {
                //                            return 1;
                //                        }
                //                        return view1.getName().compareTo(view2.getName());
                //                    } else if (o1 instanceof ViewNode) {
                //                        return -1;
                //                    } else if (o2 instanceof ViewNode) {
                //                        return 1;
                //                    }
                //                    return 0;
                //                }
                //            });
                //            sortedResult.addAll(result);
                //            result = sortedResult;
                //        }

                return result;
            }
        });
    }
 
开发者ID:Tolc,项目名称:IntelliJ_Jahia_plugin,代码行数:79,代码来源:ViewMergerTreeStructureProvider.java


示例20: modify

import com.intellij.ide.projectView.impl.nodes.BasePsiNode; //导入依赖的package包/类
public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings) {
  if (parent.getValue() instanceof Form) return children;

  // Optimization. Check if there are any forms at all.
  boolean formsFound = false;
  for (AbstractTreeNode node : children) {
    if (node.getValue() instanceof PsiFile) {
      PsiFile file = (PsiFile)node.getValue();
      if (file.getFileType() == StdFileTypes.GUI_DESIGNER_FORM) {
        formsFound = true;
        break;
      }
    }
  }

  if (!formsFound) return children;

  Collection<AbstractTreeNode> result = new LinkedHashSet<AbstractTreeNode>(children);
  ProjectViewNode[] copy = children.toArray(new ProjectViewNode[children.size()]);
  for (ProjectViewNode element : copy) {
    PsiClass psiClass = null;
    if (element.getValue() instanceof PsiClass) {
      psiClass = (PsiClass)element.getValue();
    }
    else if (element.getValue() instanceof PsiClassOwner) {
      final PsiClass[] psiClasses = ((PsiClassOwner) element.getValue()).getClasses();
      if (psiClasses.length == 1) {
        psiClass = psiClasses[0];
      }
    }
    if (psiClass == null) continue;
    String qName = psiClass.getQualifiedName();
    if (qName == null) continue;
    List<PsiFile> forms;
    try {
      forms = FormClassIndex.findFormsBoundToClass(myProject, qName);
    }
    catch (ProcessCanceledException e) {
      continue;
    }
    Collection<BasePsiNode<? extends PsiElement>> formNodes = findFormsIn(children, forms);
    if (!formNodes.isEmpty()) {
      Collection<PsiFile> formFiles = convertToFiles(formNodes);
      Collection<BasePsiNode<? extends PsiElement>> subNodes = new ArrayList<BasePsiNode<? extends PsiElement>>();
      //noinspection unchecked
      subNodes.add((BasePsiNode<? extends PsiElement>) element);
      subNodes.addAll(formNodes);
      result.add(new FormNode(myProject, new Form(psiClass, formFiles), settings, subNodes));
      result.remove(element);
      result.removeAll(formNodes);
    }
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:55,代码来源:FormMergerTreeStructureProvider.java



注:本文中的com.intellij.ide.projectView.impl.nodes.BasePsiNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java INodeAttributes类代码示例发布时间:2022-05-22
下一篇:
Java IloLinearNumExpr类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap