Search in sources :

Example 6 with CanExecute

use of org.eclipse.e4.core.di.annotations.CanExecute in project whole by wholeplatform.

the class ActionCallHandler method canExecute.

@CanExecute
public boolean canExecute(@Named(FUNCTION_URI_PARAMETER_ID) String functionUri, @Named(PREDICATE_XWL_PARAMETER_ID) String predicateXwl, @Optional @Named(ANALYSING_PARAMETER_ID) String analyzing, @Optional @Named(IServiceConstants.ACTIVE_SELECTION) IBindingManager bm) throws Exception {
    ITransactionScope ts = BindingManagerFactory.instance.createTransactionScope();
    try {
        bm.wEnterScope(ts);
        defineBindings(functionUri, predicateXwl, analyzing, bm);
        return HandlersBehavior.canCallAction(bm);
    } catch (Exception e) {
        return false;
    } finally {
        ts.rollback();
        bm.wExitScope();
    }
}
Also used : ITransactionScope(org.whole.lang.bindings.ITransactionScope) CanExecute(org.eclipse.e4.core.di.annotations.CanExecute)

Example 7 with CanExecute

use of org.eclipse.e4.core.di.annotations.CanExecute in project whole by wholeplatform.

the class ModelTransactionHandler method canExecute.

@CanExecute
public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) IBindingManager bm) {
    ITransactionScope ts = BindingManagerFactory.instance.createTransactionScope();
    try {
        bm.wEnterScope(ts);
        return isEnabled(bm);
    } catch (Exception e) {
        return false;
    } finally {
        ts.rollback();
        bm.wExitScope();
    }
}
Also used : ITransactionScope(org.whole.lang.bindings.ITransactionScope) RollbackException(org.whole.lang.lifecycle.RollbackException) CanExecute(org.eclipse.e4.core.di.annotations.CanExecute)

Example 8 with CanExecute

use of org.eclipse.e4.core.di.annotations.CanExecute in project whole by wholeplatform.

the class PerformHandler method canExecute.

@CanExecute
public boolean canExecute(@Named(BEHAVIOR_XWL_PARAMETER_ID) String behaviorXwl, @Named(PREDICATE_XWL_PARAMETER_ID) String predicateXwl, @Optional @Named(IServiceConstants.ACTIVE_SELECTION) IBindingManager bm) throws Exception {
    ITransactionScope ts = BindingManagerFactory.instance.createTransactionScope();
    try {
        bm.wEnterScope(ts);
        defineBindings(behaviorXwl, predicateXwl, bm);
        return HandlersBehavior.canPerform(bm);
    } catch (Exception e) {
        return false;
    } finally {
        ts.rollback();
        bm.wExitScope();
    }
}
Also used : ITransactionScope(org.whole.lang.bindings.ITransactionScope) CanExecute(org.eclipse.e4.core.di.annotations.CanExecute)

Aggregations

CanExecute (org.eclipse.e4.core.di.annotations.CanExecute)8 ITransactionScope (org.whole.lang.bindings.ITransactionScope)6 ChannelData (alma.acs.nsstatistics.ChannelData)2 RollbackException (org.whole.lang.lifecycle.RollbackException)2 Execute (org.eclipse.e4.core.di.annotations.Execute)1 IEntityPartViewer (org.whole.lang.ui.viewers.IEntityPartViewer)1