From 6a9c67c8263eedddf88c88bbcf9089edd1c6c12f Mon Sep 17 00:00:00 2001 From: Pablo Torregrosa Paez Date: Thu, 18 Feb 2016 16:36:50 +0100 Subject: Target Explorer: Append task name to the IO Terminal Change-Id: Ic82e140367d8518d2426858cad2422d58bbd0784 Signed-off-by: Pablo Torregrosa Paez --- .../processes/core/launcher/ProcessLauncher.java | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'target_explorer') diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java index 6ce812511..32727365a 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2011, 2016 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 @@ -693,22 +693,24 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher title.append(processPath.toString()); } - // Get the peer name - final AtomicReference peerName = new AtomicReference(getProperties().getStringProperty(IProcessLauncher.PROP_CONNECTION_NAME)); - if (peerName.get() == null) { - // Query the peer from the open channel - Runnable runnable = new Runnable() { - @Override - public void run() { - if (channel != null) { - peerName.set(channel.getRemotePeer().getName()); - } + // In case, the path is empty, append the connection name + if (title.length() == 0 && properties.getStringProperty(IProcessLauncher.PROP_CONNECTION_NAME) != null) { + title.append(properties.getStringProperty(IProcessLauncher.PROP_CONNECTION_NAME)); + } + + // Query the peer from the open channel + final AtomicReference peerName = new AtomicReference(); + Runnable runnable = new Runnable() { + @Override + public void run() { + if (channel != null) { + peerName.set(channel.getRemotePeer().getName()); } - }; + } + }; - if (Protocol.isDispatchThread()) runnable.run(); - else Protocol.invokeAndWait(runnable); - } + if (Protocol.isDispatchThread()) runnable.run(); + else Protocol.invokeAndWait(runnable); if (peerName.get() != null) { title.append(" [").append(peerName.get()).append("]"); //$NON-NLS-1$ //$NON-NLS-2$ -- cgit v1.2.3