1 11 package org.eclipse.ui.commands; 12 13 import java.util.Collections ; 14 import java.util.Map ; 15 16 import org.eclipse.ui.internal.util.Util; 17 18 30 public final class CommandEvent { 31 32 36 private final boolean attributeValuesByNameChanged; 37 38 41 private final boolean categoryIdChanged; 42 43 46 private final ICommand command; 47 48 51 private final boolean definedChanged; 52 53 56 private final boolean descriptionChanged; 57 58 61 private final boolean handledChanged; 62 63 66 private final boolean keySequenceBindingsChanged; 67 68 71 private final boolean nameChanged; 72 73 77 private Map previousAttributeValuesByName; 78 79 106 public CommandEvent(ICommand command, boolean attributeValuesByNameChanged, 107 boolean categoryIdChanged, boolean definedChanged, 108 boolean descriptionChanged, boolean handledChanged, 109 boolean keySequenceBindingsChanged, boolean nameChanged, 110 Map previousAttributeValuesByName) { 111 if (command == null) { 112 throw new NullPointerException (); 113 } 114 115 if (!attributeValuesByNameChanged 116 && previousAttributeValuesByName != null) { 117 throw new IllegalArgumentException (); 118 } 119 120 if (attributeValuesByNameChanged) { 121 if (previousAttributeValuesByName == null) { 122 this.previousAttributeValuesByName = Collections.EMPTY_MAP; 123 } else { 124 this.previousAttributeValuesByName = Util.safeCopy( 125 previousAttributeValuesByName, String .class, 126 Object .class, false, true); 127 } 128 } 129 130 this.command = command; 131 this.attributeValuesByNameChanged = attributeValuesByNameChanged; 132 this.categoryIdChanged = categoryIdChanged; 133 this.definedChanged = definedChanged; 134 this.descriptionChanged = descriptionChanged; 135 this.handledChanged = handledChanged; 136 this.keySequenceBindingsChanged = keySequenceBindingsChanged; 137 this.nameChanged = nameChanged; 138 } 139 140 146 public ICommand getCommand() { 147 return command; 148 } 149 150 161 public Map getPreviousAttributeValuesByName() { 162 return previousAttributeValuesByName; 163 } 164 165 170 public boolean hasCategoryIdChanged() { 171 return categoryIdChanged; 172 } 173 174 179 public boolean hasDefinedChanged() { 180 return definedChanged; 181 } 182 183 188 public boolean hasDescriptionChanged() { 189 return descriptionChanged; 190 } 191 192 197 public boolean hasHandledChanged() { 198 return handledChanged; 199 } 200 201 206 public boolean hasNameChanged() { 207 return nameChanged; 208 } 209 210 215 public boolean haveAttributeValuesByNameChanged() { 216 return attributeValuesByNameChanged; 217 } 218 219 224 public boolean haveKeySequenceBindingsChanged() { 225 return keySequenceBindingsChanged; 226 } 227 } 228 | Popular Tags |