Set error message in all project wizards (symbian/qt) if SBS_HOME does not exist only if SBSv2 is the builder. Always allow SBSv2 to be a selectable builder.
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java Thu Feb 25 23:50:35 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java Fri Feb 26 15:49:28 2010 -0600
@@ -27,6 +27,8 @@
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;
@@ -66,7 +68,7 @@
public void createControl(Composite parent) {
setPageComplete(false);
setErrorMessage(null);
- setMessage(null);
+ setMessage(Messages.BldInfSelectionPage_selectABLDINFToImport);
initializeDialogUnits(parent);
@@ -113,10 +115,18 @@
setButtonLayoutData(browseButton);
- if (SBSv2Utils.enableSBSv1Support() && 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) {
@@ -162,7 +172,7 @@
private boolean validatePage() {
setErrorMessage(null);
-
+ setMessage(Messages.BldInfSelectionPage_selectABLDINFToImport);
infFilePath = bldInfCombo.getText().trim();
if (infFilePath == null || infFilePath == "") { //$NON-NLS-1$
return false;
@@ -194,7 +204,12 @@
}
if (builderComposite != null) {
- return builderComposite.validatePage();
+
+ String msg = builderComposite.validatePage();
+ if (msg != null) {
+ setMessage(msg, ERROR);
+ return false;
+ }
}
return true;
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Thu Feb 25 23:50:35 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Fri Feb 26 15:49:28 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 Thu Feb 25 23:50:35 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties Fri Feb 26 15:49:28 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/sharedui/BuilderSelectionComposite.java Thu Feb 25 23:50:35 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java Fri Feb 26 15:49:28 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,9 @@
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.sdk.ui.shared.BuildTargetsPage;
public class BuilderSelectionComposite extends Composite {
@@ -60,30 +64,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() {
+// builderCombo.addSelectionListener(new SelectionListener() {
+//
+// public void widgetDefaultSelected(SelectionEvent e) {
+// widgetSelected(e);
+// }
+//
+// public void widgetSelected(SelectionEvent e) {
+// validatePage();
+// }
+//
+// });
+ }
- 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 String validatePage() {
+ useSBSv2Builder = false;
+ 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.";
}
- public void widgetSelected(SelectionEvent e) {
- validatePage();
- }
-
- });
- }
-
- public boolean validatePage() {
- useSBSv2Builder = false;
- if (builderCombo != null && builderCombo.getSelectionIndex() == 1) {
useSBSv2Builder = true;
}
getShell().setData(BuildTargetsPage.SBSV2BUILDER, new Boolean(useSBSv2Builder));
- return true;
+ return null;
}
-
+
public void saveDialogSettings(IDialogSettings settings) {
if (settings != null) {
// remember their builder selection
@@ -116,4 +131,13 @@
public void setUseSBSv2Builder(boolean useSBSv2Builder) {
this.useSBSv2Builder = useSBSv2Builder;
}
+
+ /**
+ * 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;
+ }
}
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/sharedui/NewProjectPage.java Thu Feb 25 23:50:35 2010 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/sharedui/NewProjectPage.java Fri Feb 26 15:49:28 2010 -0600
@@ -16,6 +16,25 @@
*/
package com.nokia.carbide.cpp.project.ui.sharedui;
+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.SBSv2Utils;
import com.nokia.carbide.cpp.internal.api.sdk.ui.TemplateUtils;
import com.nokia.carbide.cpp.internal.project.ui.Messages;
@@ -25,18 +44,6 @@
import com.nokia.cpp.internal.api.utils.core.HostOS;
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
*/
@@ -87,8 +94,9 @@
@Override
protected boolean validatePage() {
String projectName = getProjectName();
+
if (projectName.length() == 0) {
- // don't report error for emoty required fields, only disable next (per Eclipse guidlines)
+ // don't report error for empty required fields, only disable next (per Eclipse guidlines)
//setErrorMessage(Messages.getString("NewProjectPage.InvalidProjectNameError")); //$NON-NLS-1$
return false;
}
@@ -147,7 +155,12 @@
}
if (builderComposite != null) {
- return builderComposite.validatePage();
+
+ String msg = builderComposite.validatePage();
+ if (msg != null){
+ setMessage(msg, ERROR);
+ return false;
+ }
}
return true;
@@ -224,13 +237,20 @@
public void createControl(Composite parent) {
super.createControl(parent);
- // if there is a choice to be made...
- if (SBSv2Utils.enableSBSv1Support() && 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$
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/Messages.java Thu Feb 25 23:50:35 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/Messages.java Fri Feb 26 15:49:28 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 Thu Feb 25 23:50:35 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java Fri Feb 26 15:49:28 2010 -0600
@@ -31,6 +31,8 @@
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 +45,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;
import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils;
@@ -69,7 +70,7 @@
public void createControl(Composite parent) {
setPageComplete(false);
setErrorMessage(null);
- setMessage(null);
+ setMessage(Messages.QtProFileSelectionPage_selectAProFileInfo);
initializeDialogUnits(parent);
@@ -116,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) {
@@ -160,7 +169,7 @@
private boolean validatePage() {
setErrorMessage(null);
-
+ setMessage(Messages.QtProFileSelectionPage_selectAProFileInfo);
proFilePath = proFileCombo.getText().trim();
if (proFilePath == null || proFilePath == "") { //$NON-NLS-1$
return false;
@@ -236,9 +245,14 @@
return false;
}
- if (builderComposite != null) {
- return builderComposite.validatePage();
- }
+ if (builderComposite != null) {
+
+ String msg = builderComposite.validatePage();
+ if (msg != null){
+ setMessage(msg, ERROR);
+ return false;
+ }
+ }
return true;
}
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/messages.properties Thu Feb 25 23:50:35 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/messages.properties Fri Feb 26 15:49:28 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.