de.cau.cs.kieler.core.ui.commands
Class ReInitDiagramCommand

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.core.commands.AbstractHandler
          extended by de.cau.cs.kieler.core.ui.commands.ReInitDiagramCommand
All Implemented Interfaces:
IHandler, IHandler2
Direct Known Subclasses:
ReInitKaomDiagramCommand, ReInitSyncchartsDiagramCommand

public abstract class ReInitDiagramCommand
extends AbstractHandler

A command that reinitializes a diagram file from a given model file.

Rating proposed yellow
(2010-06-14) soh

Constructor Summary
ReInitDiagramCommand()
           
 
Method Summary
abstract  boolean createNewDiagram(EObject diagramRoot, TransactionalEditingDomain editingDomain, IFile diagramPath)
          Create a new diagram file from the given semantics model.
 Object execute(ExecutionEvent event)
          
protected abstract  String getDiagramExtension()
          Provides the file extension for the diagram file.
protected abstract  String getModelExtension()
          Provides the file extension for the model file.
protected  void performPostOperationAction(IFile path, List<IFile> partners)
          Perform actions after the reinit.
protected  void performPreOperationActions(IFile path, List<IFile> partners)
          Perform actions prior to the reinit.
protected  void refreshWorkspace()
          Refresh the workspace.
 void reinitialize(IFile path)
          Reinitialize the diagram file.
 void reinitializeDiagram(IFile modelPath, IFile diagramPath)
          Reinitialize the diagram from a given model file.
 void setEnabled(Object evaluationContext)
          Checks whether the selection consists of edit parts in files with the model extension or files with the model extension.
 
Methods inherited from class org.eclipse.core.commands.AbstractHandler
addHandlerListener, dispose, fireHandlerChanged, hasListeners, isEnabled, isHandled, removeHandlerListener, setBaseEnabled
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReInitDiagramCommand

public ReInitDiagramCommand()
Method Detail

getDiagramExtension

protected abstract String getDiagramExtension()
Provides the file extension for the diagram file.

Returns:
the file extension

getModelExtension

protected abstract String getModelExtension()
Provides the file extension for the model file.

Returns:
the file extension

setEnabled

public void setEnabled(Object evaluationContext)
Checks whether the selection consists of edit parts in files with the model extension or files with the model extension.

Specified by:
setEnabled in interface IHandler2
Overrides:
setEnabled in class AbstractHandler
Parameters:
evaluationContext - the evaluation context

execute

public Object execute(ExecutionEvent event)
               throws ExecutionException

Throws:
ExecutionException

refreshWorkspace

protected void refreshWorkspace()
Refresh the workspace.


reinitialize

public void reinitialize(IFile path)
Reinitialize the diagram file.

Parameters:
path - the path of the model file

performPostOperationAction

protected void performPostOperationAction(IFile path,
                                          List<IFile> partners)
Perform actions after the reinit. Default implemenations does nothing. Subclasses may override.

Parameters:
path - the file
partners - the partner files

performPreOperationActions

protected void performPreOperationActions(IFile path,
                                          List<IFile> partners)
Perform actions prior to the reinit. Default implemenations does nothing. Subclasses may override.

Parameters:
path - the file
partners - the partner files

reinitializeDiagram

public void reinitializeDiagram(IFile modelPath,
                                IFile diagramPath)
Reinitialize the diagram from a given model file.

Parameters:
modelPath - the source file.
diagramPath - the destination file.

createNewDiagram

public abstract boolean createNewDiagram(EObject diagramRoot,
                                         TransactionalEditingDomain editingDomain,
                                         IFile diagramPath)
Create a new diagram file from the given semantics model. Subclasses must override this as it is specific for each different diagram type.

Parameters:
diagramRoot - the root element.
editingDomain - the editing domain.
diagramPath - the destination file
Returns:
true if the creation was successful