本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}