de.cau.cs.kieler.synccharts.diagram.custom.commands
Class Utils

java.lang.Object
  extended by de.cau.cs.kieler.synccharts.diagram.custom.commands.Utils

public final class Utils
extends Object

Utility class for cut, copy and paste. It holds the different clipboards where the copied objects are kept temporarily. It also provides methods to interact with the different clipboards. *

Rating yellow
(2010-06-15) msp, cmot

Method Summary
static EObject analyze(Object object)
          Pseudo-method, allows setting breakpoints for analysing objects.
static EObject copy(Object object)
          Copy the object.
static void debug(Object object)
          Debug output for xtend code.
static void dump(String aString)
           
static Object ecoreCopy(Object object)
          Clone an eObject with the method from EcoreUtil.
static Object getObjectFromClipboard()
          Get an object from the clipboard.
static List<Region> getRegionsFromClipboard(Collection<Region> regionsClipBoard, Collection<Region> copy)
          Prepare a list of regions to be ready for insertion using xtend.
static List<State> getStatesFromClipboard(Collection<State> statesClipBoard, Collection<State> copy)
          Prepare a list of states to be ready for insertion using xtend.
static List<Transition> getTransitionsFromClipboard(Collection<Transition> transitionsClipBoard, Collection<Transition> copy)
          Prepare a list of transitions to be ready for insertion using xtend.
static boolean isClipboardEmpty()
          Check if there is any object inside the clipboard.
static Object objectToClipboard(Object object)
          Copy an object to clipboard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

ecoreCopy

public static Object ecoreCopy(Object object)
Clone an eObject with the method from EcoreUtil.

Parameters:
object - the eObject to clone
Returns:
the clone

getObjectFromClipboard

public static Object getObjectFromClipboard()
Get an object from the clipboard. This involves preparing the object so it can be inserted right away.

Returns:
an EObject or a list of eObjects

objectToClipboard

public static Object objectToClipboard(Object object)
Copy an object to clipboard.

Parameters:
object - the object
Returns:
the contents of the clipboard

isClipboardEmpty

public static boolean isClipboardEmpty()
Check if there is any object inside the clipboard.

Returns:
true if the clipboard is empty

getStatesFromClipboard

public static List<State> getStatesFromClipboard(Collection<State> statesClipBoard,
                                                 Collection<State> copy)
Prepare a list of states to be ready for insertion using xtend.

Parameters:
statesClipBoard - the raw list of states
copy - the copy of the list
Returns:
the states the formatted list

getRegionsFromClipboard

public static List<Region> getRegionsFromClipboard(Collection<Region> regionsClipBoard,
                                                   Collection<Region> copy)
Prepare a list of regions to be ready for insertion using xtend.

Parameters:
regionsClipBoard - the raw list of regions
copy - the copy of the list
Returns:
the states the formatted list

getTransitionsFromClipboard

public static List<Transition> getTransitionsFromClipboard(Collection<Transition> transitionsClipBoard,
                                                           Collection<Transition> copy)
Prepare a list of transitions to be ready for insertion using xtend.

Parameters:
transitionsClipBoard - the raw list of transitions
copy - the copy of the list
Returns:
the states the formatted list

copy

public static EObject copy(Object object)
Copy the object.

Parameters:
object - the object
Returns:
the copy

debug

public static void debug(Object object)
Debug output for xtend code.

Parameters:
object - the message

dump

public static void dump(String aString)
Parameters:
aString - the string to print

analyze

public static EObject analyze(Object object)
Pseudo-method, allows setting breakpoints for analysing objects.

Parameters:
object - the object
Returns:
the object passed as param, casted to EObject