# HG changeset patch # User cawthron # Date 1267558021 21600 # Node ID 7cfa83353a873eb7e13c972a5026f7035a095808 # Parent 49b17289f4ed438cf2818d423a3c12c85f178fe0# Parent 2b0ea08bb22f2d7aa664aa13517330898b794fcf merge diff -r 49b17289f4ed -r 7cfa83353a87 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/StatusDisplay.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/StatusDisplay.java Tue Mar 02 12:31:19 2010 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/StatusDisplay.java Tue Mar 02 13:27:01 2010 -0600 @@ -35,6 +35,8 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Link; +import org.eclipse.swt.widgets.MessageBox; +import org.eclipse.swt.widgets.Shell; import com.nokia.carbide.remoteconnections.internal.api.IStatusDisplay; import com.nokia.cpp.internal.api.utils.core.Check; @@ -75,18 +77,9 @@ @Override protected String getPopupShellTitle() { - switch (status.getSeverity()) { - case IStatus.INFO: - return "Information"; - case IStatus.WARNING: - return "Warning"; - case IStatus.ERROR: - return "Error"; - }; - Check.checkState(false); - return null; + return getTitleString(status); } - + @Override protected Image getPopupShellImage(int maximumHeight) { switch (status.getSeverity()) { @@ -102,6 +95,8 @@ } } + private static final int MODAL_MASK = SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL; + private boolean clicked; private boolean closed; @@ -134,14 +129,68 @@ action.run(); } - protected void doDisplayStatus(Display display, String prompt, IStatus status) { - NotificationPopup popup = new NotificationPopup(display, status, prompt); - popup.open(); - popup.getShell().addDisposeListener(new DisposeListener() { - public void widgetDisposed(DisposeEvent e) { - StatusDisplay.this.closed = true; + private Shell getModalShell(Display display) { + Shell[] shells = display.getShells(); + for (int i = shells.length - 1; i >= 0; i--) { + Shell shell = shells[i]; + if ((shell.getStyle() & MODAL_MASK) != 0) { + return shell; } - }); + } + return null; } + protected void doDisplayStatus(Display display, String prompt, IStatus status) { + Shell modalShell = getModalShell(display); + if (modalShell == null) { + NotificationPopup popup = new NotificationPopup(display, status, prompt); + popup.open(); + popup.getShell().addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + StatusDisplay.this.closed = true; + } + }); + } + else { + int style = SWT.YES | SWT.NO; + switch (status.getSeverity()) { + case IStatus.INFO: + style |= SWT.ICON_INFORMATION; + break; + case IStatus.WARNING: + style |= SWT.ICON_WARNING; + break; + case IStatus.ERROR: + style |= SWT.ICON_ERROR; + break; + default: + Check.checkState(false); + }; + + MessageBox messageBox = new MessageBox(modalShell, style); + messageBox.setText(getTitleString(status)); + StringBuilder sb = new StringBuilder(); + sb.append(status.getMessage()); + sb.append("\n"); + sb.append(prompt); + messageBox.setMessage(sb.toString()); + int open = messageBox.open(); + closed = true; + clicked = open == SWT.YES; + } + } + + private String getTitleString(IStatus status) { + switch (status.getSeverity()) { + case IStatus.INFO: + return "Information"; + case IStatus.WARNING: + return "Warning"; + case IStatus.ERROR: + return "Error"; + }; + Check.checkState(false); + return null; + } + } diff -r 49b17289f4ed -r 7cfa83353a87 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 Tue Mar 02 12:31:19 2010 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfSelectionPage.java Tue Mar 02 13:27:01 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.validate(); + 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; + } } diff -r 49b17289f4ed -r 7cfa83353a87 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Tue Mar 02 12:31:19 2010 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Tue Mar 02 13:27:01 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; diff -r 49b17289f4ed -r 7cfa83353a87 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties Tue Mar 02 12:31:19 2010 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties Tue Mar 02 13:27:01 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. diff -r 49b17289f4ed -r 7cfa83353a87 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/messages.properties --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/messages.properties Tue Mar 02 12:31:19 2010 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/messages.properties Tue Mar 02 13:27:01 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. SBSv1 (abld) or SBSv2 (Raptor). NewProjectPage.ProjectNameWithPeriodError=Project names can not contain periods NewProjectPage.sbsv1=SBSv1 NewProjectPage.sbsv2=SBSv2 diff -r 49b17289f4ed -r 7cfa83353a87 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 Tue Mar 02 12:31:19 2010 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java Tue Mar 02 13:27:01 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 validate() { + 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 diff -r 49b17289f4ed -r 7cfa83353a87 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 Tue Mar 02 12:31:19 2010 -0600 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/sharedui/NewProjectPage.java Tue Mar 02 13:27:01 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.validate(); + 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; + } } diff -r 49b17289f4ed -r 7cfa83353a87 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/Messages.java --- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/Messages.java Tue Mar 02 12:31:19 2010 -0600 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/Messages.java Tue Mar 02 13:27:01 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; diff -r 49b17289f4ed -r 7cfa83353a87 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 Tue Mar 02 12:31:19 2010 -0600 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileSelectionPage.java Tue Mar 02 13:27:01 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.validate(); + 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; + } } diff -r 49b17289f4ed -r 7cfa83353a87 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/messages.properties --- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/messages.properties Tue Mar 02 12:31:19 2010 -0600 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/messages.properties Tue Mar 02 13:27:01 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.