OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / sdk / eclipse / plugins / com.android.ide.eclipse.adt / src / com / android / ide / eclipse / adt / internal / editors / descriptors / AttributeDescriptorLabelProvider.java
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.IconFactory;
20 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiAbstractTextAttributeNode;
21
22 import org.eclipse.jface.viewers.ILabelProvider;
23 import org.eclipse.jface.viewers.ILabelProviderListener;
24 import org.eclipse.swt.graphics.Image;
25
26 /**
27  * Label provider for {@link UiAbstractTextAttributeNode}.
28  */
29 public class AttributeDescriptorLabelProvider implements ILabelProvider {
30     
31     private final static AttributeDescriptorLabelProvider sThis =
32         new AttributeDescriptorLabelProvider();
33     
34     public static ILabelProvider getProvider() {
35         return sThis;
36     }
37
38     public Image getImage(Object element) {
39         if (element instanceof UiAbstractTextAttributeNode) {
40             UiAbstractTextAttributeNode node = (UiAbstractTextAttributeNode) element;
41             if (node.getDescriptor().isDeprecated()) {
42                 String v = node.getCurrentValue();
43                 if (v != null && v.length() > 0) {
44                     IconFactory factory = IconFactory.getInstance();
45                     return factory.getIcon("warning"); //$NON-NLS-1$
46                 }                
47             }
48         }
49
50         return null;
51     }
52
53     public String getText(Object element) {
54         if (element instanceof UiAbstractTextAttributeNode) {
55             return ((UiAbstractTextAttributeNode)element).getCurrentValue();
56         }
57
58         return null;
59     }
60
61     public void addListener(ILabelProviderListener listener) {
62         // TODO Auto-generated method stub
63
64     }
65
66     public void dispose() {
67         // TODO Auto-generated method stub
68
69     }
70
71     public boolean isLabelProperty(Object element, String property) {
72         // TODO Auto-generated method stub
73         return false;
74     }
75
76     public void removeListener(ILabelProviderListener listener) {
77         // TODO Auto-generated method stub
78
79     }
80
81 }