diff options
Diffstat (limited to 'eclipse')
2 files changed, 21 insertions, 7 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiManifestElementNode.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiManifestElementNode.java index 0b78a22..a4f701f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiManifestElementNode.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiManifestElementNode.java @@ -56,7 +56,7 @@ public final class UiManifestElementNode extends UiElementNode { /** * Computes a short string describing the UI node suitable for tree views. * Uses the element's attribute "android:name" if present, or the "android:label" one - * followed by the element's name. + * followed by the element's name if not repeated. * * @return A short string describing the UI node suitable for tree views. */ @@ -68,12 +68,13 @@ public final class UiManifestElementNode extends UiElementNode { manifestDescriptors = target.getManifestDescriptors(); } + String name = getDescriptor().getUiName(); + if (manifestDescriptors != null && getXmlNode() != null && getXmlNode() instanceof Element && getXmlNode().hasAttributes()) { - // Application and Manifest nodes have a special treatment: they are unique nodes // so we don't bother trying to differentiate their strings and we fall back to // just using the UI name below. @@ -90,12 +91,18 @@ public final class UiManifestElementNode extends UiElementNode { AndroidManifestDescriptors.ANDROID_LABEL_ATTR); } if (attr != null && attr.length() > 0) { - return String.format("%1$s (%2$s)", attr, getDescriptor().getUiName()); + // If the ui name is repeated in the attribute value, don't use it. + // Typical case is to avoid ".pkg.MyActivity (Activity)". + if (attr.contains(name)) { + return attr; + } else { + return String.format("%1$s (%2$s)", attr, name); + } } } } - return String.format("%1$s", getDescriptor().getUiName()); + return String.format("%1$s", name); } /** diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java index 1a66cdb..b969d30 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java @@ -211,17 +211,24 @@ public class UiElementNode implements IPropertySource { /** * Computes a short string describing the UI node suitable for tree views. * Uses the element's attribute "android:name" if present, or the "android:label" one - * followed by the element's name. + * followed by the element's name if not repeated. * * @return A short string describing the UI node suitable for tree views. */ public String getShortDescription() { + String name = mDescriptor.getUiName(); String attr = getDescAttribute(); if (attr != null) { - return String.format("%1$s (%2$s)", attr, mDescriptor.getUiName()); + // If the ui name is repeated in the attribute value, don't use it. + // Typical case is to avoid ".pkg.MyActivity (Activity)". + if (attr.contains(name)) { + return attr; + } else { + return String.format("%1$s (%2$s)", attr, name); + } } - return mDescriptor.getUiName(); + return name; } /** Returns the key attribute that can be used to describe this node, or null */ |