本文整理汇总了Java中com.intellij.codeInspection.InspectionProfile.getInspectionTool方法的典型用法代码示例。如果您正苦于以下问题:Java InspectionProfile.getInspectionTool方法的具体用法?Java InspectionProfile.getInspectionTool怎么用?Java InspectionProfile.getInspectionTool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInspection.InspectionProfile
的用法示例。
在下文中一共展示了InspectionProfile.getInspectionTool方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: getInspection
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
@Nullable
private static SSBasedInspection getInspection(@NotNull Project project) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
final InspectionToolWrapper entry = profile.getInspectionTool(SSBasedInspection.SHORT_NAME, project);
return entry == null ? null : (SSBasedInspection)entry.getTool();
}
示例6: isAvailable
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
private static boolean isAvailable(PyCallExpression node) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(node.getProject()).getInspectionProfile();
final InspectionToolWrapper inspectionTool = profile.getInspectionTool("PyCompatibilityInspection", node.getProject());
if (inspectionTool != null) {
final InspectionProfileEntry inspection = inspectionTool.getTool();
if (inspection instanceof PyCompatibilityInspection) {
final JDOMExternalizableStringList versions = ((PyCompatibilityInspection)inspection).ourVersions;
for (String s : versions) {
if (!LanguageLevel.fromPythonVersion(s).supportsSetLiterals()) return false;
}
}
}
return LanguageLevel.forElement(node).supportsSetLiterals();
}
示例7: disableInspectionTool
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
protected void disableInspectionTool(@NotNull String shortName){
InspectionProfile profile = InspectionProjectProfileManager.getInstance(getProject()).getInspectionProfile();
if (profile.getInspectionTool(shortName, getProject()) != null) {
((InspectionProfileImpl)profile).disableTool(shortName, getProject());
}
}
示例8: doValidation
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
public static synchronized void doValidation(final XmlDocument document, final Validator.ValidationHost host) {
final PsiFile containingFile = document.getContainingFile();
if (containingFile == null) {
return;
}
if (containingFile.getViewProvider() instanceof TemplateLanguageFileViewProvider) {
return;
}
final FileType fileType = containingFile.getViewProvider().getFileType();
if (fileType != XmlFileType.INSTANCE && fileType != XHtmlFileType.INSTANCE) {
return;
}
for(Language lang: containingFile.getViewProvider().getLanguages()) {
if ("ANT".equals(lang.getID())) return;
}
final XmlTag rootTag = document.getRootTag();
if (rootTag == null) return;
String namespace = rootTag.getNamespace();
if (XmlUtil.ANT_URI.equals(namespace)) return;
final Project project = document.getProject();
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
final InspectionToolWrapper toolWrapper =
profile.getInspectionTool(INSPECTION_SHORT_NAME, containingFile);
if (toolWrapper == null) return;
if (!profile.isToolEnabled(HighlightDisplayKey.find(INSPECTION_SHORT_NAME), containingFile)) return;
SoftReference<ExternalDocumentValidator> validatorReference = project.getUserData(validatorInstanceKey);
ExternalDocumentValidator validator = SoftReference.dereference(validatorReference);
if(validator == null) {
validator = new ExternalDocumentValidator();
project.putUserData(validatorInstanceKey,new SoftReference<ExternalDocumentValidator>(validator));
}
validator.runJaxpValidation(document,host);
}
示例9: doValidation
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
public static synchronized void doValidation(final XmlDocument document, final Validator.ValidationHost host) {
final PsiFile containingFile = document.getContainingFile();
if (containingFile == null) {
return;
}
if (containingFile.getViewProvider() instanceof TemplateLanguageFileViewProvider) {
return;
}
final FileType fileType = containingFile.getViewProvider().getVirtualFile().getFileType();
if (fileType != XmlFileType.INSTANCE && fileType != XHtmlFileType.INSTANCE) {
return;
}
for(Language lang: containingFile.getViewProvider().getLanguages()) {
if ("ANT".equals(lang.getID())) return;
}
final XmlTag rootTag = document.getRootTag();
if (rootTag == null) return;
String namespace = rootTag.getNamespace();
if (XmlUtil.ANT_URI.equals(namespace)) return;
final Project project = document.getProject();
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
final InspectionToolWrapper toolWrapper =
profile.getInspectionTool(INSPECTION_SHORT_NAME, containingFile);
if (toolWrapper == null) return;
if (!profile.isToolEnabled(HighlightDisplayKey.find(INSPECTION_SHORT_NAME), containingFile)) return;
SoftReference<ExternalDocumentValidator> validatorReference = project.getUserData(validatorInstanceKey);
ExternalDocumentValidator validator = validatorReference != null? validatorReference.get() : null;
if(validator == null) {
validator = new ExternalDocumentValidator();
project.putUserData(validatorInstanceKey,new SoftReference<ExternalDocumentValidator>(validator));
}
validator.runJaxpValidation(document,host);
}