KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > contexts > ContextEvent


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.ui.contexts;
13
14 /**
15  * An instance of this class describes changes to an instance of
16  * <code>IContext</code>.
17  * <p>
18  * This class is not intended to be extended by clients.
19  * </p>
20  *
21  * @since 3.0
22  * @see IContextListener#contextChanged(ContextEvent)
23  * @deprecated Please use the "org.eclipse.core.commands" plug-in instead.
24  * @see org.eclipse.core.commands.contexts.ContextEvent
25  */

26 public final class ContextEvent {
27
28     /**
29      * The context that has changed. This value is never <code>null</code>.
30      */

31     private final IContext context;
32
33     /**
34      * Whether the context has become defined or undefined.
35      */

36     private final boolean definedChanged;
37
38     /**
39      * Whether the context has become enabled or disabled.
40      */

41     private final boolean enabledChanged;
42
43     /**
44      * Whether the name of the context has changed.
45      */

46     private final boolean nameChanged;
47
48     /**
49      * Whether the parent identifier has changed.
50      */

51     private final boolean parentIdChanged;
52
53     /**
54      * Creates a new instance of this class.
55      *
56      * @param context
57      * the instance of the interface that changed.
58      * @param definedChanged
59      * true, iff the defined property changed.
60      * @param enabledChanged
61      * true, iff the enabled property changed.
62      * @param nameChanged
63      * true, iff the name property changed.
64      * @param parentIdChanged
65      * true, iff the parentId property changed.
66      */

67     public ContextEvent(IContext context, boolean definedChanged,
68             boolean enabledChanged, boolean nameChanged, boolean parentIdChanged) {
69         if (context == null) {
70             throw new NullPointerException JavaDoc();
71         }
72
73         this.context = context;
74         this.definedChanged = definedChanged;
75         this.enabledChanged = enabledChanged;
76         this.nameChanged = nameChanged;
77         this.parentIdChanged = parentIdChanged;
78     }
79
80     /**
81      * Returns the instance of the interface that changed.
82      *
83      * @return the instance of the interface that changed. Guaranteed not to be
84      * <code>null</code>.
85      */

86     public IContext getContext() {
87         return context;
88     }
89
90     /**
91      * Returns whether or not the defined property changed.
92      *
93      * @return true, iff the defined property changed.
94      */

95     public boolean hasDefinedChanged() {
96         return definedChanged;
97     }
98
99     /**
100      * Returns whether or not the enabled property changed.
101      *
102      * @return true, iff the enabled property changed.
103      */

104     public boolean hasEnabledChanged() {
105         return enabledChanged;
106     }
107
108     /**
109      * Returns whether or not the name property changed.
110      *
111      * @return true, iff the name property changed.
112      */

113     public boolean hasNameChanged() {
114         return nameChanged;
115     }
116
117     /**
118      * Returns whether or not the parentId property changed.
119      *
120      * @return true, iff the parentId property changed.
121      */

122     public boolean hasParentIdChanged() {
123         return parentIdChanged;
124     }
125 }
126
Popular Tags