KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > services > IEvaluationResultCache


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 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.internal.services;
13
14 import org.eclipse.core.expressions.Expression;
15 import org.eclipse.core.expressions.IEvaluationContext;
16 import org.eclipse.ui.ISources;
17
18 /**
19  * <p>
20  * A cache of the result of an expression. This also provides the source
21  * priority for the expression.
22  * </p>
23  * <p>
24  * This interface is not intended to be implemented or extended by clients.
25  * </p>
26  *
27  * @since 3.2
28  * @see org.eclipse.ui.ISources
29  * @see org.eclipse.ui.ISourceProvider
30  */

31 public interface IEvaluationResultCache {
32
33     /**
34      * Clears the cached computation of the <code>evaluate</code> method, if
35      * any. This method is only intended for internal use. It provides a
36      * mechanism by which <code>ISourceProvider</code> events can invalidate
37      * state on a <code>IEvaluationResultCache</code> instance.
38      */

39     public void clearResult();
40
41     /**
42      * Returns the expression controlling the activation or visibility of this
43      * item.
44      *
45      * @return The expression associated with this item; may be
46      * <code>null</code>.
47      */

48     public Expression getExpression();
49
50     /**
51      * Returns the priority that has been given to this expression.
52      *
53      * @return The priority.
54      * @see ISources
55      */

56     public int getSourcePriority();
57
58     /**
59      * Evaluates the expression -- given the current state of the workbench.
60      * This method should cache its computation. The cache will be cleared by a
61      * call to <code>clearResult</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 expression currently evaluates to
67      * <code>true</code>; <code>false</code> otherwise.
68      */

69     public boolean evaluate(IEvaluationContext context);
70
71     /**
72      * Forces the cached result to be a particular value. This will <b>not</b>
73      * notify any users of the cache that it has changed.
74      *
75      * @param result
76      * The cached result to use.
77      * @since 3.3
78      */

79     public void setResult(boolean result);
80 }
81
Popular Tags