本文整理匯總了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;
}