1 11 12 package org.eclipse.ui.activities; 13 14 import java.util.Set ; 15 16 import org.eclipse.ui.internal.util.Util; 17 18 31 public final class ActivityManagerEvent { 32 private IActivityManager activityManager; 33 34 private boolean definedActivityIdsChanged; 35 36 private boolean definedCategoryIdsChanged; 37 38 private boolean enabledActivityIdsChanged; 39 40 45 private final Set previouslyDefinedActivityIds; 46 47 52 private final Set previouslyDefinedCategoryIds; 53 54 59 private final Set previouslyEnabledActivityIds; 60 61 97 public ActivityManagerEvent(IActivityManager activityManager, 98 boolean definedActivityIdsChanged, 99 boolean definedCategoryIdsChanged, 100 boolean enabledActivityIdsChanged, 101 final Set previouslyDefinedActivityIds, 102 final Set previouslyDefinedCategoryIds, 103 final Set previouslyEnabledActivityIds) { 104 if (activityManager == null) { 105 throw new NullPointerException (); 106 } 107 108 if (!definedActivityIdsChanged && previouslyDefinedActivityIds != null) { 109 throw new IllegalArgumentException (); 110 } 111 112 if (!definedCategoryIdsChanged && previouslyDefinedCategoryIds != null) { 113 throw new IllegalArgumentException (); 114 } 115 116 if (!enabledActivityIdsChanged && previouslyEnabledActivityIds != null) { 117 throw new IllegalArgumentException (); 118 } 119 120 if (definedActivityIdsChanged) { 121 this.previouslyDefinedActivityIds = Util.safeCopy( 122 previouslyDefinedActivityIds, String .class); 123 } else { 124 this.previouslyDefinedActivityIds = null; 125 } 126 127 if (definedCategoryIdsChanged) { 128 this.previouslyDefinedCategoryIds = Util.safeCopy( 129 previouslyDefinedCategoryIds, String .class); 130 } else { 131 this.previouslyDefinedCategoryIds = null; 132 } 133 134 if (enabledActivityIdsChanged) { 135 this.previouslyEnabledActivityIds = Util.safeCopy( 136 previouslyEnabledActivityIds, String .class); 137 } else { 138 this.previouslyEnabledActivityIds = null; 139 } 140 141 this.activityManager = activityManager; 142 this.definedActivityIdsChanged = definedActivityIdsChanged; 143 this.definedCategoryIdsChanged = definedCategoryIdsChanged; 144 this.enabledActivityIdsChanged = enabledActivityIdsChanged; 145 } 146 147 153 public IActivityManager getActivityManager() { 154 return activityManager; 155 } 156 157 164 public final Set getPreviouslyDefinedActivityIds() { 165 return previouslyDefinedActivityIds; 166 } 167 168 175 public final Set getPreviouslyDefinedCategoryIds() { 176 return previouslyDefinedCategoryIds; 177 } 178 179 186 public final Set getPreviouslyEnabledActivityIds() { 187 return previouslyEnabledActivityIds; 188 } 189 190 195 public boolean haveDefinedActivityIdsChanged() { 196 return definedActivityIdsChanged; 197 } 198 199 204 public boolean haveDefinedCategoryIdsChanged() { 205 return definedCategoryIdsChanged; 206 } 207 208 213 public boolean haveEnabledActivityIdsChanged() { 214 return enabledActivityIdsChanged; 215 } 216 } 217 | Popular Tags |