本文整理汇总了Java中com.intellij.navigation.ItemPresentation.getLocationString方法的典型用法代码示例。如果您正苦于以下问题:Java ItemPresentation.getLocationString方法的具体用法?Java ItemPresentation.getLocationString怎么用?Java ItemPresentation.getLocationString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.navigation.ItemPresentation
的用法示例。
在下文中一共展示了ItemPresentation.getLocationString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSymbolContainerText
import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
@Nullable
public static String getSymbolContainerText(PsiElement element) {
if (element instanceof NavigationItem) {
final ItemPresentation presentation = ((NavigationItem)element).getPresentation();
if (presentation != null){
return presentation.getLocationString();
} else {
PsiFile file = element.getContainingFile();
if (file != null) {
VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile != null) return virtualFile.getPath();
}
}
}
return null;
}
示例2: FileDescriptor
import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
public FileDescriptor(PsiFile file, PsiElement element) {
myFile = file;
final ItemPresentation presentation = element instanceof NavigationItem ? ((NavigationItem)element).getPresentation() : null;
if (presentation != null) {
myElementPresentation = presentation.getPresentableText();
myLocationString = presentation.getLocationString();
}
else {
myElementPresentation = element instanceof PsiNamedElement ? ((PsiNamedElement)element).getName() : null;
myLocationString = null;
}
}
示例3: getContainerText
import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
@Override
protected String getContainerText(final PsiElement element, final String name) {
if (element instanceof NavigationItem) {
final ItemPresentation presentation = ((NavigationItem)element).getPresentation();
return presentation != null ? presentation.getLocationString():null;
}
return null;
}
示例4: getQualifiedName
import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
public String getQualifiedName() {
String presentableUrl = myFile.getPresentableUrl();
if (myFile.isDirectory()) return presentableUrl;
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(myFile);
if (psiFile == null) return presentableUrl;
StructureViewBuilder builder = LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(psiFile);
if (builder instanceof TreeBasedStructureViewBuilder) {
StructureViewModel model = ((TreeBasedStructureViewBuilder)builder).createStructureViewModel(null);
Object element;
try {
element = model.getCurrentEditorElement();
}
finally {
model.dispose();
}
if (element instanceof NavigationItem) {
ItemPresentation presentation = ((NavigationItem)element).getPresentation();
if (presentation != null) {
presentableUrl = ((NavigationItem)element).getName() + " " + presentation.getLocationString();
}
}
}
return IdeBundle.message("bookmark.file.X.line.Y", presentableUrl, getLine() + 1);
}
示例5: getListCellRendererComponent
import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent(final JList list,
final Object value,
final int index,
final boolean isSelected,
final boolean cellHasFocus) {
final Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
String text = "";
if (value instanceof NavigationItem) {
final ItemPresentation presentation = ((NavigationItem)value).getPresentation();
if (presentation != null) {
String containerText = presentation.getLocationString();
if (!StringUtil.isEmpty(containerText)) {
text = " " + containerText;
}
}
}
setText(text);
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
setHorizontalTextPosition(SwingConstants.LEFT);
setBackground(isSelected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground());
setForeground(isSelected ? UIUtil.getListSelectionForeground() : UIUtil.getInactiveTextColor());
return component;
}
示例6: getContainerText
import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
protected String getContainerText(final PsiElement element, final String name) {
if (element instanceof NavigationItem) {
final ItemPresentation presentation = ((NavigationItem)element).getPresentation();
if (presentation != null) {
return presentation.getLocationString();
}
}
return null;
}