/** * Called be the framework to allow the handler to update its enabled state. * * @param evaluationContext * the state to evaluate against. May be <code>null</code> * which indicates that the handler can query whatever model that * is necessary. This context must not be cached. * @since 3.4 */ public void setEnabled(Object evaluationContext) { if (handler instanceof IHandler2) { ((IHandler2) handler).setEnabled(evaluationContext); } }
/** * Called be the framework to allow the handler to update its enabled state. * * @param evaluationContext * the state to evaluate against. May be <code>null</code> * which indicates that the handler can query whatever model that * is necessary. This context must not be cached. * @since 3.4 */ public void setEnabled(Object evaluationContext) { if (handler instanceof IHandler2) { ((IHandler2) handler).setEnabled(evaluationContext); } }
/** * Called be the framework to allow the handler to update its enabled state. * * @param evaluationContext * the state to evaluate against. May be <code>null</code> * which indicates that the handler can query whatever model that * is necessary. This context must not be cached. * @since 3.4 */ public void setEnabled(Object evaluationContext) { if (handler instanceof IHandler2) { ((IHandler2) handler).setEnabled(evaluationContext); } }
@Override public boolean isEnabled() { if (partHandler != null) { if (partHandler instanceof IHandler2) { ((IHandler2) partHandler).setEnabled(appContext); } return partHandler.isEnabled(); } return false; }
@Override public void setEnabled(Object evaluationContext) { IHandler2 delegate = getDelegate(); if (delegate != null) { delegate.setEnabled(evaluationContext); } } }
@SetEnabled void setEnabled(IEclipseContext context, @Optional IEvaluationContext evalContext) { if (evalContext == null) { evalContext = new ExpressionContext(context); } if (handler instanceof IHandler2) { ((IHandler2) handler).setEnabled(evalContext); } }
@CanExecute public boolean canExecute(IEclipseContext context, @Optional IEvaluationContext staticContext, MApplication application) { if (handler instanceof IHandler2) { Object ctx = staticContext; if (ctx == null) { ctx = new ExpressionContext(application.getContext()); } ((IHandler2) handler).setEnabled(ctx); } return handler.isEnabled(); }
@Override public void setEnabled(Object evaluationContext) { if (!(evaluationContext instanceof IEvaluationContext)) { return; } IEvaluationContext context = (IEvaluationContext) evaluationContext; if (enabledWhenExpression != null) { try { setProxyEnabled(enabledWhenExpression.evaluate(context) == EvaluationResult.TRUE); } catch (CoreException e) { // TODO should we log this exception, or just treat it as // a failure } } if (isOkToLoad() && loadHandler()) { if (handler instanceof IHandler2) { ((IHandler2) handler).setEnabled(evaluationContext); } } }