KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 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 import org.eclipse.core.expressions.IEvaluationContext;
15 import org.eclipse.ui.internal.services.IEvaluationResultCache;
16
17 /**
18  * <p>
19  * A token representing the activation of a context. This token can later be
20  * used to cancel that activation. Without this token, then context will only
21  * become inactive if the component in which the context was activated is
22  * destroyed.
23  * </p>
24  * <p>
25  * This interface is not intended to be implemented or extended by clients.
26  * </p>
27  *
28  * @since 3.1
29  * @see org.eclipse.ui.ISources
30  * @see org.eclipse.ui.ISourceProvider
31  */

32 public interface IContextActivation extends IEvaluationResultCache {
33
34     /**
35      * Clears the cached computation of the <code>isActive</code> method, if
36      * any. This method is only intended for internal use. It provides a
37      * mechanism by which <code>ISourceProvider</code> events can invalidate
38      * state on a <code>IContextActivation</code> instance.
39      *
40      * @deprecated Use {@link IEvaluationResultCache#clearResult()} instead.
41      */

42     public void clearActive();
43
44     /**
45      * Returns the identifier of the context that is being activated.
46      *
47      * @return The context identifier; never <code>null</code>.
48      */

49     public String JavaDoc getContextId();
50
51     /**
52      * Returns the context service from which this activation was requested.
53      * This is used to ensure that an activation can only be retracted from the
54      * same service which issued it.
55      *
56      * @return The context service; never <code>null</code>.
57      */

58     public IContextService getContextService();
59
60     /**
61      * Returns whether this context activation is currently active -- given the
62      * current state of the workbench. This method should cache its computation.
63      * The cache will be cleared by a call to <code>clearActive</code>.
64      *
65      * @param context
66      * The context in which this state should be evaluated; must not
67      * be <code>null</code>.
68      * @return <code>true</code> if the activation is currently active;
69      * <code>false</code> otherwise.
70      * @deprecated Use
71      * {@link IEvaluationResultCache#evaluate(IEvaluationContext)}
72      * instead.
73      */

74     public boolean isActive(IEvaluationContext context);
75 }
76
Popular Tags