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