01: /*******************************************************************************
02: * Copyright (c) 2005 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.ui.contexts;
11:
12: import org.eclipse.core.expressions.IEvaluationContext;
13: import org.eclipse.ui.internal.services.IEvaluationResultCache;
14:
15: /**
16: * <p>
17: * A token representing the activation of a context. This token can later be
18: * used to cancel that activation. Without this token, then context will only
19: * become inactive if the component in which the context was activated is
20: * destroyed.
21: * </p>
22: * <p>
23: * This interface is not intended to be implemented or extended by clients.
24: * </p>
25: *
26: * @since 3.1
27: * @see org.eclipse.ui.ISources
28: * @see org.eclipse.ui.ISourceProvider
29: */
30: public interface IContextActivation extends IEvaluationResultCache {
31:
32: /**
33: * Clears the cached computation of the <code>isActive</code> method, if
34: * any. This method is only intended for internal use. It provides a
35: * mechanism by which <code>ISourceProvider</code> events can invalidate
36: * state on a <code>IContextActivation</code> instance.
37: *
38: * @deprecated Use {@link IEvaluationResultCache#clearResult()} instead.
39: */
40: public void clearActive();
41:
42: /**
43: * Returns the identifier of the context that is being activated.
44: *
45: * @return The context identifier; never <code>null</code>.
46: */
47: public String getContextId();
48:
49: /**
50: * Returns the context service from which this activation was requested.
51: * This is used to ensure that an activation can only be retracted from the
52: * same service which issued it.
53: *
54: * @return The context service; never <code>null</code>.
55: */
56: public IContextService getContextService();
57:
58: /**
59: * Returns whether this context activation is currently active -- given the
60: * current state of the workbench. This method should cache its computation.
61: * The cache will be cleared by a call to <code>clearActive</code>.
62: *
63: * @param context
64: * The context in which this state should be evaluated; must not
65: * be <code>null</code>.
66: * @return <code>true</code> if the activation is currently active;
67: * <code>false</code> otherwise.
68: * @deprecated Use
69: * {@link IEvaluationResultCache#evaluate(IEvaluationContext)}
70: * instead.
71: */
72: public boolean isActive(IEvaluationContext context);
73: }
|