Mercurial > projects > dwt-addons
comparison dwtx/core/commands/contexts/ContextEvent.d @ 3:6518c18a01f7
eclipse.core package without osgi dependencies
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 26 Mar 2008 00:57:19 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:a012107a911c | 3:6518c18a01f7 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2004, 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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 | |
14 module dwtx.core.commands.contexts.ContextEvent; | |
15 | |
16 import dwtx.core.commands.contexts.Context; | |
17 import dwtx.core.commands.common.AbstractNamedHandleEvent; | |
18 import dwt.dwthelper.utils; | |
19 | |
20 /** | |
21 * An instance of this class describes changes to an instance of | |
22 * <code>IContext</code>. | |
23 * <p> | |
24 * This class is not intended to be extended by clients. | |
25 * </p> | |
26 * | |
27 * @since 3.1 | |
28 * @see IContextListener#contextChanged(ContextEvent) | |
29 */ | |
30 public final class ContextEvent : AbstractNamedHandleEvent { | |
31 | |
32 /** | |
33 * The bit used to represent whether the context has changed its parent. | |
34 */ | |
35 private static const int CHANGED_PARENT_ID = LAST_USED_BIT << 1; | |
36 | |
37 /** | |
38 * The context that has changed. This value is never <code>null</code>. | |
39 */ | |
40 private Context context; | |
41 | |
42 /** | |
43 * Creates a new instance of this class. | |
44 * | |
45 * @param context | |
46 * the instance of the interface that changed; must not be | |
47 * <code>null</code>. | |
48 * @param definedChanged | |
49 * <code>true</code>, iff the defined property changed. | |
50 * @param nameChanged | |
51 * <code>true</code>, iff the name property changed. | |
52 * @param descriptionChanged | |
53 * <code>true</code>, iff the description property changed. | |
54 * @param parentIdChanged | |
55 * <code>true</code>, iff the parentId property changed. | |
56 */ | |
57 public this(Context context, bool definedChanged, | |
58 bool nameChanged, bool descriptionChanged, | |
59 bool parentIdChanged) { | |
60 super(definedChanged, descriptionChanged, nameChanged); | |
61 | |
62 if (context is null) { | |
63 throw new NullPointerException(); | |
64 } | |
65 this.context = context; | |
66 | |
67 if (parentIdChanged) { | |
68 changedValues |= CHANGED_PARENT_ID; | |
69 } | |
70 } | |
71 | |
72 /** | |
73 * Returns the instance of the interface that changed. | |
74 * | |
75 * @return the instance of the interface that changed. Guaranteed not to be | |
76 * <code>null</code>. | |
77 */ | |
78 public final Context getContext() { | |
79 return context; | |
80 } | |
81 | |
82 /** | |
83 * Returns whether or not the parentId property changed. | |
84 * | |
85 * @return <code>true</code>, iff the parentId property changed. | |
86 */ | |
87 public final bool isParentIdChanged() { | |
88 return ((changedValues & CHANGED_PARENT_ID) !is 0); | |
89 } | |
90 } |