Check for Raptor version # when importing a project. Emit a warning in wizard pages if major version is 0 (i.e. raptor version not detected).
authortimkelly
Mon, 01 Mar 2010 14:15:09 -0600
changeset 1043 4c6fab8a081b
parent 1042 a1a443e77261
child 1045 7bd4eb5648d7
child 1052 12fd5293f52f
Check for Raptor version # when importing a project. Emit a warning in wizard pages if major version is 0 (i.e. raptor version not detected).
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/sharedui/NewProjectPage.java
qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java	Mon Mar 01 13:21:09 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java	Mon Mar 01 14:15:09 2010 -0600
@@ -23,7 +23,9 @@
 
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
@@ -204,12 +206,17 @@
 		}
 		
 		if (builderComposite != null) {
-
-			String msg = builderComposite.validatePage();
-			if (msg != null) {
-				setMessage(msg, ERROR);
-				return false;
-			}
+			
+			IStatus status = builderComposite.validatePage();
+        	if (status != null){
+        		// Get the level from the status.
+        		int level = getMessageLevelFromIStatus(status);
+        		setMessage(status.getMessage(), level);
+        		if (level == ERROR){
+        			return false;
+        		}
+        	}
+        
 		}
 		
 		return true;
@@ -277,4 +284,15 @@
 	public void performHelp() {
         PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl().getShell(), ProjectUIHelpIds.BLDINF_SELECTION_PAGE);
 	}
+	
+    private int getMessageLevelFromIStatus(IStatus status){
+    	if (status.getSeverity() == Status.ERROR)
+    		return ERROR;
+    	else if (status.getSeverity() == Status.WARNING)
+    		return WARNING;
+    	else if (status.getSeverity() == Status.INFO)
+    		return INFORMATION;
+    	
+    	return NONE;
+    }
 }
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java	Mon Mar 01 13:21:09 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java	Mon Mar 01 14:15:09 2010 -0600
@@ -31,6 +31,8 @@
 import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
 import com.nokia.carbide.cpp.internal.project.ui.Messages;
 import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin;
+import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
 import com.nokia.carbide.cpp.sdk.ui.shared.BuildTargetsPage;
 
 public class BuilderSelectionComposite extends Composite {
@@ -82,21 +84,30 @@
      * listen for changes on the builder combo via {@link #getBuilderCombo()}
      * @return null for no error, otherwise a string for the error message
      */
-    public String validatePage() {
-		useSBSv2Builder = false;
+    public IStatus validatePage() {
+		useSBSv2Builder = true;
+		IStatus status = null;
 		if (builderCombo != null && builderCombo.getSelectionIndex() == 1) {
 			
 			// if SBSv2 is selected, make sure SBS_HOME is defined
 			if (SBSv2Utils.getSBSBinDirectory() == null){
-				return "SBS_HOME environment variable is not defined. Carbide needs this variable to find the base SBS install.";
+				status = new Status(Status.ERROR, ProjectUIPlugin.PLUGIN_ID, "SBS_HOME environment variable is not defined. Carbide needs this variable to find the base SBS install.");
+				useSBSv2Builder = false;
+			}
+			
+			// check the raptor version
+			if (SDKCorePlugin.getSDKManager().getSBSv2Version(false).getMajor() == 0){
+				// Try to scan again....
+				if (SDKCorePlugin.getSDKManager().getSBSv2Version(true).getMajor() == 0){
+					status = new Status(Status.WARNING, ProjectUIPlugin.PLUGIN_ID, "SBS version cannot be determined, some SBS functionality may not work. Please check your SBS installation.");
+				}
 			}
 
-			useSBSv2Builder = true;
 		}
 
 		getShell().setData(BuildTargetsPage.SBSV2BUILDER, new Boolean(useSBSv2Builder));
 		
-		return null;
+		return status;
     }
     
     public void saveDialogSettings(IDialogSettings settings) {
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/sharedui/NewProjectPage.java	Mon Mar 01 13:21:09 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/sharedui/NewProjectPage.java	Mon Mar 01 14:15:09 2010 -0600
@@ -156,10 +156,14 @@
 		
         if (builderComposite != null) {
         	
-        	String msg = builderComposite.validatePage();
-        	if (msg != null){
-        		setMessage(msg, ERROR);
-        		return false;
+        	IStatus status = builderComposite.validatePage();
+        	if (status != null){
+        		// Get the level from the status.
+        		int level = getMessageLevelFromIStatus(status);
+        		setMessage(status.getMessage(), level);
+        		if (level == ERROR){
+        			return false;
+        		}
         	}
         }
         
@@ -277,4 +281,15 @@
             }
     	}
     }
+    
+    private int getMessageLevelFromIStatus(IStatus status){
+    	if (status.getSeverity() == Status.ERROR)
+    		return ERROR;
+    	else if (status.getSeverity() == Status.WARNING)
+    		return WARNING;
+    	else if (status.getSeverity() == Status.INFO)
+    		return INFORMATION;
+    	
+    	return NONE;
+    }
 }
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java	Mon Mar 01 13:21:09 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java	Mon Mar 01 14:15:09 2010 -0600
@@ -28,6 +28,7 @@
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
@@ -245,14 +246,18 @@
 			return false;
 		}
 
-		 if (builderComposite != null) {
-	        	
-	        	String msg = builderComposite.validatePage();
-	        	if (msg != null){
-	        		setMessage(msg, ERROR);
-	        		return false;
-	        	}
-	    }
+		if (builderComposite != null) {
+
+			IStatus status = builderComposite.validatePage();
+        	if (status != null){
+        		// Get the level from the status.
+        		int level = getMessageLevelFromIStatus(status);
+        		setMessage(status.getMessage(), level);
+        		if (level == ERROR){
+        			return false;
+        		}
+        	}
+		}
 		
 		return true;
     }
@@ -316,4 +321,15 @@
 	public void performHelp() {
         PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl().getShell(), QtUIHelpIds.QT_PRO_FILE_SELECTION_PAGE);
 	}
+	
+    private int getMessageLevelFromIStatus(IStatus status){
+    	if (status.getSeverity() == Status.ERROR)
+    		return ERROR;
+    	else if (status.getSeverity() == Status.WARNING)
+    		return WARNING;
+    	else if (status.getSeverity() == Status.INFO)
+    		return INFORMATION;
+    	
+    	return NONE;
+    }
 }