de.cau.cs.kieler.ksbase.core
Class KSBasETransformation

java.lang.Object
  extended by de.cau.cs.kieler.core.model.xtend.transformation.AbstractTransformation
      extended by de.cau.cs.kieler.ksbase.core.KSBasETransformation
All Implemented Interfaces:
Serializable, Cloneable

public class KSBasETransformation
extends AbstractTransformation
implements Serializable, Cloneable

The connection between the transformations and the KSBasE plug-In. Stores additional information about how the transformation can be executed by the user/workbench. This class is instantiated by the EditorTransformationSettings class to configure the transformations for one editor. This class may be serialized.

See Also:
Serialized Form
Rating yellow
(2010-01-22) review by msp, skn

Constructor Summary
KSBasETransformation(KSBasETransformation t)
          Copy constructor.
KSBasETransformation(String tName, String tTransName)
          Creates a new Transformation.
 
Method Summary
 void addParameters(List<String> params)
          Sets the parameters for this transformation.
 KSBasETransformation clone()
          Clone operation.
 boolean equals(Object obj)
          Two transformations are equal, when they have the same transformation name and the same number of parameters.
 String getCommandId()
           
 String getIcon()
          Returns the icon with relative path.
 String getKeyboardShortcut()
          Returns the keyboard shortcut.
 String getName()
          Gets the name of the transformation.
 int getNumSelections()
          Returns the number of selections this transformation is defined for.
 List<List<String>> getParameterList()
          Gets the list of parameters.
 String getToolTip()
          Returns the toolTip message.
 String getTransformation()
          Returns the transformation name.
 Object getTransformationClass()
           
 String getTransformationId()
          Returns the Id for this transformation.
 String getValidation()
          Gets the transformation that is used to validate a selection.
 int hashCode()
          Simple hashCode calculations, uses the hash code of the transformation name and adds the number of selections.
 Boolean isVisible()
          Checks if the transformation should be displayed in the menu.
 void serialize(ObjectOutputStream writer)
          Serializes this object to the given ObjectOutputStream.
 void setCommandId(String id)
           
 void setIcon(String iconUri)
          Sets the iconURI used by the menu contributions.
 void setKeyboardShortcut(String shortcut)
          Sets the keyboard shortcut for this transformation.
 void setName(String value)
          Sets the name of the transformation used in the menus.
 void setParameters(List<List<String>> params)
          Sets parameters list.
 void setToolTip(String message)
          Sets the toolTip message.
 void setTransformation(String value)
          Sets the name of the transformation to be executed.
 void setTransformationClass(Object transformationClass)
           
 void setTransformationId(String id)
          Sets the Id for this transformation.
 void setValidation(String transformationName)
          Sets the transformation that is used for validation.
 void setVisible(Boolean isVisible)
          Sets the transformation visibility.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KSBasETransformation

public KSBasETransformation(String tName,
                            String tTransName)
Creates a new Transformation.

Parameters:
tName - The name of this transformation which is displayed in the menu.
tTransName - The name of the transformation to execute.

KSBasETransformation

public KSBasETransformation(KSBasETransformation t)
Copy constructor.

Parameters:
t - Transformation which should be copied
Method Detail

clone

public final KSBasETransformation clone()
Clone operation.

Overrides:
clone in class Object
Returns:
A cloned transformation

setName

public final void setName(String value)
Sets the name of the transformation used in the menus.

Parameters:
value - The name for this transformation

setTransformation

public void setTransformation(String value)
Sets the name of the transformation to be executed. The value is unchecked so giving an invalid name here may result in an error when executing the transfomation.

Specified by:
setTransformation in class AbstractTransformation
Parameters:
value - The name of the transformation to execute

setIcon

public final void setIcon(String iconUri)
Sets the iconURI used by the menu contributions.

Parameters:
iconUri - The URI to the icon to use for this transformation.

getName

public final String getName()
Gets the name of the transformation.

Returns:
The transformation name used by the menus.

getTransformation

public final String getTransformation()
Returns the transformation name.

Specified by:
getTransformation in class AbstractTransformation
Returns:
The name of this transformation

getNumSelections

public final int getNumSelections()
Returns the number of selections this transformation is defined for.

Returns:
The number of selections

getIcon

public final String getIcon()
Returns the icon with relative path.

Returns:
A path string

getToolTip

public String getToolTip()
Returns the toolTip message.

Returns:
A message string

setToolTip

public void setToolTip(String message)
Sets the toolTip message.

Parameters:
message - the message

getParameterList

public final List<List<String>> getParameterList()
Gets the list of parameters.

Specified by:
getParameterList in class AbstractTransformation
Returns:
A list of parameters.

setParameters

public void setParameters(List<List<String>> params)
Sets parameters list.

Specified by:
setParameters in class AbstractTransformation
Parameters:
params - the list of list of parameters

addParameters

public final void addParameters(List<String> params)
Sets the parameters for this transformation.

Specified by:
addParameters in class AbstractTransformation
Parameters:
params - a List of parameters

getTransformationId

public final String getTransformationId()
Returns the Id for this transformation.

Returns:
The transformationId

setTransformationId

public final void setTransformationId(String id)
Sets the Id for this transformation.

Parameters:
id - The new Id for this transformation

getKeyboardShortcut

public final String getKeyboardShortcut()
Returns the keyboard shortcut. This is only a string, it's not validated or checked for conflicts.

Returns:
The keyboard shortcut

setKeyboardShortcut

public final void setKeyboardShortcut(String shortcut)
Sets the keyboard shortcut for this transformation.

Parameters:
shortcut - The new shortcut assigned to this transformation

getValidation

public String getValidation()
Gets the transformation that is used to validate a selection.

Returns:
A transformation name

getTransformationClass

public Object getTransformationClass()

setTransformationClass

public void setTransformationClass(Object transformationClass)

getCommandId

public String getCommandId()

setCommandId

public void setCommandId(String id)

setValidation

public void setValidation(String transformationName)
Sets the transformation that is used for validation.

Parameters:
transformationName - A transformation name

isVisible

public Boolean isVisible()
Checks if the transformation should be displayed in the menu. Only used for user defined editors.

Returns:
True if the transformation should be displayed

setVisible

public void setVisible(Boolean isVisible)
Sets the transformation visibility. Only used for user defined editors.

Parameters:
isVisible - New visibility status

serialize

public void serialize(ObjectOutputStream writer)
Serializes this object to the given ObjectOutputStream.

Parameters:
writer - A valid an opened ObjectOutputStream

hashCode

public final int hashCode()
Simple hashCode calculations, uses the hash code of the transformation name and adds the number of selections.

Overrides:
hashCode in class Object
Returns:
The hashCode value

equals

public final boolean equals(Object obj)
Two transformations are equal, when they have the same transformation name and the same number of parameters.

Overrides:
equals in class Object
Parameters:
obj - The object to compare with
Returns:
True if the given object is a transformation and has the same name and number of parameters

toString

public String toString()
Overrides:
toString in class Object