com.sysord.mad.ui.swt
Class ModelAction

java.lang.Object
  extended by com.sysord.mad.ui.swt.ModelAction

public abstract class ModelAction
extends java.lang.Object

A ModelAction is an action with the goal to execute operations on the model.

The WidgetValueListener and the ActivatableAdapters will be deactivated before the execution and re-activated after.

Author:
Fabien Vignal

Constructor Summary
ModelAction(com.sysord.mad.widget.WidgetValueListener<?> valueListener, com.sysord.emf.tools.misc.ActivatableAdapter... adapters)
          Construct a new ModelAction.
 
Method Summary
protected abstract  void action()
          The model action to execute.
protected  boolean canRun()
          Indicates if this ModelAction can be run.
 void execute()
          Execute the defined action in an async SWT operation if the canRun() method returns true.
protected  java.lang.Object getLock()
          Provides an Object's instance for lock purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelAction

public ModelAction(com.sysord.mad.widget.WidgetValueListener<?> valueListener,
                   com.sysord.emf.tools.misc.ActivatableAdapter... adapters)
Construct a new ModelAction.

Parameters:
valueListener -
adapters -
Method Detail

execute

public void execute()
Execute the defined action in an async SWT operation if the canRun() method returns true.


action

protected abstract void action()
The model action to execute.


canRun

protected boolean canRun()
Indicates if this ModelAction can be run.

This method return true by default, and should be overridden in subclasses if this action is conditional.

Returns:
true if this ModelAction can be run; false otherwise.

getLock

protected java.lang.Object getLock()
Provides an Object's instance for lock purposes.

Return this by default.

Returns:
an Object's instance for lock purposes.