--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java Tue Mar 02 08:21:24 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java Tue Mar 02 09:27:11 2010 -0600
@@ -23,10 +23,14 @@
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;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -39,7 +43,6 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.PlatformUI;
-import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
import com.nokia.carbide.cpp.internal.project.ui.ProjectUIHelpIds;
import com.nokia.carbide.cpp.internal.project.ui.sharedui.BuilderSelectionComposite;
@@ -65,6 +68,7 @@
public void createControl(Composite parent) {
setPageComplete(false);
setErrorMessage(null);
+ setMessage(Messages.BldInfSelectionPage_selectABLDINFToImport);
setMessage(null);
initializeDialogUnits(parent);
@@ -112,10 +116,16 @@
setButtonLayoutData(browseButton);
- if (SBSv2Utils.enableSBSv2Support()) {
- builderComposite = new BuilderSelectionComposite(parent);
- builderComposite.createControls();
- }
+ builderComposite = new BuilderSelectionComposite(parent);
+ builderComposite.createControls();
+ builderComposite.getBuilderCombo().addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ public void widgetSelected(SelectionEvent e) {
+ setPageComplete(validatePage());
+ }
+ });
}
public void handleEvent(Event event) {
@@ -165,7 +175,8 @@
private boolean validatePage() {
setErrorMessage(null);
-
+ setMessage(Messages.BldInfSelectionPage_selectABLDINFToImport);
+
infFilePath = bldInfCombo.getText().trim();
if (infFilePath == null || infFilePath == "") { //$NON-NLS-1$
return false;
@@ -197,7 +208,15 @@
}
if (builderComposite != null) {
- return builderComposite.validatePage();
+ 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;
@@ -262,4 +281,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/importWizards/Messages.java Tue Mar 02 08:21:24 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Tue Mar 02 09:27:11 2010 -0600
@@ -30,6 +30,8 @@
public static String BldInfSelectionPage_browseDialogTitle;
public static String BldInfSelectionPage_noSpacesInPathError;
+
+ public static String BldInfSelectionPage_selectABLDINFToImport;
public static String BldInfSelectionPage_invalidInfError;
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties Tue Mar 02 08:21:24 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties Tue Mar 02 09:27:11 2010 -0600
@@ -40,6 +40,7 @@
BldInfImportWizard_CreatingProjectJobName=Creating project...
BldInfSelectionPage_browseDialogTitle=Select bld.inf file
BldInfSelectionPage_noSpacesInPathError=The path cannot contain spaces due to limitations in the build system.
+BldInfSelectionPage_selectABLDINFToImport=Select a bld.inf file to import.
BldInfSelectionPage_invalidInfError=The selected bld.inf file does not exist.
BldInfSelectionPage_notInfError=The specified path does not refer to a bld.inf file.
BldInfSelectionPage_badLocationError=The bld.inf file cannot be at the root of the workspace.
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/messages.properties Tue Mar 02 08:21:24 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/messages.properties Tue Mar 02 09:27:11 2010 -0600
@@ -2,7 +2,7 @@
NewProjectPage.NameBeginWithDigitError=Project names can not begin with a digit
NewProjectPage.InvalidProjectName={0} is not a valid project name
NewProjectPage.builderLabel=Builder:
-NewProjectPage.builderToolTip=Select the builder to use for this project
+NewProjectPage.builderToolTip=Select the builder to use for this project. SBSv2 = Raptor | SBSv1 = abld
NewProjectPage.ProjectNameWithPeriodError=Project names can not contain periods
NewProjectPage.sbsv1=SBSv1
NewProjectPage.sbsv2=SBSv2
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java Tue Mar 02 08:21:24 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java Tue Mar 02 09:27:11 2010 -0600
@@ -16,6 +16,8 @@
*/
package com.nokia.carbide.cpp.internal.project.ui.sharedui;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -26,7 +28,11 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
+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 {
@@ -41,6 +47,15 @@
super(parent, SWT.NONE);
}
+ /**
+ * Get the builder combo that the user select the builder (e.g. SBSv1 or SBSv2)
+ * when creating projects.
+ * @return the Combo
+ */
+ public Combo getBuilderCombo(){
+ return builderCombo;
+ }
+
public void createControls() {
GridLayout layout = new GridLayout();
layout.numColumns = 2;
@@ -60,30 +75,41 @@
builderCombo.add(Messages.getString("NewProjectPage.sbsv2")); //$NON-NLS-1$
builderCombo.setData(".uid", "builderCombo"); //$NON-NLS-1$ //$NON-NLS-2$
builderCombo.select(0);
- builderCombo.addSelectionListener(new SelectionListener() {
+
+ }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
+ /**
+ * Validate the builder selection. Implementers of this client should
+ * listen for changes on the builder combo via {@link #getBuilderCombo()}
+ * @return null for no error, otherwise a string for the error message
+ */
+ 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){
+ 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.");
+ }
+
+ // 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.");
+ }
}
- public void widgetSelected(SelectionEvent e) {
- validatePage();
- }
-
- });
- }
-
- public boolean validatePage() {
- useSBSv2Builder = false;
- if (builderCombo != null && builderCombo.getSelectionIndex() == 1) {
- useSBSv2Builder = true;
+ } else {
+ useSBSv2Builder = false;
}
getShell().setData(BuildTargetsPage.SBSV2BUILDER, new Boolean(useSBSv2Builder));
- return true;
+ return status;
}
-
+
public void saveDialogSettings(IDialogSettings settings) {
if (settings != null) {
// remember their builder selection
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/sharedui/NewProjectPage.java Tue Mar 02 08:21:24 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/sharedui/NewProjectPage.java Tue Mar 02 09:27:11 2010 -0600
@@ -16,7 +16,25 @@
*/
package com.nokia.carbide.cpp.project.ui.sharedui;
-import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+
import com.nokia.carbide.cpp.internal.api.sdk.ui.TemplateUtils;
import com.nokia.carbide.cpp.internal.project.ui.Messages;
import com.nokia.carbide.cpp.internal.project.ui.sharedui.BuilderSelectionComposite;
@@ -24,18 +42,6 @@
import com.nokia.cpp.internal.api.utils.core.FileUtils;
import com.nokia.cpp.internal.api.utils.core.TextUtils;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-import java.io.File;
-import java.text.MessageFormat;
-import java.util.*;
-
/**
* Page that gathers name and location for new project
*/
@@ -141,7 +147,15 @@
}
if (builderComposite != null) {
- return builderComposite.validatePage();
+ 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;
@@ -218,13 +232,21 @@
public void createControl(Composite parent) {
super.createControl(parent);
- if (SBSv2Utils.enableSBSv2Support()) {
- Control control = getControl();
- if (control instanceof Composite) {
- builderComposite = new BuilderSelectionComposite((Composite)control);
- builderComposite.createControls();
- }
+
+ Control control = getControl();
+ if (control instanceof Composite) {
+ builderComposite = new BuilderSelectionComposite((Composite)control);
+ builderComposite.createControls();
+ builderComposite.getBuilderCombo().addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ public void widgetSelected(SelectionEvent e) {
+ setPageComplete(validatePage());
+ }
+ });
}
+
getControl().setData(".uid", "NewProjectPage"); //$NON-NLS-1$ //$NON-NLS-2$
getControl().setData("WizardPage", this); //$NON-NLS-1$
@@ -250,4 +272,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/Messages.java Tue Mar 02 08:21:24 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/Messages.java Tue Mar 02 09:27:11 2010 -0600
@@ -34,6 +34,8 @@
public static String QtProFileSelectionPage_browseDialogTitle;
public static String QtProFileSelectionPage_noSpacesInPathError;
+
+ public static String QtProFileSelectionPage_selectAProFileInfo;
public static String QtProFileSelectionPage_invalidProError;
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java Tue Mar 02 08:21:24 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java Tue Mar 02 09:27:11 2010 -0600
@@ -28,9 +28,12 @@
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;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -43,7 +46,6 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.PlatformUI;
-import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
import com.nokia.carbide.cpp.internal.project.ui.sharedui.BuilderSelectionComposite;
import com.nokia.carbide.cpp.internal.qt.ui.QtUIHelpIds;
@@ -68,7 +70,7 @@
public void createControl(Composite parent) {
setPageComplete(false);
setErrorMessage(null);
- setMessage(null);
+ setMessage(Messages.QtProFileSelectionPage_selectAProFileInfo);
initializeDialogUnits(parent);
@@ -115,10 +117,18 @@
setButtonLayoutData(browseButton);
- if (SBSv2Utils.enableSBSv2Support()) {
- builderComposite = new BuilderSelectionComposite(parent);
- builderComposite.createControls();
- }
+ builderComposite = new BuilderSelectionComposite(parent);
+ builderComposite.createControls();
+ builderComposite.getBuilderCombo().addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ setPageComplete(validatePage());
+ }
+ });
}
public void handleEvent(Event event) {
@@ -163,7 +173,7 @@
private boolean validatePage() {
setErrorMessage(null);
-
+ setMessage(Messages.QtProFileSelectionPage_selectAProFileInfo);
proFilePath = proFileCombo.getText().trim();
if (proFilePath == null || proFilePath == "") { //$NON-NLS-1$
return false;
@@ -240,7 +250,16 @@
}
if (builderComposite != null) {
- return builderComposite.validatePage();
+
+ 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;
@@ -305,4 +324,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;
+ }
}
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/messages.properties Tue Mar 02 08:21:24 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/messages.properties Tue Mar 02 09:27:11 2010 -0600
@@ -12,6 +12,7 @@
QtProFileSelectionPage_browseButtonTooltip=Browse the file system and select the .pro file to import.
QtProFileSelectionPage_browseDialogTitle=Select .pro file
QtProFileSelectionPage_noSpacesInPathError=The path cannot contain spaces due to limitations in the build system.
+QtProFileSelectionPage_selectAProFileInfo=Select a .pro file to import.
QtProFileSelectionPage_invalidProError=The selected .pro file does not exist.
QtProFileSelectionPage_notProError=The specified path does not refer to a .pro file.
QtProFileSelectionPage_badLocationError=The.pro file cannot be at the root of the workspace.