diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/events/SelectionChangedBroadcastEvent.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/events/SelectionChangedBroadcastEvent.java | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/events/SelectionChangedBroadcastEvent.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/events/SelectionChangedBroadcastEvent.java new file mode 100644 index 000000000..1eb267f5d --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals/src/org/eclipse/tm/te/ui/terminals/events/SelectionChangedBroadcastEvent.java @@ -0,0 +1,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.tm.te.ui.terminals.events; + +import java.util.EventObject; + +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.tm.te.runtime.events.EventManager; +import org.eclipse.tm.te.ui.terminals.tabs.TabFolderManager; + +/** + * 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(); + } +} |