Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-02-09 10:10:06 +0000
committerUwe Stieber2014-02-09 10:10:06 +0000
commitbd6fd8cec1338e197981bd8f791aa4dec6a057cb (patch)
treeca633290e1dd216bedcac04d25cc0790fe1bd371 /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views
parentf49bcee890959b904bde8fd80b5b4435551ca53c (diff)
downloadorg.eclipse.tcf-bd6fd8cec1338e197981bd8f791aa4dec6a057cb.tar.gz
org.eclipse.tcf-bd6fd8cec1338e197981bd8f791aa4dec6a057cb.tar.xz
org.eclipse.tcf-bd6fd8cec1338e197981bd8f791aa4dec6a057cb.zip
Target Explorer: Improve agent monitor. Log all communication to the same peer to the same console.
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Console.java126
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Factory.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/events/EventListener.java130
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/nls/Messages.properties4
4 files changed, 138 insertions, 135 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Console.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Console.java
index 3201e5659..b66752111 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Console.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Console.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * 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.tcf.ui.views.monitor.console;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.tcf.ui.console.AbstractConsole;
-import org.eclipse.tcf.te.tcf.ui.views.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.ui.views.help.IContextHelpIds;
-import org.eclipse.tcf.te.tcf.ui.views.internal.ImageConsts;
-import org.eclipse.tcf.te.tcf.ui.views.nls.Messages;
-
-/**
- * Communication monitor console implementation.
- */
-public class Console extends AbstractConsole {
-
- /**
- * Constructor.
- *
- * @param peer The peer. Must not be <code>null</code>.
- */
- public Console(final IPeer peer) {
- super(Messages.Monitor_Console_name, UIPlugin.getImageDescriptor(ImageConsts.MONITOR_CONSOLE));
-
- Assert.isNotNull(peer);
-
- // Determine name and id of the peer
- final AtomicReference<String> name = new AtomicReference<String>();
- final AtomicReference<String> id = new AtomicReference<String>();
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- name.set(peer.getName());
- id.set(peer.getID());
- }
- };
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
-
- setName(NLS.bind(Messages.Monitor_Console_name_with_peer, name.get(), id.get()));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.AbstractConsole#getHelpContextId()
- */
- @Override
- public String getHelpContextId() {
- return IContextHelpIds.MONITOR_CONSOLE;
- }
-}
+/*******************************************************************************
+ * 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.tcf.ui.views.monitor.console;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.ui.console.AbstractConsole;
+import org.eclipse.tcf.te.tcf.ui.views.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.ui.views.help.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.ui.views.internal.ImageConsts;
+import org.eclipse.tcf.te.tcf.ui.views.nls.Messages;
+
+/**
+ * Communication monitor console implementation.
+ */
+public class Console extends AbstractConsole {
+
+ /**
+ * Constructor.
+ *
+ * @param peer The peer. Must not be <code>null</code>.
+ */
+ public Console(final IPeer peer) {
+ super(Messages.Monitor_Console_name, UIPlugin.getImageDescriptor(ImageConsts.MONITOR_CONSOLE));
+
+ Assert.isNotNull(peer);
+
+ // Determine name and id of the peer
+ final AtomicReference<String> name = new AtomicReference<String>();
+ final AtomicReference<String> id = new AtomicReference<String>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ name.set(peer.getName());
+ id.set(peer.getID());
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ setName(NLS.bind(Messages.Monitor_Console_name_with_peer, name.get()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.console.AbstractConsole#getHelpContextId()
+ */
+ @Override
+ public String getHelpContextId() {
+ return IContextHelpIds.MONITOR_CONSOLE;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Factory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Factory.java
index 7b180571f..ae3c82538 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Factory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/console/Factory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2011 - 2014 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
@@ -22,8 +22,8 @@ import org.eclipse.ui.console.IConsoleManager;
* Communication monitor console factory implementation.
*/
public class Factory {
- // Map of active consoles per peer
- private static final Map<IPeer, Console> CONSOLES = new HashMap<IPeer, Console>();
+ // Map of active consoles per agent or peer id
+ private static final Map<String, Console> CONSOLES = new HashMap<String, Console>();
/**
* Show the console. Called by {@link Console}.
@@ -79,13 +79,16 @@ public class Factory {
*/
public static Console getConsole(IPeer peer, boolean createNew) {
Assert.isNotNull(peer);
+ // One console per agent or peer id
+ String id = peer.getAgentID();
+ if (id == null) id = peer.getID();
// Lookup the peer specific console
- Console console = CONSOLES.get(peer);
+ Console console = CONSOLES.get(id);
if (console == null && createNew) {
// Create a new console instance
console = new Console(peer);
// And store the new console in the map
- CONSOLES.put(peer, console);
+ CONSOLES.put(id, console);
}
// Add the console to the manager if not yet done
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/events/EventListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/events/EventListener.java
index 73daa6889..f9ee5e781 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/events/EventListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/monitor/events/EventListener.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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.tcf.ui.views.monitor.events;
-
-import java.util.EventObject;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.te.tcf.log.core.events.MonitorEvent;
-import org.eclipse.tcf.te.tcf.ui.views.monitor.console.Console;
-import org.eclipse.tcf.te.tcf.ui.views.monitor.console.Factory;
-import org.eclipse.tcf.te.ui.events.AbstractEventListener;
-
-/**
- * Communication monitor console event listener
- */
-public class EventListener extends AbstractEventListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
- */
- @Override
- public void eventFired(EventObject event) {
- if (event instanceof MonitorEvent) {
- MonitorEvent monitorEvent = (MonitorEvent)event;
-
- // Get the event simulator and message
- MonitorEvent.Type type = monitorEvent.getType();
- MonitorEvent.Message message = monitorEvent.getMessage();
-
- switch (type) {
- case CLOSE:
- // Channel close messages are logged only if there is an error
- if (message != null && message.text != null && !message.text.contains("(error=null)")) { //$NON-NLS-1$
- // Get the console
- Console console = Factory.getConsole((IPeer)monitorEvent.getSource(), true);
- Assert.isNotNull(console);
- // Message simulator 'R' is an unknown simulator and will lead to print the
- // message text using the error color.
- console.appendMessage('R', message.text);
- }
- break;
- case ACTIVITY:
- if (message != null) {
- // Get the console
- Console console = Factory.getConsole((IPeer)monitorEvent.getSource(), true);
- Assert.isNotNull(console);
- console.appendMessage(message.type, message.text);
- }
- break;
- case OPEN:
- default:
- break;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.tcf.ui.views.monitor.events;
+
+import java.util.EventObject;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.te.tcf.log.core.events.MonitorEvent;
+import org.eclipse.tcf.te.tcf.ui.views.monitor.console.Console;
+import org.eclipse.tcf.te.tcf.ui.views.monitor.console.Factory;
+import org.eclipse.tcf.te.ui.events.AbstractEventListener;
+
+/**
+ * Communication monitor console event listener
+ */
+public class EventListener extends AbstractEventListener {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
+ */
+ @Override
+ public void eventFired(EventObject event) {
+ if (event instanceof MonitorEvent) {
+ MonitorEvent monitorEvent = (MonitorEvent)event;
+
+ // Get the event simulator and message
+ MonitorEvent.Type type = monitorEvent.getType();
+ MonitorEvent.Message message = monitorEvent.getMessage();
+
+ switch (type) {
+ case CLOSE:
+ // Channel close messages are logged only if there is an error
+ if (message != null && message.text != null && !message.text.contains("(error=null)")) { //$NON-NLS-1$
+ // Get the console
+ Console console = Factory.getConsole((IPeer)monitorEvent.getSource(), true);
+ Assert.isNotNull(console);
+ // Message type 'X' is an unknown type and will lead to print the
+ // message text using the error color.
+ console.appendMessage('X', message.text);
+ }
+ break;
+ case ACTIVITY:
+ if (message != null) {
+ // Get the console
+ Console console = Factory.getConsole((IPeer)monitorEvent.getSource(), true);
+ Assert.isNotNull(console);
+ console.appendMessage(message.type, message.text);
+ }
+ break;
+ case OPEN:
+ default:
+ break;
+ }
+ }
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/nls/Messages.properties
index 012778f30..88e9a1aab 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui.views/src/org/eclipse/tcf/te/tcf/ui/views/nls/Messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+# Copyright (c) 2012 - 2014 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
@@ -11,7 +11,7 @@
ScriptPad_Console_name=Script Pad Console
Monitor_Console_name=Monitor Console
-Monitor_Console_name_with_peer=Monitor Console: {0} [{1}]
+Monitor_Console_name_with_peer=Monitor Console: {0}
ScriptPad_error_title=Error
ScriptPad_error_possibleCause=Possible Cause:\n{0}

Back to the top