• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java InspectionProfile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.codeInspection.InspectionProfile的典型用法代码示例。如果您正苦于以下问题:Java InspectionProfile类的具体用法?Java InspectionProfile怎么用?Java InspectionProfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InspectionProfile类属于com.intellij.codeInspection包,在下文中一共展示了InspectionProfile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doQuickFixInternal

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
static void doQuickFixInternal(@NotNull Project project, @NotNull List<String> targetList, @NotNull String qualifiedName) {
  targetList.add(qualifiedName);
  Collections.sort(targetList);
  final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
  //correct save settings

  //TODO lesya
  InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile);
  /*
  try {
    inspectionProfile.save();
  }
  catch (IOException e) {
    Messages.showErrorDialog(project, e.getMessage(), CommonBundle.getErrorTitle());
  }

  */
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SpecialAnnotationsUtilBase.java


示例2: findTool2RunInBatch

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
public static InspectionToolWrapper findTool2RunInBatch(@NotNull Project project, @Nullable PsiElement element, @NotNull String name) {
  final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
  final InspectionToolWrapper toolWrapper = element == null
                                         ? inspectionProfile.getInspectionTool(name, project)
                                         : inspectionProfile.getInspectionTool(name, element);
  if (toolWrapper instanceof LocalInspectionToolWrapper && ((LocalInspectionToolWrapper)toolWrapper).isUnfair()) {
    final LocalInspectionTool inspectionTool = ((LocalInspectionToolWrapper)toolWrapper).getTool();
    if (inspectionTool instanceof PairedUnfairLocalInspectionTool) {
      final String oppositeShortName = ((PairedUnfairLocalInspectionTool)inspectionTool).getInspectionForBatchShortName();
      return element == null
                       ? inspectionProfile.getInspectionTool(oppositeShortName, project)
                       : inspectionProfile.getInspectionTool(oppositeShortName, element);
    }
    return null;
  }
  return toolWrapper;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:LocalInspectionToolWrapper.java


示例3: convertToNewFormat

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
public static Element convertToNewFormat(Element profileFile, InspectionProfile profile) {
  Element rootElement = new Element(INSPECTIONS_TAG);
  rootElement.setAttribute(NAME_ATT, profile.getName());
  final InspectionToolWrapper[] tools = profile.getInspectionTools(null);
  for (final Object o : profileFile.getChildren(INSP_TOOL_TAG)) {
    Element toolElement = ((Element)o).clone();
    String toolClassName = toolElement.getAttributeValue(CLASS_ATT);
    final String shortName = convertToShortName(toolClassName, tools);
    if (shortName == null) {
      continue;
    }
    toolElement.setAttribute(CLASS_ATT, shortName);
    rootElement.addContent(toolElement);
  }
  return rootElement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:InspectionProfileConvertor.java


示例4: showOfflineView

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@NotNull
public static InspectionResultsView showOfflineView(@NotNull Project project,
                                                    @NotNull Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap,
                                                    @NotNull InspectionProfile inspectionProfile,
                                                    @NotNull String title) {
  final AnalysisScope scope = new AnalysisScope(project);
  final InspectionManagerEx managerEx = (InspectionManagerEx)InspectionManager.getInstance(project);
  final GlobalInspectionContextImpl context = managerEx.createNewGlobalContext(false);
  context.setExternalProfile(inspectionProfile);
  context.setCurrentScope(scope);
  context.initializeTools(new ArrayList<Tools>(), new ArrayList<Tools>(), new ArrayList<Tools>());
  final InspectionResultsView view = new InspectionResultsView(project, inspectionProfile, scope, context,
                                                               new OfflineInspectionRVContentProvider(resMap, project));
  ((RefManagerImpl)context.getRefManager()).startOfflineView();
  view.update();
  TreeUtil.selectFirstNode(view.getTree());
  context.addView(view, title);
  return view;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ViewOfflineResultsAction.java


示例5: getDescription

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@Override
public String getDescription(@NotNull final String refSuffix, @NotNull final Editor editor) {
  final Project project = editor.getProject();
  if (project == null) {
    LOG.error(editor);
    return null;
  }
  if (project.isDisposed()) return null;
  final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
  if (file == null) {
    return null;
  }

  final InspectionProfile profile = (InspectionProfile)InspectionProfileManager.getInstance().getRootProfile();
  final InspectionToolWrapper toolWrapper = profile.getInspectionTool(refSuffix, file);
  if (toolWrapper == null) return null;

  String description = toolWrapper.loadDescription();
  if (description == null) {
    LOG.warn("No description for inspection '" + refSuffix + "'");
    description = InspectionsBundle.message("inspection.tool.description.under.construction.text");
  }
  return description;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:InspectionDescriptionLinkHandler.java


示例6: getHighlighLevelAndInspection

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@Nullable
public static Pair<AndroidLintInspectionBase, HighlightDisplayLevel> getHighlighLevelAndInspection(@NotNull Project project,
                                                                                                   @NotNull Issue issue,
                                                                                                   @NotNull PsiElement context) {
  final String inspectionShortName = AndroidLintInspectionBase.getInspectionShortNameByIssue(project, issue);
  if (inspectionShortName == null) {
    return null;
  }

  final HighlightDisplayKey key = HighlightDisplayKey.find(inspectionShortName);
  if (key == null) {
    return null;
  }

  final InspectionProfile profile = InspectionProjectProfileManager.getInstance(context.getProject()).getInspectionProfile();
  if (!profile.isToolEnabled(key, context)) {
    return null;
  }

  final AndroidLintInspectionBase inspection = (AndroidLintInspectionBase)profile.getUnwrappedTool(inspectionShortName, context);
  if (inspection == null) return null;
  final HighlightDisplayLevel errorLevel = profile.getErrorLevel(key, context);
  return Pair.create(inspection,
                     errorLevel != null ? errorLevel : HighlightDisplayLevel.WARNING);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AndroidLintUtil.java


示例7: getVariants

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@NotNull
public Object[] getVariants() {
  List<Object> list = new ArrayList<Object>();

  InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
  DependsOnGroupsInspection inspection = (DependsOnGroupsInspection)inspectionProfile.getUnwrappedTool(
    DependsOnGroupsInspection.SHORT_NAME, myElement);

  for (String groupName : inspection.groups) {
    list.add(LookupValueFactory.createLookupValue(groupName, null));
  }

  if (!list.isEmpty()) {
    return list.toArray();
  }
  return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TestNGReferenceContributor.java


示例8: convertToNewFormat

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
public static Element convertToNewFormat(Element profileFile, InspectionProfile profile) throws IOException, JDOMException {
  Element rootElement = new Element(INSPECTIONS_TAG);
  rootElement.setAttribute(NAME_ATT, profile.getName());
  final InspectionToolWrapper[] tools = profile.getInspectionTools(null);
  for (final Object o : profileFile.getChildren(INSP_TOOL_TAG)) {
    Element toolElement = ((Element)o).clone();
    String toolClassName = toolElement.getAttributeValue(CLASS_ATT);
    final String shortName = convertToShortName(toolClassName, tools);
    if (shortName == null) {
      continue;
    }
    toolElement.setAttribute(CLASS_ATT, shortName);
    rootElement.addContent(toolElement);
  }
  return rootElement;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:InspectionProfileConvertor.java


示例9: showOfflineView

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@NotNull
public static InspectionResultsView showOfflineView(@NotNull Project project,
                                                    @NotNull Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap,
                                                    final InspectionProfile inspectionProfile,
                                                    final String title) {
  final AnalysisScope scope = new AnalysisScope(project);
  final InspectionManagerEx managerEx = (InspectionManagerEx)InspectionManager.getInstance(project);
  final GlobalInspectionContextImpl context = managerEx.createNewGlobalContext(false);
  context.setExternalProfile(inspectionProfile);
  context.setCurrentScope(scope);
  context.initializeTools(new ArrayList<Tools>(), new ArrayList<Tools>(), new ArrayList<Tools>());
  final InspectionResultsView view = new InspectionResultsView(project, inspectionProfile, scope, context,
                                                               new OfflineInspectionRVContentProvider(resMap, project));
  ((RefManagerImpl)context.getRefManager()).inspectionReadActionStarted();
  view.update();
  TreeUtil.selectFirstNode(view.getTree());
  if (context.getContentManager() != null) { //test
    context.addView(view, title);
  }
  return view;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:ViewOfflineResultsAction.java


示例10: getDescription

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@Override
public String getDescription(@NotNull final String refSuffix, @NotNull final Editor editor) {
  final Project project = editor.getProject();
  if (project == null) {
    LOG.error(editor);
    return null;
  }

  final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
  if (file == null) {
    return null;
  }

  final InspectionProfile profile = (InspectionProfile)InspectionProfileManager.getInstance().getRootProfile();
  final InspectionToolWrapper toolWrapper = profile.getInspectionTool(refSuffix, file);
  if (toolWrapper == null) return null;

  String description = toolWrapper.loadDescription();
  if (description == null) {
    LOG.warn("No description for inspection '" + refSuffix + "'");
    description = InspectionsBundle.message("inspection.tool.description.under.construction.text");
  }
  return description;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:InspectionDescriptionLinkHandler.java


示例11: showOfflineView

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@Nonnull
public static InspectionResultsView showOfflineView(@Nonnull Project project,
                                                    @Nonnull Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap,
                                                    @Nonnull InspectionProfile inspectionProfile,
                                                    @Nonnull String title) {
  final AnalysisScope scope = new AnalysisScope(project);
  final InspectionManagerEx managerEx = (InspectionManagerEx)InspectionManager.getInstance(project);
  final GlobalInspectionContextImpl context = managerEx.createNewGlobalContext(false);
  context.setExternalProfile(inspectionProfile);
  context.setCurrentScope(scope);
  context.initializeTools(new ArrayList<Tools>(), new ArrayList<Tools>(), new ArrayList<Tools>());
  final InspectionResultsView view = new InspectionResultsView(project, inspectionProfile, scope, context,
                                                               new OfflineInspectionRVContentProvider(resMap, project));
  ((RefManagerImpl)context.getRefManager()).inspectionReadActionStarted();
  view.update();
  TreeUtil.selectFirstNode(view.getTree());
  context.addView(view, title);
  return view;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:ViewOfflineResultsAction.java


示例12: getDescription

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@Override
public String getDescription(@Nonnull final String refSuffix, @Nonnull final Editor editor) {
  final Project project = editor.getProject();
  if (project == null) {
    LOG.error(editor);
    return null;
  }

  final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
  if (file == null) {
    return null;
  }

  final InspectionProfile profile = (InspectionProfile)InspectionProfileManager.getInstance().getRootProfile();
  final InspectionToolWrapper toolWrapper = profile.getInspectionTool(refSuffix, file);
  if (toolWrapper == null) return null;

  String description = toolWrapper.loadDescription();
  if (description == null) {
    LOG.warn("No description for inspection '" + refSuffix + "'");
    description = InspectionsBundle.message("inspection.tool.description.under.construction.text");
  }
  return description;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:InspectionDescriptionLinkHandler.java


示例13: getEntitiesString

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@Nullable
public static String getEntitiesString(@Nullable PsiElement context, @NotNull String inspectionName)
{
	if(context == null)
	{
		return null;
	}
	PsiFile containingFile = context.getContainingFile().getOriginalFile();

	final InspectionProfile profile = InspectionProjectProfileManager.getInstance(context.getProject()).getInspectionProfile();
	XmlEntitiesInspection inspection = (XmlEntitiesInspection) profile.getUnwrappedTool(inspectionName, containingFile);
	if(inspection != null)
	{
		return inspection.getAdditionalEntries();
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:18,代码来源:HtmlUtil.java


示例14: isUnusedImportEnabled

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
private boolean isUnusedImportEnabled(HighlightDisplayKey unusedImportKey)
{
	InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
	if(profile.isToolEnabled(unusedImportKey, myFile) && myFile instanceof PsiJavaFile && HighlightingLevelManager.getInstance(myProject).shouldInspect(myFile))
	{
		return true;
	}
	final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
	for(ImplicitUsageProvider provider : implicitUsageProviders)
	{
		if(provider instanceof UnusedImportProvider && ((UnusedImportProvider) provider).isUnusedImportEnabled(myFile))
		{
			return true;
		}
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:PostHighlightingVisitor.java


示例15: applyFix

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
  if (myTag == null) return;
  if (myAdditionalJavadocTags.length() > 0) {
    myAdditionalJavadocTags += "," + myTag;
  }
  else {
    myAdditionalJavadocTags = myTag;
  }
  final InspectionProfile inspectionProfile =
    InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
  //correct save settings
  InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile);
  //TODO lesya

  /*

  try {
    inspectionProfile.save();
  }
  catch (IOException e) {
    Messages.showErrorDialog(project, e.getMessage(), CommonBundle.getErrorTitle());
  }

  */
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:JavaDocLocalInspection.java


示例16: registerFixesForUnusedParameter

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@Override
public void registerFixesForUnusedParameter(@NotNull PsiParameter parameter, @NotNull Object highlightInfo)
{
	Project myProject = parameter.getProject();
	InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
	UnusedDeclarationInspectionBase unusedParametersInspection = (UnusedDeclarationInspectionBase) profile.getUnwrappedTool(UnusedSymbolLocalInspectionBase.SHORT_NAME, parameter);
	LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode() || unusedParametersInspection != null);
	List<IntentionAction> options = new ArrayList<>();
	HighlightDisplayKey myUnusedSymbolKey = HighlightDisplayKey.find(UnusedSymbolLocalInspectionBase.SHORT_NAME);
	options.addAll(IntentionManager.getInstance().getStandardIntentionOptions(myUnusedSymbolKey, parameter));
	if(unusedParametersInspection != null)
	{
		SuppressQuickFix[] batchSuppressActions = unusedParametersInspection.getBatchSuppressActions(parameter);
		Collections.addAll(options, SuppressIntentionActionFromFix.convertBatchToSuppressIntentionActions(batchSuppressActions));
	}
	//need suppress from Unused Parameters but settings from Unused Symbol
	QuickFixAction.registerQuickFixAction((HighlightInfo) highlightInfo, new SafeDeleteFix(parameter), options, HighlightDisplayKey.getDisplayNameByKey(myUnusedSymbolKey));
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:QuickFixFactoryImpl.java


示例17: PostHighlightingVisitor

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
PostHighlightingVisitor(@NotNull PsiFile file,
                        @NotNull Document document,
                        @NotNull RefCountHolder refCountHolder) throws ProcessCanceledException {
  myProject = file.getProject();
  myFile = file;
  myDocument = document;

  myCurrentEntryIndex = -1;
  myLanguageLevel = PsiUtil.getLanguageLevel(file);

  final FileViewProvider viewProvider = myFile.getViewProvider();

  ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  VirtualFile virtualFile = viewProvider.getVirtualFile();
  myInLibrary = fileIndex.isInLibraryClasses(virtualFile) || fileIndex.isInLibrarySource(virtualFile);

  myRefCountHolder = refCountHolder;


  ApplicationManager.getApplication().assertReadAccessAllowed();

  InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();

  myDeadCodeKey = HighlightDisplayKey.find(UnusedDeclarationInspectionBase.SHORT_NAME);

  myDeadCodeInspection = (UnusedDeclarationInspectionBase)profile.getUnwrappedTool(UnusedDeclarationInspectionBase.SHORT_NAME, myFile);
  LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode() || myDeadCodeInspection != null);

  myUnusedSymbolInspection = myDeadCodeInspection != null ? myDeadCodeInspection.getSharedLocalInspectionTool() : null;

  myDeadCodeInfoType = myDeadCodeKey == null
                       ? HighlightInfoType.UNUSED_SYMBOL
                       : new HighlightInfoType.HighlightInfoTypeImpl(profile.getErrorLevel(myDeadCodeKey, myFile).getSeverity(),
                                                                     HighlightInfoType.UNUSED_SYMBOL.getAttributesKey());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:PostHighlightingVisitor.java


示例18: isUnusedImportEnabled

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
private boolean isUnusedImportEnabled(HighlightDisplayKey unusedImportKey) {
  InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
  if (profile.isToolEnabled(unusedImportKey, myFile) &&
      myFile instanceof PsiJavaFile &&
      HighlightingLevelManager.getInstance(myProject).shouldHighlight(myFile)) {
    return true;
  }
  final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
  for (ImplicitUsageProvider provider : implicitUsageProviders) {
    if (provider instanceof UnusedImportProvider && ((UnusedImportProvider)provider).isUnusedImportEnabled(myFile)) return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PostHighlightingVisitor.java


示例19: invoke

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
@Override
public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
  if (!FileModificationService.getInstance().preparePsiElementForWrite(file)) return;
  final InspectionManager managerEx = InspectionManager.getInstance(project);
  final GlobalInspectionContextBase globalContext = (GlobalInspectionContextBase)managerEx.createNewGlobalContext(false);
  final AnalysisScope scope = getScope(project, file);
  if (scope != null) {
    final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
    globalContext.codeCleanup(project, scope, profile, getText(), null, false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CleanupIntention.java


示例20: storeEditorHighlightingProfile

import com.intellij.codeInspection.InspectionProfile; //导入依赖的package包/类
public void storeEditorHighlightingProfile(@NotNull Element element, @NotNull InspectionProfile editorProfile) {
  if (retrieveOldSettings(element)) {

    final ModifiableModel editorProfileModel = editorProfile.getModifiableModel();

    fillErrorLevels(editorProfileModel);
    try {
      editorProfileModel.commit();
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:InspectionProfileConvertor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SPNegoScheme类代码示例发布时间:2022-05-22
下一篇:
Java ParameterizedSingleTypeReference类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap