• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UsageViewBundle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.usageView.UsageViewBundle的典型用法代码示例。如果您正苦于以下问题:Java UsageViewBundle类的具体用法?Java UsageViewBundle怎么用?Java UsageViewBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UsageViewBundle类属于com.intellij.usageView包,在下文中一共展示了UsageViewBundle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: customizeCellRenderer

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@Override
public void customizeCellRenderer(@NotNull SliceUsageCellRendererBase renderer,
                                  @NotNull JTree tree,
                                  Object value,
                                  boolean selected,
                                  boolean expanded,
                                  boolean leaf,
                                  int row,
                                  boolean hasFocus) {
  Usage usage = getValue();
  renderer.append("Value: ", SimpleTextAttributes.REGULAR_ATTRIBUTES);

  if (usage instanceof UsageInfo2UsageAdapter) {
    PsiElement element = ((UsageInfo2UsageAdapter)usage).getElement();
    if (element == null) {
      renderer.append(UsageViewBundle.message("node.invalid") + " ", SliceUsageCellRenderer.ourInvalidAttributes);
    }
    else {
      appendElementText((UsageInfo2UsageAdapter)usage, element, renderer);
    }
  }
  else {
    renderer.append("Other", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SliceLeafValueRootNode.java


示例2: getPackageName

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
public static String getPackageName(PsiDirectory directory, boolean includeRootDir) {
  PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
  if (aPackage == null) {
    return directory.getVirtualFile().getPresentableUrl();
  }
  else {
    String packageName = getPackageName(aPackage);
    if (includeRootDir) {
      String rootDir = getRootDirectoryForPackage(directory);
      if (rootDir != null) {
        return UsageViewBundle.message("usage.target.package.in.directory", packageName, rootDir);
      }
    }
    return packageName;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaFindUsagesProvider.java


示例3: appendNodeText

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
private void appendNodeText(StringBuilder buf, DefaultMutableTreeNode node, String lineSeparator) {
  if (node instanceof Node && ((Node)node).isExcluded()) {
    buf.append("(").append(UsageViewBundle.message("usage.excluded")).append(") ");
  }

  if (node instanceof UsageNode) {
    TextChunk[] chunks = ((UsageNode)node).getUsage().getPresentation().getText();
    for (TextChunk chunk : chunks) {
      buf.append(chunk.getText());
    }
  }
  else if (node instanceof GroupNode) {
    UsageGroup group = ((GroupNode)node).getGroup();
    buf.append(group != null ? group.getText(myUsageView) : UsageViewBundle.message("usages.title"));
    buf.append(" ");
    int count = ((GroupNode)node).getRecursiveUsageCount();
    buf.append(" (").append(UsageViewBundle.message("usages.n", count)).append(")");
  }
  else if (node instanceof UsageTargetNode) {
    buf.append(((UsageTargetNode)node).getTarget().getPresentation().getPresentableText());
  }
  else {
    buf.append(node.toString());
  }
  buf.append(lineSeparator);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ExporterToTextFile.java


示例4: showTooManyUsagesWarning

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
public static void showTooManyUsagesWarning(@NotNull final Project project,
                                            @NotNull final TooManyUsagesStatus tooManyUsagesStatus,
                                            @NotNull final ProgressIndicator indicator,
                                            @NotNull final UsageViewPresentation presentation,
                                            final int usageCount,
                                            @Nullable final UsageViewImpl usageView) {
  UIUtil.invokeLaterIfNeeded(new Runnable() {
    @Override
    public void run() {
      if (usageView != null && usageView.searchHasBeenCancelled() || indicator.isCanceled()) return;
      String message = UsageViewBundle.message("find.excessive.usage.count.prompt", usageCount, StringUtil.pluralize(presentation.getUsagesWord()));
      UsageLimitUtil.Result ret = UsageLimitUtil.showTooManyUsagesWarning(project, message, presentation);
      if (ret == UsageLimitUtil.Result.ABORT) {
        if (usageView != null) {
          usageView.cancelCurrentSearch();
        }
        indicator.cancel();
      }
      tooManyUsagesStatus.userResponded();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:UsageViewManagerImpl.java


示例5: initChunks

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@NotNull
private TextChunk[] initChunks() {
  PsiFile psiFile = getPsiFile();
  Document document = psiFile == null ? null : PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
  TextChunk[] chunks;
  if (document == null) {
    // element over light virtual file
    PsiElement element = getElement();
    if (element == null) {
      chunks = new TextChunk[]{new TextChunk(SimpleTextAttributes.ERROR_ATTRIBUTES.toTextAttributes(), UsageViewBundle.message("node.invalid"))};
    }
    else {
      chunks = new TextChunk[] {new TextChunk(new TextAttributes(), element.getText())};
    }
  }
  else {
    chunks = ChunkExtractor.extractChunks(psiFile, this);
  }

  myTextChunks = new SoftReference<TextChunk[]>(chunks);
  return chunks;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:UsageInfo2UsageAdapter.java


示例6: getPlainText

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@Override
@NotNull
public String getPlainText() {
  int startOffset = getNavigationOffset();
  final PsiElement element = getElement();
  if (element != null && startOffset != -1) {
    final Document document = getDocument();
    if (document != null) {
      int lineNumber = document.getLineNumber(startOffset);
      int lineStart = document.getLineStartOffset(lineNumber);
      int lineEnd = document.getLineEndOffset(lineNumber);
      String prefixSuffix = null;

      if (lineEnd - lineStart > ChunkExtractor.MAX_LINE_LENGTH_TO_SHOW) {
        prefixSuffix = "...";
        lineStart = Math.max(startOffset - ChunkExtractor.OFFSET_BEFORE_TO_SHOW_WHEN_LONG_LINE, lineStart);
        lineEnd = Math.min(startOffset + ChunkExtractor.OFFSET_AFTER_TO_SHOW_WHEN_LONG_LINE, lineEnd);
      }
      String s = document.getCharsSequence().subSequence(lineStart, lineEnd).toString();
      if (prefixSuffix != null) s = prefixSuffix + s + prefixSuffix;
      return s;
    }
  }
  return UsageViewBundle.message("node.invalid");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:UsageInfo2UsageAdapter.java


示例7: collectData

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@NotNull
private static List<UsageNode> collectData(@NotNull List<Usage> usages,
                                           @NotNull Collection<UsageNode> visibleNodes,
                                           @NotNull UsageViewImpl usageView,
                                           @NotNull UsageViewPresentation presentation) {
  @NotNull List<UsageNode> data = new ArrayList<UsageNode>();
  int filtered = filtered(usages, usageView);
  if (filtered != 0) {
    data.add(createStringNode(UsageViewBundle.message("usages.were.filtered.out", filtered)));
  }
  data.addAll(visibleNodes);
  if (data.isEmpty()) {
    String progressText = StringUtil.escapeXml(UsageViewManagerImpl.getProgressTitle(presentation));
    data.add(createStringNode(progressText));
  }
  Collections.sort(data, USAGE_NODE_COMPARATOR);
  return data;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ShowUsagesAction.java


示例8: customizeCellRenderer

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@Override
  public void customizeCellRenderer(
  JTree tree,
  Object value,
  boolean selected,
  boolean expanded,
  boolean leaf,
  int row,
  boolean hasFocus
){
    PackageDependenciesNode node = (PackageDependenciesNode)value;
    if (node.isValid()) {
      setIcon(node.getIcon());
    } else {
      append(UsageViewBundle.message("node.invalid") + " ", SimpleTextAttributes.ERROR_ATTRIBUTES);
    }
    append(node.toString(), node.hasMarked() && !selected ? SimpleTextAttributes.ERROR_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
    append(node.getPresentableFilesCount(), SimpleTextAttributes.GRAYED_ATTRIBUTES);
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DependenciesPanel.java


示例9: createUsageViewDescriptor

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@NotNull
@Override
protected UsageViewDescriptor createUsageViewDescriptor(@NotNull UsageInfo[] usages) {
  return new UsageViewDescriptorAdapter() {
    @NotNull
    @Override
    public PsiElement[] getElements() {
      return new PsiElement[]{myStyleTag};
    }

    @Override
    public String getProcessedElementsHeader() {
      return "Style to use";
    }

    @Override
    public String getCodeReferencesText(int usagesCount, int filesCount) {
      return "Tags the reference to the style will be added to " +
             UsageViewBundle.getOccurencesString(usagesCount, filesCount);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AndroidFindStyleApplicationsProcessor.java


示例10: createUsageViewDescriptor

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@NotNull
@Override
protected UsageViewDescriptor createUsageViewDescriptor(@NotNull UsageInfo[] usages) {
  return new UsageViewDescriptorAdapter() {
    @NotNull
    @Override
    public PsiElement[] getElements() {
      return new PsiElement[]{myLayoutFile};
    }

    @Override
    public String getCodeReferencesText(int usagesCount, int filesCount) {
      return "References to be inlined" + UsageViewBundle.getReferencesString(usagesCount, filesCount);
    }

    @Override
    public String getProcessedElementsHeader() {
      return "Layout file to inline";
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AndroidInlineLayoutProcessor.java


示例11: createUsageViewDescriptor

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@NotNull
@Override
protected UsageViewDescriptor createUsageViewDescriptor(@NotNull UsageInfo[] usages) {
  return new UsageViewDescriptorAdapter() {
    @NotNull
    @Override
    public PsiElement[] getElements() {
      return new PsiElement[]{myStyleElement};
    }

    @Override
    public String getCodeReferencesText(int usagesCount, int filesCount) {
      return "References to be inlined" + UsageViewBundle.getReferencesString(usagesCount, filesCount);
    }

    @Override
    public String getProcessedElementsHeader() {
      return "Style to inline";
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AndroidInlineAllStyleUsagesProcessor.java


示例12: customizeCellRenderer

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@Override
public void customizeCellRenderer(SliceUsageCellRenderer renderer,
                                  JTree tree,
                                  Object value,
                                  boolean selected,
                                  boolean expanded,
                                  boolean leaf,
                                  int row,
                                  boolean hasFocus) {
  Usage usage = getValue();
  renderer.append("Value: ", SimpleTextAttributes.REGULAR_ATTRIBUTES);

  if (usage instanceof UsageInfo2UsageAdapter) {
    PsiElement element = ((UsageInfo2UsageAdapter)usage).getElement();
    if (element == null) {
      renderer.append(UsageViewBundle.message("node.invalid") + " ", SliceUsageCellRenderer.ourInvalidAttributes);
    }
    else {
      appendElementText((UsageInfo2UsageAdapter)usage, element, renderer);
    }
  }
  else {
    renderer.append("Other", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:SliceLeafValueRootNode.java


示例13: MyPanel

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
private MyPanel(@NotNull JTree tree) {
  mySupport = new OccurenceNavigatorSupport(tree) {
    @Override
    protected Navigatable createDescriptorForNode(DefaultMutableTreeNode node) {
      if (node.getChildCount() > 0) return null;
      return getNavigatableForNode(node);
    }

    @Override
    public String getNextOccurenceActionName() {
      return UsageViewBundle.message("action.next.occurrence");
    }

    @Override
    public String getPreviousOccurenceActionName() {
      return UsageViewBundle.message("action.previous.occurrence");
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:UsageViewImpl.java


示例14: showTooManyUsagesWarning

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
public static void showTooManyUsagesWarning(@NotNull final Project project,
                                            @NotNull final TooManyUsagesStatus tooManyUsagesStatus,
                                            @NotNull final ProgressIndicator indicator,
                                            final int usageCount,
                                            final UsageViewImpl usageView) {
  UIUtil.invokeLaterIfNeeded(new Runnable() {
    @Override
    public void run() {
      if (usageView != null && usageView.searchHasBeenCancelled() || indicator.isCanceled()) return;
      String message = UsageViewBundle.message("find.excessive.usage.count.prompt", usageCount);
      UsageLimitUtil.Result ret = UsageLimitUtil.showTooManyUsagesWarning(project, message);
      if (ret == UsageLimitUtil.Result.ABORT && usageView != null) {
        usageView.setCurrentSearchCancelled(true);
        indicator.cancel();
      }
      tooManyUsagesStatus.userResponded();
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:UsageViewManagerImpl.java


示例15: collectData

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@NotNull
private static List<UsageNode> collectData(@NotNull List<Usage> usages,
                                           @NotNull Collection<UsageNode> visibleNodes,
                                           @NotNull UsageViewImpl usageView,
                                           @NotNull UsageViewPresentation presentation) {
  @NotNull List<UsageNode> data = new ArrayList<UsageNode>();
  int filtered = filtered(usages, usageView);
  if (filtered != 0) {
    data.add(createStringNode(UsageViewBundle.message("usages.were.filtered.out", filtered)));
  }
  data.addAll(visibleNodes);
  if (data.isEmpty()) {
    String progressText = UsageViewManagerImpl.getProgressTitle(presentation);
    data.add(createStringNode(progressText));
  }
  Collections.sort(data, USAGE_NODE_COMPARATOR);
  return data;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ShowUsagesAction.java


示例16: getNodeText

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@NotNull
public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
  if (element instanceof XmlTag) {
    final XmlTag xmlTag = (XmlTag)element;
    final PsiMetaData metaData = xmlTag.getMetaData();
    final String name = metaData != null ? DescriptiveNameUtil.getMetaDataName(metaData) : xmlTag.getName();
    return UsageViewBundle.message("usage.target.xml.tag.of.file", metaData == null ? "<" + name + ">" : name, xmlTag.getContainingFile().getName());
  }
  else if (element instanceof XmlAttributeValue) {
    return ((XmlAttributeValue)element).getValue();
  }
  if (element instanceof PsiNamedElement) {
    return ((PsiNamedElement)element).getName();
  } else {
    return element.getText();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:XmlFindUsagesProvider.java


示例17: collectData

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@NotNull
private static List<UsageNode> collectData(@NotNull List<Usage> usages,
    @NotNull Collection<UsageNode> visibleNodes, @NotNull UsageViewImpl usageView,
    @NotNull UsageViewPresentation presentation) {
  @NotNull List<UsageNode> data = new ArrayList<UsageNode>();
  int filtered = filtered(usages, usageView);
  if (filtered != 0) {
    data.add(createStringNode(UsageViewBundle.message("usages.were.filtered.out", filtered)));
  }
  data.addAll(visibleNodes);
  if (data.isEmpty()) {
    String progressText = UsageViewManagerImpl.getProgressTitle(presentation);
    data.add(createStringNode(progressText));
  }
  Collections.sort(data, USAGE_NODE_COMPARATOR);
  return data;
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:18,代码来源:ShowUsagesAction.java


示例18: showTooManyUsagesWarning

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@Nonnull
public static Result showTooManyUsagesWarning(@Nonnull final Project project,
                                              @Nonnull final String message,
                                              @Nonnull final UsageViewPresentation usageViewPresentation) {
  final String[] buttons = {UsageViewBundle.message("button.text.continue"), UsageViewBundle.message("button.text.abort")};
  int result = runOrInvokeAndWait(new Computable<Integer>() {
    @Override
    public Integer compute() {
      String title = UsageViewBundle.message("find.excessive.usages.title", StringUtil.capitalize(StringUtil.pluralize(usageViewPresentation.getUsagesWord())));
      return Messages.showOkCancelDialog(project, message,
                                         title, buttons[0], buttons[1],
                                         Messages.getWarningIcon());
    }
  });
  return result == Messages.OK ? Result.CONTINUE : Result.ABORT;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:UsageLimitUtil.java


示例19: showTooManyUsagesWarning

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
public static void showTooManyUsagesWarning(@Nonnull final Project project,
                                            @Nonnull final TooManyUsagesStatus tooManyUsagesStatus,
                                            @Nonnull final ProgressIndicator indicator,
                                            @Nonnull final UsageViewPresentation presentation,
                                            final int usageCount,
                                            @Nullable final UsageViewImpl usageView) {
  UIUtil.invokeLaterIfNeeded(() -> {
    if (usageView != null && usageView.searchHasBeenCancelled() || indicator.isCanceled()) return;
    int shownUsageCount = usageView == null ? usageCount : usageView.getRoot().getRecursiveUsageCount();
    String message = UsageViewBundle.message("find.excessive.usage.count.prompt", shownUsageCount, StringUtil.pluralize(presentation.getUsagesWord()));
    UsageLimitUtil.Result ret = UsageLimitUtil.showTooManyUsagesWarning(project, message, presentation);
    if (ret == UsageLimitUtil.Result.ABORT) {
      if (usageView != null) {
        usageView.cancelCurrentSearch();
      }
      indicator.cancel();
    }
    tooManyUsagesStatus.userResponded();
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:UsageViewManagerImpl.java


示例20: initChunks

import com.intellij.usageView.UsageViewBundle; //导入依赖的package包/类
@Nonnull
private TextChunk[] initChunks() {
  PsiFile psiFile = getPsiFile();
  Document document = psiFile == null ? null : PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
  TextChunk[] chunks;
  if (document == null) {
    // element over light virtual file
    PsiElement element = getElement();
    if (element == null) {
      chunks = new TextChunk[]{new TextChunk(SimpleTextAttributes.ERROR_ATTRIBUTES.toTextAttributes(), UsageViewBundle.message("node.invalid"))};
    }
    else {
      chunks = new TextChunk[]{new TextChunk(new TextAttributes(), element.getText())};
    }
  }
  else {
    chunks = ChunkExtractor.extractChunks(psiFile, this);
  }

  myTextChunks = new SoftReference<>(chunks);
  return chunks;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:UsageInfo2UsageAdapter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WriterRepresentation类代码示例发布时间:2022-05-22
下一篇:
Java ExceptionUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap