本文整理汇总了Java中com.intellij.ide.structureView.newStructureView.StructureViewComponent.StructureViewTreeElementWrapper方法的典型用法代码示例。如果您正苦于以下问题:Java StructureViewComponent.StructureViewTreeElementWrapper方法的具体用法?Java StructureViewComponent.StructureViewTreeElementWrapper怎么用?Java StructureViewComponent.StructureViewTreeElementWrapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.structureView.newStructureView.StructureViewComponent
的用法示例。
在下文中一共展示了StructureViewComponent.StructureViewTreeElementWrapper方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isPsiValid
import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入方法依赖的package包/类
private static boolean isPsiValid(@NotNull StructureViewComposite.StructureViewDescriptor baseStructureViewDescriptor) {
final StructureViewComponent view = (StructureViewComponent)baseStructureViewDescriptor.structureView;
if (view.isDisposed()) return false;
final Object root = view.getTreeStructure().getRootElement();
if (root instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)root).getValue();
if (value instanceof StructureViewTreeElement) {
final Object psi = ((StructureViewTreeElement)value).getValue();
if (psi instanceof PsiElement) {
return ((PsiElement)psi).isValid();
}
}
}
return true;
}
示例2: isPsiValid
import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入方法依赖的package包/类
private static boolean isPsiValid(@Nonnull StructureViewComposite.StructureViewDescriptor baseStructureViewDescriptor) {
final StructureViewComponent view = (StructureViewComponent)baseStructureViewDescriptor.structureView;
if (view.isDisposed()) return false;
final Object root = view.getTreeStructure().getRootElement();
if (root instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)root).getValue();
if (value instanceof StructureViewTreeElement) {
final Object psi = ((StructureViewTreeElement)value).getValue();
if (psi instanceof PsiElement) {
return ((PsiElement)psi).isValid();
}
}
}
return true;
}
示例3: getPsi
import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入方法依赖的package包/类
@Nullable
private PsiElement getPsi(FilteringTreeStructure.FilteringNode n) {
final Object delegate = n.getDelegate();
if (delegate instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)delegate).getValue();
if (value instanceof StructureViewTreeElement) {
final Object element = ((StructureViewTreeElement)value).getValue();
if (element instanceof PsiElement) {
return (PsiElement)element;
}
}
}
return null;
}
示例4: getSpeedSearchText
import com.intellij.ide.structureView.newStructureView.StructureViewComponent; //导入方法依赖的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.newStructureView.StructureViewComponent; //导入方法依赖的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;
}