org.eclipse.emf.emfstore.internal.client.ui.common
Class MonitoredEMFStoreAction<T>

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.client.ui.common.MonitoredEMFStoreAction<T>
Type Parameters:
T - the return type of the action
Direct Known Subclasses:
AbstractEMFStoreUIController

public abstract class MonitoredEMFStoreAction<T>
extends Object

A monitored action will be executed using the IProgressService of Eclipse. Clients may use the passed IProgressMonitor to update the status of their progress.

Author:
emueller

Constructor Summary
MonitoredEMFStoreAction(boolean fork, boolean cancelable)
          Constructor.
 
Method Summary
 void afterRun()
          Called after doRun(IProgressMonitor) is finished.
abstract  T doRun(org.eclipse.core.runtime.IProgressMonitor monitor)
          The actual behavior that should be performed when the execute() is called.
Must be implemented by clients.
 T execute()
          Executes the request using the IProgressService of Eclipse.
 T executeSub(org.eclipse.core.runtime.IProgressMonitor monitor)
          Executes the request creating a SubProgressMonitor.
 boolean isForked()
          Whether this action runs in its own thread.
 boolean preRun()
          Called right before doRun(IProgressMonitor) is called.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitoredEMFStoreAction

public MonitoredEMFStoreAction(boolean fork,
                               boolean cancelable)
Constructor.

Parameters:
fork - whether the IProgressService should fork the request
cancelable - whether the request is cancelable
Method Detail

execute

public final T execute()
Executes the request using the IProgressService of Eclipse.

Returns:
the return value as determined by doRun(IProgressMonitor)

executeSub

public final T executeSub(org.eclipse.core.runtime.IProgressMonitor monitor)
Executes the request creating a SubProgressMonitor.

Parameters:
monitor - the currently used IProgressMonitor
Returns:
the return value as determined by doRun(IProgressMonitor)

preRun

public boolean preRun()
Called right before doRun(IProgressMonitor) is called. This method will not be executed via the IProgressService and is intended to be overridden by clients to initialize data that needs user involvement via UI calls. Clients should not execute long-lasting operations via this method.

Returns:
true, if execution may continue, false, if requirements for executing doRun(IProgressMonitor) are not met

afterRun

public void afterRun()
Called after doRun(IProgressMonitor) is finished. This method will not be executed via the IProgressService and is intended to be overridden by clients. Clients may use this method in order to perform clean-up tasks or the like.


doRun

public abstract T doRun(org.eclipse.core.runtime.IProgressMonitor monitor)
                 throws ESException
The actual behavior that should be performed when the execute() is called.
Must be implemented by clients.

Parameters:
monitor - the IProgressMonitor that should be used by clients to update the status of their progress
Returns:
an optional return value
Throws:
ESException - in case an error occurs

isForked

public boolean isForked()
Whether this action runs in its own thread.

Returns:
true, if this action has been forked to run in its own thread, false otherwise


Copyright © 2015. All Rights Reserved.