1 11 12 package org.eclipse.jface.menus; 13 14 import org.eclipse.core.commands.INamedHandleStateIds; 15 import org.eclipse.jface.commands.PersistentState; 16 import org.eclipse.jface.preference.IPreferenceStore; 17 18 37 public class TextState extends PersistentState { 38 39 public final void load(final IPreferenceStore store, 40 final String preferenceKey) { 41 final String value = store.getString(preferenceKey); 42 setValue(value); 43 } 44 45 public final void save(final IPreferenceStore store, 46 final String preferenceKey) { 47 final Object value = getValue(); 48 if (value instanceof String ) { 49 store.setValue(preferenceKey, ((String ) value)); 50 } 51 } 52 53 public void setValue(final Object value) { 54 if (!(value instanceof String )) { 55 throw new IllegalArgumentException ( 56 "TextState takes a String as a value"); } 58 59 super.setValue(value); 60 } 61 62 } 63 | Popular Tags |