本文整理汇总了Java中com.intellij.usages.UsageViewPresentation.setCodeUsagesString方法的典型用法代码示例。如果您正苦于以下问题:Java UsageViewPresentation.setCodeUsagesString方法的具体用法?Java UsageViewPresentation.setCodeUsagesString怎么用?Java UsageViewPresentation.setCodeUsagesString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.usages.UsageViewPresentation
的用法示例。
在下文中一共展示了UsageViewPresentation.setCodeUsagesString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showObjectUpcastedUsageView
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
private void showObjectUpcastedUsageView(final ObjectUpcastedUsageInfo[] usages) {
UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setTargetsNodeText(RefactoringBundle.message("replacing.inheritance.with.delegation"));
presentation.setCodeUsagesString(RefactoringBundle.message("instances.casted.to.java.lang.object"));
final String upcastedString = RefactoringBundle.message("instances.upcasted.to.object");
presentation.setUsagesString(upcastedString);
presentation.setTabText(upcastedString);
UsageViewManager manager = UsageViewManager.getInstance(myProject);
manager.showUsages(
new UsageTarget[]{new PsiElement2UsageTargetAdapter(myClass)},
UsageInfoToUsageConverter.convert(new PsiElement[]{myClass}, usages),
presentation
);
WindowManager.getInstance().getStatusBar(myProject).setInfo(RefactoringBundle.message("instances.upcasted.to.java.lang.object.found"));
}
示例2: showConflicts
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
/**
* Shows a panel with name redefinition conflicts, if needed.
* @param project
* @param conflicts what {@link #findDefinitions} would return
* @param obscured name or its topmost qualifier that is obscured, used at top of pane.
* @param name full name (maybe qualified) to show as obscured and display as qualifier in "would be" chunks.
* @return true iff conflicts is not empty and the panel is shown.
*/
public static boolean showConflicts(Project project, List<Pair<PsiElement, PsiElement>> conflicts, String obscured, @Nullable String name) {
if (conflicts.size() > 0) {
Usage[] usages = new Usage[conflicts.size()];
int i = 0;
for (Pair<PsiElement, PsiElement> pair : conflicts) {
usages[i] = new NameUsage(pair.getFirst(), pair.getSecond(), name != null? name : obscured, name != null);
i += 1;
}
UsageViewPresentation prsnt = new UsageViewPresentation();
prsnt.setTabText(PyBundle.message("CONFLICT.name.$0.obscured", obscured));
prsnt.setCodeUsagesString(PyBundle.message("CONFLICT.name.$0.obscured.cannot.convert", obscured));
prsnt.setUsagesWord(PyBundle.message("CONFLICT.occurrence.sing"));
prsnt.setUsagesString(PyBundle.message("CONFLICT.occurrence.pl"));
UsageViewManager.getInstance(project).showUsages(UsageTarget.EMPTY_ARRAY, usages, prsnt);
return true;
}
return false;
}
示例3: showObjectUpcastedUsageView
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
private void showObjectUpcastedUsageView(final ObjectUpcastedUsageInfo[] usages) {
UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setTargetsNodeText(RefactoringBundle.message("replacing.inheritance.with.delegation"));
presentation.setCodeUsagesString(RefactoringBundle.message("instances.casted.to.java.lang.object"));
final String upcastedString = RefactoringBundle.message("instances.upcasted.to.object");
presentation.setUsagesString(upcastedString);
presentation.setTabText(upcastedString);
UsageViewManager manager = UsageViewManager.getInstance(myProject);
manager.showUsages(
new UsageTarget[]{new PsiElement2UsageTargetAdapter(myClass)},
UsageInfoToUsageConverter.convert(new UsageInfoToUsageConverter.TargetElementsDescriptor(myClass), usages),
presentation
);
WindowManager.getInstance().getStatusBar(myProject).setInfo(RefactoringBundle.message("instances.upcasted.to.java.lang.object.found"));
}
示例4: configure
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
public void configure(@NotNull UsageViewPresentation presentation) {
final String pattern = myConfiguration.getMatchOptions().getSearchPattern();
final String scopeText = myConfiguration.getMatchOptions().getScope().getDisplayName();
presentation.setScopeText(scopeText);
final String usagesString = SSRBundle.message("occurrences.of", pattern);
presentation.setUsagesString(usagesString);
presentation.setTabText(StringUtil.shortenTextWithEllipsis(usagesString, 60, 0, false));
presentation.setUsagesWord(SSRBundle.message("occurrence"));
presentation.setCodeUsagesString(SSRBundle.message("found.occurrences", scopeText));
presentation.setTargetsNodeText(SSRBundle.message("targets.node.text"));
presentation.setCodeUsages(false);
}
示例5: setupViewPresentation
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
@NotNull
public static UsageViewPresentation setupViewPresentation(final boolean toOpenInNewTab, @NotNull FindModel findModel) {
final UsageViewPresentation presentation = new UsageViewPresentation();
final String scope = getTitleForScope(findModel);
final String stringToFind = findModel.getStringToFind();
presentation.setScopeText(scope);
if (stringToFind.isEmpty()) {
presentation.setTabText("Files");
presentation.setToolwindowTitle(BundleBase.format("Files in {0}", scope));
presentation.setUsagesString("files");
}
else {
FindModel.SearchContext searchContext = findModel.getSearchContext();
String contextText = "";
if (searchContext != FindModel.SearchContext.ANY) {
contextText = FindBundle.message("find.context.presentation.scope.label", FindDialog.getPresentableName(searchContext));
}
presentation.setTabText(FindBundle.message("find.usage.view.tab.text", stringToFind, contextText));
presentation.setToolwindowTitle(FindBundle.message("find.usage.view.toolwindow.title", stringToFind, scope, contextText));
presentation.setUsagesString(FindBundle.message("find.usage.view.usages.text", stringToFind));
presentation.setUsagesWord(FindBundle.message("occurrence"));
presentation.setCodeUsagesString(FindBundle.message("found.occurrences"));
presentation.setContextText(contextText);
}
presentation.setOpenInNewTab(toOpenInNewTab);
presentation.setCodeUsages(false);
presentation.setUsageTypeFilteringAvailable(true);
return presentation;
}
示例6: setupViewPresentation
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
@Nonnull
public static UsageViewPresentation setupViewPresentation(final boolean toOpenInNewTab, @Nonnull FindModel findModel) {
final UsageViewPresentation presentation = new UsageViewPresentation();
final String scope = getTitleForScope(findModel);
final String stringToFind = findModel.getStringToFind();
presentation.setScopeText(scope);
if (stringToFind.isEmpty()) {
presentation.setTabText("Files");
presentation.setToolwindowTitle(BundleBase.format("Files in {0}", scope));
presentation.setUsagesString("files");
}
else {
FindModel.SearchContext searchContext = findModel.getSearchContext();
String contextText = "";
if (searchContext != FindModel.SearchContext.ANY) {
contextText = FindBundle.message("find.context.presentation.scope.label", FindDialog.getPresentableName(searchContext));
}
presentation.setTabText(FindBundle.message("find.usage.view.tab.text", stringToFind, contextText));
presentation.setToolwindowTitle(FindBundle.message("find.usage.view.toolwindow.title", stringToFind, scope, contextText));
presentation.setUsagesString(FindBundle.message("find.usage.view.usages.text", stringToFind));
presentation.setUsagesWord(FindBundle.message("occurrence"));
presentation.setCodeUsagesString(FindBundle.message("found.occurrences"));
presentation.setContextText(contextText);
}
presentation.setOpenInNewTab(toOpenInNewTab);
presentation.setCodeUsages(false);
presentation.setUsageTypeFilteringAvailable(true);
return presentation;
}