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


Java InspectionProfile类代码示例

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


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


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