当前位置: 首页>>代码示例>>Java>>正文


Java ItemPresentation.getPresentableText方法代码示例

本文整理汇总了Java中com.intellij.navigation.ItemPresentation.getPresentableText方法的典型用法代码示例。如果您正苦于以下问题:Java ItemPresentation.getPresentableText方法的具体用法?Java ItemPresentation.getPresentableText怎么用?Java ItemPresentation.getPresentableText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.navigation.ItemPresentation的用法示例。


在下文中一共展示了ItemPresentation.getPresentableText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateImpl

import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
  final PyElement value = getValue();
  final String name = value.getName();
  final ItemPresentation presentation = value.getPresentation();
  String presentableText = name != null ? name : PyNames.UNNAMED_ELEMENT;
  Icon presentableIcon = value.getIcon(0);
  if (presentation != null) {
    final String text = presentation.getPresentableText();
    if (text != null) {
      presentableText = text;
    }
    final Icon icon = presentation.getIcon(false);
    if (icon != null) {
      presentableIcon = icon;
    }
  }
  data.setPresentableText(presentableText);
  data.setIcon(presentableIcon);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyElementNode.java

示例2: getPresentableText

import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
@Nullable
@Override
public String getPresentableText() {
  final NavigatablePsiElement element = getElement();
  final ItemPresentation presentation = element == null ? null : element.getPresentation();
  return presentation == null ? null : presentation.getPresentableText();
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:8,代码来源:AppleScriptStructureViewElement.java

示例3: computeUsages

import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
@Override
public void computeUsages(final List<PsiClass> classes) {
  for (PsiMethod method : myClass.getMethods()) {
    List<HierarchicalMethodSignature> superSignatures = method.getHierarchicalMethodSignature().getSuperSignatures();
    for (HierarchicalMethodSignature superSignature : superSignatures) {
      PsiClass containingClass = superSignature.getMethod().getContainingClass();
      if (containingClass == null) continue;
      for (PsiClass classToAnalyze : classes) {
        if (InheritanceUtil.isInheritorOrSelf(classToAnalyze, containingClass, true)) {
          PsiIdentifier identifier = method.getNameIdentifier();
          if (identifier != null) {
            addOccurrence(identifier);
            break;
          }
        }
      }
    }
  }
  if (myReadUsages.isEmpty()) {
    if (ApplicationManager.getApplication().isUnitTestMode()) return;
    String name;
    if (classes.size() == 1) {
      final ItemPresentation presentation = classes.get(0).getPresentation();
      name = presentation != null ? presentation.getPresentableText() : "";
    }
    else {
      name = "";
    }
    myHintText = CodeInsightBundle.message("no.methods.overriding.0.are.found", classes.size(), name);
  }
  else {
    addOccurrence(myTarget);
    final int methodCount = myReadUsages.size()-1;  // exclude 'target' keyword
    myStatusText = CodeInsightBundle.message("status.bar.overridden.methods.highlighted.message", methodCount,
                                                                      HighlightUsagesHandler.getShortcutText());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:HighlightOverridingMethodsHandler.java

示例4: getSymbolPresentableText

import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
public static String getSymbolPresentableText(@NotNull PsiElement element) {
  if (element instanceof NavigationItem) {
    final ItemPresentation presentation = ((NavigationItem)element).getPresentation();
    if (presentation != null){
      return presentation.getPresentableText();
    }
  }

  if (element instanceof PsiNamedElement) return ((PsiNamedElement)element).getName();
  return element.getText();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SymbolPresentationUtil.java

示例5: 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

示例6: doGenerateInfo

import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
@Nullable
private static String doGenerateInfo(@NotNull PsiElement element,
                                     @NotNull PsiElement atPointer,
                                     @NotNull DocumentationProvider documentationProvider)
{
  String info = documentationProvider.getQuickNavigateInfo(element, atPointer);
  if (info != null) {
    return info;
  }

  if (element instanceof PsiFile) {
    final VirtualFile virtualFile = ((PsiFile)element).getVirtualFile();
    if (virtualFile != null) {
      return virtualFile.getPresentableUrl();
    }
  }

  info = getQuickNavigateInfo(element);
  if (info != null) {
    return info;
  }

  if (element instanceof NavigationItem) {
    final ItemPresentation presentation = ((NavigationItem)element).getPresentation();
    if (presentation != null) {
      return presentation.getPresentableText();
    }
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:CtrlMouseHandler.java

示例7: update

import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
private void update(PsiElement element) {
  if (element != null && element.isValid()) {
    final ItemPresentation presentation = ((NavigationItem)element).getPresentation();
    myIconOpen = presentation == null ? null : ComputableIcon.create(presentation, true);
    myIconClosed = presentation == null ? null : ComputableIcon.create(presentation, false);
    myPresentableText = presentation == null ? UsageViewUtil.createNodeText(element) : presentation.getPresentableText();
    if (myIconOpen == null || myIconClosed == null) {
      if (element instanceof PsiMetaOwner) {
        final PsiMetaOwner psiMetaOwner = (PsiMetaOwner)element;
        final PsiMetaData metaData = psiMetaOwner.getMetaData();
        if (metaData instanceof PsiPresentableMetaData) {
          final PsiPresentableMetaData psiPresentableMetaData = (PsiPresentableMetaData)metaData;
          if (myIconOpen == null) myIconOpen = ComputableIcon.create(psiPresentableMetaData);
          if (myIconClosed == null) myIconClosed = ComputableIcon.create(psiPresentableMetaData);
        }
      }
      else if (element instanceof PsiFile) {
        final PsiFile psiFile = (PsiFile)element;
        final VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile != null) {
          myIconOpen = ComputableIcon.create(virtualFile);
          myIconClosed = ComputableIcon.create(virtualFile);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:PsiElement2UsageTargetAdapter.java

示例8: getPresentation

import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
@NotNull
@Override
public ItemPresentation getPresentation() {
  ItemPresentation presentation = SchemaPresentationUtil.getPresentation(element, true);
  // remove location
  return new StaticItemPresentation(
      presentation.getPresentableText(),
      null,
      presentation.getIcon(false)
  );
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:12,代码来源:SchemaStructureViewElement.java

示例9: getPresentation

import com.intellij.navigation.ItemPresentation; //导入方法依赖的package包/类
@NotNull
@Override
public ItemPresentation getPresentation() {
  final ItemPresentation presentation = myElement.getPresentation();
  return new ColoredItemPresentation() {
    @Nullable
    @Override
    public String getPresentableText() {
      if (myElement instanceof PyFile) {
        return myElement.getName();
      }
      return presentation != null ? presentation.getPresentableText() : PyNames.UNNAMED_ELEMENT;
    }

    @Nullable
    @Override
    public TextAttributesKey getTextAttributesKey() {
      if (isInherited()) {
        return CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES;
      }
      return null;
    }

    @Nullable
    @Override
    public String getLocationString() {
      return null;
    }

    @Nullable
    @Override
    public Icon getIcon(boolean open) {
      Icon normal_icon = myElement.getIcon(0);
      if (myIcon != null) normal_icon = myIcon; // override normal
      if (myVisibility == Visibility.NORMAL) {
        return normal_icon;
      }
      else {
        LayeredIcon icon = new LayeredIcon(2);
        icon.setIcon(normal_icon, 0);
        Icon overlay = null;
        if (myVisibility == Visibility.PRIVATE || myVisibility == Visibility.PROTECTED) {
          overlay = PythonIcons.Python.Nodes.Lock;
        }
        else if (myVisibility == Visibility.PREDEFINED) {
          overlay = PythonIcons.Python.Nodes.Cyan_dot;
        }
        else if (myVisibility == Visibility.INVISIBLE) {
          overlay = PythonIcons.Python.Nodes.Red_inv_triangle;
        }
        if (overlay != null) {
          icon.setIcon(overlay, 1);
        }
        return icon;
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:59,代码来源:PyStructureViewElement.java


注:本文中的com.intellij.navigation.ItemPresentation.getPresentableText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。