Bug 282242 - "LOCALHOST" as host name for first time connection creation
Summary: "LOCALHOST" as host name for first time connection creation
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.1.1   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-02 02:44 EDT by Zhou Renjian CLA
Modified: 2011-05-19 12:44 EDT (History)
1 user (show)

See Also:


Attachments
Fixing the bug (918 bytes, patch)
2009-07-02 02:46 EDT, Zhou Renjian CLA
no flags Details | Diff
Fixing the bug and fix copyrights (1.40 KB, patch)
2009-07-02 23:15 EDT, Zhou Renjian CLA
dmcknigh: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zhou Renjian CLA 2009-07-02 02:44:28 EDT
If no connections have been created yet, trying to create a new one using "New Connection" wizard won't get a drop list of host names for you to choose.

It would better to provide "LOCALHOST" in the drop list in this case.
Comment 1 Zhou Renjian CLA 2009-07-02 02:46:48 EDT
Created attachment 140654 [details]
Fixing the bug

Index: src/org/eclipse/rse/ui/SystemWidgetHelpers.java

===================================================================

--- src/org/eclipse/rse/ui/SystemWidgetHelpers.java	(revision 11)

+++ src/org/eclipse/rse/ui/SystemWidgetHelpers.java	(working copy)

@@ -1208,7 +1208,12 @@

 		//System.out.println("TipId: " + ISystemConstants.RESID_HOSTNAME_TIP);		
 		Combo combo = createCombo(parent, listener, SystemResources.RESID_CONNECTION_HOSTNAME_TIP);
 		//System.out.println("Tip  : " + combo.getToolTipText());
-		combo.setItems(RSECorePlugin.getTheSystemRegistry().getHostNames(systemType));
+		// Fix bug#282242: No default host names if no connection has been created.
+		String[] hostNames = RSECorePlugin.getTheSystemRegistry().getHostNames(systemType);
+		if (hostNames.length == 0) {
+			hostNames = new String[] { "LOCALHOST" };
+		}
+		combo.setItems(hostNames);
 		combo.select(0);
 		return combo;
 	}
Comment 2 David McKnight CLA 2009-07-02 09:28:41 EDT
Hi Zhou, thanks for the contribution!  Note that these contributions need the following:

1) modified files need to contain your copyright line
2) a legal disclaimer is needed for your patch as per
http://www.eclipse.org/dsdp/tm/development/committer_howto.php#external_contrib

Comment 3 Zhou Renjian CLA 2009-07-02 23:15:43 EDT
Created attachment 140734 [details]
Fixing the bug and fix copyrights

Legal Message: I, Zhou Renjian, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, Shanghai Kortide, to make this contribution under the EPL. 

/org.eclipse.rse.ui/src/org/eclipse/rse/ui/SystemWidgetHelpers.java
Comment 4 David McKnight CLA 2009-07-03 11:05:18 EDT
Comment on attachment 140734 [details]
Fixing the bug and fix copyrights

Patch format doesn't work for my Eclipse so I have to apply the changes manually.
Comment 5 David McKnight CLA 2009-07-03 11:16:33 EDT
I've committed the change to cvs.
Comment 6 Martin Oberhuber CLA 2011-05-19 12:44:40 EDT
Comment on attachment 140654 [details]
Fixing the bug

Obsoleted by later patch.