當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。