use of org.jetbrains.android.inspections.lint.SetAttributeQuickFix in project android by JetBrains.
the class AndroidLintGoogleAppIndexingApiWarningInspection method getAppIndexingQuickFix.
@NotNull
static AndroidLintQuickFix[] getAppIndexingQuickFix(PsiElement startElement, String message) {
AppIndexingApiDetector.IssueType type = AppIndexingApiDetector.IssueType.parse(message);
switch(type) {
case SCHEME_MISSING:
case URL_MISSING:
return new AndroidLintQuickFix[] { new SetAttributeQuickFix("Set scheme", ATTR_SCHEME, "http") };
case HOST_MISSING:
return new AndroidLintQuickFix[] { new SetAttributeQuickFix("Set host", ATTR_HOST, null) };
case MISSING_SLASH:
PsiElement parent = startElement.getParent();
if (parent instanceof XmlAttribute) {
XmlAttribute attr = (XmlAttribute) parent;
String path = attr.getValue();
if (path != null) {
return new AndroidLintQuickFix[] { new ReplaceStringQuickFix("Replace with /" + path, path, "/" + path) };
}
}
break;
default:
break;
}
return AndroidLintQuickFix.EMPTY_ARRAY;
}
use of org.jetbrains.android.inspections.lint.SetAttributeQuickFix in project android by JetBrains.
the class AndroidLintRtlCompatInspection method getQuickFixes.
@NotNull
@Override
public AndroidLintQuickFix[] getQuickFixes(@NotNull String message) {
if (message.startsWith("To support older versions than API 17")) {
Matcher matcher = QUOTED_PARAMETER.matcher(message);
if (matcher.find()) {
final String name = matcher.group(1);
final String value = matcher.group(2);
return new AndroidLintQuickFix[] { new SetAttributeQuickFix(String.format("Set %s", name), name, value) };
}
}
return AndroidLintQuickFix.EMPTY_ARRAY;
}
Aggregations