Search in sources :

Example 1 with ExpressionContext

use of org.eclipse.e4.core.commands.ExpressionContext in project tmdm-studio-se by Talend.

the class JumpToSourceLineHandler method setEnabled.

/*
     * (non-Javadoc)
     *
     * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
     */
@Override
public void setEnabled(Object evaluationContext) {
    if (evaluationContext != null) {
        Object defaultVariable = null;
        if (evaluationContext instanceof ExpressionContext) {
            ExpressionContext exc = (ExpressionContext) evaluationContext;
            defaultVariable = exc.getDefaultVariable();
        } else if (evaluationContext instanceof EvaluationContext) {
            EvaluationContext context = (EvaluationContext) evaluationContext;
            defaultVariable = context.getDefaultVariable();
        }
        if (defaultVariable instanceof List) {
            selectedObjs = (List) defaultVariable;
        } else {
            selectedObjs = null;
        }
    }
}
Also used : ExpressionContext(org.eclipse.e4.core.commands.ExpressionContext) List(java.util.List) EvaluationContext(org.eclipse.core.expressions.EvaluationContext)

Example 2 with ExpressionContext

use of org.eclipse.e4.core.commands.ExpressionContext in project jbosstools-hibernate by jbosstools.

the class JPAMapToolActionDelegate method setEnabled.

public void setEnabled(Object context) {
    if (context instanceof EvaluationContext) {
        EvaluationContext ec = (EvaluationContext) context;
        Object obj = ec.getDefaultVariable();
        refContextObject = new WeakReference<Object>(obj);
    } else if (context instanceof ExpressionContext) {
        ExpressionContext ec = (ExpressionContext) context;
        Object obj = ec.getDefaultVariable();
        refContextObject = new WeakReference<Object>(obj);
    } else {
        refContextObject = null;
    }
    setBaseEnabled(checkEnabled());
}
Also used : ExpressionContext(org.eclipse.e4.core.commands.ExpressionContext) WeakReference(java.lang.ref.WeakReference) EvaluationContext(org.eclipse.core.expressions.EvaluationContext)

Aggregations

EvaluationContext (org.eclipse.core.expressions.EvaluationContext)2 ExpressionContext (org.eclipse.e4.core.commands.ExpressionContext)2 WeakReference (java.lang.ref.WeakReference)1 List (java.util.List)1