1 11 12 package org.eclipse.ui.contexts; 13 14 import java.util.Set ; 15 16 import org.eclipse.ui.internal.util.Util; 17 18 30 public final class ContextManagerEvent { 31 32 36 private final IContextManager contextManager; 37 38 41 private final boolean definedContextIdsChanged; 42 43 46 private final boolean enabledContextIdsChanged; 47 48 53 private final Set previouslyDefinedContextIds; 54 55 60 private final Set previouslyEnabledContextIds; 61 62 86 public ContextManagerEvent(IContextManager contextManager, 87 boolean definedContextIdsChanged, boolean enabledContextIdsChanged, 88 Set previouslyDefinedContextIds, Set previouslyEnabledContextIds) { 89 if (contextManager == null) { 90 throw new NullPointerException (); 91 } 92 93 if (!definedContextIdsChanged && previouslyDefinedContextIds != null) { 94 throw new IllegalArgumentException (); 95 } 96 97 if (!enabledContextIdsChanged && previouslyEnabledContextIds != null) { 98 throw new IllegalArgumentException (); 99 } 100 101 if (definedContextIdsChanged) { 102 this.previouslyDefinedContextIds = Util.safeCopy( 103 previouslyDefinedContextIds, String .class); 104 } else { 105 this.previouslyDefinedContextIds = null; 106 } 107 108 if (enabledContextIdsChanged) { 109 this.previouslyEnabledContextIds = Util.safeCopy( 110 previouslyEnabledContextIds, String .class); 111 } else { 112 this.previouslyEnabledContextIds = null; 113 } 114 115 this.contextManager = contextManager; 116 this.definedContextIdsChanged = definedContextIdsChanged; 117 this.enabledContextIdsChanged = enabledContextIdsChanged; 118 } 119 120 126 public IContextManager getContextManager() { 127 return contextManager; 128 } 129 130 141 public Set getPreviouslyDefinedContextIds() { 142 return previouslyDefinedContextIds; 143 } 144 145 156 public Set getPreviouslyEnabledContextIds() { 157 return previouslyEnabledContextIds; 158 } 159 160 165 public boolean haveDefinedContextIdsChanged() { 166 return definedContextIdsChanged; 167 } 168 169 174 public boolean haveEnabledContextIdsChanged() { 175 return enabledContextIdsChanged; 176 } 177 } 178 | Popular Tags |