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 / resources / configurations / NavigationMethodQualifier.java
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.resources.configurations;
18
19 import com.android.ide.eclipse.adt.internal.editors.IconFactory;
20 import com.android.sdklib.resources.Navigation;
21 import com.android.sdklib.resources.ResourceEnum;
22
23 import org.eclipse.swt.graphics.Image;
24
25 /**
26  * Resource Qualifier for Navigation Method.
27  */
28 public final class NavigationMethodQualifier extends EnumBasedResourceQualifier {
29
30     public static final String NAME = "Navigation Method";
31
32     private Navigation mValue;
33
34     public NavigationMethodQualifier() {
35         // pass
36     }
37
38     public NavigationMethodQualifier(Navigation value) {
39         mValue = value;
40     }
41
42     public Navigation getValue() {
43         return mValue;
44     }
45
46     @Override
47     ResourceEnum getEnumValue() {
48         return mValue;
49     }
50
51     @Override
52     public String getName() {
53         return NAME;
54     }
55
56     @Override
57     public String getShortName() {
58         return NAME;
59     }
60
61
62     @Override
63     public Image getIcon() {
64         return IconFactory.getInstance().getIcon("navpad"); //$NON-NLS-1$
65     }
66
67     @Override
68     public boolean checkAndSet(String value, FolderConfiguration config) {
69         Navigation method = Navigation.getEnum(value);
70         if (method != null) {
71             NavigationMethodQualifier qualifier = new NavigationMethodQualifier(method);
72             config.setNavigationMethodQualifier(qualifier);
73             return true;
74         }
75
76         return false;
77     }
78 }