@Override public boolean supportsProjectResources() { return mDelegate.supportsProjectResources(); }
private void checkManifest(@NonNull XmlContext context, @NonNull Document document) { LintClient client = context.getClient(); Project project = context.getProject(); AbstractResourceRepository repository = null; if (client.supportsProjectResources()) { repository = client.getResourceRepository(project, true, false); } if (repository == null && !context.getScope().contains(Scope.RESOURCE_FILE)) { // Can't perform incremental analysis without a resource repository return; } Element root = document.getDocumentElement(); if (root != null) { visit(context, root, repository); } }
@NonNull Project project, @NonNull LintClient client, @NonNull String styleUrl) { if (!client.supportsProjectResources()) { return null;
@NonNull Project project, @NonNull LintClient client, @NonNull String styleUrl, @NonNull String namespace, @NonNull String attribute) { if (!client.supportsProjectResources()) { return null;
String sourceId = sourceIdAttr.getValue(); ResourceUrl resourceUrl = ResourceUrl.parse(sourceId); if (context.getClient().supportsProjectResources() && resourceUrl != null && !resourceUrl.framework) {
context.getClient().supportsProjectResources()) { incrementalCheckCount(context, element, name, childCount); return;
LintClient client = context.getClient(); if (!isBound && checkExists && (projectScope || client.supportsProjectResources())) { Handle handle = pair.getSecond(); boolean isDeclared = idDefined(mDeclaredIds, id); String suggestionMessage; Set<String> spellingDictionary = mGlobalIds; if (!projectScope && client.supportsProjectResources()) { AbstractResourceRepository resources = client.getResourceRepository(context.getProject(), true, false);
LintClient client = context.getClient(); if (!isBound && checkExists && (projectScope || client.supportsProjectResources())) { Handle handle = pair.getSecond(); boolean isDeclared = idDefined(mDeclaredIds, id); String suggestionMessage; Set<String> spellingDictionary = mGlobalIds; if (!projectScope && client.supportsProjectResources()) { AbstractResourceRepository resources = client.getProjectResources(context.getProject(), true);
context.getClient().supportsProjectResources()) { incrementalCheckCount(context, element, name, childCount); return;
} else if (mIgnore == null) { mIgnore = !context.getScope().contains(Scope.ALL_RESOURCE_FILES) && !client.supportsProjectResources(); if (mIgnore) { return; String id = ((Select) first).astIdentifier().astValue(); if (client.supportsProjectResources()) { AbstractResourceRepository resources = client .getProjectResources(context.getMainProject(), true);
private static String replaceUrlWithValue(@NonNull XmlContext context, @NonNull String str) { Project project = context.getProject(); LintClient client = context.getClient(); if (!client.supportsProjectResources()) { return str; } ResourceUrl style = ResourceUrl.parse(str); if (style == null || style.type != ResourceType.STRING || style.framework) { return str; } AbstractResourceRepository resources = client.getProjectResources(project, true); if (resources == null) { return str; } List<ResourceItem> items = resources.getResourceItem(ResourceType.STRING, style.name); if (items == null || items.isEmpty()) { return str; } ResourceValue resourceValue = items.get(0).getResourceValue(false); if (resourceValue == null) { return str; } return resourceValue.getValue() == null ? str : resourceValue.getValue(); } }
private static String replaceUrlWithValue(@NonNull XmlContext context, @NonNull String str) { Project project = context.getProject(); LintClient client = context.getClient(); if (!client.supportsProjectResources()) { return str; } ResourceUrl style = ResourceUrl.parse(str); if (style == null || style.type != ResourceType.STRING || style.framework) { return str; } AbstractResourceRepository resources = client.getResourceRepository(project, true, true); if (resources == null) { return str; } List<ResourceItem> items = resources.getResourceItem(ResourceType.STRING, style.name); if (items == null || items.isEmpty()) { return str; } ResourceValue resourceValue = items.get(0).getResourceValue(false); if (resourceValue == null) { return str; } return resourceValue.getValue() == null ? str : resourceValue.getValue(); }
private static boolean hasLayoutParams(@NonNull JavaContext context, String name) { LintClient client = context.getClient(); if (!client.supportsProjectResources()) { return true; // not certain
if (style != null && !style.isEmpty()) { LintClient client = context.getClient(); if (client.supportsProjectResources()) { Project project = context.getMainProject(); List<ResourceValue> styles = LintUtils.getStyleAttributes(project, client,
private static boolean hasLayoutParams(@NonNull JavaContext context, String name) { LintClient client = context.getClient(); if (!client.supportsProjectResources()) { return true; // not certain
} else if (mIgnore == null) { mIgnore = !context.getScope().contains(Scope.ALL_RESOURCE_FILES) && !client.supportsProjectResources(); if (mIgnore) { return; String id = resourceUrl.name; if (client.supportsProjectResources()) { AbstractResourceRepository resources = client .getResourceRepository(context.getMainProject(), true, false);
@Override public void visitMethod(@NonNull JavaContext context, @Nullable AstVisitor visitor, @NonNull MethodInvocation node) { if (mFormatStrings == null && !context.getClient().supportsProjectResources()) { return; } String methodName = node.astName().astValue(); if (methodName.equals(FORMAT_METHOD)) { // String.format(getResources().getString(R.string.foo), arg1, arg2, ...) // Check that the arguments in R.string.foo match arg1, arg2, ... if (node.astOperand() instanceof VariableReference) { VariableReference ref = (VariableReference) node.astOperand(); if ("String".equals(ref.astIdentifier().astValue())) { //$NON-NLS-1$ // Found a String.format call // Look inside to see if we can find an R string // Find surrounding method checkFormatCall(context, node); } } } else { // getResources().getString(R.string.foo, arg1, arg2, ...) // Check that the arguments in R.string.foo match arg1, arg2, ... if (node.astArguments().size() > 1 && node.astOperand() != null ) { checkFormatCall(context, node); } } }
return; if (context.getClient().supportsProjectResources()) {
return; if (context.getClient().supportsProjectResources()) {
@Override public void visitMethod(@NonNull JavaContext context, @Nullable JavaElementVisitor visitor, @NonNull PsiMethodCallExpression node, @NonNull PsiMethod method) { if (mFormatStrings == null && !context.getClient().supportsProjectResources()) { return;