本文整理汇总了Java中com.intellij.usageView.UsageViewBundle类的典型用法代码示例。如果您正苦于以下问题:Java UsageViewBundle类的具体用法?Java UsageViewBundle怎么用?Java UsageViewBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UsageViewBundle类属于com.intellij.usageView包,在下文中一共展示了UsageViewBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
}
示例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);
}
示例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();
}
});
}
示例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;
}
示例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");
}
示例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;
}
示例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);
}
示例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);
}
};
}
示例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";
}
};
}
示例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";
}
};
}
示例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);
}
}
示例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");
}
};
}
示例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();
}
});
}
示例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;
}