diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tm.te.tcf.core/src/org/eclipse/tm/te/tcf/core/internal/listener/InternalChannelOpenListener.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tm.te.tcf.core/src/org/eclipse/tm/te/tcf/core/internal/listener/InternalChannelOpenListener.java | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.core/src/org/eclipse/tm/te/tcf/core/internal/listener/InternalChannelOpenListener.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.core/src/org/eclipse/tm/te/tcf/core/internal/listener/InternalChannelOpenListener.java deleted file mode 100644 index a9b576d81..000000000 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.core/src/org/eclipse/tm/te/tcf/core/internal/listener/InternalChannelOpenListener.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * 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.tcf.core.internal.listener; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.tcf.protocol.IChannel; -import org.eclipse.tcf.protocol.IChannel.IChannelListener; -import org.eclipse.tcf.protocol.Protocol; -import org.eclipse.tm.te.tcf.core.Tcf; -import org.eclipse.tm.te.tcf.core.internal.interfaces.IChannelOpenListener; -import org.eclipse.tm.te.tcf.core.internal.nls.Messages; -import org.eclipse.tm.te.tcf.core.internal.utils.LogUtils; - - -/** - * Internal channel open listener taking care of logging and caching. - */ -public class InternalChannelOpenListener implements IChannelOpenListener { - // Static map containing the channel listeners per channel. Access to the - // map should happen from the TCF protocol dispatch thread only. - private final Map<IChannel, IChannel.IChannelListener> channelListeners = new HashMap<IChannel, IChannel.IChannelListener>(); - - /* (non-Javadoc) - * @see org.eclipse.tcf.protocol.Protocol.ChannelOpenListener#onChannelOpen(org.eclipse.tcf.protocol.IChannel) - */ - @Override - public void onChannelOpen(IChannel channel) { - Assert.isNotNull(channel); - Assert.isTrue(Protocol.isDispatchThread()); - - // Trace the channel opening - LogUtils.logMessageForChannel(channel, Messages.InternalChannelOpenListener_onChannelOpen_message, "debug/channels", this); //$NON-NLS-1$ - - // As the channel has just opened, there should be no channel listener, but better be safe and check. - IChannel.IChannelListener channelListener = channelListeners.remove(channel); - if (channelListener != null) channel.removeChannelListener(channelListener); - // Create a new channel listener instance - channelListener = new InternalChannelListener(channel); - // Add the channel listener to the global map - setChannelListener(channel, channelListener); - // Attach channel listener to the channel - channel.addChannelListener(channelListener); - - // Fire the property change event for the channel - Tcf.fireChannelStateChangeListeners(channel, IChannel.STATE_OPEN); - } - - /* (non-Javadoc) - * @see org.eclipse.tm.te.tcf.core.internal.interfaces.IChannelOpenListener#setChannelListener(org.eclipse.tcf.protocol.IChannel, org.eclipse.tcf.protocol.IChannel.IChannelListener) - */ - @Override - public void setChannelListener(IChannel channel, IChannelListener listener) { - Assert.isNotNull(channel); - if (listener != null) channelListeners.put(channel, listener); - else channelListeners.remove(channel); - } -} |