1 11 package org.eclipse.core.commands.contexts; 12 13 import java.util.Set ; 14 15 import org.eclipse.core.commands.common.AbstractBitSetEvent; 16 17 25 public final class ContextManagerEvent extends AbstractBitSetEvent { 26 27 31 private static final int CHANGED_CONTEXT_DEFINED = 1 << 1; 32 33 36 private static final int CHANGED_CONTEXTS_ACTIVE = 1; 37 38 42 private final String contextId; 43 44 47 private final ContextManager contextManager; 48 49 54 private final Set previouslyActiveContextIds; 55 56 78 public ContextManagerEvent(final ContextManager contextManager, 79 final String contextId, final boolean contextIdAdded, 80 final boolean activeContextsChanged, 81 final Set previouslyActiveContextIds) { 82 if (contextManager == null) { 83 throw new NullPointerException (); 84 } 85 86 this.contextManager = contextManager; 87 this.contextId = contextId; 88 this.previouslyActiveContextIds = previouslyActiveContextIds; 89 90 if (contextIdAdded) { 91 changedValues |= CHANGED_CONTEXT_DEFINED; 92 } 93 if (activeContextsChanged) { 94 changedValues |= CHANGED_CONTEXTS_ACTIVE; 95 } 96 } 97 98 105 public final String getContextId() { 106 return contextId; 107 } 108 109 115 public final ContextManager getContextManager() { 116 return contextManager; 117 } 118 119 130 public final Set getPreviouslyActiveContextIds() { 131 return previouslyActiveContextIds; 132 } 133 134 140 public final boolean isActiveContextsChanged() { 141 return ((changedValues & CHANGED_CONTEXTS_ACTIVE) != 0); 142 } 143 144 150 public final boolean isContextChanged() { 151 return (contextId != null); 152 } 153 154 161 public final boolean isContextDefined() { 162 return (((changedValues & CHANGED_CONTEXT_DEFINED) != 0) && (contextId != null)); 163 } 164 } 165 | Popular Tags |