1 11 package org.eclipse.ui.commands; 12 13 import java.util.Set ; 14 15 import org.eclipse.ui.internal.util.Util; 16 17 29 public final class CommandManagerEvent { 30 31 34 private final boolean activeContextIdsChanged; 35 36 39 private final boolean activeKeyConfigurationIdChanged; 40 41 44 private final boolean activeLocaleChanged; 45 46 49 private final boolean activePlatformChanged; 50 51 54 private final ICommandManager commandManager; 55 56 59 private final boolean definedCategoryIdsChanged; 60 61 64 private final boolean definedCommandIdsChanged; 65 66 69 private final boolean definedKeyConfigurationIdsChanged; 70 71 75 private final Set previouslyDefinedCategoryIds; 76 77 81 private final Set previouslyDefinedCommandIds; 82 83 87 private final Set previouslyDefinedKeyConfigurationIds; 88 89 133 public CommandManagerEvent(ICommandManager commandManager, 134 boolean activeContextIdsChanged, 135 boolean activeKeyConfigurationIdChanged, 136 boolean activeLocaleChanged, boolean activePlatformChanged, 137 boolean definedCategoryIdsChanged, 138 boolean definedCommandIdsChanged, 139 boolean definedKeyConfigurationIdsChanged, 140 Set previouslyDefinedCategoryIds, Set previouslyDefinedCommandIds, 141 Set previouslyDefinedKeyConfigurationIds) { 142 if (commandManager == null) { 143 throw new NullPointerException (); 144 } 145 146 if (!definedCategoryIdsChanged && previouslyDefinedCategoryIds != null) { 147 throw new IllegalArgumentException (); 148 } 149 150 if (!definedCommandIdsChanged && previouslyDefinedCommandIds != null) { 151 throw new IllegalArgumentException (); 152 } 153 154 if (!definedKeyConfigurationIdsChanged 155 && previouslyDefinedKeyConfigurationIds != null) { 156 throw new IllegalArgumentException (); 157 } 158 159 if (definedCategoryIdsChanged) { 160 this.previouslyDefinedCategoryIds = Util.safeCopy( 161 previouslyDefinedCategoryIds, String .class); 162 } else { 163 this.previouslyDefinedCategoryIds = null; 164 } 165 166 if (definedCommandIdsChanged) { 167 this.previouslyDefinedCommandIds = Util.safeCopy( 168 previouslyDefinedCommandIds, String .class); 169 } else { 170 this.previouslyDefinedCommandIds = null; 171 } 172 173 if (definedKeyConfigurationIdsChanged) { 174 this.previouslyDefinedKeyConfigurationIds = Util.safeCopy( 175 previouslyDefinedKeyConfigurationIds, String .class); 176 } else { 177 this.previouslyDefinedKeyConfigurationIds = null; 178 } 179 180 this.commandManager = commandManager; 181 this.activeContextIdsChanged = activeContextIdsChanged; 182 this.activeKeyConfigurationIdChanged = activeKeyConfigurationIdChanged; 183 this.activeLocaleChanged = activeLocaleChanged; 184 this.activePlatformChanged = activePlatformChanged; 185 this.definedCategoryIdsChanged = definedCategoryIdsChanged; 186 this.definedCommandIdsChanged = definedCommandIdsChanged; 187 this.definedKeyConfigurationIdsChanged = definedKeyConfigurationIdsChanged; 188 } 189 190 196 public ICommandManager getCommandManager() { 197 return commandManager; 198 } 199 200 211 public Set getPreviouslyDefinedCategoryIds() { 212 return previouslyDefinedCategoryIds; 213 } 214 215 226 public Set getPreviouslyDefinedCommandIds() { 227 return previouslyDefinedCommandIds; 228 } 229 230 241 public Set getPreviouslyDefinedKeyConfigurationIds() { 242 return previouslyDefinedKeyConfigurationIds; 243 } 244 245 250 public boolean hasActiveKeyConfigurationIdChanged() { 251 return activeKeyConfigurationIdChanged; 252 } 253 254 259 public boolean hasActiveLocaleChanged() { 260 return activeLocaleChanged; 261 } 262 263 268 public boolean hasActivePlatformChanged() { 269 return activePlatformChanged; 270 } 271 272 277 public boolean haveActiveContextIdsChanged() { 278 return activeContextIdsChanged; 279 } 280 281 286 public boolean haveDefinedCategoryIdsChanged() { 287 return definedCategoryIdsChanged; 288 } 289 290 295 public boolean haveDefinedCommandIdsChanged() { 296 return definedCommandIdsChanged; 297 } 298 299 304 public boolean haveDefinedKeyConfigurationIdsChanged() { 305 return definedKeyConfigurationIdsChanged; 306 } 307 } 308 | Popular Tags |