diff options
Diffstat (limited to 'sources/events/VSAbstractEvent.java')
| -rw-r--r-- | sources/events/VSAbstractEvent.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sources/events/VSAbstractEvent.java b/sources/events/VSAbstractEvent.java index 834b691..263f21f 100644 --- a/sources/events/VSAbstractEvent.java +++ b/sources/events/VSAbstractEvent.java @@ -55,17 +55,21 @@ abstract public class VSAbstractEvent extends VSPrefs { private String eventClassname; /** - * Creates a copy of the event. + * Creates a copy of the event. * * @return The copy */ final public VSAbstractEvent getCopy() throws VSEventNotCopyableException { - VSAbstractEvent copy = null + if (!(this instanceof VSCopyableEvent)) + throw new VSEventNotCopyableException(eventShortname); - if (this instanceof VSCopyableEvent) - throw new VSEventNotCopyableException(eventShortname); + VSAbstractEvent copy = + VSRegisteredEvents.createEventInstanceByClassname( + eventClassname, process); - return copy; + ((VSCopyableEvent) this).initCopy(copy); + + return copy; } /** |
