KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > expressions > IEvaluationContext


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 package org.eclipse.core.expressions;
12
13 import org.eclipse.core.runtime.CoreException;
14
15 /**
16  * An evaluation context is used to manage a set of objects needed during
17  * XML expression evaluation. A context has a parent context, can manage
18  * a set of named variables and has a default variable. The default variable
19  * is used during XML expression evaluation if no explicit variable is
20  * referenced.
21  * <p>
22  * This interface is not intended to be implemented by clients. Clients
23  * are allowed to instantiate <code>EvaluationContext</code>.
24  * </p>
25  *
26  * @since 3.0
27  */

28 public interface IEvaluationContext {
29
30     /**
31      * Returns the parent context or <code>null</code> if
32      * this is the root of the evaluation context hierarchy.
33      *
34      * @return the parent evaluation context or <code>null</code>
35      */

36     public IEvaluationContext getParent();
37     
38     /**
39      * Returns the root evaluation context.
40      *
41      * @return the root evaluation context
42      */

43     public IEvaluationContext getRoot();
44     
45     /**
46      * Specifies whether this evaluation context allows activation
47      * of plug-ins for testers used in the expression tree. To actual
48      * trigger the plug-in loading this flag has to be set to <code>
49      * true</code> and the actual test expression must have the
50      * attribute <code>forcePluginActivation</code> set to <code>
51      * true</code> as well.
52      *
53      * @param value whether this evaluation context allows plug-in activation
54      * @since 3.2
55      */

56     public void setAllowPluginActivation(boolean value);
57     
58     /**
59      * Returns whether this evaluation context supports plug-in
60      * activation. If not set via {@link #setAllowPluginActivation(boolean)}
61      * the parent value is returned. If no parent is set <code>false</code>
62      * is returned.
63      *
64      * @return whether plug-in activation is supported or not
65      * @since 3.2
66      */

67     public boolean getAllowPluginActivation();
68     
69     /**
70      * Returns the default variable.
71      *
72      * @return the default variable or <code>null</code> if
73      * no default variable is managed.
74      */

75     public Object JavaDoc getDefaultVariable();
76     
77     /**
78      * Adds a new named variable to this context. If a variable
79      * with the name already exists the new one overrides the
80      * existing one.
81      *
82      * @param name the variable's name
83      * @param value the variable's value
84      */

85     public void addVariable(String JavaDoc name, Object JavaDoc value);
86     
87     /**
88      * Removes the variable managed under the given name
89      * from this evaluation context.
90      *
91      * @param name the variable's name
92      * @return the currently stored value or <code>null</code> if
93      * the variable doesn't exist
94      */

95     public Object JavaDoc removeVariable(String JavaDoc name);
96     
97     /**
98      * Returns the variable managed under the given name.
99      *
100      * @param name the variable's name
101      * @return the variable's value or <code>null</code> if the content
102      * doesn't manage a variable with the given name
103      */

104     public Object JavaDoc getVariable(String JavaDoc name);
105     
106     /**
107      * Resolves a variable for the given name and arguments. This
108      * method can be used to dynamically resolve variable such as
109      * plug-in descriptors, resources, etc. The method is used
110      * by the <code>resolve</code> expression.
111      *
112      * @param name the variable to resolve
113      * @param args an object array of arguments used to resolve the
114      * variable
115      * @return the variable's value or <code>null</code> if no variable
116      * can be resolved for the given name and arguments
117      * @exception CoreException if an errors occurs while resolving
118      * the variable
119      */

120     public Object JavaDoc resolveVariable(String JavaDoc name, Object JavaDoc[] args) throws CoreException;
121 }
Popular Tags