KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > bindings > SchemeEvent


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  *******************************************************************************/

11
12 package org.eclipse.jface.bindings;
13
14 import org.eclipse.core.commands.common.AbstractNamedHandleEvent;
15
16 /**
17  * An instance of this class describes changes to an instance of
18  * <code>IScheme</code>.
19  * <p>
20  * This class is not intended to be extended by clients.
21  * </p>
22  *
23  * @since 3.1
24  * @see ISchemeListener#schemeChanged(SchemeEvent)
25  */

26 public final class SchemeEvent extends AbstractNamedHandleEvent {
27
28     /**
29      * The bit used to represent whether the scheme has changed its parent.
30      */

31     private static final int CHANGED_PARENT_ID = LAST_USED_BIT << 1;
32
33     /**
34      * The scheme that has changed; this value is never <code>null</code>.
35      */

36     private final Scheme scheme;
37
38     /**
39      * Creates a new instance of this class.
40      *
41      * @param scheme
42      * the instance of the interface that changed; must not be
43      * <code>null</code>.
44      * @param definedChanged
45      * true, iff the defined property changed.
46      * @param nameChanged
47      * true, iff the name property changed.
48      * @param descriptionChanged
49      * <code>true</code> if the description property changed;
50      * <code>false</code> otherwise.
51      * @param parentIdChanged
52      * true, iff the parentId property changed.
53      */

54     public SchemeEvent(Scheme scheme, boolean definedChanged,
55             boolean nameChanged, boolean descriptionChanged,
56             boolean parentIdChanged) {
57         super(definedChanged, descriptionChanged, nameChanged);
58
59         if (scheme == null) {
60             throw new NullPointerException JavaDoc();
61         }
62         this.scheme = scheme;
63
64         if (parentIdChanged) {
65             changedValues |= CHANGED_PARENT_ID;
66         }
67     }
68
69     /**
70      * Returns the instance of the scheme that changed.
71      *
72      * @return the instance of the scheme that changed. Guaranteed not to be
73      * <code>null</code>.
74      */

75     public final Scheme getScheme() {
76         return scheme;
77     }
78
79     /**
80      * Returns whether or not the parentId property changed.
81      *
82      * @return true, iff the parentId property changed.
83      */

84     public final boolean isParentIdChanged() {
85         return ((changedValues & CHANGED_PARENT_ID) != 0);
86     }
87 }
88
Popular Tags