本文整理汇总了Java中com.intellij.usages.UsageViewPresentation.setTabText方法的典型用法代码示例。如果您正苦于以下问题:Java UsageViewPresentation.setTabText方法的具体用法?Java UsageViewPresentation.setTabText怎么用?Java UsageViewPresentation.setTabText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.usages.UsageViewPresentation
的用法示例。
在下文中一共展示了UsageViewPresentation.setTabText方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setupViewPresentation
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
@NotNull
public static UsageViewPresentation setupViewPresentation(final boolean toOpenInNewTab, @NotNull final FindModel findModelCopy) {
final UsageViewPresentation presentation = new UsageViewPresentation();
final String scope = getTitleForScope(findModelCopy);
final String stringToFind = findModelCopy.getStringToFind();
presentation.setScopeText(scope);
if (stringToFind.isEmpty()) {
presentation.setTabText("Files");
presentation.setToolwindowTitle(BundleBase.format("Files in ''{0}''", scope));
presentation.setUsagesString("files");
}
else {
presentation.setTabText(FindBundle.message("find.usage.view.tab.text", stringToFind));
presentation.setToolwindowTitle(FindBundle.message("find.usage.view.toolwindow.title", stringToFind, scope));
presentation.setUsagesString(FindBundle.message("find.usage.view.usages.text", stringToFind));
}
presentation.setOpenInNewTab(toOpenInNewTab);
presentation.setCodeUsages(false);
return presentation;
}
示例5: actionPerformed
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setTabName("Statics");
presentation.setTabText("Statitcs");
final UsageView view = UsageViewManager.getInstance(project).showUsages(UsageTarget.EMPTY_ARRAY, new Usage[0], presentation);
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Searching icons usages") {
@Override
public void run(@NotNull ProgressIndicator indicator) {
JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
GlobalSearchScope all = GlobalSearchScope.allScope(project);
PsiClass allIcons = facade.findClass("com.intellij.icons.AllIcons", all);
searchFields(allIcons, view, indicator);
for (PsiClass iconsClass : facade.findPackage("icons").getClasses(all)) {
searchFields(iconsClass, view, indicator);
}
}
});
}
示例6: 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);
}
示例7: 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;
}
示例8: 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;
}
示例9: invoke
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
@Override
public void invoke(@NotNull Project project, @NotNull PsiFile file, @NotNull PsiElement startElement, @NotNull PsiElement endElement)
{
PsiParameter p = (PsiParameter) startElement;
final PsiMethod method = PsiTreeUtil.getParentOfType(p, PsiMethod.class);
if(method == null)
{
return;
}
final int parameterIdx = ArrayUtil.find(method.getParameterList().getParameters(), p);
if(parameterIdx < 0)
{
return;
}
UsageViewPresentation presentation = new UsageViewPresentation();
String title = InspectionsBundle.message("nullable.stuff.inspection.navigate.null.argument.usages.view.name", p.getName());
presentation.setUsagesString(title);
presentation.setTabName(title);
presentation.setTabText(title);
UsageViewManager.getInstance(project).searchAndShowUsages(new UsageTarget[]{new PsiElement2UsageTargetAdapter(method.getParameterList().getParameters()[parameterIdx])}, () -> new
UsageSearcher()
{
@Override
public void generate(@NotNull final Processor<Usage> processor)
{
ReadAction.run(() -> JavaNullMethodArgumentUtil.searchNullArgument(method, parameterIdx, (arg) -> processor.process(new UsageInfo2UsageAdapter(new UsageInfo(arg)))));
}
}, false, false, presentation, null);
}
示例10: showUsageView
import com.intellij.usages.UsageViewPresentation; //导入方法依赖的package包/类
private void showUsageView(@NotNull Project project, final UsageInfo[] usageInfos, @NotNull AnalysisScope scope)
{
final UsageTarget[] targets = UsageTarget.EMPTY_ARRAY;
final Ref<Usage[]> convertUsagesRef = new Ref<>();
if(!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> convertUsagesRef.set(UsageInfo2UsageAdapter.convert
(usageInfos))), "Preprocess Usages", true, project))
{
return;
}
if(convertUsagesRef.isNull())
{
return;
}
final Usage[] usages = convertUsagesRef.get();
final UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setTabText("Infer Nullity Preview");
presentation.setShowReadOnlyStatusAsRed(true);
presentation.setShowCancelButton(true);
presentation.setUsagesString(RefactoringBundle.message("usageView.usagesText"));
final UsageView usageView = UsageViewManager.getInstance(project).showUsages(targets, usages, presentation, rerunFactory(project, scope));
final Runnable refactoringRunnable = applyRunnable(project, () ->
{
final Set<UsageInfo> infos = UsageViewUtil.getNotExcludedUsageInfos(usageView);
return infos.toArray(new UsageInfo[infos.size()]);
});
String canNotMakeString = "Cannot perform operation.\nThere were changes in code after usages have been found.\nPlease perform operation search again.";
usageView.addPerformOperationAction(refactoringRunnable, INFER_NULLITY_ANNOTATIONS, canNotMakeString, INFER_NULLITY_ANNOTATIONS, false);
}