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


Java UsageViewBundle.message方法代码示例

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


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

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

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

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

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

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

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

示例7: getFullTitle

import com.intellij.usageView.UsageViewBundle; //导入方法依赖的package包/类
@Nonnull
private static String getFullTitle(@Nonnull List<Usage> usages,
                                   @Nonnull String title,
                                   boolean hadMoreSeparator,
                                   int visibleNodesCount,
                                   boolean findUsagesInProgress) {
  String s;
  String soFarSuffix = findUsagesInProgress ? " so far" : "";
  if (hadMoreSeparator) {
    s = "<b>Some</b> " + title + " " + "<b>(Only " + visibleNodesCount + " usages shown" + soFarSuffix + ")</b>";
  }
  else {
    s = title + " (" + UsageViewBundle.message("usages.n", usages.size()) + soFarSuffix + ")";
  }
  return "<html><nobr>" + s + "</nobr></html>";
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ShowUsagesAction.java

示例8: getPlainText

import com.intellij.usageView.UsageViewBundle; //导入方法依赖的package包/类
@Override
@Nonnull
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:consulo,项目名称:consulo,代码行数:26,代码来源:UsageInfo2UsageAdapter.java

示例9: 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:consulo,项目名称:consulo-java,代码行数:22,代码来源:JavaFindUsagesProvider.java

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

示例11: getLongDescriptiveName

import com.intellij.usageView.UsageViewBundle; //导入方法依赖的package包/类
@NotNull
@Override
public String getLongDescriptiveName() {
  SearchScope searchScope = myOptions.searchScope;
  String scopeString = searchScope.getDisplayName();
  PsiElement psiElement = getElement();

  return psiElement == null ? UsageViewBundle.message("node.invalid") :
         FindBundle.message("recent.find.usages.action.popup", StringUtil.capitalize(UsageViewUtil.getType(psiElement)),
                            DescriptiveNameUtil.getDescriptiveName(psiElement),
                            scopeString
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PsiElement2UsageTargetAdapter.java

示例12: 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;
      if (node instanceof Node && ((Node)node).isExcluded()) 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");
    }
  };
  myCopyProvider = new TextCopyProvider() {
    @Nullable
    @Override
    public Collection<String> getTextLinesToCopy() {
      final Node[] selectedNodes = getSelectedNodes();
      if (selectedNodes != null && selectedNodes.length > 0) {
        ArrayList<String> lines = ContainerUtil.newArrayList();
        for (Node node : selectedNodes) {
          lines.add(node.getText(UsageViewImpl.this));
        }
        return lines;
      }
      return null;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:UsageViewImpl.java

示例13: notifyByFindBalloon

import com.intellij.usageView.UsageViewBundle; //导入方法依赖的package包/类
private static void notifyByFindBalloon(@Nullable final HyperlinkListener listener,
                                        @NotNull final MessageType info,
                                        @NotNull FindUsagesProcessPresentation processPresentation,
                                        @NotNull final Project project,
                                        @NotNull final List<String> lines) {
  com.intellij.usageView.UsageViewManager.getInstance(project); // in case tool window not registered

  final Collection<VirtualFile> largeFiles = processPresentation.getLargeFiles();
  List<String> resultLines = new ArrayList<String>(lines);
  HyperlinkListener resultListener = listener;
  if (!largeFiles.isEmpty()) {
    String shortMessage = "(<a href='" + LARGE_FILES_HREF_TARGET + "'>"
                          + UsageViewBundle.message("large.files.were.ignored", largeFiles.size()) + "</a>)";

    resultLines.add(shortMessage);
    resultListener = addHrefHandling(resultListener, LARGE_FILES_HREF_TARGET, new Runnable() {
      @Override
      public void run() {
        String detailedMessage = detailedLargeFilesMessage(largeFiles);
        List<String> strings = new ArrayList<String>(lines);
        strings.add(detailedMessage);
        //noinspection SSBasedInspection
        ToolWindowManager.getInstance(project).notifyByBalloon(ToolWindowId.FIND, info, wrapInHtml(strings), AllIcons.Actions.Find, listener);
      }
    });
  }

  Runnable searchIncludingProjectFileUsages = processPresentation.searchIncludingProjectFileUsages();
  if (searchIncludingProjectFileUsages != null) {
    resultLines.add("Occurrences in project configuration files are skipped. " +
                    "<a href='" + SHOW_PROJECT_FILE_OCCURRENCES_HREF_TARGET + "'>Include them</a>");
    resultListener = addHrefHandling(resultListener, SHOW_PROJECT_FILE_OCCURRENCES_HREF_TARGET, searchIncludingProjectFileUsages);
  }

  //noinspection SSBasedInspection
  ToolWindowManager.getInstance(project).notifyByBalloon(ToolWindowId.FIND, info, wrapInHtml(resultLines), AllIcons.Actions.Find, resultListener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:SearchForUsagesRunnable.java

示例14: updateLayoutLater

import com.intellij.usageView.UsageViewBundle; //导入方法依赖的package包/类
@Override
public void updateLayoutLater(@Nullable final List<UsageInfo> infos) {
  PsiElement element = infos == null ? null : getElementToSliceOn(infos);
  if (myBrowser instanceof Disposable) {
    Disposer.dispose((Disposable)myBrowser);
    myBrowser = null;
  }
  if (element != null) {
    myBrowser = createCallHierarchyPanel(element);
    if (myBrowser == null) {
      element = null;
    }
  }

  removeAll();
  if (element == null) {
    JComponent titleComp = new JLabel(UsageViewBundle.message("select.the.usage.to.preview", myPresentation.getUsagesWord()), SwingConstants.CENTER);
    add(titleComp, BorderLayout.CENTER);
    revalidate();
  }
  else {
    if (myBrowser instanceof Disposable) {
      Disposer.register(this, (Disposable)myBrowser);
    }
    JComponent panel = myBrowser.getComponent();
    add(panel, BorderLayout.CENTER);
    revalidate();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:UsageContextCallHierarchyPanel.java

示例15: getFullTitle

import com.intellij.usageView.UsageViewBundle; //导入方法依赖的package包/类
@NotNull
private static String getFullTitle(@NotNull List<Usage> usages,
                                   @NotNull String title,
                                   boolean hadMoreSeparator,
                                   int visibleNodesCount,
                                   boolean findUsagesInProgress) {
  String s;
  if (hadMoreSeparator) {
    s = "<b>Some</b> " + title + " " + "<b>(Only " + visibleNodesCount + " usages shown" +(findUsagesInProgress ? " so far" : "")+")</b>";
  }
  else {
    s = title + " (" + UsageViewBundle.message("usages.n", usages.size()) + (findUsagesInProgress ? " so far" : "") + ")";
  }
  return "<html><nobr>" + s + "</nobr></html>";
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:ShowUsagesAction.java


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