1 11 package org.eclipse.core.commands; 12 13 import org.eclipse.core.commands.common.AbstractNamedHandleEvent; 14 15 25 public final class CommandEvent extends AbstractNamedHandleEvent { 26 27 30 private static final int CHANGED_CATEGORY = LAST_USED_BIT << 1; 31 32 35 private static final int CHANGED_HANDLED = LAST_USED_BIT << 2; 36 37 40 private static final int CHANGED_PARAMETERS = LAST_USED_BIT << 3; 41 42 48 private static final int CHANGED_RETURN_TYPE = LAST_USED_BIT << 4; 49 50 56 private static final int CHANGED_HELP_CONTEXT_ID = LAST_USED_BIT << 5; 57 58 64 private static final int CHANGED_ENABLED = LAST_USED_BIT << 6; 65 66 69 private final Command command; 70 71 90 public CommandEvent(final Command command, final boolean categoryChanged, 91 final boolean definedChanged, final boolean descriptionChanged, 92 final boolean handledChanged, final boolean nameChanged, 93 final boolean parametersChanged) { 94 this(command, categoryChanged, definedChanged, descriptionChanged, 95 handledChanged, nameChanged, parametersChanged, false); 96 } 97 98 121 public CommandEvent(final Command command, final boolean categoryChanged, 122 final boolean definedChanged, final boolean descriptionChanged, 123 final boolean handledChanged, final boolean nameChanged, 124 final boolean parametersChanged, final boolean returnTypeChanged) { 125 this(command, categoryChanged, definedChanged, descriptionChanged, 126 handledChanged, nameChanged, parametersChanged, 127 returnTypeChanged, false); 128 } 129 130 156 public CommandEvent(final Command command, final boolean categoryChanged, 157 final boolean definedChanged, final boolean descriptionChanged, 158 final boolean handledChanged, final boolean nameChanged, 159 final boolean parametersChanged, final boolean returnTypeChanged, 160 final boolean helpContextIdChanged) { 161 this(command, categoryChanged, definedChanged, descriptionChanged, 162 handledChanged, nameChanged, parametersChanged, 163 returnTypeChanged, helpContextIdChanged, false); 164 } 165 166 195 public CommandEvent(final Command command, final boolean categoryChanged, 196 final boolean definedChanged, final boolean descriptionChanged, 197 final boolean handledChanged, final boolean nameChanged, 198 final boolean parametersChanged, final boolean returnTypeChanged, 199 final boolean helpContextIdChanged, final boolean enabledChanged) { 200 super(definedChanged, descriptionChanged, nameChanged); 201 202 if (command == null) { 203 throw new NullPointerException (); 204 } 205 this.command = command; 206 207 if (categoryChanged) { 208 changedValues |= CHANGED_CATEGORY; 209 } 210 if (handledChanged) { 211 changedValues |= CHANGED_HANDLED; 212 } 213 if (parametersChanged) { 214 changedValues |= CHANGED_PARAMETERS; 215 } 216 if (returnTypeChanged) { 217 changedValues |= CHANGED_RETURN_TYPE; 218 } 219 if (helpContextIdChanged) { 220 changedValues |= CHANGED_HELP_CONTEXT_ID; 221 } 222 if (enabledChanged) { 223 changedValues |= CHANGED_ENABLED; 224 } 225 } 226 227 233 public final Command getCommand() { 234 return command; 235 } 236 237 242 public final boolean isCategoryChanged() { 243 return ((changedValues & CHANGED_CATEGORY) != 0); 244 } 245 246 251 public final boolean isHandledChanged() { 252 return ((changedValues & CHANGED_HANDLED) != 0); 253 } 254 255 261 public final boolean isHelpContextIdChanged() { 262 return ((changedValues & CHANGED_HELP_CONTEXT_ID) != 0); 263 } 264 265 270 public final boolean isParametersChanged() { 271 return ((changedValues & CHANGED_PARAMETERS) != 0); 272 } 273 274 280 public final boolean isReturnTypeChanged() { 281 return ((changedValues & CHANGED_RETURN_TYPE) != 0); 282 } 283 284 290 public final boolean isEnabledChanged() { 291 return ((changedValues & CHANGED_ENABLED) != 0); 292 } 293 } 294 | Popular Tags |