当前位置: 首页>>代码示例>>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;未经允许,请勿转载。