Home | History | Annotate | Download | only in descriptors
      1 /*
      2  * Copyright (C) 2009 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.common.api.IAttributeInfo;
     20 import com.android.ide.eclipse.adt.internal.editors.descriptors.DescriptorsUtils;
     21 import com.android.ide.eclipse.adt.internal.editors.descriptors.ITextAttributeCreator;
     22 import com.android.ide.eclipse.adt.internal.editors.descriptors.TextAttributeDescriptor;
     23 import com.android.ide.eclipse.adt.internal.editors.manifest.model.UiManifestPkgAttrNode;
     24 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiAttributeNode;
     25 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
     26 
     27 /**
     28  * Describes a package XML attribute. It is displayed by a {@link UiManifestPkgAttrNode}.
     29  * <p/>
     30  * Used by the override for .../targetPackage in {@link AndroidManifestDescriptors}.
     31  */
     32 public class ManifestPkgAttrDescriptor extends TextAttributeDescriptor {
     33 
     34     /**
     35      * Used by {@link DescriptorsUtils} to create instances of this descriptor.
     36      */
     37     public static final ITextAttributeCreator CREATOR = new ITextAttributeCreator() {
     38         @Override
     39         public TextAttributeDescriptor create(String xmlLocalName,
     40                 String nsUri, IAttributeInfo attrInfo) {
     41             return new ManifestPkgAttrDescriptor(xmlLocalName, nsUri, attrInfo);
     42         }
     43     };
     44 
     45     public ManifestPkgAttrDescriptor(String xmlLocalName, String nsUri, IAttributeInfo attrInfo) {
     46         super(xmlLocalName, nsUri, attrInfo);
     47     }
     48 
     49     /**
     50      * @return A new {@link UiManifestPkgAttrNode} linked to this descriptor.
     51      */
     52     @Override
     53     public UiAttributeNode createUiNode(UiElementNode uiParent) {
     54         return new UiManifestPkgAttrNode(this, uiParent);
     55     }
     56 }
     57