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

Java ClassTreeNode类代码示例

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

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



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

示例1: compare

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SourceComparator.java


示例2: decorate

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
  if (!(node instanceof ClassTreeNode)) {
    return;
  }
  PsiClass psiClass = ((ClassTreeNode) node).getPsiClass();
  if (psiClass == null) {
    return;
  }
  PsiFile psiFile = psiClass.getContainingFile();
  if (psiFile == null) {
    return;
  }
  VirtualFile virtualFile = psiFile.getVirtualFile();
  if (virtualFile == null) {
    return;
  }

  Project project = node.getProject();
  if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
    data.clearText();
    data.addText(psiClass.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
    data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:26,代码来源:BlazeJavaSyncStatusClassNodeDecorator.java


示例3: compare

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:SourceComparator.java


示例4: getElementWeight

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@Override
public int getElementWeight(final Object value, final boolean isSortByType) {
   if (value instanceof PsiClass){
    return isSortByType ? ClassTreeNode.getClassPosition((PsiClass)value) : 3;
  }

  return -1;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PsiClassFavoriteNodeProvider.java


示例5: getChildrenImpl

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@Override
public Collection<AbstractTreeNode> getChildrenImpl() {
  final ViewSettings settings = getSettings();
  final ArrayList<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
  for (PsiClass aClass : ((PsiClassOwner)getValue()).getClasses()) {
    if (!(aClass instanceof SyntheticElement)) {
      result.add(new ClassTreeNode(myProject, aClass, settings));
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ClassesTreeStructureProvider.java


示例6: getSelectedFromTreeUserObject

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@Override
@Nullable
protected PsiClass getSelectedFromTreeUserObject(DefaultMutableTreeNode node) {
  Object userObject = node.getUserObject();
  if (!(userObject instanceof ClassTreeNode)) return null;
  ClassTreeNode descriptor = (ClassTreeNode)userObject;
  return descriptor.getPsiClass();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:TreeJavaClassChooserDialog.java


示例7: compareTo

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
public int compareTo(final ClassNode o) {
  final int comparision = ClassTreeNode.getClassPosition((PsiClass)getPsiElement()) - ClassTreeNode.getClassPosition((PsiClass)o.getPsiElement());
  if (comparision == 0) {
    return toString().compareToIgnoreCase(o.toString());
  }
  return comparision;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ClassNode.java


示例8: getChildren

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的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


示例9: isForMe

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@Override
public boolean isForMe(ProjectViewNode node) {
    if (node instanceof ClassTreeNode) {
        ClassTreeNode classNode = (ClassTreeNode) node;
        if (classNode.isTopLevel()) {
            return true;
        }
    }
    return false;
}
 
开发者ID:zielu,项目名称:SVNToolBox,代码行数:11,代码来源:ClassFileDecoration.java


示例10: getChildrenImpl

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@Override
public Collection<AbstractTreeNode> getChildrenImpl()
{
	final ViewSettings settings = getSettings();
	final ArrayList<AbstractTreeNode> result = new ArrayList<>();
	for(PsiClass aClass : ((PsiClassOwner) getValue()).getClasses())
	{
		if(!(aClass instanceof SyntheticElement))
		{
			result.add(new ClassTreeNode(myProject, aClass, settings));
		}
	}
	return result;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:15,代码来源:ClassesTreeStructureProvider.java


示例11: modify

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
  ArrayList<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
  for (final AbstractTreeNode child : children) {
    Object o = child.getValue();
    if (o instanceof PsiClassOwner && !(o instanceof ServerPageFile)) {
      final ViewSettings settings1 = ((ProjectViewNode)parent).getSettings();
      final PsiClassOwner classOwner = (PsiClassOwner)o;
      final VirtualFile file = classOwner.getVirtualFile();

      if (!(classOwner instanceof PsiCompiledElement)) {
        //do not show duplicated items if jar file contains classes and sources
        final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
        if (file != null && fileIndex.isInLibrarySource(file)) {
          final PsiElement originalElement = classOwner.getOriginalElement();
          if (originalElement instanceof PsiFile) {
            PsiFile classFile = (PsiFile)originalElement;
            final VirtualFile virtualClassFile = classFile.getVirtualFile();
            if (virtualClassFile != null && fileIndex.isInLibraryClasses(virtualClassFile)
                && !classOwner.getManager().areElementsEquivalent(classOwner, classFile)
                && classOwner.getManager().areElementsEquivalent(classOwner.getContainingDirectory(), classFile.getContainingDirectory())) {
              continue;
            }
          }
        }
      }

      if (fileInRoots(file)) {
        PsiClass[] classes = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass[]>() {
          @Override
          public PsiClass[] compute() {
            return classOwner.getClasses();
          }
        });
        if (classes.length == 1 && !(classes[0] instanceof SyntheticElement) &&
            (file == null || file.getNameWithoutExtension().equals(classes[0].getName()))) {
          result.add(new ClassTreeNode(myProject, classes[0], settings1));
        } else {
          result.add(new PsiClassOwnerTreeNode(classOwner, settings1));
        }
        continue;
      }
    }
    result.add(child);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:ClassesTreeStructureProvider.java


示例12: modify

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@Override
public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings) {
  ArrayList<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
  for (final AbstractTreeNode child : children) {
    Object o = child.getValue();
    if (o instanceof PsiClassOwner && !(o instanceof JspFile)) {
      final ViewSettings settings1 = ((ProjectViewNode)parent).getSettings();
      final PsiClassOwner classOwner = (PsiClassOwner)o;
      final VirtualFile file = classOwner.getVirtualFile();

      if (!(classOwner instanceof PsiCompiledElement)) {
        //do not show duplicated items if jar file contains classes and sources
        final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
        if (file != null && fileIndex.isInLibrarySource(file)) {
          final PsiElement originalElement = classOwner.getOriginalElement();
          if (originalElement instanceof PsiFile) {
            PsiFile classFile = (PsiFile)originalElement;
            final VirtualFile virtualClassFile = classFile.getVirtualFile();
            if (virtualClassFile != null && fileIndex.isInLibraryClasses(virtualClassFile) &&
                classOwner.getManager().areElementsEquivalent(classOwner.getContainingDirectory(), classFile.getContainingDirectory())) {
              continue;
            }
          }
        }
      }

      if (fileInRoots(file)) {
        PsiClass[] classes = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass[]>() {
          @Override
          public PsiClass[] compute() {
            return classOwner.getClasses();
          }
        });
        if (classes.length == 1 && !(classes[0] instanceof SyntheticElement) &&
            (file == null || file.getNameWithoutExtension().equals(classes[0].getName()))) {
          result.add(new ClassTreeNode(myProject, classes[0], settings1));
        } else {
          result.add(new PsiClassOwnerTreeNode(classOwner, settings1));
        }
        continue;
      }
    }
    result.add(child);
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:47,代码来源:ClassesTreeStructureProvider.java


示例13: getVirtualFile

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@Override
protected VirtualFile getVirtualFile(ProjectViewNode node) {
    ClassTreeNode classNode = (ClassTreeNode) node;
    return PsiUtilBase.getVirtualFile(classNode.getPsiClass());
}
 
开发者ID:zielu,项目名称:SVNToolBox,代码行数:6,代码来源:ClassFileDecoration.java


示例14: modify

import com.intellij.ide.projectView.impl.nodes.ClassTreeNode; //导入依赖的package包/类
@Override
@RequiredReadAction
public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings)
{
	ArrayList<AbstractTreeNode> result = new ArrayList<>();
	for(final AbstractTreeNode child : children)
	{
		Object o = child.getValue();
		if(o instanceof PsiClassOwner/* && !(o instanceof JspFile)*/)
		{
			final PsiClassOwner classOwner = (PsiClassOwner) o;
			final VirtualFile file = classOwner.getVirtualFile();

			if(!(classOwner instanceof PsiCompiledElement))
			{
				//do not show duplicated items if jar file contains classes and sources
				final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
				if(file != null && fileIndex.isInLibrarySource(file))
				{
					final PsiElement originalElement = classOwner.getOriginalElement();
					if(originalElement instanceof PsiFile)
					{
						PsiFile classFile = (PsiFile) originalElement;
						final VirtualFile virtualClassFile = classFile.getVirtualFile();
						if(virtualClassFile != null && fileIndex.isInLibraryClasses(virtualClassFile) && classOwner.getManager().areElementsEquivalent(classOwner.getContainingDirectory(), classFile.getContainingDirectory()))
						{
							continue;
						}
					}
				}
			}

			if(fileInRoots(file))
			{
				PsiClass[] classes = classOwner.getClasses();
				if(classes.length == 1 && !(classes[0] instanceof SyntheticElement) && file.getNameWithoutExtension().equals(classes[0].getName()))
				{
					result.add(new ClassTreeNode(myProject, classes[0], settings));
				}
				else
				{
					result.add(new PsiClassOwnerTreeNode(classOwner, settings));
				}
				continue;
			}
		}
		else if(o instanceof PsiDirectory && JavaModuleIconDescriptorUpdater.isModuleDirectory((PsiDirectory) o))
		{
			result.add(new JavaModuleRootTreeNode(myProject, (PsiDirectory) o, settings));
		}

		result.add(child);
	}
	return result;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:56,代码来源:ClassesTreeStructureProvider.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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