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


Java UsageViewPresentation.setUsagesString方法代码示例

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


在下文中一共展示了UsageViewPresentation.setUsagesString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:InheritanceToDelegationProcessor.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DeclarationConflictChecker.java

示例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"));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:InheritanceToDelegationProcessor.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:FindInProjectUtil.java

示例5: 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:UsageViewContext.java

示例6: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:FindInProjectUtil.java

示例7: 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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:32,代码来源:FindInProjectUtil.java

示例8: 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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:31,代码来源:NullableStuffInspection.java

示例9: 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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:36,代码来源:InferNullityAnnotationsAction.java


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