Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0379523350d6012f93bd3c26d9c754c1ca5aad9d (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
/*******************************************************************************
 * 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.tcf.te.ui.terminals.events;

import java.util.EventObject;

import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
import org.eclipse.tcf.te.runtime.events.EventManager;

/**
 * Terminal console selection changed broadcast event. The event is typically fired
 * by a terminal console tab folder manager to signal a tab switch to all listeners.
 */
public class SelectionChangedBroadcastEvent extends EventObject {
	private static final long serialVersionUID = -4970244776543572896L;

	// The selection changed event to broadcast
	private final SelectionChangedEvent selectionChangedEvent;

	/**
	 * Constructor.
	 *
	 * @param source The event source. Must not be <code>null</code>.
	 * @param selectionChangedEvent The selection changed event or <code>null</code>.
	 */
	public SelectionChangedBroadcastEvent(TabFolderManager source, SelectionChangedEvent selectionChangedEvent) {
		super(source);
		this.selectionChangedEvent = selectionChangedEvent;
	}

	/**
	 * Convenience method to return the source tab folder manager.
	 *
	 * @return The source tab folder manager.
	 */
	public TabFolderManager getSourceTabFolderManager() {
		return (TabFolderManager)getSource();
	}

	/**
	 * Returns the broadcasted selection changed event.
	 *
	 * @return The broadcasted selection changed event or <code>null</code>.
	 */
	public SelectionChangedEvent getSelectionChangedEvent() {
		return selectionChangedEvent;
	}

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

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

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

		return toString.toString();
   }
}

Back to the top