From 4ad5b5f5933425e4416c5ef4434e0c8c16ccf0a8 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 26 Dec 2009 21:27:14 -0800 Subject: [PATCH] ADT: Refactor in ViewElementDescriptor. This changes the member "CanonicalClassName" into "FullClassName" since the value is the FQCN of the java View. Change-Id: Idbfcf665c12c598f680fdf58ecb0ae7820da8bdb --- .../internal/editors/layout/WidgetPullParser.java | 20 +++-- .../descriptors/CustomViewDescriptorService.java | 94 +++++++++++----------- .../layout/descriptors/LayoutDescriptors.java | 4 +- .../layout/descriptors/ViewElementDescriptor.java | 56 ++++++------- .../editors/ui/tree/NewItemSelectionDialog.java | 54 ++++++------- .../editors/xml/descriptors/XmlDescriptors.java | 4 +- .../adt/internal/resources/ViewClassInfo.java | 22 ++--- 7 files changed, 130 insertions(+), 124 deletions(-) diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java index 50d259f93..4343ce730 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java @@ -19,17 +19,21 @@ package com.android.ide.eclipse.adt.internal.editors.layout; import com.android.ide.eclipse.adt.AndroidConstants; import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor; import com.android.layoutlib.api.IXmlPullParser; +import com.android.layoutlib.api.ILayoutResult.ILayoutViewInfo; import com.android.sdklib.SdkConstants; import org.xmlpull.v1.XmlPullParserException; /** * {@link IXmlPullParser} implementation to render android widget bitmap. - *

The parser emulates a layout that contains just one widget, described by the + *

+ * The parser emulates a layout that contains just one widget, described by the * {@link ViewElementDescriptor} passed in the constructor. + *

+ * This pull parser generates {@link ILayoutViewInfo}s which key is a {@link ViewElementDescriptor}. */ public class WidgetPullParser extends BasePullParser { - + private final ViewElementDescriptor mDescriptor; private String[][] mAttributes = new String[][] { { "text", null }, @@ -39,8 +43,8 @@ public class WidgetPullParser extends BasePullParser { public WidgetPullParser(ViewElementDescriptor descriptor) { mDescriptor = descriptor; - - String[] segments = mDescriptor.getCanonicalClassName().split(AndroidConstants.RE_DOT); + + String[] segments = mDescriptor.getFullClassName().split(AndroidConstants.RE_DOT); mAttributes[0][1] = segments[segments.length-1]; } @@ -57,7 +61,7 @@ public class WidgetPullParser extends BasePullParser { if (index < mAttributes.length) { return mAttributes[index][0]; } - + return null; } @@ -74,7 +78,7 @@ public class WidgetPullParser extends BasePullParser { if (index < mAttributes.length) { return mAttributes[index][1]; } - + return null; } @@ -86,7 +90,7 @@ public class WidgetPullParser extends BasePullParser { } } } - + return null; } @@ -118,7 +122,7 @@ public class WidgetPullParser extends BasePullParser { if (mParsingState == START_TAG) { return true; } - + throw new XmlPullParserException("Call to isEmptyElementTag while not in START_TAG", this, null); } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/CustomViewDescriptorService.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/CustomViewDescriptorService.java index b765abd5e..be844cc8c 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/CustomViewDescriptorService.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/CustomViewDescriptorService.java @@ -45,13 +45,13 @@ import java.util.List; * associated {@link ElementDescriptor} object. *

* If the custom class does not exist, no monitoring is put in place to avoid having to listen - * to all class changes in the projects. - * + * to all class changes in the projects. + * */ public final class CustomViewDescriptorService { private static CustomViewDescriptorService sThis = new CustomViewDescriptorService(); - + /** * Map where keys are the project, and values are another map containing all the known * custom View class for this project. The custom View class are stored in a map @@ -67,10 +67,10 @@ public final class CustomViewDescriptorService { */ @SuppressWarnings("unused") private ICustomViewDescriptorListener mListener; - + /** * Classes which implements this interface provide a method that deal with modifications - * in custom View class triggering a change in its associated {@link ViewClassInfo} object. + * in custom View class triggering a change in its associated {@link ViewClassInfo} object. */ public interface ICustomViewDescriptorListener { /** @@ -81,14 +81,14 @@ public final class CustomViewDescriptorService { */ public void updatedClassInfo(IProject project, String className, ElementDescriptor descriptor); } - + /** * Returns the singleton instance of {@link CustomViewDescriptorService}. */ public static CustomViewDescriptorService getInstance() { return sThis; } - + /** * Sets the listener receiving custom View class modification notifications. * @param listener the listener to receive the notifications. @@ -99,7 +99,7 @@ public final class CustomViewDescriptorService { public void setListener(ICustomViewDescriptorListener listener) { mListener = listener; } - + /** * Returns the {@link ElementDescriptor} for a particular project/class. *

@@ -108,51 +108,51 @@ public final class CustomViewDescriptorService { * established, a monitoring for that particular class is initiated. Any change will * trigger a notification to the {@link ICustomViewDescriptorListener}. * @param project the project containing the class. - * @param fqClassName the fully qualified name of the class. + * @param fqcn the fully qualified name of the class. * @return a ElementDescriptor or null if the class was not * a custom View class. */ - public ElementDescriptor getDescriptor(IProject project, String fqClassName) { + public ElementDescriptor getDescriptor(IProject project, String fqcn) { // look in the map first synchronized (mCustomDescriptorMap) { HashMap map = mCustomDescriptorMap.get(project); - + if (map != null) { - ElementDescriptor descriptor = map.get(fqClassName); + ElementDescriptor descriptor = map.get(fqcn); if (descriptor != null) { return descriptor; } } - + // if we step here, it looks like we haven't created it yet. // First lets check this is in fact a valid type in the project - + try { // We expect the project to be both opened and of java type (since it's an android // project), so we can create a IJavaProject object from our IProject. IJavaProject javaProject = JavaCore.create(project); - + // replace $ by . in the class name - String javaClassName = fqClassName.replaceAll("\\$", "\\."); //$NON-NLS-1$ //$NON-NLS-2$ - + String javaClassName = fqcn.replaceAll("\\$", "\\."); //$NON-NLS-1$ //$NON-NLS-2$ + // look for the IType object for this class IType type = javaProject.findType(javaClassName); if (type != null && type.exists()) { // the type exists. Let's get the parent class and its ViewClassInfo. - + // get the type hierarchy ITypeHierarchy hierarchy = type.newSupertypeHierarchy( new NullProgressMonitor()); - + ElementDescriptor parentDescriptor = getDescriptor( hierarchy.getSuperclass(type), project, hierarchy); - + if (parentDescriptor != null) { // we have a valid parent, lets create a new ElementDescriptor. - ViewElementDescriptor descriptor = new ViewElementDescriptor(fqClassName, - fqClassName, // ui_name - fqClassName, // canonical class name + ViewElementDescriptor descriptor = new ViewElementDescriptor(fqcn, + fqcn, // ui_name + fqcn, // canonical class name null, // tooltip null, // sdk_url getAttributeDescriptor(type, parentDescriptor), @@ -166,12 +166,12 @@ public final class CustomViewDescriptorService { map = new HashMap(); mCustomDescriptorMap.put(project, map); } - - map.put(fqClassName, descriptor); + + map.put(fqcn, descriptor); } - + //TODO setup listener on this resource change. - + return descriptor; } } @@ -183,12 +183,12 @@ public final class CustomViewDescriptorService { return null; } - + /** * Computes (if needed) and returns the {@link ElementDescriptor} for the specified type. - * - * @param type - * @param project + * + * @param type + * @param project * @param typeHierarchy * @return A ViewElementDescriptor or null if type or typeHierarchy is null. */ @@ -209,19 +209,19 @@ public final class CustomViewDescriptorService { return null; } - String canonicalName = type.getFullyQualifiedName(); - + String fqcn = type.getFullyQualifiedName(); + if (builtInList != null) { for (ElementDescriptor desc : builtInList) { if (desc instanceof ViewElementDescriptor) { ViewElementDescriptor viewDescriptor = (ViewElementDescriptor)desc; - if (canonicalName.equals(viewDescriptor.getCanonicalClassName())) { + if (fqcn.equals(viewDescriptor.getFullClassName())) { return viewDescriptor; } } } } - + // it's not a built-in class? Lets look if the superclass is built-in // give up if there's no type if (typeHierarchy == null) { @@ -232,43 +232,43 @@ public final class CustomViewDescriptorService { if (parentType != null) { ViewElementDescriptor parentDescriptor = getDescriptor(parentType, project, typeHierarchy); - + if (parentDescriptor != null) { // parent class is a valid View class with a descriptor, so we create one // for this class. - ViewElementDescriptor descriptor = new ViewElementDescriptor(canonicalName, - canonicalName, // ui_name - canonicalName, // canonical name + ViewElementDescriptor descriptor = new ViewElementDescriptor(fqcn, + fqcn, // ui_name + fqcn, // canonical name null, // tooltip null, // sdk_url getAttributeDescriptor(type, parentDescriptor), null, // layout attributes null, // children false /* mandatory */); - + // add it to the map synchronized (mCustomDescriptorMap) { HashMap map = mCustomDescriptorMap.get(project); - + if (map == null) { map = new HashMap(); mCustomDescriptorMap.put(project, map); } - - map.put(canonicalName, descriptor); - + + map.put(fqcn, descriptor); + } //TODO setup listener on this resource change. - + return descriptor; } } - + // class is neither a built-in view class, nor extend one. return null. return null; } - + /** * Returns the array of {@link AttributeDescriptor} for the specified {@link IType}. *

diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java index b855587c0..89f0a3b87 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java @@ -217,7 +217,7 @@ public final class LayoutDescriptors implements IDescriptorProvider { return new ViewElementDescriptor(xml_name, xml_name, // ui_name - info.getCanonicalClassName(), + info.getFullClassName(), tooltip, null, // sdk_url attributes.toArray(new AttributeDescriptor[attributes.size()]), @@ -313,7 +313,7 @@ public final class LayoutDescriptors implements IDescriptorProvider { for (ElementDescriptor desc : knownViews) { if (desc instanceof ViewElementDescriptor) { ViewElementDescriptor viewDesc = (ViewElementDescriptor) desc; - if (viewFqcn.equals(viewDesc.getCanonicalClassName())) { + if (viewFqcn.equals(viewDesc.getFullClassName())) { return viewDesc.getLayoutAttributes(); } } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/ViewElementDescriptor.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/ViewElementDescriptor.java index 1ae9231a7..bd3332e85 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/ViewElementDescriptor.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/ViewElementDescriptor.java @@ -24,26 +24,27 @@ import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode; /** * {@link ViewElementDescriptor} describes the properties expected for a given XML element node * representing a class in an XML Layout file. - * + * * @see ElementDescriptor */ public final class ViewElementDescriptor extends ElementDescriptor { - - private String mCanonicalClassName; + + /** The full class name (FQCN) of this view. */ + private String mFullClassName; /** The list of layout attributes. Can be empty but not null. */ private AttributeDescriptor[] mLayoutAttributes; - + /** * Constructs a new {@link ViewElementDescriptor} based on its XML name, UI name, * the canonical name of the class it represents, its tooltip, its SDK url, its attributes list, * its children list and its mandatory flag. - * + * * @param xml_name The XML element node name. Case sensitive. * @param ui_name The XML element name for the user interface, typically capitalized. - * @param canonicalClassName The canonical class name the {@link ViewElementDescriptor} is - * representing. + * @param fullClassName The fully qualified class name the {@link ViewElementDescriptor} is + * representing. * @param tooltip An optional tooltip. Can be null or empty. * @param sdk_url An optional SKD URL. Can be null or empty. * @param attributes The list of allowed attributes. Can be null or empty. @@ -55,12 +56,12 @@ public final class ViewElementDescriptor extends ElementDescriptor { * ceases to exist. */ public ViewElementDescriptor(String xml_name, String ui_name, - String canonicalClassName, + String fullClassName, String tooltip, String sdk_url, AttributeDescriptor[] attributes, AttributeDescriptor[] layoutAttributes, ElementDescriptor[] children, boolean mandatory) { super(xml_name, ui_name, tooltip, sdk_url, attributes, children, mandatory); - mCanonicalClassName = canonicalClassName; + mFullClassName = fullClassName; mLayoutAttributes = layoutAttributes != null ? layoutAttributes : new AttributeDescriptor[0]; } @@ -69,37 +70,37 @@ public final class ViewElementDescriptor extends ElementDescriptor { * name of the class it represents, and its children list. * The UI name is build by capitalizing the XML name. * The UI nodes will be non-mandatory. - * + * * @param xml_name The XML element node name. Case sensitive. - * @param canonicalClassName The canonical class name the {@link ViewElementDescriptor} is - * representing. + * @param fullClassName The fully qualified class name the {@link ViewElementDescriptor} is + * representing. * @param children The list of allowed children. Can be null or empty. * @param mandatory Whether this node must always exist (even for empty models). A mandatory * UI node is never deleted and it may lack an actual XML node attached. A non-mandatory * UI node MUST have an XML node attached and it will cease to exist when the XML node * ceases to exist. */ - public ViewElementDescriptor(String xml_name, String canonicalClassName, + public ViewElementDescriptor(String xml_name, String fullClassName, ElementDescriptor[] children, boolean mandatory) { super(xml_name, children, mandatory); - mCanonicalClassName = canonicalClassName; + mFullClassName = fullClassName; } /** * Constructs a new {@link ElementDescriptor} based on its XML name and children list. * The UI name is build by capitalizing the XML name. * The UI nodes will be non-mandatory. - * + * * @param xml_name The XML element node name. Case sensitive. - * @param canonicalClassName The canonical class name the {@link ViewElementDescriptor} is + * @param fullClassName The fully qualified class name the {@link ViewElementDescriptor} is * representing. * @param children The list of allowed children. Can be null or empty. */ - public ViewElementDescriptor(String xml_name, String canonicalClassName, + public ViewElementDescriptor(String xml_name, String fullClassName, ElementDescriptor[] children) { super(xml_name, children); - mCanonicalClassName = canonicalClassName; + mFullClassName = fullClassName; } /** @@ -107,23 +108,24 @@ public final class ViewElementDescriptor extends ElementDescriptor { * name of the class it represents. * The UI name is build by capitalizing the XML name. * The UI nodes will be non-mandatory. - * + * * @param xml_name The XML element node name. Case sensitive. - * @param canonicalClassName The canonical class name the {@link ViewElementDescriptor} is + * @param fullClassName The fully qualified class name the {@link ViewElementDescriptor} is * representing. */ - public ViewElementDescriptor(String xml_name, String canonicalClassName) { + public ViewElementDescriptor(String xml_name, String fullClassName) { super(xml_name); - mCanonicalClassName = canonicalClassName; + mFullClassName = fullClassName; } - + /** - * Returns the canonical name of the class represented by this element descriptor. + * Returns the fully qualified name of the View class represented by this element descriptor + * e.g. "android.view.View". */ - public String getCanonicalClassName() { - return mCanonicalClassName; + public String getFullClassName() { + return mFullClassName; } - + /** Returns the list of layout attributes. Can be empty but not null. */ public AttributeDescriptor[] getLayoutAttributes() { return mLayoutAttributes; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/tree/NewItemSelectionDialog.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/tree/NewItemSelectionDialog.java index 6fdb7aa75..dc532929e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/tree/NewItemSelectionDialog.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/tree/NewItemSelectionDialog.java @@ -73,7 +73,7 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { /** * Creates the new item selection dialog. - * + * * @param shell The parent shell for the list. * @param labelProvider ILabelProvider for the list. * @param descriptorFilters The element allows at the root of the tree. Can be null. @@ -100,17 +100,17 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { } } } - + setHelpAvailable(false); setMultipleSelection(false); - + setValidator(new ISelectionStatusValidator() { public IStatus validate(Object[] selection) { if (selection.length == 1 && selection[0] instanceof ViewElementDescriptor) { return new Status(IStatus.OK, // severity AdtPlugin.PLUGIN_ID, //plugin id IStatus.OK, // code - ((ViewElementDescriptor) selection[0]).getCanonicalClassName(), //msg + ((ViewElementDescriptor) selection[0]).getFullClassName(), //msg null); // exception } else if (selection.length == 1 && selection[0] instanceof ElementDescriptor) { return new Status(IStatus.OK, // severity @@ -122,14 +122,14 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { return new Status(IStatus.ERROR, // severity AdtPlugin.PLUGIN_ID, //plugin id IStatus.ERROR, // code - "Invalid selection", // msg, translatable + "Invalid selection", // msg, translatable null); // exception } } }); - + // Determine the initial selection using a couple heuristics. - + // First check if we can get the last used node type for this file. // The heuristic is that generally one keeps adding the same kind of items to the // same file, so reusing the last used item type makes most sense. @@ -165,7 +165,7 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { } } } - + return null; } @@ -184,13 +184,13 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { IFile f = ((FileEditorInput) editorInput).getFile(); if (f != null) { mLastUsedKey = f.getFullPath().toPortableString(); - + return sLastUsedXmlName.get(mLastUsedKey); } } } } - + return null; } @@ -216,7 +216,7 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { if (ui_node != null) { TreeMap counts = new TreeMap(); int max = -1; - + for (UiElementNode child : ui_node.getUiChildren()) { String name = child.getDescriptor().getXmlName(); Integer i = counts.get(name); @@ -257,15 +257,15 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { /** * Creates the dialog area. - * + * * First add a radio area, which may be either 2 radio controls or * just a message area if there's only one choice (the app root node). - * + * * Then uses the default from the AbstractElementListSelectionDialog * which is to add both a filter text and a filtered list. Adding both * is necessary (since the base class accesses both internal directly - * fields without checking for null pointers.) - * + * fields without checking for null pointers.) + * * Finally sets the initial selection list. */ @Override @@ -279,12 +279,12 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { // Initialize the list state. // This must be done after the filtered list as been created. chooseNode(mChosenRootNode); - + // Set the initial selection setInitialSelection(mChosenRootNode); return contents; } - + /** * Tries to set the initial selection based on the {@link #mInitialXmlName} computed * in the constructor. The selection is only set if there's an element descriptor @@ -301,7 +301,7 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { if (partial) { name = name.substring(1).toLowerCase(); } - + for (ElementDescriptor desc : getAllowedDescriptors(rootNode)) { if (!partial && desc.getXmlName().equals(name)) { initialElement = desc; @@ -315,7 +315,7 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { } } } - + setSelection(initialElement == null ? null : new ElementDescriptor[] { initialElement }); } @@ -324,7 +324,7 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { * @param content the parent composite of the message area. */ private Composite createRadioControl(Composite content) { - + if (mSelectedUiNode != null) { Button radio1 = new Button(content, SWT.RADIO); radio1.setText(String.format("Create a new element at the top level, in %1$s.", @@ -339,7 +339,7 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { radio1.setSelection(false); radio2.setSelection(true); mChosenRootNode = mSelectedUiNode; - + radio1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -347,7 +347,7 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { chooseNode(mLocalRootNode); } }); - + radio2.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -362,7 +362,7 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { mChosenRootNode = mLocalRootNode; } - + return content; } @@ -370,11 +370,11 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { * Internal helper to remember the root node choosen by the user. * It also sets the list view to the adequate list of children that can * be added to the chosen root node. - * + * * If the chosen root node is mLocalRootNode and a descriptor filter was specified * when creating the master-detail part, we use this as the set of nodes that * can be created on the root node. - * + * * @param ui_node The chosen root node, either mLocalRootNode or * mSelectedUiNode. */ @@ -386,12 +386,12 @@ public class NewItemSelectionDialog extends AbstractElementListSelectionDialog { /** * Returns the list of {@link ElementDescriptor}s that can be added to the given * UI node. - * + * * @param ui_node The UI node to which element should be added. Cannot be null. * @return A non-null array of {@link ElementDescriptor}. The array might be empty. */ private ElementDescriptor[] getAllowedDescriptors(UiElementNode ui_node) { - if (ui_node == mLocalRootNode && + if (ui_node == mLocalRootNode && mDescriptorFilters != null && mDescriptorFilters.length != 0) { return mDescriptorFilters; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/descriptors/XmlDescriptors.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/descriptors/XmlDescriptors.java index d393bee43..600db1b4c 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/descriptors/XmlDescriptors.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/descriptors/XmlDescriptors.java @@ -282,7 +282,7 @@ public final class XmlDescriptors implements IDescriptorProvider { ElementDescriptor desc = convertPref(info); newGroups.add(desc); - if (info.getCanonicalClassName() == AndroidConstants.CLASS_PREFERENCES) { + if (info.getFullClassName() == AndroidConstants.CLASS_PREFERENCES) { topPreferences = desc; } } @@ -353,7 +353,7 @@ public final class XmlDescriptors implements IDescriptorProvider { return new ViewElementDescriptor(xml_name, xml_name, // ui_name - info.getCanonicalClassName(), + info.getFullClassName(), tooltip, null, // sdk_url attributes.toArray(new AttributeDescriptor[attributes.size()]), diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ViewClassInfo.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ViewClassInfo.java index 23eb1e411..2e615444a 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ViewClassInfo.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ViewClassInfo.java @@ -27,23 +27,23 @@ public class ViewClassInfo { /** Is this a layout class (i.e. ViewGroup) or just a view? */ private boolean mIsLayout; /** FQCN e.g. android.view.View, never null. */ - private String mCanonicalClassName; + private String mFullClassName; /** Short class name, e.g. View, never null. */ private String mShortClassName; /** Super class. Can be null. */ private ViewClassInfo mSuperClass; /** Short javadoc. Can be null. */ - private String mJavaDoc; + private String mJavaDoc; /** Attributes for this view or view group. Can be empty but never null. */ private AttributeInfo[] mAttributes; - + public static class LayoutParamsInfo { /** Short class name, e.g. LayoutData, never null. */ private String mShortClassName; /** ViewLayout class info owning this layout data */ private ViewClassInfo mViewLayoutClass; /** Super class. Can be null. */ - private LayoutParamsInfo mSuperClass; + private LayoutParamsInfo mSuperClass; /** Layout Data Attributes for layout classes. Can be empty but not null. */ private AttributeInfo[] mAttributes; @@ -54,7 +54,7 @@ public class ViewClassInfo { mSuperClass = superClassInfo; mAttributes = new AttributeInfo[0]; } - + /** Returns short class name, e.g. "LayoutData" */ public String getShortClassName() { return mShortClassName; @@ -82,22 +82,22 @@ public class ViewClassInfo { public LayoutParamsInfo mLayoutData; // -------- - - public ViewClassInfo(boolean isLayout, String canonicalClassName, String shortClassName) { + + public ViewClassInfo(boolean isLayout, String fullClassName, String shortClassName) { mIsLayout = isLayout; - mCanonicalClassName = canonicalClassName; + mFullClassName = fullClassName; mShortClassName = shortClassName; mAttributes = new AttributeInfo[0]; } - + /** Returns whether this is a layout class (i.e. ViewGroup) or just a View */ public boolean isLayout() { return mIsLayout; } /** Returns FQCN e.g. "android.view.View" */ - public String getCanonicalClassName() { - return mCanonicalClassName; + public String getFullClassName() { + return mFullClassName; } /** Returns short class name, e.g. "View" */ -- 2.11.0