aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-03-01 18:57:39 -0800
committerTor Norbye <tnorbye@google.com>2012-03-01 18:58:45 -0800
commiteb84e2ffdfc1f734ed360caab3c48d799cd5d20f (patch)
tree5fcec63844838ea92b51758cdcdb607d3c3b80ff /eclipse/plugins
parent540b8a8fac9d9f07c0439a08d3f9f8f0486fd71f (diff)
downloadsdk-eb84e2ffdfc1f734ed360caab3c48d799cd5d20f.zip
sdk-eb84e2ffdfc1f734ed360caab3c48d799cd5d20f.tar.gz
sdk-eb84e2ffdfc1f734ed360caab3c48d799cd5d20f.tar.bz2
Show correct icons for <view class="Button"/>
Change-Id: I14b75cbbd80bdefc0a03f7b78579772ac0905b6e
Diffstat (limited to 'eclipse/plugins')
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java
index ef1a17c..485d574 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java
@@ -17,6 +17,7 @@
package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
import static com.android.ide.common.layout.LayoutConstants.ANDROID_URI;
+import static com.android.ide.common.layout.LayoutConstants.ATTR_CLASS;
import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_COLUMN;
import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_COLUMN_SPAN;
import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_ROW;
@@ -28,6 +29,7 @@ import static com.android.ide.common.layout.LayoutConstants.DRAWABLE_PREFIX;
import static com.android.ide.common.layout.LayoutConstants.LAYOUT_PREFIX;
import static com.android.ide.common.layout.LayoutConstants.LINEAR_LAYOUT;
import static com.android.ide.common.layout.LayoutConstants.VALUE_VERTICAL;
+import static com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors.VIEW_VIEWTAG;
import static org.eclipse.jface.viewers.StyledString.QUALIFIER_STYLER;
import com.android.annotations.VisibleForTesting;
@@ -496,13 +498,26 @@ public class OutlinePage extends ContentOutlinePage
Image img = null;
// Special case for the common case of vertical linear layouts:
// show vertical linear icon (the default icon shows horizontal orientation)
- if (desc.getUiName().equals(LINEAR_LAYOUT)) {
+ String uiName = desc.getUiName();
+ if (uiName.equals(LINEAR_LAYOUT)) {
Element e = (Element) node.getXmlNode();
if (VALUE_VERTICAL.equals(e.getAttributeNS(ANDROID_URI,
ATTR_ORIENTATION))) {
IconFactory factory = IconFactory.getInstance();
img = factory.getIcon("VerticalLinearLayout"); //$NON-NLS-1$
}
+ } else if (uiName.equals(VIEW_VIEWTAG)) {
+ Node xmlNode = node.getXmlNode();
+ if (xmlNode instanceof Element) {
+ String className = ((Element) xmlNode).getAttribute(ATTR_CLASS);
+ if (className != null && className.length() > 0) {
+ int index = className.lastIndexOf('.');
+ if (index != -1) {
+ className = className.substring(index + 1);
+ }
+ img = IconFactory.getInstance().getIcon(className);
+ }
+ }
}
if (img == null) {
img = desc.getGenericIcon();