1 11 12 package org.eclipse.ui.commands; 13 14 import java.util.Collections ; 15 import java.util.HashMap ; 16 import java.util.Hashtable ; 17 import java.util.Map ; 18 import java.util.StringTokenizer ; 19 20 import org.eclipse.core.commands.IParameterValues; 21 import org.eclipse.core.runtime.IConfigurationElement; 22 import org.eclipse.core.runtime.IExecutableExtension; 23 24 50 public final class ExtensionParameterValues implements IParameterValues, 51 IExecutableExtension { 52 53 57 public static final String DELIMITER = ","; 59 63 private Map parameterValues = null; 64 65 public Map getParameterValues() { 66 return parameterValues; 67 } 68 69 public final void setInitializationData(final IConfigurationElement config, 70 final String propertyName, final Object data) { 71 if (data == null) { 72 parameterValues = Collections.EMPTY_MAP; 73 74 } else if (data instanceof String ) { 75 parameterValues = new HashMap (); 76 final StringTokenizer tokenizer = new StringTokenizer ( 77 (String ) data, DELIMITER); 78 while (tokenizer.hasMoreTokens()) { 79 final String name = tokenizer.nextToken(); 80 if (tokenizer.hasMoreTokens()) { 81 final String value = tokenizer.nextToken(); 82 parameterValues.put(name, value); 83 } 84 } 85 parameterValues = Collections.unmodifiableMap(parameterValues); 86 87 } else if (data instanceof Hashtable ) { 88 parameterValues = Collections.unmodifiableMap((Hashtable ) data); 89 90 } 91 92 } 93 } 94 | Popular Tags |