1 11 12 package org.eclipse.ui.handlers; 13 14 import java.util.Hashtable ; 15 16 import org.eclipse.core.runtime.IConfigurationElement; 17 import org.eclipse.core.runtime.IExecutableExtension; 18 import org.eclipse.jface.commands.RadioState; 19 20 45 public final class RegistryRadioState extends RadioState implements 46 IExecutableExtension { 47 48 56 private final void readDefault(final String defaultString) { 57 if ("true".equalsIgnoreCase(defaultString)) { setValue(Boolean.TRUE); 59 } 60 } 61 62 70 private final void readPersisted(final String persistedString) { 71 if ("false".equalsIgnoreCase(persistedString)) { setShouldPersist(false); 73 } 74 75 setShouldPersist(true); 76 } 77 78 public final void setInitializationData( 79 final IConfigurationElement configurationElement, 80 final String propertyName, final Object data) { 81 if (data instanceof String ) { 82 setRadioGroupIdentifier((String ) data); 84 setValue(Boolean.FALSE); 85 setShouldPersist(true); 86 87 } else if (data instanceof Hashtable ) { 88 final Hashtable parameters = (Hashtable ) data; 89 90 final Object defaultObject = parameters.get("default"); if (defaultObject instanceof String ) { 92 readDefault((String ) defaultObject); 93 } 94 95 final Object persistedObject = parameters.get("persisted"); if (persistedObject instanceof String ) { 97 readPersisted((String ) persistedObject); 98 } 99 100 final Object idObject = parameters.get("id"); if (idObject instanceof String ) { 102 setRadioGroupIdentifier((String ) idObject); 103 } 104 105 } else { 106 setShouldPersist(true); 107 108 } 109 } 110 } 111 | Popular Tags |