1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Modifed the changes

4.Remove the super freference, there's no reason to call that way.
5. Clean up the getDefaultTerminalTitle method in
AbstractLauncherDelegate.
    
Change-Id: I5211dd26fa6691c666bb457a1ef10e19a190441d
Signed-off-by: Q.S. Wang <wangqs_eclipse@yahoo.com>
This commit is contained in:
qwang 2015-06-07 09:50:47 +10:00
parent a04778c8e8
commit 1489103f23
3 changed files with 33 additions and 2 deletions

View file

@ -90,7 +90,14 @@ public class SshLauncherDelegate extends AbstractLauncherDelegate {
*
* @return The terminal title string or <code>null</code>.
*/
private String getTerminalTitle(Map<String, Object> properties) {
private String getTerminalTitle(Map<String, Object> properties) {
//Try to see if the user set a title explicitly via the properties map.
String title = getDefaultTerminalTitle(properties);
if(title!=null){
return title;
}
//No title,try to calculate the title
String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
String user = (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_USER);
Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT);

View file

@ -89,7 +89,14 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
*
* @return The terminal title string or <code>null</code>.
*/
private String getTerminalTitle(Map<String, Object> properties) {
private String getTerminalTitle(Map<String, Object> properties) {
//Try to see if the user set a title explicitly via the properties map.
String title = getDefaultTerminalTitle(properties);
if(title!=null){
return title;
}
//No title,try to calculate the title
String host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
if (host != null) {

View file

@ -9,6 +9,8 @@
*******************************************************************************/
package org.eclipse.tm.terminal.view.ui.launcher;
import java.util.Map;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionConverter;
import org.eclipse.core.runtime.Assert;
@ -18,6 +20,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.tm.terminal.view.core.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tm.terminal.view.ui.activator.UIPlugin;
import org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate;
import org.eclipse.tm.terminal.view.ui.nls.Messages;
@ -140,4 +143,18 @@ public abstract class AbstractLauncherDelegate extends PlatformObject implements
public int hashCode() {
return id.hashCode();
}
/**
* Get the title from the settings, and use it as the default title.
* @param properties the setting properties map.
* @return the value retrieved via the @see {@link ITerminalsConnectorConstants#PROP_TITLE}, or null if the key hasn't been set.
*/
protected String getDefaultTerminalTitle(Map<String, Object> properties) {
String title = (String)properties.get(ITerminalsConnectorConstants.PROP_TITLE);
if (title != null) {
return title;
}
return null;
}
}