Home | History | Annotate | Download | only in descriptors
      1 /*
      2  * Copyright (C) 2008 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.descriptors;
     18 
     19 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
     20 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
     21 
     22 /**
     23  * {@link DocumentDescriptor} describes the properties expected for an XML document node.
     24  *
     25  * Compared to ElementDescriptor, {@link DocumentDescriptor} does not have XML name nor UI name,
     26  * tooltip, SDK url and attributes list.
     27  * <p/>
     28  * It has a children list which represent all the possible roots of the document.
     29  * <p/>
     30  * The document nodes are "mandatory", meaning the UI node is never deleted and it may lack
     31  * an actual XML node attached.
     32  */
     33 public class DocumentDescriptor extends ElementDescriptor {
     34 
     35     /**
     36      * Constructs a new {@link DocumentDescriptor} based on its XML name and children list.
     37      * The UI name is build by capitalizing the XML name.
     38      * The UI nodes will be non-mandatory.
     39      * <p/>
     40      * The XML name is never shown in the UI directly. It is however used when an icon
     41      * needs to be found for the node.
     42      *
     43      * @param xml_name The XML element node name. Case sensitive.
     44      * @param children The list of allowed children. Can be null or empty.
     45      */
     46     public DocumentDescriptor(String xml_name, ElementDescriptor[] children) {
     47         super(xml_name, children, Mandatory.MANDATORY);
     48     }
     49 
     50     /**
     51      * @return A new {@link UiElementNode} linked to this descriptor.
     52      */
     53     @Override
     54     public UiElementNode createUiNode() {
     55         return new UiDocumentNode(this);
     56     }
     57 }
     58