1 /* 2 * Copyright (C) 2010 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.NavigationState; 21 import com.android.sdklib.resources.ResourceEnum; 22 23 import org.eclipse.swt.graphics.Image; 24 25 /** 26 * Resource Qualifier for navigation state. 27 */ 28 public final class NavigationStateQualifier extends EnumBasedResourceQualifier { 29 30 public static final String NAME = "Navigation State"; 31 32 private NavigationState mValue = null; 33 34 public NavigationStateQualifier() { 35 // pass 36 } 37 38 public NavigationStateQualifier(NavigationState value) { 39 mValue = value; 40 } 41 42 public NavigationState 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 @Override 62 public Image getIcon() { 63 return IconFactory.getInstance().getIcon("navpad"); //$NON-NLS-1$ 64 } 65 66 @Override 67 public boolean checkAndSet(String value, FolderConfiguration config) { 68 NavigationState state = NavigationState.getEnum(value); 69 if (state != null) { 70 NavigationStateQualifier qualifier = new NavigationStateQualifier(); 71 qualifier.mValue = state; 72 config.setNavigationStateQualifier(qualifier); 73 return true; 74 } 75 76 return false; 77 } 78 } 79