| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2000, 2006 IBM Corporation and others. |
| 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
| 7 | * |
| 8 | * Contributors: |
| 9 | * IBM Corporation - initial API and implementation |
| 10 | *******************************************************************************/ |
| 11 | |
| 12 | package org.eclipse.ui.activities; |
| 13 | |
| 14 | /** |
| 15 | * An instance of this class describes changes to an instance of |
| 16 | * <code>ICategory</code>. This class does not give details as to the |
| 17 | * specifics of a change, only that the given property on the source object has |
| 18 | * changed. |
| 19 | * |
| 20 | * <p> |
| 21 | * This class is not intended to be extended by clients. |
| 22 | * </p> |
| 23 | * |
| 24 | * @since 3.0 |
| 25 | * @see ICategoryListener#categoryChanged(CategoryEvent) |
| 26 | */ |
| 27 | public final class CategoryEvent { |
| 28 | private ICategory category; |
| 29 | |
| 30 | private boolean categoryActivityBindingsChanged; |
| 31 | |
| 32 | private boolean definedChanged; |
| 33 | |
| 34 | private boolean nameChanged; |
| 35 | |
| 36 | private boolean descriptionChanged; |
| 37 | |
| 38 | /** |
| 39 | * Creates a new instance of this class. |
| 40 | * |
| 41 | * @param category |
| 42 | * the instance of the interface that changed. |
| 43 | * @param categoryActivityBindingsChanged |
| 44 | * <code>true</code>, iff the categoryActivityBindings property changed. |
| 45 | * @param definedChanged |
| 46 | * <code>true</code>, iff the defined property changed. |
| 47 | * @param descriptionChanged |
| 48 | * <code>true</code>, iff the description property changed. |
| 49 | * @param nameChanged |
| 50 | * <code>true</code>, iff the name property changed. |
| 51 | */ |
| 52 | public CategoryEvent(ICategory category, |
| 53 | boolean categoryActivityBindingsChanged, boolean definedChanged, |
| 54 | boolean descriptionChanged, boolean nameChanged) { |
| 55 | if (category == null) { |
| 56 | throw new NullPointerException(); |
| 57 | } |
| 58 | |
| 59 | this.category = category; |
| 60 | this.categoryActivityBindingsChanged = categoryActivityBindingsChanged; |
| 61 | this.definedChanged = definedChanged; |
| 62 | this.nameChanged = nameChanged; |
| 63 | this.descriptionChanged = descriptionChanged; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Returns the instance of the interface that changed. |
| 68 | * |
| 69 | * @return the instance of the interface that changed. Guaranteed not to be |
| 70 | * <code>null</code>. |
| 71 | */ |
| 72 | public ICategory getCategory() { |
| 73 | return category; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Returns whether or not the defined property changed. |
| 78 | * |
| 79 | * @return <code>true</code>, iff the defined property changed. |
| 80 | */ |
| 81 | public boolean hasDefinedChanged() { |
| 82 | return definedChanged; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Returns whether or not the name property changed. |
| 87 | * |
| 88 | * @return <code>true</code>, iff the name property changed. |
| 89 | */ |
| 90 | public boolean hasNameChanged() { |
| 91 | return nameChanged; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Returns whether or not the description property changed. |
| 96 | * |
| 97 | * @return <code>true</code>, iff the description property changed. |
| 98 | */ |
| 99 | public boolean hasDescriptionChanged() { |
| 100 | return descriptionChanged; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Returns whether or not the categoryActivityBindings property changed. |
| 105 | * |
| 106 | * @return <code>true</code>, iff the categoryActivityBindings property changed. |
| 107 | */ |
| 108 | public boolean haveCategoryActivityBindingsChanged() { |
| 109 | return categoryActivityBindingsChanged; |
| 110 | } |
| 111 | } |