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.activities;
011:
012: /**
013: * An instance of this class describes changes to an instance of
014: * <code>IActivity</code>. This class does not give details as to the
015: * specifics of a change, only that the given property on the source object has
016: * changed.
017: * <p>
018: * This class is not intended to be extended by clients.
019: * </p>
020: *
021: * @since 3.0
022: * @see IActivityListener#activityChanged(ActivityEvent)
023: */
024: public final class ActivityEvent {
025: private IActivity activity;
026:
027: private boolean activityRequirementBindingsChanged;
028:
029: private boolean activityPatternBindingsChanged;
030:
031: private boolean definedChanged;
032:
033: private boolean enabledChanged;
034:
035: private boolean defaultEnabledChanged;
036:
037: private boolean nameChanged;
038:
039: private boolean descriptionChanged;
040:
041: /**
042: * Creates a new instance of this class. Since 3.1 this method will assume
043: * that the default enabled state has not changed.
044: *
045: * @param activity
046: * the instance of the interface that changed.
047: * @param activityRequirementBindingsChanged
048: * <code>true</code>, iff the activityRequirementBindings
049: * property changed.
050: * @param activityPatternBindingsChanged
051: * <code>true</code>, iff the activityPatternBindings property
052: * changed.
053: * @param definedChanged
054: * <code>true</code>, iff the defined property changed.
055: * @param descriptionChanged
056: * <code>true</code>, iff the description property changed.
057: * @param enabledChanged
058: * <code>true</code>, iff the enabled property changed.
059: * @param nameChanged
060: * <code>true</code>, iff the name property changed.
061: */
062: public ActivityEvent(IActivity activity,
063: boolean activityRequirementBindingsChanged,
064: boolean activityPatternBindingsChanged,
065: boolean definedChanged, boolean descriptionChanged,
066: boolean enabledChanged, boolean nameChanged) {
067:
068: this (activity, activityRequirementBindingsChanged,
069: activityPatternBindingsChanged, definedChanged,
070: descriptionChanged, enabledChanged, nameChanged, false);
071: }
072:
073: /**
074: * Creates a new instance of this class.
075: *
076: * @param activity
077: * the instance of the interface that changed.
078: * @param activityRequirementBindingsChanged
079: * <code>true</code>, iff the activityRequirementBindings property changed.
080: * @param activityPatternBindingsChanged
081: * <code>true</code>, iff the activityPatternBindings property changed.
082: * @param definedChanged
083: * <code>true</code>, iff the defined property changed.
084: * @param descriptionChanged
085: * <code>true</code>, iff the description property changed.
086: * @param enabledChanged
087: * <code>true</code>, iff the enabled property changed.
088: * @param nameChanged
089: * <code>true</code>, iff the name property changed.
090: * @param defaultEnabledChanged
091: * <code>true</code>, iff the default enabled property changed.
092: * @since 3.1
093: */
094: public ActivityEvent(IActivity activity,
095: boolean activityRequirementBindingsChanged,
096: boolean activityPatternBindingsChanged,
097: boolean definedChanged, boolean descriptionChanged,
098: boolean enabledChanged, boolean nameChanged,
099: boolean defaultEnabledChanged) {
100: if (activity == null) {
101: throw new NullPointerException();
102: }
103:
104: this .activity = activity;
105: this .activityRequirementBindingsChanged = activityRequirementBindingsChanged;
106: this .activityPatternBindingsChanged = activityPatternBindingsChanged;
107: this .definedChanged = definedChanged;
108: this .enabledChanged = enabledChanged;
109: this .nameChanged = nameChanged;
110: this .descriptionChanged = descriptionChanged;
111: this .defaultEnabledChanged = defaultEnabledChanged;
112: }
113:
114: /**
115: * Returns the instance of the interface that changed.
116: *
117: * @return the instance of the interface that changed. Guaranteed not to be
118: * <code>null</code>.
119: */
120: public IActivity getActivity() {
121: return activity;
122: }
123:
124: /**
125: * Returns whether or not the defined property changed.
126: *
127: * @return <code>true</code>, iff the defined property changed.
128: */
129: public boolean hasDefinedChanged() {
130: return definedChanged;
131: }
132:
133: /**
134: * Returns whether or not the enabled property changed.
135: *
136: * @return <code>true</code>, iff the enabled property changed.
137: */
138: public boolean hasEnabledChanged() {
139: return enabledChanged;
140: }
141:
142: /**
143: * Returns whether or not the default enabled property changed.
144: *
145: * @return <code>true</code>, iff the default enabled property changed.
146: * @since 3.1
147: */
148: public boolean hasDefaultEnabledChanged() {
149: return defaultEnabledChanged;
150: }
151:
152: /**
153: * Returns whether or not the name property changed.
154: *
155: * @return <code>true</code>, iff the name property changed.
156: */
157: public boolean hasNameChanged() {
158: return nameChanged;
159: }
160:
161: /**
162: * Returns whether or not the description property changed.
163: *
164: * @return <code>true</code>, iff the description property changed.
165: */
166: public boolean hasDescriptionChanged() {
167: return descriptionChanged;
168: }
169:
170: /**
171: * Returns whether or not the activityRequirementBindings property changed.
172: *
173: * @return <code>true</code>, iff the activityRequirementBindings property changed.
174: */
175: public boolean haveActivityRequirementBindingsChanged() {
176: return activityRequirementBindingsChanged;
177: }
178:
179: /**
180: * Returns whether or not the activityPatternBindings property changed.
181: *
182: * @return <code>true</code>, iff the activityPatternBindings property changed.
183: */
184: public boolean haveActivityPatternBindingsChanged() {
185: return activityPatternBindingsChanged;
186: }
187: }
|