make open location more robust in portal
authordadubrow
Tue, 14 Sep 2010 14:24:51 -0500
changeset 2002 e9a2c2c218b4
parent 2001 75d787292eea
child 2003 576284888c71
make open location more robust in portal
core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java	Tue Sep 14 13:37:29 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java	Tue Sep 14 14:24:51 2010 -0500
@@ -294,7 +294,7 @@
 					@Override
 					public String isValid(String newText) {
 						try {
-							new URL(newText);
+							new URL(getLocationURL(newText));
 						} catch (MalformedURLException e) {
 							return Messages.AbstractBrowserPortalPageLayer_InvalidURLError;
 						}
@@ -303,9 +303,19 @@
 				});
 				int result = dlg.open();
 				if (result == Dialog.OK) {
-					setUrl(dlg.getValue());
+					String value = dlg.getValue();
+					setUrl(getLocationURL(value));
 					actionBar.update();
 				}
+			}
+
+			private String getLocationURL(String value) {
+				try {
+					new URL(value);
+				} catch (MalformedURLException e) {
+					value = "http://" + value;
+				}
+				return value;
 			};
 			
 			public boolean isEnabled() {