org.csstudio.ui.util
Class AbstractAdaptedHandler<T>

java.lang.Object
  extended by AbstractHandler
      extended by org.csstudio.ui.util.AbstractAdaptedHandler<T>

public abstract class AbstractAdaptedHandler<T>
extends AbstractHandler

Abstract class for all commands that use AdapterUtil for conversion and displays the exception in a suitable dialog.

Author:
carcassi

Constructor Summary
AbstractAdaptedHandler(java.lang.Class<T> dataType)
           
 
Method Summary
 java.lang.Object execute(ExecutionEvent event)
           
protected abstract  void execute(java.util.List<T> data, ExecutionEvent event)
          Implements the command.
static
<T> T
findView(java.lang.Class<T> clazz, java.lang.String viewId)
          Searches for the view of the given class with the given view id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAdaptedHandler

public AbstractAdaptedHandler(java.lang.Class<T> dataType)
Method Detail

findView

public static <T> T findView(java.lang.Class<T> clazz,
                             java.lang.String viewId)
                  throws PartInitException
Searches for the view of the given class with the given view id.

Parameters:
clazz - the view class
viewId - the view id
Returns:
the view
Throws:
PartInitException - if the view was not found
java.lang.ClassCastException - if the view is of a different type

execute

public java.lang.Object execute(ExecutionEvent event)
                         throws ExecutionException
Throws:
ExecutionException

execute

protected abstract void execute(java.util.List<T> data,
                                ExecutionEvent event)
                         throws java.lang.Exception
Implements the command. The selection is already converted to the target class.

Parameters:
data - data in the selection
event - event of the command
Throws:
java.lang.Exception