comparison dwtx/jface/bindings/SchemeEvent.d @ 16:e0f0aaf75edd

PopupDialog, bindings and actions
author Frank Benoit <benoit@tionex.de>
date Tue, 01 Apr 2008 08:00:31 +0200
parents
children
comparison
equal deleted inserted replaced
15:db8940420ed8 16:e0f0aaf75edd
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.jface.bindings.SchemeEvent;
15
16 import dwtx.jface.bindings.Scheme;
17
18 import dwtx.core.commands.common.AbstractNamedHandleEvent;
19
20 import dwt.dwthelper.utils;
21
22 /**
23 * An instance of this class describes changes to an instance of
24 * <code>IScheme</code>.
25 * <p>
26 * This class is not intended to be extended by clients.
27 * </p>
28 *
29 * @since 3.1
30 * @see ISchemeListener#schemeChanged(SchemeEvent)
31 */
32 public final class SchemeEvent : AbstractNamedHandleEvent {
33
34 /**
35 * The bit used to represent whether the scheme has changed its parent.
36 */
37 private static const int CHANGED_PARENT_ID = LAST_USED_BIT << 1;
38
39 /**
40 * The scheme that has changed; this value is never <code>null</code>.
41 */
42 private const Scheme scheme;
43
44 /**
45 * Creates a new instance of this class.
46 *
47 * @param scheme
48 * the instance of the interface that changed; must not be
49 * <code>null</code>.
50 * @param definedChanged
51 * true, iff the defined property changed.
52 * @param nameChanged
53 * true, iff the name property changed.
54 * @param descriptionChanged
55 * <code>true</code> if the description property changed;
56 * <code>false</code> otherwise.
57 * @param parentIdChanged
58 * true, iff the parentId property changed.
59 */
60 public this(Scheme scheme, bool definedChanged,
61 bool nameChanged, bool descriptionChanged,
62 bool parentIdChanged) {
63 super(definedChanged, descriptionChanged, nameChanged);
64
65 if (scheme is null) {
66 throw new NullPointerException();
67 }
68 this.scheme = scheme;
69
70 if (parentIdChanged) {
71 changedValues |= CHANGED_PARENT_ID;
72 }
73 }
74
75 /**
76 * Returns the instance of the scheme that changed.
77 *
78 * @return the instance of the scheme that changed. Guaranteed not to be
79 * <code>null</code>.
80 */
81 public final Scheme getScheme() {
82 return scheme;
83 }
84
85 /**
86 * Returns whether or not the parentId property changed.
87 *
88 * @return true, iff the parentId property changed.
89 */
90 public final bool isParentIdChanged() {
91 return ((changedValues & CHANGED_PARENT_ID) !is 0);
92 }
93 }