1 11 12 package org.eclipse.core.commands.common; 13 14 import java.util.HashMap ; 15 import java.util.HashSet ; 16 import java.util.Iterator ; 17 import java.util.Map ; 18 import java.util.Set ; 19 20 31 public abstract class HandleObjectManager extends EventManager { 32 33 37 protected final Set definedHandleObjects = new HashSet (); 38 39 44 protected final Map handleObjectsById = new HashMap (); 45 46 53 protected final void checkId(final String id) { 54 if (id == null) { 55 throw new NullPointerException ( 56 "A handle object may not have a null identifier"); } 58 59 if (id.length() < 1) { 60 throw new IllegalArgumentException ( 61 "The handle object must not have a zero-length identifier"); } 63 } 64 65 71 protected final Set getDefinedHandleObjectIds() { 72 final HashSet definedHandleObjectIds = new HashSet (definedHandleObjects 73 .size()); 74 final Iterator handleObjectItr = definedHandleObjects.iterator(); 75 while (handleObjectItr.hasNext()) { 76 final HandleObject handleObject = (HandleObject) handleObjectItr 77 .next(); 78 final String id = handleObject.getId(); 79 definedHandleObjectIds.add(id); 80 } 81 return definedHandleObjectIds; 82 } 83 } 84 | Popular Tags |