mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +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:
parent
a04778c8e8
commit
1489103f23
3 changed files with 33 additions and 2 deletions
|
@ -91,6 +91,13 @@ public class SshLauncherDelegate extends AbstractLauncherDelegate {
|
||||||
* @return The terminal title string or <code>null</code>.
|
* @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 host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
|
||||||
String user = (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_USER);
|
String user = (String)properties.get(ITerminalsConnectorConstants.PROP_SSH_USER);
|
||||||
Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT);
|
Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT);
|
||||||
|
|
|
@ -90,6 +90,13 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
|
||||||
* @return The terminal title string or <code>null</code>.
|
* @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 host = (String)properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
|
||||||
|
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.view.ui.launcher;
|
package org.eclipse.tm.terminal.view.ui.launcher;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.expressions.Expression;
|
import org.eclipse.core.expressions.Expression;
|
||||||
import org.eclipse.core.expressions.ExpressionConverter;
|
import org.eclipse.core.expressions.ExpressionConverter;
|
||||||
import org.eclipse.core.runtime.Assert;
|
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.PlatformObject;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.osgi.util.NLS;
|
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.activator.UIPlugin;
|
||||||
import org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate;
|
import org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate;
|
||||||
import org.eclipse.tm.terminal.view.ui.nls.Messages;
|
import org.eclipse.tm.terminal.view.ui.nls.Messages;
|
||||||
|
@ -140,4 +143,18 @@ public abstract class AbstractLauncherDelegate extends PlatformObject implements
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return id.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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue