# HG changeset patch # User timkelly # Date 1267474509 21600 # Node ID 4c6fab8a081bee8859e79d545ece6d5d0a3202f6 # Parent a1a443e77261e1b65400ddb23be451c7763e569b 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). diff -r a1a443e77261 -r 4c6fab8a081b project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.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; + } } diff -r a1a443e77261 -r 4c6fab8a081b project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java --- 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) { diff -r a1a443e77261 -r 4c6fab8a081b project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/sharedui/NewProjectPage.java --- 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; + } } diff -r a1a443e77261 -r 4c6fab8a081b qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java --- 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; + } }