public Location getLocation(Node node) { if (parser != null) { return new Location(file, parser.getStartPosition(this, node), parser.getEndPosition(this, node)); } return location; }
@Override public void visitAttribute(Context context, Attr attribute) { String value = attribute.getValue(); if (value.startsWith("@+") && !value.startsWith("@+android")) { //$NON-NLS-1$ //$NON-NLS-2$ String r = R_PREFIX + value.substring(2).replace('/', '.'); // We already have the declarations when we scan the R file, but we're tracking // these here to get attributes for position info mDeclarations.add(r); mIdToAttr.put(r, attribute); mAttrToFile.put(attribute, context.file); // It's important for this to be lightweight since we're storing ALL attribute // locations even if we don't know that we're going to have any unused resources! mAttrToLocation.put(attribute, context.parser.getLocation(context, attribute)); mDeclarationToFile.put(r, context.file); } else if (value.startsWith("@") //$NON-NLS-1$ && !value.startsWith("@android:")) { //$NON-NLS-1$ // Compute R-string, e.g. @string/foo => R.string.foo String r = R_PREFIX + value.substring(1).replace('/', '.'); mReferences.add(r); } else if (value.startsWith(ATTR_REF_PREFIX)) { mReferences.add(R_PREFIX + RESOURCE_CLZ_ATTR + '.' + value.substring(ATTR_REF_PREFIX.length())); } }
context.location = new Location(manifestFile, null, null); IDomParser parser = mClient.getParser(); context.document = parser.parse(context); if (context.document != null) { project.readManifest(context.document);
Position start = parser.getStartPosition(context, attribute); Position end = null; if (start != null) { end = parser.getEndPosition(context, attribute);
Location location = context.parser.getLocation(context, attribute); mPending.add(Pair.of(name, location)); Location location = context.parser.getLocation(context, attribute); mPending.add(Pair.of(name, location));
File f = mAttrToFile.get(attr); IDomParser parser = context.client.getParser(); Position start = parser.getStartPosition(context, attr); Position end = null; if (start != null) { end = parser.getEndPosition(context, attr);