当前位置: 首页>>代码示例>>Java>>正文


Java PsiTreeElementBase类代码示例

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


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

示例1: provideNodes

import com.intellij.ide.structureView.impl.common.PsiTreeElementBase; //导入依赖的package包/类
@NotNull
@Override
public Collection<JavaAnonymousClassTreeElement> provideNodes(@NotNull TreeElement node) {
  if (node instanceof PsiMethodTreeElement || node instanceof PsiFieldTreeElement || node instanceof ClassInitializerTreeElement) {
    final PsiElement el = ((PsiTreeElementBase)node).getElement();
    if (el != null) {
      for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) {
        final PsiElement[] elements = provider.getAnonymousElements(el);
        if (elements.length > 0) {
          List<JavaAnonymousClassTreeElement> result = new ArrayList<JavaAnonymousClassTreeElement>(elements.length);
          for (PsiElement element : elements) {
            result.add(new JavaAnonymousClassTreeElement((PsiAnonymousClass)element, new HashSet<PsiClass>()));
          }
          return result;
        }
      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaAnonymousClassesNodeProvider.java

示例2: provideNodes

import com.intellij.ide.structureView.impl.common.PsiTreeElementBase; //导入依赖的package包/类
@Override
public Collection<JavaAnonymousClassTreeElement> provideNodes(TreeElement node) {
  if (node instanceof PsiMethodTreeElement || node instanceof PsiFieldTreeElement || node instanceof ClassInitializerTreeElement) {
    final PsiElement el = ((PsiTreeElementBase)node).getElement();
    for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) {
      final PsiElement[] elements = provider.getAnonymousElements(el);
      if (elements != null && elements.length > 0) {
        List<JavaAnonymousClassTreeElement> result = new ArrayList<JavaAnonymousClassTreeElement>(elements.length);
        for (PsiElement element : elements) {
          result.add(new JavaAnonymousClassTreeElement((PsiAnonymousClass)element, new HashSet<PsiClass>()));
        }
        return result;
      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:JavaAnonymousClassesNodeProvider.java

示例3: isValid

import com.intellij.ide.structureView.impl.common.PsiTreeElementBase; //导入依赖的package包/类
public static boolean isValid(Object treeElement) {
  if (treeElement instanceof StructureViewTreeElementWrapper) {
    final StructureViewTreeElementWrapper wrapper = (StructureViewTreeElementWrapper)treeElement;
    if (wrapper.getValue() instanceof PsiTreeElementBase) {
      final PsiTreeElementBase psiNode = (PsiTreeElementBase)wrapper.getValue();
      return psiNode.isValid();
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:StructureViewComponent.java

示例4: getSpeedSearchText

import com.intellij.ide.structureView.impl.common.PsiTreeElementBase; //导入依赖的package包/类
@Nullable
public static String getSpeedSearchText(final Object userObject) {
  String text = String.valueOf(userObject);
  if (text != null) {
    if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
      final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue();
      if (value instanceof PsiTreeElementBase && ((PsiTreeElementBase)value).isSearchInLocationString()) {
        final String locationString = ((PsiTreeElementBase)value).getLocationString();
        if (!StringUtil.isEmpty(locationString)) {
          String locationPrefix = null;
          String locationSuffix = null;
          if (value instanceof LocationPresentation) {
            locationPrefix = ((LocationPresentation)value).getLocationPrefix();
            locationSuffix = ((LocationPresentation)value).getLocationSuffix();
          }

          return text +
                 StringUtil.notNullize(locationPrefix, LocationPresentation.DEFAULT_LOCATION_PREFIX) +
                 locationString +
                 StringUtil.notNullize(locationSuffix, LocationPresentation.DEFAULT_LOCATION_SUFFIX);
        }
      }
    }
    return text;
  }

  if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
    return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      @Nullable
      @Override
      public String compute() {
        final ItemPresentation presentation =
          ((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue().getPresentation();
        return presentation.getPresentableText();
      }
    });
  }

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

示例5: getSpeedSearchText

import com.intellij.ide.structureView.impl.common.PsiTreeElementBase; //导入依赖的package包/类
@Nullable
public static String getSpeedSearchText(final Object userObject) {
  String text = String.valueOf(userObject);
  if (text != null) {
    if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
      final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue();
      if (value instanceof PsiTreeElementBase && ((PsiTreeElementBase)value).isSearchInLocationString()) {
        final String locationString = ((PsiTreeElementBase)value).getLocationString();
        if (!StringUtil.isEmpty(locationString)) {
          String locationPrefix = null;
          String locationSuffix = null;
          if (value instanceof LocationPresentation) {
            locationPrefix = ((LocationPresentation)value).getLocationPrefix();
            locationSuffix = ((LocationPresentation)value).getLocationSuffix();
          }

          return text +
                 StringUtil.notNullize(locationPrefix, LocationPresentation.DEFAULT_LOCATION_PREFIX) +
                 locationString +
                 StringUtil.notNullize(locationSuffix, LocationPresentation.DEFAULT_LOCATION_SUFFIX);
        }
      }
    }
    return text;
  }
  // NB!: this point is achievable if the following method returns null
  // see com.intellij.ide.util.treeView.NodeDescriptor.toString
  if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
    return ReadAction.compute(() -> {
      final ItemPresentation presentation =
              ((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue().getPresentation();
      return presentation.getPresentableText();
    });
  }

  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:38,代码来源:FileStructurePopup.java

示例6: provideNodes

import com.intellij.ide.structureView.impl.common.PsiTreeElementBase; //导入依赖的package包/类
@NotNull
@Override
public List<JavaLambdaTreeElement> provideNodes(@NotNull TreeElement node)
{
	if(node instanceof PsiMethodTreeElement ||
			node instanceof PsiFieldTreeElement ||
			node instanceof ClassInitializerTreeElement ||
			node instanceof JavaLambdaTreeElement)
	{
		final PsiElement el = ((PsiTreeElementBase) node).getElement();
		if(el != null)
		{
			final List<JavaLambdaTreeElement> result = new ArrayList<>();
			el.accept(new JavaRecursiveElementVisitor()
			{
				@Override
				public void visitLambdaExpression(PsiLambdaExpression expression)
				{
					super.visitLambdaExpression(expression);
					result.add(new JavaLambdaTreeElement(expression));
				}

				@Override
				public void visitClass(PsiClass aClass)
				{
					//stop at class level
				}
			});
			return result;
		}
	}
	return Collections.emptyList();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:34,代码来源:JavaLambdaNodeProvider.java


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