fix bug in rss display and more tweaks
authordadubrow
Wed, 18 Aug 2010 09:07:07 -0500
changeset 1849 40d70835dc4f
parent 1848 2a6d912d3065
child 1850 5d37d47936a2
fix bug in rss display and more tweaks
core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties
core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java
core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractRSSPortalPageLayer.java
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties	Tue Aug 17 20:22:30 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties	Wed Aug 18 09:07:07 2010 -0500
@@ -19,7 +19,7 @@
 AbstractDiscoveryPortalPageLayer_InstallActionTooltip=Install selected items
 AbstractDiscoveryPortalPageLayer_P2InstallWizardOpenError=Could not open install wizard
 AbstractDiscoveryPortalPageLayer_RefreshActionLabel=Refresh
-AbstractDiscoveryPortalPageLayer_Title=Install Extensions
+AbstractDiscoveryPortalPageLayer_Title=Install
 AbstractDiscoveryPortalPageLayer_UncheckAllActionLabel=Deselect all
 AbstractImportExportPage_BrowseButtonLabel=Browse...
 AbstractImportExportPage_CheckAllLabel=Select All
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java	Tue Aug 17 20:22:30 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java	Wed Aug 18 09:07:07 2010 -0500
@@ -89,7 +89,7 @@
 				@Override
 				public void completed(ProgressEvent event) {
 					getStatusLineManager().setMessage(null);
-					if (!failedConnect && !browserHasURL()) {
+					if (!failedConnect && !isValidPage()) {
 						displayCannotFindServerPage();
 						Activator.logError("Could not display URL in browser: " + getURL().toExternalForm(), null);
 						failedConnect = true;
@@ -188,7 +188,7 @@
 				public void run() {
 					URL url = getURL();
 					if (url != null) {
-						browser.setUrl(url.toString());
+						setUrl(url.toString());
 					}
 					actionBar.hookBrowser();
 					actionBar.update();
@@ -246,15 +246,14 @@
 			@Override
 			public void run() {
 				if (browser != null) {
-					if (failedConnect) {
+					if (browserHasURL())
+						browser.refresh();
+					else {
 						URL url = getURL();
 						if (url != null) {
-							browser.setUrl(url.toString());
-							failedConnect = false;
+							setUrl(url.toString());
 						}
 					}
-					else
-						browser.refresh();
 					actionBar.update();
 				}
 			}
@@ -304,7 +303,7 @@
 				});
 				int result = dlg.open();
 				if (result == Dialog.OK) {
-					browser.setUrl(dlg.getValue());
+					setUrl(dlg.getValue());
 					actionBar.update();
 				}
 			};
@@ -323,6 +322,15 @@
 		return url.matches("^.*://.*"); //$NON-NLS-1$
 	}
 
+	protected boolean isValidPage() {
+		return browserHasURL();
+	}
+	
+	protected void setUrl(String url) {
+		browser.setUrl(url);
+		failedConnect = false;
+	}
+
 	protected void displayCannotFindServerPage() {
 		StringBuilder sb = new StringBuilder(HTML_BODY_HEADER);
 		// if we want, we can add html here for failed connect case
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractRSSPortalPageLayer.java	Tue Aug 17 20:22:30 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractRSSPortalPageLayer.java	Wed Aug 18 09:07:07 2010 -0500
@@ -98,6 +98,8 @@
 	
 	private Rss rss;
 
+	private boolean displayingFeed;
+
 	@Override
 	public void init() {
 		Activator.runInUIThreadWhenProxyDataSet(browser, new Runnable() {
@@ -170,6 +172,7 @@
 			@Override
 			public void run() {
 				browser.setText(s);
+				displayingFeed = true;
 			}
 		});
 	}
@@ -188,6 +191,17 @@
 	}
 
 	@Override
+	protected boolean isValidPage() {
+		return super.browserHasURL() || displayingFeed;
+	}
+	
+	@Override
+	protected void setUrl(String url) {
+		super.setUrl(url);
+		displayingFeed = false;
+	}
+	
+	@Override
 	protected Set<IAction> makeActions() {
 		Set<IAction> actions = new LinkedHashSet<IAction>();
 		for (IAction action : super.makeActions()) {