01: /*******************************************************************************
02: * Copyright (c) 2004, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.bindings;
11:
12: import org.eclipse.core.commands.common.AbstractNamedHandleEvent;
13:
14: /**
15: * An instance of this class describes changes to an instance of
16: * <code>IScheme</code>.
17: * <p>
18: * This class is not intended to be extended by clients.
19: * </p>
20: *
21: * @since 3.1
22: * @see ISchemeListener#schemeChanged(SchemeEvent)
23: */
24: public final class SchemeEvent extends AbstractNamedHandleEvent {
25:
26: /**
27: * The bit used to represent whether the scheme has changed its parent.
28: */
29: private static final int CHANGED_PARENT_ID = LAST_USED_BIT << 1;
30:
31: /**
32: * The scheme that has changed; this value is never <code>null</code>.
33: */
34: private final Scheme scheme;
35:
36: /**
37: * Creates a new instance of this class.
38: *
39: * @param scheme
40: * the instance of the interface that changed; must not be
41: * <code>null</code>.
42: * @param definedChanged
43: * true, iff the defined property changed.
44: * @param nameChanged
45: * true, iff the name property changed.
46: * @param descriptionChanged
47: * <code>true</code> if the description property changed;
48: * <code>false</code> otherwise.
49: * @param parentIdChanged
50: * true, iff the parentId property changed.
51: */
52: public SchemeEvent(Scheme scheme, boolean definedChanged,
53: boolean nameChanged, boolean descriptionChanged,
54: boolean parentIdChanged) {
55: super (definedChanged, descriptionChanged, nameChanged);
56:
57: if (scheme == null) {
58: throw new NullPointerException();
59: }
60: this .scheme = scheme;
61:
62: if (parentIdChanged) {
63: changedValues |= CHANGED_PARENT_ID;
64: }
65: }
66:
67: /**
68: * Returns the instance of the scheme that changed.
69: *
70: * @return the instance of the scheme that changed. Guaranteed not to be
71: * <code>null</code>.
72: */
73: public final Scheme getScheme() {
74: return scheme;
75: }
76:
77: /**
78: * Returns whether or not the parentId property changed.
79: *
80: * @return true, iff the parentId property changed.
81: */
82: public final boolean isParentIdChanged() {
83: return ((changedValues & CHANGED_PARENT_ID) != 0);
84: }
85: }
|