Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fc8eee27cf37bbcb6d593a1a6ac134264b6c13fe (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
/*******************************************************************************
 * Copyright (c) 2011 Wind River Systems, Inc. and others. 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:
 * Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tm.te.runtime.events;

import java.util.EventObject;

import org.eclipse.tm.te.runtime.activator.CoreBundleActivator;
import org.eclipse.tm.te.runtime.interfaces.tracing.ITraceIds;

/**
 * Event used to signal the disposal of an element.
 */
public class DisposedEvent extends EventObject {
	private static final long serialVersionUID = -8900361742097122798L;

	private final Object data;

	/**
	 * Constructor.
	 *
	 * @param source The event source. Must not be <code>null</code>.
	 *               <p>
	 *               The event source is expected to be of type {@link CTabItem}.
	 *
	 * @param data The custom data object or <code>null</code>.
	 */
	public DisposedEvent(Object source, Object data) {
		super(source);
		this.data = data;
	}

	/**
	 * Returns the custom data object associated with the disposed terminal console.
	 *
	 * @return The custom data object or <code>null</code>.
	 */
	public final Object getData() {
		return data;
	}

	/* (non-Javadoc)
	 * @see java.util.EventObject#toString()
	 */
	@Override
	public String toString() {
		StringBuffer toString = new StringBuffer(getClass().getName());

		String prefix = ""; //$NON-NLS-1$
		// if debugging the event, formating them a little bit better readable.
		if (CoreBundleActivator.getTraceHandler().isSlotEnabled(1, ITraceIds.TRACE_EVENTS))
			prefix = "\n\t\t"; //$NON-NLS-1$

		toString.append(prefix + "{source="); //$NON-NLS-1$
		toString.append(source);
		toString.append("}"); //$NON-NLS-1$

		return toString.toString();
	}

}

Back to the top