1 11 12 package org.eclipse.ui.internal.handlers; 13 14 import java.util.HashMap ; 15 import java.util.Map ; 16 17 import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; 18 19 32 public final class ActionCommandMappingService implements 33 IActionCommandMappingService { 34 35 39 private final Map mapping = new HashMap (); 40 41 public final String getCommandId(final String actionId) { 42 if (actionId == null) { 43 throw new NullPointerException ( 44 "Cannot get the command identifier for a null action id"); } 46 47 return (String ) mapping.get(actionId); 48 } 49 50 public final void map(final String actionId, final String commandId) { 51 if (actionId == null) { 52 throw new NullPointerException ("The action id cannot be null"); } 54 55 if (commandId == null) { 56 throw new NullPointerException ("The command id cannot be null"); } 58 59 mapping.put(actionId, commandId); 60 } 61 62 public final String getGeneratedCommandId(String targetId, String actionId) { 63 return IWorkbenchRegistryConstants.AUTOGENERATED_PREFIX + targetId 64 + '/' + actionId; 65 } 66 } 67 | Popular Tags |