當前位置: 首頁>>代碼示例>>Java>>正文


Java ItemPresentation.getLocationString方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:SymbolPresentationUtil.java

示例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;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:ImplementationViewComponent.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:GotoTargetHandler.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:Bookmark.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:PlatformModuleRendererFactory.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:PyElementListCellRenderer.java


注:本文中的com.intellij.navigation.ItemPresentation.getLocationString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。