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.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.uimodel.UiAttributeNode;
     24 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
     25 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiResourceAttributeNode;
     26 import com.android.resources.ResourceType;
     27 
     28 /**
     29  * Describes a Theme/Style XML attribute displayed by a {@link UiResourceAttributeNode}
     30  * <p/>
     31  * Used by the override for .../theme in {@link AndroidManifestDescriptors}.
     32  */
     33 public final class ThemeAttributeDescriptor extends TextAttributeDescriptor {
     34 
     35     /**
     36      * Used by {@link DescriptorsUtils} to create instances of this descriptor.
     37      */
     38     public static final ITextAttributeCreator CREATOR = new ITextAttributeCreator() {
     39         @Override
     40         public TextAttributeDescriptor create(String xmlLocalName,
     41                 String nsUri, IAttributeInfo attrInfo) {
     42             return new ThemeAttributeDescriptor(xmlLocalName, nsUri, attrInfo);
     43         }
     44     };
     45 
     46     public ThemeAttributeDescriptor(String xmlLocalName, String nsUri, IAttributeInfo attrInfo) {
     47         super(xmlLocalName, nsUri, attrInfo);
     48     }
     49 
     50     /**
     51      * @return A new {@link UiResourceAttributeNode} linked to this theme descriptor.
     52      */
     53     @Override
     54     public UiAttributeNode createUiNode(UiElementNode uiParent) {
     55         return new UiResourceAttributeNode(ResourceType.STYLE, this, uiParent);
     56     }
     57 }
     58