KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > expressions > EnablementExpression


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.internal.expressions;
12
13 import org.w3c.dom.Element JavaDoc;
14
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.core.runtime.IConfigurationElement;
17
18 import org.eclipse.core.expressions.EvaluationResult;
19 import org.eclipse.core.expressions.IEvaluationContext;
20
21 public class EnablementExpression extends CompositeExpression {
22
23     public EnablementExpression(IConfigurationElement configElement) {
24         // config element not used yet.
25
}
26
27     public EnablementExpression(Element JavaDoc element) {
28         // element not used yet.
29
}
30
31     public boolean equals(final Object JavaDoc object) {
32         if (!(object instanceof EnablementExpression))
33             return false;
34         
35         final EnablementExpression that= (EnablementExpression)object;
36         return equals(this.fExpressions, that.fExpressions);
37     }
38     
39     public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
40         long start= 0;
41         if (Expressions.TRACING)
42             start= System.currentTimeMillis();
43         EvaluationResult result= evaluateAnd(context);
44         if (Expressions.TRACING) {
45             System.out.println("[Enablement Expression] - evaluation time: " + //$NON-NLS-1$
46
(System.currentTimeMillis() - start) + " ms."); //$NON-NLS-1$
47
}
48         return result;
49     }
50 }
51
Popular Tags