OSDN Git Service

ADT: Exclude <include> tag from the GLE palette.
authorRaphael Moll <ralf@android.com>
Tue, 26 Oct 2010 23:18:45 +0000 (16:18 -0700)
committerRaphael Moll <ralf@android.com>
Tue, 26 Oct 2010 23:22:35 +0000 (16:22 -0700)
Change-Id: Ia318556bc88a823fb6eae9048634c824524f3b90

eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteComposite.java

index 5972df6..d49aeb9 100644 (file)
@@ -40,6 +40,13 @@ import java.util.Map.Entry;
  */
 public final class LayoutDescriptors implements IDescriptorProvider {
 
+    /**
+     * The XML name of the special &lt;include&gt; layout tag.
+     * A synthetic element with that name is created as part of the view descriptors list
+     * returned by {@link #getViewDescriptors()}.
+     */
+    public static final String VIEW_INCLUDE = "include";      //$NON-NLS-1$
+
     // Public attributes names, attributes descriptors and elements descriptors
     public static final String ID_ATTR = "id"; //$NON-NLS-1$
 
@@ -272,7 +279,7 @@ public final class LayoutDescriptors implements IDescriptorProvider {
      *   View descriptor and extract its layout attributes.
      */
     private void insertInclude(ArrayList<ElementDescriptor> knownViews) {
-        String xml_name = "include";  //$NON-NLS-1$
+        String xml_name = VIEW_INCLUDE;
 
         // Create the include custom attributes
         ArrayList<AttributeDescriptor> attributes = new ArrayList<AttributeDescriptor>();
index a1f0b10..4d62502 100755 (executable)
@@ -17,6 +17,7 @@
 package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
 
 import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
+import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
 
 import org.eclipse.swt.SWT;
@@ -241,6 +242,13 @@ public class PaletteComposite extends Composite {
         Toggle toggle = new Toggle(group, uiName);
 
         for (ElementDescriptor desc : descriptors) {
+
+            // Exclude the <include> tag from the View palette.
+            // We don't have drop support for it right now, although someday we should.
+            if (LayoutDescriptors.VIEW_INCLUDE.equals(desc.getXmlName())) {
+                continue;
+            }
+
             Item item = new Item(group, desc);
             toggle.addItem(item);
             GridData gd = new GridData();