Show only warning when all installed
authordadubrow
Wed, 18 Aug 2010 13:56:22 -0500
changeset 1856 e3ec6febb587
parent 1855 03d160c02b5f
child 1858 5741137411ec
Show only warning when all installed
core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java
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
core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportWizard.java
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java	Wed Aug 18 13:49:37 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java	Wed Aug 18 13:56:22 2010 -0500
@@ -31,6 +31,7 @@
 	public static String AbstractBrowserPortalPageLayer_OpenLocationLabel;
 	public static String AbstractBrowserPortalPageLayer_OpenLocationTitle;
 	public static String AbstractBrowserPortalPageLayer_ShowInBrowserLabel;
+	public static String AbstractBrowserPortalPageLayer_URLDisplayError;
 	public static String AbstractBrowserPortalPageLayer_URLLabel;
 	public static String AbstractDiscoveryPortalPageLayer_AdvancedInstallActionLabel;
 	public static String AbstractDiscoveryPortalPageLayer_CheckAllActionLabel;
@@ -48,6 +49,7 @@
 	public static String AbstractImportExportPage_CheckNoneLabel;
 	public static String AbstractImportExportPage_FeatureColTitle;
 	public static String AbstractImportExportPage_VersionColTitle;
+	public static String AbstractRSSPortalPageLayer_GettingFeedJobTitle;
 	public static String AbstractRSSPortalPageLayer_ReturnToFeedLabel;
 	public static String AbstractRSSPortalPageLayer_RSSReadError;
 	public static String Activator_GetProxyInfoJobTitle;
@@ -83,6 +85,8 @@
 	public static String ImportPage_Title;
 	public static String ImportPage_ViewerGroupLabel;
 	public static String ImportPage_XMLFileFilterName;
+	public static String ImportWizard_AllInstalledMessage;
+	public static String ImportWizard_AllInstalledTitle;
 	public static String ImportWizard_ErrorTitle;
 	public static String ImportWizard_ImportFailedError;
 	public static String ImportWizard_InstallErrorSimple;
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties	Wed Aug 18 13:49:37 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties	Wed Aug 18 13:56:22 2010 -0500
@@ -9,6 +9,7 @@
 AbstractBrowserPortalPageLayer_OpenLocationLabel=Open location
 AbstractBrowserPortalPageLayer_OpenLocationTitle=Open Location
 AbstractBrowserPortalPageLayer_ShowInBrowserLabel=Show in browser
+AbstractBrowserPortalPageLayer_URLDisplayError=Could not display URL in browser: 
 AbstractBrowserPortalPageLayer_URLLabel=URL:
 AbstractDiscoveryPortalPageLayer_AdvancedInstallActionLabel=Advanced install...
 AbstractDiscoveryPortalPageLayer_CheckAllActionLabel=Select all
@@ -26,6 +27,7 @@
 AbstractImportExportPage_CheckNoneLabel=Deselect All
 AbstractImportExportPage_FeatureColTitle=Feature
 AbstractImportExportPage_VersionColTitle=Version
+AbstractRSSPortalPageLayer_GettingFeedJobTitle=Getting RSS feed
 AbstractRSSPortalPageLayer_ReturnToFeedLabel=Return to RSS
 AbstractRSSPortalPageLayer_RSSReadError=Could not read RSS from: {0}
 Activator_GetProxyInfoJobTitle=Getting proxy info
@@ -61,6 +63,8 @@
 ImportPage_Title=Import Feature Configuration and Install
 ImportPage_ViewerGroupLabel=Import Features:
 ImportPage_XMLFileFilterName=XML Files
+ImportWizard_AllInstalledMessage=Could not complete installation, all features are already installed
+ImportWizard_AllInstalledTitle=Warning
 ImportWizard_ErrorTitle=Error
 ImportWizard_ImportFailedError=Import operation failed
 ImportWizard_InstallErrorSimple=Could not install due to error: {0}
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java	Wed Aug 18 13:49:37 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java	Wed Aug 18 13:56:22 2010 -0500
@@ -91,7 +91,7 @@
 					getStatusLineManager().setMessage(null);
 					if (!failedConnect && !isValidPage()) {
 						displayCannotFindServerPage();
-						Activator.logError("Could not display URL in browser: " + getURL().toExternalForm(), null);
+						Activator.logError(Messages.AbstractBrowserPortalPageLayer_URLDisplayError + getURL().toExternalForm(), null);
 						failedConnect = true;
 					}
 					setLoading(false);
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractRSSPortalPageLayer.java	Wed Aug 18 13:49:37 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractRSSPortalPageLayer.java	Wed Aug 18 13:56:22 2010 -0500
@@ -116,7 +116,7 @@
 	protected void readRSS() {
 		final URL url = getURL();
 		if (url != null) {
-			Job j = new Job("Getting RSS feed") {
+			Job j = new Job(Messages.AbstractRSSPortalPageLayer_GettingFeedJobTitle) {
 
 				@Override
 				protected IStatus run(IProgressMonitor monitor) {
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportWizard.java	Wed Aug 18 13:49:37 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportWizard.java	Wed Aug 18 13:56:22 2010 -0500
@@ -50,8 +50,12 @@
 			Throwable cause = e.getCause();
 			if (cause instanceof CoreException) {
 				IStatus status = ((CoreException) cause).getStatus();
-				Activator.logError(Messages.ImportWizard_ImportFailedError, cause);
-				ErrorDialog.openError(getShell(), Messages.ImportWizard_ErrorTitle, null, status);
+				if (allInstalledStatus(status)) {
+					MessageDialog.openWarning(getShell(), Messages.ImportWizard_AllInstalledTitle, Messages.ImportWizard_AllInstalledMessage);
+				}
+				else {
+					ErrorDialog.openError(getShell(), Messages.ImportWizard_ErrorTitle, null, status);
+				}
 			} else {
 				MessageDialog.openError(getShell(), Messages.ImportWizard_ErrorTitle, 
 						MessageFormat.format(Messages.ImportWizard_InstallErrorSimple, cause.getMessage()));
@@ -61,6 +65,21 @@
 		return true;
 	}
 
+	private boolean allInstalledStatus(IStatus status) {
+		boolean isOpFailed = false;
+		IStatus[] statusChildren = status.getChildren();
+		if (statusChildren != null && statusChildren.length > 0) {
+			isOpFailed = statusChildren[0].getCode() == 10050;
+			if (isOpFailed) {
+				for (int i = 1; i < statusChildren.length; i++) {
+					if (statusChildren[i].getCode() != 10005)
+						isOpFailed = false;
+				}
+			}
+		}
+		return isOpFailed;
+	}
+
 	public void init(IWorkbench workbench, IStructuredSelection selection) {
 		setDefaultPageImageDescriptor(Activator.getImageDescriptor("icons\\install_wiz.gif")); //$NON-NLS-1$
 		setNeedsProgressMonitor(true);