auto import from //branches/cupcake/...@127101
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
<name>adt</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>SdkLib</project>
|
||||
<project>SdkUiLib</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
|
||||
@@ -82,9 +82,11 @@ public class Sdk {
|
||||
logMessages.add(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void warning(String warningFormat, Object... arg) {
|
||||
logMessages.add(String.format(warningFormat, arg));
|
||||
}
|
||||
|
||||
public void printf(String msgFormat, Object... arg) {
|
||||
logMessages.add(String.format(msgFormat, arg));
|
||||
}
|
||||
|
||||
@@ -158,9 +158,6 @@ public class AndroidConstants {
|
||||
/** Regexp for aidl extension, i.e. "\.aidl$" */
|
||||
public final static String RE_AIDL_EXT = "\\.aidl$"; //$NON-NLS-1$
|
||||
|
||||
/** Namespace for the resource XML, i.e. "http://schemas.android.com/apk/res/android" */
|
||||
public final static String NS_RESOURCES = "http://schemas.android.com/apk/res/android"; //$NON-NLS-1$
|
||||
|
||||
/** Namespace pattern for the custom resource XML, i.e. "http://schemas.android.com/apk/res/%s" */
|
||||
public final static String NS_CUSTOM_RESOURCES = "http://schemas.android.com/apk/res/%1$s"; //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.ide.eclipse.common.project;
|
||||
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.common.project.XmlErrorHandler.XmlErrorListener;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
@@ -442,7 +443,7 @@ public class AndroidManifestParser {
|
||||
* @param attributeName the name of the attribute to look for.
|
||||
* @param hasNamespace Indicates whether the attribute has an android namespace.
|
||||
* @return a String with the value or null if the attribute was not found.
|
||||
* @see AndroidConstants#NS_RESOURCES
|
||||
* @see SdkConstants#NS_RESOURCES
|
||||
*/
|
||||
private String getAttributeValue(Attributes attributes, String attributeName,
|
||||
boolean hasNamespace) {
|
||||
@@ -450,7 +451,7 @@ public class AndroidManifestParser {
|
||||
for (int i = 0 ; i < count ; i++) {
|
||||
if (attributeName.equals(attributes.getLocalName(i)) &&
|
||||
((hasNamespace &&
|
||||
AndroidConstants.NS_RESOURCES.equals(attributes.getURI(i))) ||
|
||||
SdkConstants.NS_RESOURCES.equals(attributes.getURI(i))) ||
|
||||
(hasNamespace == false && attributes.getURI(i).length() == 0))) {
|
||||
return attributes.getValue(i);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.ide.eclipse.common.project;
|
||||
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class AndroidXPathFactory {
|
||||
public String getNamespaceURI(String prefix) {
|
||||
if (prefix != null) {
|
||||
if (prefix.equals(mAndroidPrefix)) {
|
||||
return AndroidConstants.NS_RESOURCES;
|
||||
return SdkConstants.NS_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.android.ide.eclipse.editors;
|
||||
|
||||
import com.android.ide.eclipse.adt.sdk.AndroidTargetData;
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.editors.descriptors.AttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.DescriptorsUtils;
|
||||
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
||||
@@ -29,6 +28,7 @@ import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiAttributeNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiFlagAttributeNode;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
@@ -199,13 +199,13 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor {
|
||||
*
|
||||
* @param node The current node. Must not be null.
|
||||
* @param nsUri The namespace URI of which the prefix is to be found,
|
||||
* e.g. AndroidConstants.NS_RESOURCES
|
||||
* e.g. {@link SdkConstants#NS_RESOURCES}
|
||||
* @return The first prefix declared or the default "android" prefix.
|
||||
*/
|
||||
private String lookupNamespacePrefix(Node node, String nsUri) {
|
||||
// Note: Node.lookupPrefix is not implemented in wst/xml/core NodeImpl.java
|
||||
// The following emulates this:
|
||||
// String prefix = node.lookupPrefix(AndroidConstants.NS_RESOURCES);
|
||||
// String prefix = node.lookupPrefix(SdkConstants.NS_RESOURCES);
|
||||
|
||||
if (XmlnsAttributeDescriptor.XMLNS_URI.equals(nsUri)) {
|
||||
return "xmlns"; //$NON-NLS-1$
|
||||
@@ -223,7 +223,7 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor {
|
||||
Node attr = attrs.item(n);
|
||||
if ("xmlns".equals(attr.getPrefix())) { //$NON-NLS-1$
|
||||
String uri = attr.getNodeValue();
|
||||
if (AndroidConstants.NS_RESOURCES.equals(uri)) {
|
||||
if (SdkConstants.NS_RESOURCES.equals(uri)) {
|
||||
return attr.getLocalName();
|
||||
}
|
||||
visited.add(uri);
|
||||
@@ -234,7 +234,7 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor {
|
||||
// Use a sensible default prefix if we can't find one.
|
||||
// We need to make sure the prefix is not one that was declared in the scope
|
||||
// visited above.
|
||||
prefix = AndroidConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
prefix = SdkConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String base = prefix;
|
||||
for (int i = 1; visited.contains(prefix); i++) {
|
||||
prefix = base + Integer.toString(i);
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
package com.android.ide.eclipse.editors.descriptors;
|
||||
|
||||
import com.android.ide.eclipse.adt.AdtPlugin;
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.editors.IconFactory;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiAttributeNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class AttributeDescriptor {
|
||||
*
|
||||
* @param xmlLocalName The XML name of the attribute (case sensitive)
|
||||
* @param nsUri The URI of the attribute. Can be null if attribute has no namespace.
|
||||
* See {@link AndroidConstants#NS_RESOURCES} for a common value.
|
||||
* See {@link SdkConstants#NS_RESOURCES} for a common value.
|
||||
*/
|
||||
public AttributeDescriptor(String xmlLocalName, String nsUri) {
|
||||
mXmlLocalName = xmlLocalName;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.android.ide.eclipse.common.resources.DeclareStyleableInfo.AttributeIn
|
||||
import com.android.ide.eclipse.editors.layout.LayoutConstants;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiDocumentNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
@@ -75,7 +76,7 @@ public final class DescriptorsUtils {
|
||||
* @param xmlName The XML attribute name.
|
||||
* @param uiName The UI attribute name.
|
||||
* @param nsUri The URI of the attribute. Can be null if attribute has no namespace.
|
||||
* See {@link AndroidConstants#NS_RESOURCES} for a common value.
|
||||
* See {@link SdkConstants#NS_RESOURCES} for a common value.
|
||||
* @param tooltip An optional tooltip.
|
||||
* @return A new {@link TextAttributeDescriptor} (or derived) instance.
|
||||
*/
|
||||
@@ -90,7 +91,7 @@ public final class DescriptorsUtils {
|
||||
* @param elementXmlName Optional XML local name of the element to which attributes are
|
||||
* being added. When not null, this is used to filter overrides.
|
||||
* @param nsUri The URI of the attribute. Can be null if attribute has no namespace.
|
||||
* See {@link AndroidConstants#NS_RESOURCES} for a common value.
|
||||
* See {@link SdkConstants#NS_RESOURCES} for a common value.
|
||||
* @param infos The array of {@link AttributeInfo} to read and append to attributes
|
||||
* @param requiredAttributes An optional set of attributes to mark as "required" (i.e. append
|
||||
* a "*" to their UI name as a hint for the user.) If not null, must contains
|
||||
@@ -125,7 +126,7 @@ public final class DescriptorsUtils {
|
||||
* being added. When not null, this is used to filter overrides.
|
||||
* @param info The {@link AttributeInfo} to append to attributes
|
||||
* @param nsUri The URI of the attribute. Can be null if attribute has no namespace.
|
||||
* See {@link AndroidConstants#NS_RESOURCES} for a common value.
|
||||
* See {@link SdkConstants#NS_RESOURCES} for a common value.
|
||||
* @param required True if the attribute is to be marked as "required" (i.e. append
|
||||
* a "*" to its UI name as a hint for the user.)
|
||||
* @param overrides A map [attribute name => TextAttributeDescriptor creator]. A creator
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
package com.android.ide.eclipse.editors.descriptors;
|
||||
|
||||
import com.android.ide.eclipse.adt.AdtPlugin;
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.editors.IconFactory;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
@@ -147,7 +147,7 @@ public class ElementDescriptor {
|
||||
public final String getNamespace() {
|
||||
// For now we hard-code the prefix as being "android"
|
||||
if (mXmlName.startsWith("android:")) { //$NON-NLs-1$
|
||||
return AndroidConstants.NS_RESOURCES;
|
||||
return SdkConstants.NS_RESOURCES;
|
||||
}
|
||||
|
||||
return ""; //$NON-NLs-1$
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package com.android.ide.eclipse.editors.descriptors;
|
||||
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.common.resources.ResourceType;
|
||||
import com.android.ide.eclipse.editors.ui.ResourceValueCellEditor;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiAttributeNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiResourceAttributeNode;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
@@ -39,7 +39,7 @@ public final class ReferenceAttributeDescriptor extends TextAttributeDescriptor
|
||||
* @param xmlLocalName The XML name of the attribute (case sensitive)
|
||||
* @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null.
|
||||
* @param nsUri The URI of the attribute. Can be null if attribute has no namespace.
|
||||
* See {@link AndroidConstants#NS_RESOURCES} for a common value.
|
||||
* See {@link SdkConstants#NS_RESOURCES} for a common value.
|
||||
* @param tooltip A non-empty tooltip string or null
|
||||
*/
|
||||
public ReferenceAttributeDescriptor(String xmlLocalName, String uiName, String nsUri,
|
||||
@@ -55,7 +55,7 @@ public final class ReferenceAttributeDescriptor extends TextAttributeDescriptor
|
||||
* @param xmlLocalName The XML name of the attribute (case sensitive)
|
||||
* @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null.
|
||||
* @param nsUri The URI of the attribute. Can be null if attribute has no namespace.
|
||||
* See {@link AndroidConstants#NS_RESOURCES} for a common value.
|
||||
* See {@link SdkConstants#NS_RESOURCES} for a common value.
|
||||
* @param tooltip A non-empty tooltip string or null
|
||||
*/
|
||||
public ReferenceAttributeDescriptor(ResourceType resourceType,
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
package com.android.ide.eclipse.editors.descriptors;
|
||||
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.editors.ui.TextValueCellEditor;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiAttributeNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiTextAttributeNode;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
@@ -47,7 +47,7 @@ public class TextAttributeDescriptor extends AttributeDescriptor implements IPro
|
||||
* @param xmlLocalName The XML name of the attribute (case sensitive)
|
||||
* @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null.
|
||||
* @param nsUri The URI of the attribute. Can be null if attribute has no namespace.
|
||||
* See {@link AndroidConstants#NS_RESOURCES} for a common value.
|
||||
* See {@link SdkConstants#NS_RESOURCES} for a common value.
|
||||
* @param tooltip A non-empty tooltip string or null
|
||||
*/
|
||||
public TextAttributeDescriptor(String xmlLocalName, String uiName,
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.ide.eclipse.editors.layout;
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.editors.layout.descriptors.ViewElementDescriptor;
|
||||
import com.android.layoutlib.api.IXmlPullParser;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
@@ -61,7 +62,7 @@ public class WidgetPullParser extends BasePullParser {
|
||||
}
|
||||
|
||||
public String getAttributeNamespace(int index) {
|
||||
return AndroidConstants.NS_RESOURCES;
|
||||
return SdkConstants.NS_RESOURCES;
|
||||
}
|
||||
|
||||
public String getAttributePrefix(int index) {
|
||||
@@ -78,7 +79,7 @@ public class WidgetPullParser extends BasePullParser {
|
||||
}
|
||||
|
||||
public String getAttributeValue(String ns, String name) {
|
||||
if (AndroidConstants.NS_RESOURCES.equals(ns)) {
|
||||
if (SdkConstants.NS_RESOURCES.equals(ns)) {
|
||||
for (String[] attribute : mAttributes) {
|
||||
if (name.equals(attribute[0])) {
|
||||
return attribute[1];
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.android.ide.eclipse.editors.descriptors.DocumentDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.IDescriptorProvider;
|
||||
import com.android.ide.eclipse.editors.descriptors.SeparatorAttributeDescriptor;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -134,7 +135,7 @@ public final class LayoutDescriptors implements IDescriptorProvider {
|
||||
ArrayList<AttributeDescriptor> attributes = new ArrayList<AttributeDescriptor>();
|
||||
DescriptorsUtils.appendAttributes(attributes,
|
||||
null, // elementName
|
||||
AndroidConstants.NS_RESOURCES,
|
||||
SdkConstants.NS_RESOURCES,
|
||||
info.getAttributes(),
|
||||
null, // requiredAttributes
|
||||
null /* overrides */);
|
||||
@@ -148,7 +149,7 @@ public final class LayoutDescriptors implements IDescriptorProvider {
|
||||
String.format("Attributes from %1$s", link.getShortClassName())));
|
||||
DescriptorsUtils.appendAttributes(attributes,
|
||||
null, // elementName
|
||||
AndroidConstants.NS_RESOURCES,
|
||||
SdkConstants.NS_RESOURCES,
|
||||
attrList,
|
||||
null, // requiredAttributes
|
||||
null /* overrides */);
|
||||
@@ -163,7 +164,7 @@ public final class LayoutDescriptors implements IDescriptorProvider {
|
||||
boolean need_separator = true;
|
||||
for (AttributeInfo attr_info : layoutParams.getAttributes()) {
|
||||
if (DescriptorsUtils.containsAttribute(layoutAttributes,
|
||||
AndroidConstants.NS_RESOURCES, attr_info)) {
|
||||
SdkConstants.NS_RESOURCES, attr_info)) {
|
||||
continue;
|
||||
}
|
||||
if (need_separator) {
|
||||
@@ -182,7 +183,7 @@ public final class LayoutDescriptors implements IDescriptorProvider {
|
||||
}
|
||||
DescriptorsUtils.appendAttribute(layoutAttributes,
|
||||
null, // elementName
|
||||
AndroidConstants.NS_RESOURCES,
|
||||
SdkConstants.NS_RESOURCES,
|
||||
attr_info,
|
||||
false, // required
|
||||
null /* overrides */);
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
package com.android.ide.eclipse.editors.layout.parts;
|
||||
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
||||
import com.android.ide.eclipse.editors.uimodel.IUiUpdateListener;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.draw2d.IFigure;
|
||||
import org.eclipse.draw2d.geometry.Point;
|
||||
@@ -177,7 +177,7 @@ public abstract class UiElementEditPart extends AbstractGraphicalEditPart
|
||||
NamedNodeMap nodeAttributes = xmlNode.getAttributes();
|
||||
if (nodeAttributes != null) {
|
||||
Node attr = nodeAttributes.getNamedItemNS(
|
||||
AndroidConstants.NS_RESOURCES, attrName);
|
||||
SdkConstants.NS_RESOURCES, attrName);
|
||||
if (attr != null) {
|
||||
return attr.getNodeValue();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.android.ide.eclipse.editors.layout.descriptors.ViewElementDescriptor;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiDocumentNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||
import com.android.sdklib.IAndroidTarget;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
||||
@@ -109,7 +110,7 @@ public class UiViewElementNode extends UiElementNode {
|
||||
if (need_xmlns) {
|
||||
AttributeDescriptor desc = new XmlnsAttributeDescriptor(
|
||||
"android", //$NON-NLS-1$
|
||||
AndroidConstants.NS_RESOURCES);
|
||||
SdkConstants.NS_RESOURCES);
|
||||
mCachedAttributeDescriptors[direct_attrs.length + layout_attrs.length] = desc;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.android.ide.eclipse.editors.descriptors.ListAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.ReferenceAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.TextAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
||||
@@ -166,7 +167,7 @@ public final class AndroidManifestDescriptors implements IDescriptorProvider {
|
||||
|
||||
XmlnsAttributeDescriptor xmlns = new XmlnsAttributeDescriptor(
|
||||
"android", //$NON-NLS-1$
|
||||
AndroidConstants.NS_RESOURCES);
|
||||
SdkConstants.NS_RESOURCES);
|
||||
|
||||
// -- setup the required attributes overrides --
|
||||
|
||||
@@ -355,7 +356,7 @@ public final class AndroidManifestDescriptors implements IDescriptorProvider {
|
||||
ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>();
|
||||
DescriptorsUtils.appendAttributes(attrDescs,
|
||||
elemDesc.getXmlLocalName(),
|
||||
AndroidConstants.NS_RESOURCES,
|
||||
SdkConstants.NS_RESOURCES,
|
||||
style.getAttributes(),
|
||||
requiredAttributes,
|
||||
overrides);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ClassAttributeDescriptor extends TextAttributeDescriptor {
|
||||
* @param xmlLocalName The XML name of the attribute (case sensitive, with android: prefix).
|
||||
* @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null.
|
||||
* @param nsUri The URI of the attribute. Can be null if attribute has no namespace.
|
||||
* See {@link AndroidConstants#NS_RESOURCES} for a common value.
|
||||
* See {@link SdkConstants#NS_RESOURCES} for a common value.
|
||||
* @param tooltip A non-empty tooltip string or null.
|
||||
* @param mandatory indicates if the class attribute is mandatory.
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public class ClassAttributeDescriptor extends TextAttributeDescriptor {
|
||||
* @param xmlLocalName The XML local name of the attribute (case sensitive).
|
||||
* @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null.
|
||||
* @param nsUri The URI of the attribute. Can be null if attribute has no namespace.
|
||||
* See {@link AndroidConstants#NS_RESOURCES} for a common value.
|
||||
* See {@link SdkConstants#NS_RESOURCES} for a common value.
|
||||
* @param tooltip A non-empty tooltip string or null.
|
||||
* @param mandatory indicates if the class attribute is mandatory.
|
||||
*/
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package com.android.ide.eclipse.editors.manifest.model;
|
||||
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
||||
import com.android.ide.eclipse.editors.manifest.descriptors.AndroidManifestDescriptors;
|
||||
import com.android.ide.eclipse.editors.manifest.descriptors.ManifestElementDescriptor;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiAttributeNode;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
@@ -74,10 +74,10 @@ public final class UiManifestElementNode extends UiElementNode {
|
||||
if (desc != manifestDescriptors.getManifestElement() &&
|
||||
desc != manifestDescriptors.getApplicationElement()) {
|
||||
Element elem = (Element) getXmlNode();
|
||||
String attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES,
|
||||
String attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES,
|
||||
AndroidManifestDescriptors.ANDROID_NAME_ATTR);
|
||||
if (attr == null || attr.length() == 0) {
|
||||
attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES,
|
||||
attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES,
|
||||
AndroidManifestDescriptors.ANDROID_LABEL_ATTR);
|
||||
}
|
||||
if (attr != null && attr.length() > 0) {
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package com.android.ide.eclipse.editors.menu.descriptors;
|
||||
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.common.resources.DeclareStyleableInfo;
|
||||
import com.android.ide.eclipse.editors.descriptors.AttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.DescriptorsUtils;
|
||||
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.IDescriptorProvider;
|
||||
import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@@ -121,7 +121,7 @@ public final class MenuDescriptors implements IDescriptorProvider {
|
||||
false /* mandatory */);
|
||||
|
||||
XmlnsAttributeDescriptor xmlns = new XmlnsAttributeDescriptor("android", //$NON-NLS-1$
|
||||
AndroidConstants.NS_RESOURCES);
|
||||
SdkConstants.NS_RESOURCES);
|
||||
|
||||
updateElement(mDescriptor, styleMap, "Menu", xmlns); //$NON-NLS-1$
|
||||
mDescriptor.setChildren(new ElementDescriptor[] { top_item, top_group });
|
||||
@@ -159,7 +159,7 @@ public final class MenuDescriptors implements IDescriptorProvider {
|
||||
if (style != null) {
|
||||
DescriptorsUtils.appendAttributes(descs,
|
||||
null, // elementName
|
||||
AndroidConstants.NS_RESOURCES,
|
||||
SdkConstants.NS_RESOURCES,
|
||||
style.getAttributes(),
|
||||
null, // requiredAttributes
|
||||
null); // overrides
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.ide.eclipse.editors.uimodel;
|
||||
|
||||
import com.android.ide.eclipse.adt.AdtPlugin;
|
||||
import com.android.ide.eclipse.adt.sdk.AndroidTargetData;
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.editors.AndroidEditor;
|
||||
import com.android.ide.eclipse.editors.descriptors.AttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
||||
@@ -31,6 +30,7 @@ import com.android.ide.eclipse.editors.manifest.descriptors.AndroidManifestDescr
|
||||
import com.android.ide.eclipse.editors.resources.descriptors.ResourcesDescriptors;
|
||||
import com.android.ide.eclipse.editors.uimodel.IUiUpdateListener.UiUpdateState;
|
||||
import com.android.ide.eclipse.editors.xml.descriptors.XmlDescriptors;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
@@ -201,21 +201,21 @@ public class UiElementNode implements IPropertySource {
|
||||
// just using the UI name below.
|
||||
Element elem = (Element) mXmlNode;
|
||||
|
||||
String attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES,
|
||||
String attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES,
|
||||
AndroidManifestDescriptors.ANDROID_NAME_ATTR);
|
||||
if (attr == null || attr.length() == 0) {
|
||||
attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES,
|
||||
attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES,
|
||||
AndroidManifestDescriptors.ANDROID_LABEL_ATTR);
|
||||
}
|
||||
if (attr == null || attr.length() == 0) {
|
||||
attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES,
|
||||
attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES,
|
||||
XmlDescriptors.PREF_KEY_ATTR);
|
||||
}
|
||||
if (attr == null || attr.length() == 0) {
|
||||
attr = elem.getAttribute(ResourcesDescriptors.NAME_ATTR);
|
||||
}
|
||||
if (attr == null || attr.length() == 0) {
|
||||
attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES,
|
||||
attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES,
|
||||
LayoutDescriptors.ID_ATTR);
|
||||
|
||||
if (attr != null && attr.length() > 0) {
|
||||
@@ -1205,13 +1205,13 @@ public class UiElementNode implements IPropertySource {
|
||||
*
|
||||
* @param node The current node. Must not be null.
|
||||
* @param nsUri The namespace URI of which the prefix is to be found,
|
||||
* e.g. AndroidConstants.NS_RESOURCES
|
||||
* e.g. SdkConstants.NS_RESOURCES
|
||||
* @return The first prefix declared or the default "android" prefix.
|
||||
*/
|
||||
private String lookupNamespacePrefix(Node node, String nsUri) {
|
||||
// Note: Node.lookupPrefix is not implemented in wst/xml/core NodeImpl.java
|
||||
// The following code emulates this simple call:
|
||||
// String prefix = node.lookupPrefix(AndroidConstants.NS_RESOURCES);
|
||||
// String prefix = node.lookupPrefix(SdkConstants.NS_RESOURCES);
|
||||
|
||||
// if the requested URI is null, it denotes an attribute with no namespace.
|
||||
if (nsUri == null) {
|
||||
@@ -1234,7 +1234,7 @@ public class UiElementNode implements IPropertySource {
|
||||
if ("xmlns".equals(attr.getPrefix())) { //$NON-NLS-1$
|
||||
String uri = attr.getNodeValue();
|
||||
String nsPrefix = attr.getLocalName();
|
||||
if (AndroidConstants.NS_RESOURCES.equals(uri)) {
|
||||
if (SdkConstants.NS_RESOURCES.equals(uri)) {
|
||||
return nsPrefix;
|
||||
}
|
||||
visited.add(nsPrefix);
|
||||
@@ -1245,7 +1245,7 @@ public class UiElementNode implements IPropertySource {
|
||||
// Use a sensible default prefix if we can't find one.
|
||||
// We need to make sure the prefix is not one that was declared in the scope
|
||||
// visited above.
|
||||
String prefix = AndroidConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String prefix = SdkConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String base = prefix;
|
||||
for (int i = 1; visited.contains(prefix); i++) {
|
||||
prefix = base + Integer.toString(i);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.ide.eclipse.editors.uimodel;
|
||||
|
||||
import com.android.ide.eclipse.adt.AdtPlugin;
|
||||
import com.android.ide.eclipse.adt.sdk.AndroidTargetData;
|
||||
import com.android.ide.eclipse.common.AndroidConstants;
|
||||
import com.android.ide.eclipse.editors.AndroidEditor;
|
||||
import com.android.ide.eclipse.editors.descriptors.AttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.DescriptorsUtils;
|
||||
@@ -26,6 +25,7 @@ import com.android.ide.eclipse.editors.descriptors.ListAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.TextAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.ui.SectionHelper;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.swt.SWT;
|
||||
@@ -135,7 +135,7 @@ public class UiListAttributeNode extends UiAbstractTextAttributeNode {
|
||||
|
||||
// FrameworkResourceManager expects a specific prefix for the attribute.
|
||||
String prefix = "";
|
||||
if (AndroidConstants.NS_RESOURCES.equals(descriptor.getNamespaceUri())) {
|
||||
if (SdkConstants.NS_RESOURCES.equals(descriptor.getNamespaceUri())) {
|
||||
prefix = "android:"; //$NON-NLS-1$
|
||||
} else if (XmlnsAttributeDescriptor.XMLNS_URI.equals(descriptor.getNamespaceUri())) {
|
||||
prefix = "xmlns:"; //$NON-NLS-1$
|
||||
|
||||
@@ -163,7 +163,7 @@ class NewXmlFileCreationPage extends WizardPage {
|
||||
|
||||
/**
|
||||
* If the generated resource XML file requires an "android" XMLNS, this should be set
|
||||
* to {@link AndroidConstants#NS_RESOURCES}. When it is null, no XMLNS is generated.
|
||||
* to {@link SdkConstants#NS_RESOURCES}. When it is null, no XMLNS is generated.
|
||||
*/
|
||||
String getXmlns() {
|
||||
return mXmlns;
|
||||
@@ -188,7 +188,7 @@ class NewXmlFileCreationPage extends WizardPage {
|
||||
ResourceFolderType.LAYOUT, // folder type
|
||||
AndroidTargetData.DESCRIPTOR_LAYOUT, // root seed
|
||||
"LinearLayout", // default root
|
||||
AndroidConstants.NS_RESOURCES, // xmlns
|
||||
SdkConstants.NS_RESOURCES, // xmlns
|
||||
"android:layout_width=\"wrap_content\"\n" + // default attributes
|
||||
"android:layout_height=\"wrap_content\""
|
||||
),
|
||||
@@ -205,7 +205,7 @@ class NewXmlFileCreationPage extends WizardPage {
|
||||
ResourceFolderType.MENU, // folder type
|
||||
MenuDescriptors.MENU_ROOT_ELEMENT, // root seed
|
||||
null, // default root
|
||||
AndroidConstants.NS_RESOURCES, // xmlns
|
||||
SdkConstants.NS_RESOURCES, // xmlns
|
||||
null // default attributes
|
||||
),
|
||||
new TypeInfo("Preference", // UI name
|
||||
@@ -213,7 +213,7 @@ class NewXmlFileCreationPage extends WizardPage {
|
||||
ResourceFolderType.XML, // folder type
|
||||
AndroidTargetData.DESCRIPTOR_PREFERENCES, // root seed
|
||||
AndroidConstants.CLASS_PREFERENCE_SCREEN, // default root
|
||||
AndroidConstants.NS_RESOURCES, // xmlns
|
||||
SdkConstants.NS_RESOURCES, // xmlns
|
||||
null // default attributes
|
||||
),
|
||||
new TypeInfo("Searchable", // UI name
|
||||
@@ -221,7 +221,7 @@ class NewXmlFileCreationPage extends WizardPage {
|
||||
ResourceFolderType.XML, // folder type
|
||||
AndroidTargetData.DESCRIPTOR_SEARCHABLE, // root seed
|
||||
null, // default root
|
||||
AndroidConstants.NS_RESOURCES, // xmlns
|
||||
SdkConstants.NS_RESOURCES, // xmlns
|
||||
null // default attributes
|
||||
),
|
||||
new TypeInfo("Animation", // UI name
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.android.ide.eclipse.editors.descriptors.DocumentDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
||||
import com.android.ide.eclipse.editors.uimodel.UiDocumentNode;
|
||||
import com.android.sdklib.IAndroidTarget;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
@@ -80,7 +81,7 @@ public class XmlEditor extends AndroidEditor {
|
||||
|
||||
FirstElementParser.Result result = FirstElementParser.parse(
|
||||
file.getLocation().toOSString(),
|
||||
AndroidConstants.NS_RESOURCES);
|
||||
SdkConstants.NS_RESOURCES);
|
||||
|
||||
if (result != null) {
|
||||
String name = result.getElement();
|
||||
|
||||
@@ -25,9 +25,10 @@ import com.android.ide.eclipse.editors.descriptors.DescriptorsUtils;
|
||||
import com.android.ide.eclipse.editors.descriptors.DocumentDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.IDescriptorProvider;
|
||||
import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.SeparatorAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor;
|
||||
import com.android.ide.eclipse.editors.layout.descriptors.ViewElementDescriptor;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@@ -111,7 +112,7 @@ public final class XmlDescriptors implements IDescriptorProvider {
|
||||
|
||||
XmlnsAttributeDescriptor xmlns = new XmlnsAttributeDescriptor(
|
||||
"android", //$NON-NLS-1$
|
||||
AndroidConstants.NS_RESOURCES);
|
||||
SdkConstants.NS_RESOURCES);
|
||||
|
||||
ElementDescriptor searchable = createSearchable(searchableStyleMap, xmlns);
|
||||
ElementDescriptor preferences = createPreference(prefs, prefGroups, xmlns);
|
||||
@@ -191,7 +192,7 @@ public final class XmlDescriptors implements IDescriptorProvider {
|
||||
if (style != null) {
|
||||
DescriptorsUtils.appendAttributes(descs,
|
||||
null, // elementName
|
||||
AndroidConstants.NS_RESOURCES,
|
||||
SdkConstants.NS_RESOURCES,
|
||||
style.getAttributes(),
|
||||
null, // requiredAttributes
|
||||
null); // overrides
|
||||
@@ -280,7 +281,7 @@ public final class XmlDescriptors implements IDescriptorProvider {
|
||||
ArrayList<AttributeDescriptor> attributes = new ArrayList<AttributeDescriptor>();
|
||||
DescriptorsUtils.appendAttributes(attributes,
|
||||
null, // elementName
|
||||
AndroidConstants.NS_RESOURCES,
|
||||
SdkConstants.NS_RESOURCES,
|
||||
info.getAttributes(),
|
||||
null, // requiredAttributes
|
||||
null); // overrides
|
||||
@@ -294,7 +295,7 @@ public final class XmlDescriptors implements IDescriptorProvider {
|
||||
String.format("Attributes from %1$s", link.getShortClassName())));
|
||||
DescriptorsUtils.appendAttributes(attributes,
|
||||
null, // elementName
|
||||
AndroidConstants.NS_RESOURCES,
|
||||
SdkConstants.NS_RESOURCES,
|
||||
attrList,
|
||||
null, // requiredAttributes
|
||||
null); // overrides
|
||||
|
||||
Reference in New Issue
Block a user