001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.contexts;
011:
012: /**
013: * An instance of this class describes changes to an instance of
014: * <code>IContext</code>.
015: * <p>
016: * This class is not intended to be extended by clients.
017: * </p>
018: *
019: * @since 3.0
020: * @see IContextListener#contextChanged(ContextEvent)
021: * @deprecated Please use the "org.eclipse.core.commands" plug-in instead.
022: * @see org.eclipse.core.commands.contexts.ContextEvent
023: */
024: public final class ContextEvent {
025:
026: /**
027: * The context that has changed. This value is never <code>null</code>.
028: */
029: private final IContext context;
030:
031: /**
032: * Whether the context has become defined or undefined.
033: */
034: private final boolean definedChanged;
035:
036: /**
037: * Whether the context has become enabled or disabled.
038: */
039: private final boolean enabledChanged;
040:
041: /**
042: * Whether the name of the context has changed.
043: */
044: private final boolean nameChanged;
045:
046: /**
047: * Whether the parent identifier has changed.
048: */
049: private final boolean parentIdChanged;
050:
051: /**
052: * Creates a new instance of this class.
053: *
054: * @param context
055: * the instance of the interface that changed.
056: * @param definedChanged
057: * true, iff the defined property changed.
058: * @param enabledChanged
059: * true, iff the enabled property changed.
060: * @param nameChanged
061: * true, iff the name property changed.
062: * @param parentIdChanged
063: * true, iff the parentId property changed.
064: */
065: public ContextEvent(IContext context, boolean definedChanged,
066: boolean enabledChanged, boolean nameChanged,
067: boolean parentIdChanged) {
068: if (context == null) {
069: throw new NullPointerException();
070: }
071:
072: this .context = context;
073: this .definedChanged = definedChanged;
074: this .enabledChanged = enabledChanged;
075: this .nameChanged = nameChanged;
076: this .parentIdChanged = parentIdChanged;
077: }
078:
079: /**
080: * Returns the instance of the interface that changed.
081: *
082: * @return the instance of the interface that changed. Guaranteed not to be
083: * <code>null</code>.
084: */
085: public IContext getContext() {
086: return context;
087: }
088:
089: /**
090: * Returns whether or not the defined property changed.
091: *
092: * @return true, iff the defined property changed.
093: */
094: public boolean hasDefinedChanged() {
095: return definedChanged;
096: }
097:
098: /**
099: * Returns whether or not the enabled property changed.
100: *
101: * @return true, iff the enabled property changed.
102: */
103: public boolean hasEnabledChanged() {
104: return enabledChanged;
105: }
106:
107: /**
108: * Returns whether or not the name property changed.
109: *
110: * @return true, iff the name property changed.
111: */
112: public boolean hasNameChanged() {
113: return nameChanged;
114: }
115:
116: /**
117: * Returns whether or not the parentId property changed.
118: *
119: * @return true, iff the parentId property changed.
120: */
121: public boolean hasParentIdChanged() {
122: return parentIdChanged;
123: }
124: }
|