comparison org.eclipse.core.commands/src/org/eclipse/core/commands/common/AbstractNamedHandleEvent.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
1 /*******************************************************************************
2 * Copyright (c) 2005 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 module org.eclipse.core.commands.common.AbstractNamedHandleEvent;
13
14 import org.eclipse.core.commands.common.AbstractHandleObjectEvent;
15
16 /**
17 * <p>
18 * An event fired from a <code>NamedHandleObject</code>. This provides
19 * notification of changes to the defined state, the name and the description.
20 * </p>
21 *
22 * @since 3.1
23 */
24 public abstract class AbstractNamedHandleEvent :
25 AbstractHandleObjectEvent {
26
27 /**
28 * The bit used to represent whether the category has changed its
29 * description.
30 */
31 protected static const int CHANGED_DESCRIPTION = 1 << LAST_BIT_USED_ABSTRACT_HANDLE;
32
33 /**
34 * The bit used to represent whether the category has changed its name.
35 */
36 protected static const int CHANGED_NAME = 1 << LAST_BIT_USED_ABSTRACT_HANDLE;
37
38 /**
39 * The last used bit so that subclasses can add more properties.
40 */
41 protected static const int LAST_USED_BIT = CHANGED_NAME;
42
43 /**
44 * Constructs a new instance of <code>AbstractHandleObjectEvent</code>.
45 *
46 * @param definedChanged
47 * <code>true</code>, iff the defined property changed.
48 * @param descriptionChanged
49 * <code>true</code>, iff the description property changed.
50 * @param nameChanged
51 * <code>true</code>, iff the name property changed.
52 */
53 protected this(bool definedChanged,
54 bool descriptionChanged, bool nameChanged) {
55 super(definedChanged);
56
57 if (descriptionChanged) {
58 changedValues |= CHANGED_DESCRIPTION;
59 }
60 if (nameChanged) {
61 changedValues |= CHANGED_NAME;
62 }
63 }
64
65 /**
66 * Returns whether or not the description property changed.
67 *
68 * @return <code>true</code>, iff the description property changed.
69 */
70 public final bool isDescriptionChanged() {
71 return ((changedValues & CHANGED_DESCRIPTION) !is 0);
72 }
73
74 /**
75 * Returns whether or not the name property changed.
76 *
77 * @return <code>true</code>, iff the name property changed.
78 */
79 public final bool isNameChanged() {
80 return ((changedValues & CHANGED_NAME) !is 0);
81 }
82
83 }