Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: dee12d48db162afa744fd6c57deb50fda5597fb2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*****************************************************************************
 * Copyright (c) 2013 CEA LIST.
 *
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  CEA LIST - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.moka.communication.event.iterminate;

import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.papyrus.moka.communication.Marshaller;
import org.eclipse.papyrus.moka.communication.event.EventMessage;

/**
 * An event message representing a Terminate event.
 * This message is emitted by the AbstractExecution engine,
 * to inform the debug target that it has properly terminated
 * to execute.
 *
 */
public class Terminate_Event extends EventMessage {

	/**
	 * The threads available at the execution engine when it emitted
	 * this Terminate_Event message
	 */
	protected IThread[] threads;

	/**
	 * Construct a terminate event from the given source.
	 * The source is usually the debug target. See Start_Event for the rationale.
	 *
	 * @param source
	 *            The source for the terminate event
	 */
	public Terminate_Event(IDebugElement source, IThread[] threads) {
		this.source = source;
		this.eventKind = DebugEvent.TERMINATE;
		this.threads = threads;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.papyrus.moka.communication.event.Event#marshal()
	 */
	@Override
	public String marshal() {
		return Marshaller.getInstance().terminate_event_marshal(this);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.papyrus.moka.communication.event.Event#getDebugEvent()
	 */
	@Override
	public DebugEvent getDebugEvent() {
		if (this.debugEvent == null) {
			this.debugEvent = new DebugEvent(source, eventKind);
		}
		return this.debugEvent;
	}

	/**
	 * Returns the source of this terminate event
	 *
	 * @return the source of this terminate event
	 */
	public IDebugElement getSource() {
		return this.source;
	}

	/**
	 * Returns the threads available at the execution engine when it emitted this Terminate_Event message
	 *
	 * @return The threads available at the execution engine when it emitted this Terminate_Event message
	 */
	public IThread[] getThreads() {
		return this.threads;
	}

}

Back to the top