本文整理汇总了Java中com.intellij.codeInspection.InspectionProfile.isToolEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java InspectionProfile.isToolEnabled方法的具体用法?Java InspectionProfile.isToolEnabled怎么用?Java InspectionProfile.isToolEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInspection.InspectionProfile
的用法示例。
在下文中一共展示了InspectionProfile.isToolEnabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: 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;
}
示例4: getSuitableDomInspections
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
public List<DomElementsInspection> getSuitableDomInspections(final DomFileElement fileElement, boolean enabledOnly) {
Class rootType = fileElement.getRootElementClass();
final InspectionProfile profile = getInspectionProfile(fileElement);
final List<DomElementsInspection> inspections = new SmartList<DomElementsInspection>();
for (final InspectionToolWrapper toolWrapper : profile.getInspectionTools(fileElement.getFile())) {
if (!enabledOnly || profile.isToolEnabled(HighlightDisplayKey.find(toolWrapper.getShortName()), fileElement.getFile())) {
ContainerUtil.addIfNotNull(getSuitableInspection(toolWrapper.getTool(), rootType), inspections);
}
}
return inspections;
}
示例5: reportOneTagProblem
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
private void reportOneTagProblem(final XmlTag tag,
final String name,
@NotNull String localizedMessage,
final IntentionAction basicIntention,
final HighlightDisplayKey key,
final XmlEntitiesInspection inspection,
final IntentionAction addAttributeFix)
{
boolean htmlTag = false;
if(tag instanceof HtmlTag)
{
htmlTag = true;
if(isAdditionallyDeclared(inspection.getAdditionalEntries(), name))
{
return;
}
}
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(tag.getProject()).getInspectionProfile();
if(htmlTag && profile.isToolEnabled(key, tag))
{
addElementsForTagWithManyQuickFixes(tag, localizedMessage, isInjectedWithoutValidation(tag) ? HighlightInfoType.INFORMATION : SeverityRegistrar.getSeverityRegistrar(tag.getProject())
.getHighlightInfoTypeBySeverity(profile.getErrorLevel(key, tag).getSeverity()), addAttributeFix, basicIntention);
}
else if(!htmlTag)
{
addElementsForTag(tag, localizedMessage, HighlightInfoType.ERROR, basicIntention);
}
}
示例6: collectInformation
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
@Nullable
@Override
public State collectInformation(@NotNull PsiFile file) {
VirtualFile vFile = file.getVirtualFile();
if (vFile == null || vFile.getFileType() != PythonFileType.INSTANCE) {
return null;
}
Sdk sdk = PythonSdkType.findLocalCPython(ModuleUtilCore.findModuleForPsiElement(file));
if (sdk == null) {
if (!myReportedMissingInterpreter) {
myReportedMissingInterpreter = true;
reportMissingInterpreter();
}
return null;
}
final String homePath = sdk.getHomePath();
if (homePath == null) {
if (!myReportedMissingInterpreter) {
myReportedMissingInterpreter = true;
LOG.info("Could not find home path for interpreter " + homePath);
}
return null;
}
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(file.getProject()).getInspectionProfile();
final HighlightDisplayKey key = HighlightDisplayKey.find(PyPep8Inspection.INSPECTION_SHORT_NAME);
if (!profile.isToolEnabled(key)) {
return null;
}
final PyPep8Inspection inspection = (PyPep8Inspection)profile.getUnwrappedTool(PyPep8Inspection.KEY.toString(), file);
final CodeStyleSettings currentSettings = CodeStyleSettingsManager.getInstance(file.getProject()).getCurrentSettings();
final List<String> ignoredErrors = Lists.newArrayList(inspection.ignoredErrors);
if (!currentSettings.getCustomSettings(PyCodeStyleSettings.class).SPACE_AFTER_NUMBER_SIGN) {
ignoredErrors.add("E262"); // Block comment should start with a space
ignoredErrors.add("E265"); // Inline comment should start with a space
}
if (!currentSettings.getCustomSettings(PyCodeStyleSettings.class).SPACE_BEFORE_NUMBER_SIGN) {
ignoredErrors.add("E261"); // At least two spaces before inline comment
}
final int margin = currentSettings.getRightMargin(file.getLanguage());
return new State(homePath, file.getText(), profile.getErrorLevel(key, file), ignoredErrors, margin);
}
示例7: 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);
}
示例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().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);
}
示例9: isInspectionEnabled
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
private static boolean isInspectionEnabled(PsiFile file, Project project) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
final HighlightDisplayKey unusedDefKey = HighlightDisplayKey.find(SHORT_NAME);
return profile.isToolEnabled(unusedDefKey, file);
}
示例10: isActive
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
public boolean isActive(PsiElement psiRoot) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(psiRoot.getProject()).getInspectionProfile();
HighlightDisplayKey key = HighlightDisplayKey.find(myInspectionKey);
return key != null && profile.isToolEnabled(key, psiRoot);
}