本文整理汇总了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;
}
}
示例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");
}
示例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;
}
示例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();
}
}
示例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");
}
};
}
示例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;
}
示例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>";
}
示例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");
}
示例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;
}
}
示例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;
}
示例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
);
}
示例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;
}
};
}
示例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);
}
示例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();
}
}
示例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>";
}