+ */
+ private static final String HelpID_Prefix = LaunchPlugin.getUniqueIdentifier() + ".launch2_"; //$NON-NLS-1$
+
+
+ public static final String WIZARD_DIALOG_CHANGE_DEBUG_PROCESS = HelpID_Prefix + "wizard_dialog_change_debug_process"; //$NON-NLS-1$
+ public static final String WIZARD_DIALOG_CHANGE_RUN_PROCESS = HelpID_Prefix + "wizard_dialog_change_run_process"; //$NON-NLS-1$
+ public static final String WIZARD_DIALOG_CHANGE_CONNECTION = HelpID_Prefix + "wizard_dialog_change_connection"; //$NON-NLS-1$
+
+
+ public static final String WIZARD_DIALOG_OTHER_SETTINGS = HelpID_Prefix + "wizard_dialog_other_settings"; //$NON-NLS-1$
+
+}
diff -r 24ba32fc0320 -r 81a2e70a37d7 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/Messages.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/Messages.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.cdt.internal.debug.launch.newwizard;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "com.nokia.cdt.internal.debug.launch.newwizard.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff -r 24ba32fc0320 -r 81a2e70a37d7 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsDialog.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsDialog.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,189 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.cdt.internal.debug.launch.newwizard;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+import com.nokia.cdt.internal.debug.launch.newwizard.LaunchOptionsData.EBuildBeforeLaunchOption;
+
+/**
+ * This dialog allows in-depth configuration of the other settings in the launch.
+ * Currently this only covers the build-before-launch options.
+ */
+public class OtherSettingsDialog extends AbstractLaunchSettingsDialog {
+
+ private Button fDisableBuildButton;
+ private Button fEnableBuildButton;
+ private Button fWorkspaceSettingsButton;
+ private Link fWorkspaceSettingsLink;
+
+ protected OtherSettingsDialog(Shell shell, LaunchOptionsData data) {
+ super(shell, data);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = initDialogArea(parent,
+ "Other Settings",
+ LaunchWizardHelpIds.WIZARD_DIALOG_OTHER_SETTINGS);
+
+ String description = "Build the project before launch? " +
+ "This can take a very long time in some projects and build systems. " +
+ "On the other hand, you must remember to build the project yourself if you make changes.";
+
+ final Label label = new Label(composite, SWT.WRAP);
+ label.setText(description);
+ GridData labelData = GridDataFactory.fillDefaults().grab(true, false).create();
+ labelData.widthHint = 500;
+ label.setLayoutData(labelData);
+
+ // spacer
+ new Label(composite, SWT.NONE);
+
+ final Composite radio = new Composite(composite, SWT.NONE);
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(radio);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(radio);
+
+ composite.addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(ControlEvent e) {
+ label.pack();
+ }
+ });
+
+ fDisableBuildButton = new Button(radio, SWT.RADIO);
+ fDisableBuildButton.setText(Messages.getString("OtherSettingsDialog.DisableButtonLabel")); //$NON-NLS-1$
+ fDisableBuildButton.setToolTipText(Messages.getString("OtherSettingsDialog.DisableButtonToolTip")); //$NON-NLS-1$
+ fDisableBuildButton.setData(UID, "OtherSettingsDialog.disableBuildButton");
+
+ GridDataFactory.fillDefaults().span(2, 1).applyTo(fDisableBuildButton);
+
+ fDisableBuildButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.NEVER);
+ }
+ });
+
+
+ fEnableBuildButton = new Button(radio, SWT.RADIO);
+ fEnableBuildButton.setText(Messages.getString("OtherSettingsDialog.EnableButtonLabel")); //$NON-NLS-1$
+ fEnableBuildButton.setToolTipText(Messages.getString("OtherSettingsDialog.EnableButtonToolTip")); //$NON-NLS-1$
+ fEnableBuildButton.setData(UID, "OtherSettingsDialog.enableBuildButon");
+
+ GridDataFactory.fillDefaults().span(2, 1).applyTo(fEnableBuildButton);
+
+ fEnableBuildButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.ALWAYS);
+ }
+ });
+
+
+ fWorkspaceSettingsButton = new Button(radio, SWT.RADIO);
+ fWorkspaceSettingsButton.setText(Messages.getString("OtherSettingsDialog.WorkspaceSettingsButtonLabel")); //$NON-NLS-1$
+ fWorkspaceSettingsButton.setToolTipText(Messages.getString("OtherSettingsDialog.WorkspaceSettingsButtonToolTip")); //$NON-NLS-1$
+ fWorkspaceSettingsButton.setData(UID, "OtherSettingsDialog.workspaceSettingsButton");
+
+ GridDataFactory.swtDefaults().span(1, 1).applyTo(fWorkspaceSettingsButton);
+
+ fWorkspaceSettingsButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING);
+ }
+ });
+
+
+ fWorkspaceSettingsLink = new Link(radio, SWT.NONE);
+ fWorkspaceSettingsLink.setText(Messages.getString("OtherSettingsDialog.WorkspaceSettingsLinkLabel")); //$NON-NLS-1$
+ fWorkspaceSettingsLink.setData(UID, "OtherSettingsDialog.workspaceSettingsLink");
+
+ GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(true, false).span(1, 1).applyTo(fWorkspaceSettingsLink);
+
+ fWorkspaceSettingsLink.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ PreferencesUtil.createPreferenceDialogOn(
+ radio.getShell(),
+ Messages.getString("OtherSettingsDialog.WorkspaceSettingsPageID"), //$NON-NLS-1$
+ null,
+ null).open();
+ validate();
+ }
+ });
+
+ switch (data.getBuildBeforeLaunch()) {
+ case ALWAYS:
+ fEnableBuildButton.setSelection(true);
+ fEnableBuildButton.setFocus();
+ break;
+ case NEVER:
+ fDisableBuildButton.setSelection(true);
+ fDisableBuildButton.setFocus();
+ break;
+ case USE_WORKSPACE_SETTING:
+ fWorkspaceSettingsButton.setSelection(true);
+ fWorkspaceSettingsButton.setFocus();
+ break;
+ }
+
+ validate();
+
+ return radio;
+ }
+
+ @Override
+ protected void validate() {
+ IStatus status = Status.OK_STATUS;
+ updateStatus(status);
+
+ String wsState = "";
+ if (data.isWorkspaceBuildBeforeLaunch())
+ wsState = " (enabled)";
+ else
+ wsState = " (disabled)";
+
+ fWorkspaceSettingsButton.setText(
+ Messages.getString("OtherSettingsDialog.WorkspaceSettingsButtonLabel") + //$NON-NLS-1$
+ wsState);
+ fWorkspaceSettingsButton.pack();
+
+ }
+}
+
diff -r 24ba32fc0320 -r 81a2e70a37d7 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsSection.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsSection.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.cdt.internal.debug.launch.newwizard;
+
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.cdt.internal.debug.launch.newwizard.LaunchOptionsData.EBuildBeforeLaunchOption;
+
+/**
+ * Present the "Build before debug" section with a short description.
+ */
+public class OtherSettingsSection extends AbstractLaunchWizardSection {
+
+ /**
+ *
+ */
+ public OtherSettingsSection(LaunchOptionsData data) {
+ super(data, "Other settings");
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.IWizardSection#createComposite(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ createSection(parent, 2);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#dispose()
+ */
+ @Override
+ protected void dispose() {
+ }
+
+ public void initializeSettings() {
+ data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#validate()
+ */
+ @Override
+ protected void validate() {
+ status = Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#updateUI()
+ */
+ @Override
+ protected void updateUI() {
+ String msg;
+
+ String ifWorkspace = "";
+ if (data.getBuildBeforeLaunch() == EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING)
+ ifWorkspace = " (workspace setting)";
+
+ if (data.isCurrentBuildBeforeLaunch())
+ msg = "Carbide will build the project before launch";
+ else
+ msg = "Carbide will not build the project before launch";
+
+ descriptionLabel.setText(msg + ifWorkspace + ".");
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#createChangeSettingsDialog(org.eclipse.swt.widgets.Shell, com.nokia.cdt.internal.debug.launch.wizard2.LaunchOptionsData)
+ */
+ @Override
+ protected AbstractLaunchSettingsDialog createChangeSettingsDialog(
+ Shell shell, LaunchOptionsData dialogData) {
+ return new OtherSettingsDialog(shell, dialogData);
+ }
+
+ protected void refresh() {
+ validate();
+ updateUI();
+ }
+}
diff -r 24ba32fc0320 -r 81a2e70a37d7 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.cdt.internal.debug.launch.newwizard;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
+import com.nokia.cdt.internal.debug.launch.newwizard.IWizardSection.ISectionChangeListener;
+
+/**
+ * This page presents three sections:
+ *
+ * Connection to use: container for the Remote Connection selection UI, plus a label
+ * explaining how to handle the case of no connections defined.
+ *
+ * Debug process: section explaining how the launch will happen, with a combo
+ * allowing selecting different process to launch, and a button allowing more
+ * in-depth configuration.
+ *
+ * Build before debug: section with the build-before-debug preference for this
+ * launch configuration.
+ */
+public class UnifiedLaunchOptionsPage extends WizardPage implements ISectionChangeListener {
+
+ private final LaunchOptionsData data;
+ private ArrayList sections;
+
+
+ /**
+ * @param mmps
+ * @param exes
+ * @param defaultExecutable
+ * @param project
+ * @param configurationName
+ */
+ public UnifiedLaunchOptionsPage(LaunchOptionsData data) {
+ super("Configure Launch Settings");
+
+ setDescription("Configure the connection and process to launch.");
+
+ this.data = data;
+ this.sections = new ArrayList();
+
+
+ IWizardSection section;
+
+ section = new ConnectToDeviceSection(data, this);
+ sections.add(section);
+
+ section = new DebugRunProcessSection(data);
+ sections.add(section);
+
+ section = new OtherSettingsSection(data);
+ sections.add(section);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+
+ GridLayoutFactory.fillDefaults().applyTo(composite);
+
+ setPageComplete(false);
+
+ for (IWizardSection section : sections) {
+ section.createControl(composite);
+ section.setChangeListener(this);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(section.getControl());
+ }
+
+
+ setControl(composite);
+ }
+
+ /**
+ * @return
+ */
+ public void validatePage() {
+ setMessage(null, INFORMATION);
+ setErrorMessage(null);
+ setPageComplete(true);
+
+ IStatus pageStatus = null;
+
+ // validate the subsections
+ StringBuilder builder = new StringBuilder();
+ int severity = IStatus.OK;
+ for (IWizardSection section : sections) {
+ IStatus status = section.getStatus();
+ if (status.isOK())
+ continue;
+ if (builder.length() > 0)
+ builder.append("\n");
+
+ builder.append(MessageFormat.format("{0}: {1}",
+ section.getSectionName(),
+ status.getMessage()));
+ severity = Math.max(severity, status.getSeverity());
+ }
+ if (severity != 0 || builder.length() > 0) {
+ // error from one or more sections
+ pageStatus = new Status(severity, LaunchPlugin.PLUGIN_ID, builder.toString());
+ } else {
+ // sections are good; validate the page as a whole
+ pageStatus = data.validate();
+ }
+
+ setTitle("Configure launch configuration");
+
+ if (pageStatus != null && !pageStatus.isOK()) {
+ setMessage(pageStatus.getMessage(), severityToMsgType(pageStatus.getSeverity()));
+ setPageComplete(false);
+ }
+ }
+
+ private int severityToMsgType(int severity) {
+ switch (severity) {
+ case IStatus.OK:
+ case IStatus.INFO:
+ return INFORMATION;
+ case IStatus.WARNING:
+ return WARNING;
+ case IStatus.ERROR:
+ default:
+ return ERROR;
+ }
+ }
+
+ /*
+ private String getSeverityTag(int severity) {
+ if (severity == IStatus.OK || severity == IStatus.INFO || severity == IStatus.CANCEL)
+ return "";
+ if (severity == IStatus.WARNING)
+ return "warning";
+ return "error";
+ }
+ */
+
+ public void initializeSettings() {
+ for (IWizardSection section : sections) {
+ section.initializeSettings();
+ }
+ validatePage();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.IWizardSection.ISectionChangeListener#changed()
+ */
+ public void changed() {
+ validatePage();
+ }
+}
diff -r 24ba32fc0320 -r 81a2e70a37d7 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,11 @@
+OtherSettingsDialog.Title=Build Options Selection
+OtherSettingsDialog.Description=Select build options before launching
+OtherSettingsDialog.OptionsGroupLabel=Build (if required) before launching
+OtherSettingsDialog.DisableButtonLabel=Disable build before launch
+OtherSettingsDialog.DisableButtonToolTip=Requires manually building project before launching (this may improve launch performance)
+OtherSettingsDialog.EnableButtonLabel=Enable build before launch
+OtherSettingsDialog.EnableButtonToolTip=Always build project before launching (this may impact launch performance)
+OtherSettingsDialog.WorkspaceSettingsButtonLabel=Use workspace settings
+OtherSettingsDialog.WorkspaceSettingsButtonToolTip=Use workspace setting for "Build (if required) before Launch"
+OtherSettingsDialog.WorkspaceSettingsLinkLabel=Configure Workspace Settings...
+OtherSettingsDialog.WorkspaceSettingsPageID=org.eclipse.debug.ui.LaunchingPreferencePage