本文整理汇总了Java中com.intellij.codeInspection.InspectionProfile.getUnwrappedTool方法的典型用法代码示例。如果您正苦于以下问题:Java InspectionProfile.getUnwrappedTool方法的具体用法?Java InspectionProfile.getUnwrappedTool怎么用?Java InspectionProfile.getUnwrappedTool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInspection.InspectionProfile
的用法示例。
在下文中一共展示了InspectionProfile.getUnwrappedTool方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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;
}
示例4: 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));
}
示例5: 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());
}
示例6: 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;
}
示例7: getEntitiesString
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
@Nullable
public static String getEntitiesString(XmlElement context, 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;
}
示例8: checkRequiredAttributes
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
private void checkRequiredAttributes(XmlTag tag, String name, XmlElementDescriptor elementDescriptor)
{
XmlAttributeDescriptor[] attributeDescriptors = elementDescriptor.getAttributesDescriptors(tag);
Set<String> requiredAttributes = null;
for(XmlAttributeDescriptor attribute : attributeDescriptors)
{
if(attribute != null && attribute.isRequired())
{
if(requiredAttributes == null)
{
requiredAttributes = new HashSet<>();
}
requiredAttributes.add(attribute.getName(tag));
}
}
if(requiredAttributes != null)
{
for(final String attrName : requiredAttributes)
{
if(!hasAttribute(tag, attrName) && !XmlExtension.getExtension(tag.getContainingFile()).isRequiredAttributeImplicitlyPresent(tag, attrName))
{
IntentionAction insertRequiredAttributeIntention = XmlQuickFixFactory.getInstance().insertRequiredAttributeFix(tag, attrName);
final String localizedMessage = XmlErrorMessages.message("element.doesnt.have.required.attribute", name, attrName);
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(tag.getProject()).getInspectionProfile();
RequiredAttributesInspectionBase inspection = (RequiredAttributesInspectionBase) profile.getUnwrappedTool(XmlEntitiesInspection.REQUIRED_ATTRIBUTES_SHORT_NAME, tag);
if(inspection != null)
{
reportOneTagProblem(tag, attrName, localizedMessage, insertRequiredAttributeIntention, HighlightDisplayKey.find(XmlEntitiesInspection.REQUIRED_ATTRIBUTES_SHORT_NAME),
inspection, RequiredAttributesInspectionBase.getIntentionAction(attrName));
}
}
}
}
}
示例9: 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);
}
示例10: addRequiredAttributes
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
@Nullable
private static StringBuilder addRequiredAttributes(XmlElementDescriptor descriptor,
@Nullable XmlTag tag,
Template template,
PsiFile containingFile) {
boolean htmlCode = HtmlUtil.hasHtml(containingFile) || HtmlUtil.supportsXmlTypedHandlers(containingFile);
Set<String> notRequiredAttributes = Collections.emptySet();
if (tag instanceof HtmlTag) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(tag.getProject()).getInspectionProfile();
XmlEntitiesInspection inspection = (XmlEntitiesInspection)profile.getUnwrappedTool(
XmlEntitiesInspection.REQUIRED_ATTRIBUTES_SHORT_NAME, tag);
if (inspection != null) {
StringTokenizer tokenizer = new StringTokenizer(inspection.getAdditionalEntries());
notRequiredAttributes = new HashSet<String>();
while(tokenizer.hasMoreElements()) notRequiredAttributes.add(tokenizer.nextToken());
}
}
XmlAttributeDescriptor[] attributes = descriptor.getAttributesDescriptors(tag);
StringBuilder indirectRequiredAttrs = null;
if (WebEditorOptions.getInstance().isAutomaticallyInsertRequiredAttributes()) {
final XmlExtension extension = XmlExtension.getExtension(containingFile);
for (XmlAttributeDescriptor attributeDecl : attributes) {
String attributeName = attributeDecl.getName(tag);
if (attributeDecl.isRequired() && (tag == null || tag.getAttributeValue(attributeName) == null)) {
if (!notRequiredAttributes.contains(attributeName)) {
if (!extension.isIndirectSyntax(attributeDecl)) {
template.addTextSegment(" " + attributeName + "=\"");
template.addVariable(new MacroCallNode(new CompleteMacro()), true);
template.addTextSegment("\"");
}
else {
if (indirectRequiredAttrs == null) indirectRequiredAttrs = new StringBuilder();
indirectRequiredAttrs.append("\n<jsp:attribute name=\"").append(attributeName).append("\"></jsp:attribute>\n");
}
}
}
else if (attributeDecl.isRequired() && attributeDecl.isFixed() && attributeDecl.getDefaultValue() != null && !htmlCode) {
template.addTextSegment(" " + attributeName + "=\"" + attributeDecl.getDefaultValue() + "\"");
}
}
}
return indirectRequiredAttrs;
}
示例11: addRequiredAttributes
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
@Nullable
private static StringBuilder addRequiredAttributes(XmlElementDescriptor descriptor,
@Nullable XmlTag tag,
Template template,
PsiFile containingFile) {
boolean htmlCode = HtmlUtil.hasHtml(containingFile);
Set<String> notRequiredAttributes = Collections.emptySet();
if (tag instanceof HtmlTag) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(tag.getProject()).getInspectionProfile();
XmlEntitiesInspection inspection = (XmlEntitiesInspection)profile.getUnwrappedTool(
XmlEntitiesInspection.REQUIRED_ATTRIBUTES_SHORT_NAME, tag);
if (inspection != null) {
StringTokenizer tokenizer = new StringTokenizer(inspection.getAdditionalEntries());
notRequiredAttributes = new HashSet<String>();
while(tokenizer.hasMoreElements()) notRequiredAttributes.add(tokenizer.nextToken());
}
}
XmlAttributeDescriptor[] attributes = descriptor.getAttributesDescriptors(tag);
StringBuilder indirectRequiredAttrs = null;
if (WebEditorOptions.getInstance().isAutomaticallyInsertRequiredAttributes()) {
final XmlExtension extension = XmlExtension.getExtension(containingFile);
for (XmlAttributeDescriptor attributeDecl : attributes) {
String attributeName = attributeDecl.getName(tag);
if (attributeDecl.isRequired() && (tag == null || tag.getAttributeValue(attributeName) == null)) {
if (!notRequiredAttributes.contains(attributeName)) {
if (!extension.isIndirectSyntax(attributeDecl)) {
template.addTextSegment(" " + attributeName + "=\"");
template.addVariable(new MacroCallNode(new CompleteMacro()), true);
template.addTextSegment("\"");
}
else {
if (indirectRequiredAttrs == null) indirectRequiredAttrs = new StringBuilder();
indirectRequiredAttrs.append("\n<jsp:attribute name=\"").append(attributeName).append("\"></jsp:attribute>\n");
}
}
}
else if (attributeDecl.isRequired() && attributeDecl.isFixed() && attributeDecl.getDefaultValue() != null && !htmlCode) {
template.addTextSegment(" " + attributeName + "=\"" + attributeDecl.getDefaultValue() + "\"");
}
}
}
return indirectRequiredAttrs;
}
示例12: getInstance
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
public static GrUnresolvedAccessInspection getInstance(PsiFile file, Project project) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
return (GrUnresolvedAccessInspection)profile.getUnwrappedTool(SHORT_NAME, file);
}
示例13: addRequiredAttributes
import com.intellij.codeInspection.InspectionProfile; //导入方法依赖的package包/类
@Nullable
private static StringBuilder addRequiredAttributes(XmlElementDescriptor descriptor, @Nullable XmlTag tag, Template template, PsiFile containingFile)
{
boolean htmlCode = HtmlUtil.hasHtml(containingFile) || HtmlUtil.supportsXmlTypedHandlers(containingFile);
Set<String> notRequiredAttributes = Collections.emptySet();
if(tag instanceof HtmlTag)
{
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(tag.getProject()).getInspectionProfile();
XmlEntitiesInspection inspection = (XmlEntitiesInspection) profile.getUnwrappedTool(XmlEntitiesInspection.REQUIRED_ATTRIBUTES_SHORT_NAME, tag);
if(inspection != null)
{
StringTokenizer tokenizer = new StringTokenizer(inspection.getAdditionalEntries());
notRequiredAttributes = new HashSet<String>();
while(tokenizer.hasMoreElements())
{
notRequiredAttributes.add(tokenizer.nextToken());
}
}
}
XmlAttributeDescriptor[] attributes = descriptor.getAttributesDescriptors(tag);
StringBuilder indirectRequiredAttrs = null;
if(XmlEditorOptions.getInstance().isAutomaticallyInsertRequiredAttributes())
{
final XmlExtension extension = XmlExtension.getExtension(containingFile);
for(XmlAttributeDescriptor attributeDecl : attributes)
{
String attributeName = attributeDecl.getName(tag);
if(attributeDecl.isRequired() && (tag == null || tag.getAttributeValue(attributeName) == null))
{
if(!notRequiredAttributes.contains(attributeName))
{
if(!extension.isIndirectSyntax(attributeDecl))
{
template.addTextSegment(" " + attributeName + "=\"");
template.addVariable(new MacroCallNode(new CompleteMacro()), true);
template.addTextSegment("\"");
}
else
{
if(indirectRequiredAttrs == null)
{
indirectRequiredAttrs = new StringBuilder();
}
indirectRequiredAttrs.append("\n<jsp:attribute name=\"").append(attributeName).append("\"></jsp:attribute>\n");
}
}
}
else if(attributeDecl.isRequired() && attributeDecl.isFixed() && attributeDecl.getDefaultValue() != null && !htmlCode)
{
template.addTextSegment(" " + attributeName + "=\"" + attributeDecl.getDefaultValue() + "\"");
}
}
}
return indirectRequiredAttrs;
}
示例14: 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;
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());
}