KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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 interface is an context as defined by the extension point
16  * <code>org.eclipse.ui.contexts</code>.
17  * <p>
18  * An instance of this interface can be obtained from an instance of
19  * <code>IContextManager</code> for any identifier, whether or not an context
20  * with that identifier is defined in the extension registry.
21  * </p>
22  * <p>
23  * The handle-based nature of this API allows it to work well with runtime
24  * plugin activation and deactivation. If a context is defined, that means that
25  * its corresponding plug-in is active. If the plug-in is then deactivated, the
26  * context will still exist but it will be undefined. An attempts to use an
27  * undefined context will result in a <code>NotDefinedException</code> being
28  * thrown.
29  * </p>
30  * <p>
31  * This interface is not intended to be extended or implemented by clients.
32  * </p>
33  *
34  * @since 3.0
35  * @see org.eclipse.ui.contexts.IContextManager
36  * @see org.eclipse.core.commands.contexts.Context
37  * @deprecated Please use the "org.eclipse.core.commands" plug-in instead.
38  */

39 public interface IContext extends Comparable JavaDoc {
40
41     /**
42      * Registers an instance of <code>IContextListener</code> to listen for
43      * changes to properties of this instance.
44      *
45      * @param contextListener
46      * the instance to register. Must not be <code>null</code>. If
47      * an attempt is made to register an instance which is already
48      * registered with this instance, no operation is performed.
49      */

50     void addContextListener(IContextListener contextListener);
51
52     /**
53      * Returns the identifier of this instance.
54      *
55      * @return the identifier of this instance. Guaranteed not to be
56      * <code>null</code>.
57      */

58     String JavaDoc getId();
59
60     /**
61      * Returns the name of this instance suitable for display to the user.
62      * <p>
63      * Notification is sent to all registered listeners if this property
64      * changes.
65      * </p>
66      *
67      * @return the name of this instance. Guaranteed not to be <code>null</code>.
68      * @throws NotDefinedException
69      * if this instance is not defined.
70      */

71     String JavaDoc getName() throws NotDefinedException;
72
73     /**
74      * Returns the identifier of the parent of this instance.
75      * <p>
76      * Notification is sent to all registered listeners if this property
77      * changes.
78      * </p>
79      *
80      * @return the identifier of the parent of this instance. May be
81      * <code>null</code>.
82      * @throws NotDefinedException
83      * if this instance is not defined.
84      */

85     String JavaDoc getParentId() throws NotDefinedException;
86
87     /**
88      * Returns whether or not this instance is defined.
89      * <p>
90      * Notification is sent to all registered listeners if this property
91      * changes.
92      * </p>
93      *
94      * @return true, iff this instance is defined.
95      */

96     boolean isDefined();
97
98     /**
99      * Returns whether or not this instance is enabled.
100      * <p>
101      * Notification is sent to all registered listeners if this property
102      * changes.
103      * </p>
104      *
105      * @return true, iff this instance is enabled.
106      */

107     boolean isEnabled();
108
109     /**
110      * Unregisters an instance of <code>IContextListener</code> listening for
111      * changes to properties of this instance.
112      *
113      * @param contextListener
114      * the instance to unregister. Must not be <code>null</code>.
115      * If an attempt is made to unregister an instance which is not
116      * already registered with this instance, no operation is
117      * performed.
118      */

119     void removeContextListener(IContextListener contextListener);
120 }
121
Popular Tags