Home | History | Annotate | Download | only in descriptors
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.eclipse.org/org/documents/epl-v10.php
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ide.eclipse.adt.internal.editors.manifest.descriptors;
     18 
     19 import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor;
     20 import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
     21 import com.android.ide.eclipse.adt.internal.editors.manifest.model.UiManifestElementNode;
     22 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
     23 
     24 /**
     25  * {@link ManifestElementDescriptor} describes an XML element node, with its
     26  * element name, its possible attributes, its possible child elements but also
     27  * its display name and tooltip.
     28  *
     29  * This {@link ElementDescriptor} is specialized to create {@link UiManifestElementNode} UI nodes.
     30  */
     31 public class ManifestElementDescriptor extends ElementDescriptor {
     32 
     33     /**
     34      * Constructs a new {@link ManifestElementDescriptor}.
     35      *
     36      * @param xml_name The XML element node name. Case sensitive.
     37      * @param ui_name The XML element name for the user interface, typically capitalized.
     38      * @param tooltip An optional tooltip. Can be null or empty.
     39      * @param sdk_url An optional SKD URL. Can be null or empty.
     40      * @param attributes The list of allowed attributes. Can be null or empty.
     41      * @param children The list of allowed children. Can be null or empty.
     42      * @param mandatory Whether this node must always exist (even for empty models).
     43      */
     44     public ManifestElementDescriptor(String xml_name,
     45             String ui_name,
     46             String tooltip,
     47             String sdk_url,
     48             AttributeDescriptor[] attributes,
     49             ElementDescriptor[] children,
     50             Mandatory mandatory) {
     51         super(xml_name, ui_name, tooltip, sdk_url, attributes, children, mandatory);
     52     }
     53 
     54     /**
     55      * Constructs a new {@link ManifestElementDescriptor}.
     56      *
     57      * @param xml_name The XML element node name. Case sensitive.
     58      * @param ui_name The XML element name for the user interface, typically capitalized.
     59      * @param tooltip An optional tooltip. Can be null or empty.
     60      * @param sdk_url An optional SKD URL. Can be null or empty.
     61      * @param attributes The list of allowed attributes. Can be null or empty.
     62      * @param children The list of allowed children. Can be null or empty.
     63      * @param mandatory Whether this node must always exist (even for empty models).
     64      */
     65     public ManifestElementDescriptor(String xml_name,
     66             String ui_name,
     67             String tooltip,
     68             String sdk_url,
     69             AttributeDescriptor[] attributes,
     70             ElementDescriptor[] children,
     71             boolean mandatory) {
     72         super(xml_name, ui_name, tooltip, sdk_url, attributes, children, mandatory);
     73     }
     74 
     75     /**
     76      * Constructs a new {@link ManifestElementDescriptor}.
     77      *
     78      * @param xml_name The XML element node name. Case sensitive.
     79      * @param ui_name The XML element name for the user interface, typically capitalized.
     80      * @param tooltip An optional tooltip. Can be null or empty.
     81      * @param sdk_url An optional SKD URL. Can be null or empty.
     82      * @param attributes The list of allowed attributes. Can be null or empty.
     83      * @param children The list of allowed children. Can be null or empty.
     84      */
     85     public ManifestElementDescriptor(String xml_name,
     86             String ui_name,
     87             String tooltip,
     88             String sdk_url,
     89             AttributeDescriptor[] attributes,
     90             ElementDescriptor[] children) {
     91         super(xml_name, ui_name, tooltip, sdk_url, attributes, children, false);
     92     }
     93 
     94     /**
     95      * This is a shortcut for
     96      * ManifestElementDescriptor(xml_name, xml_name.capitalize(), null, null, null, children).
     97      * This constructor is mostly used for unit tests.
     98      *
     99      * @param xml_name The XML element node name. Case sensitive.
    100      */
    101     public ManifestElementDescriptor(String xml_name, ElementDescriptor[] children) {
    102         super(xml_name, children);
    103     }
    104 
    105     /**
    106      * This is a shortcut for
    107      * ManifestElementDescriptor(xml_name, xml_name.capitalize(), null, null, null, null).
    108      * This constructor is mostly used for unit tests.
    109      *
    110      * @param xml_name The XML element node name. Case sensitive.
    111      */
    112     public ManifestElementDescriptor(String xml_name) {
    113         super(xml_name, null);
    114     }
    115 
    116     /**
    117      * @return A new {@link UiElementNode} linked to this descriptor.
    118      */
    119     @Override
    120     public UiElementNode createUiNode() {
    121         return new UiManifestElementNode(this);
    122     }
    123 }
    124