--- a/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF Tue Feb 09 08:06:51 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF Tue Feb 09 15:35:02 2010 -0600
@@ -28,7 +28,8 @@
com.nokia.carbide.cpp.ui,
com.nokia.cpp.utils.core,
com.freescale.cdt.debug.cw.core.ui,
- com.nokia.carbide.remoteConnections
+ com.nokia.carbide.remoteConnections,
+ com.nokia.cpp.utils.ui;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Export-Package: com.nokia.cdt.internal.debug.launch,
com.nokia.cdt.internal.debug.launch.ui,
--- a/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Tue Feb 09 08:06:51 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Tue Feb 09 15:35:02 2010 -0600
@@ -280,5 +280,41 @@
<extension-point id="launchWizardExtension" name="Launch Wizard Page" schema="schema/launchWizardExtension.exsd"/>
<extension-point id="launchCategoryExtension" name="Launch Category" schema="schema/launchCategoryExtension.exsd"/>
-
+
+ <!-- REMOVE THIS : just a hack for getting the new launch wizard into a toolbar -->
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <category
+ id="com.nokia.cdt.debug.launch.commands.category"
+ name="Sample Category">
+ </category>
+ <command
+ categoryId="com.nokia.cdt.debug.launch.commands.category"
+ id="com.nokia.cdt.debug.launch.commands.sampleCommand"
+ name="Sample Command">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="com.nokia.cdt.internal.debug.launch.newwizard.CommandRunLaunchWizard2"
+ commandId="com.nokia.cdt.debug.launch.commands.sampleCommand">
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar
+ id="com.nokia.cdt.debug.launch.toolbars.sampleToolbar">
+ <command
+ commandId="com.nokia.cdt.debug.launch.commands.sampleCommand"
+ icon="icons/NewProjectAssist/debug.gif"
+ id="com.nokia.cdt.debug.launch.toolbars.sampleCommand"
+ tooltip="Show New Launch Wizard">
+ </command>
+ </toolbar>
+ </menuContribution>
+ </extension>
</plugin>
--- /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/AbstractLaunchSettingsDialog.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,126 @@
+/*
+ * 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 org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
+/**
+ *
+ */
+public abstract class AbstractLaunchSettingsDialog extends TitleAreaDialog {
+
+ protected final static String UID = ".uid";
+
+ protected final LaunchOptionsData data;
+ protected int INDENT;
+ private String title;
+
+ protected abstract void validate();
+
+ /**
+ * @param parentShell
+ * @param data
+ */
+ public AbstractLaunchSettingsDialog(Shell parentShell, LaunchOptionsData data) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ this.data = data;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText("New Launch Configuration Wizard");
+ }
+
+ protected Composite initDialogArea(Composite parent, String title, String helpId) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ GridLayoutFactory.fillDefaults().margins(6, 6).applyTo(composite);
+
+ INDENT = convertWidthInCharsToPixels(4);
+
+ setTitle(title);
+
+ this.title = title;
+
+ WorkbenchUtils.setHelpContextId(composite, helpId);
+
+ return composite;
+ }
+
+ protected int severityToMsgType(int severity) {
+ switch (severity) {
+ case IStatus.OK:
+ case IStatus.CANCEL:
+ default:
+ break;
+ case IStatus.INFO:
+ return IMessageProvider.INFORMATION;
+ case IStatus.ERROR:
+ return IMessageProvider.ERROR;
+ case IStatus.WARNING:
+ return IMessageProvider.WARNING;
+ }
+ return IMessageProvider.NONE;
+ }
+
+ protected IStatus error(String msg, Object... args) {
+ return new Status(IStatus.ERROR, LaunchPlugin.PLUGIN_ID,
+ MessageFormat.format(msg, args));
+ }
+
+ protected IStatus warning(String msg, Object... args) {
+ return new Status(IStatus.WARNING, LaunchPlugin.PLUGIN_ID,
+ MessageFormat.format(msg, args));
+ }
+
+ private void setOkEnabled(boolean enabled) {
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ if (okButton != null)
+ okButton.setEnabled(enabled);
+ }
+
+ protected void updateStatus(IStatus status) {
+ setTitle(title);
+
+ if (status.isOK()) {
+ setMessage("", IMessageProvider.NONE);
+ } else {
+ setMessage(status.getMessage(), severityToMsgType(status.getSeverity()));
+ }
+
+ setOkEnabled(!status.matches(IStatus.ERROR));
+ }
+
+}
\ No newline at end of file
--- /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/AbstractLaunchWizardSection.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,182 @@
+/*
+ * 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 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.resource.JFaceResources;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+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.Shell;
+
+import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
+
+/**
+ *
+ */
+public abstract class AbstractLaunchWizardSection implements IWizardSection {
+
+ private static final String CHANGE_LABEL = "Change...";
+ protected final LaunchOptionsData data;
+ private String sectionName;
+
+ protected IStatus status;
+ protected Label descriptionLabel;
+ protected Button changeButton;
+ protected Composite control;
+ private ISectionChangeListener changeListener;
+
+
+ public AbstractLaunchWizardSection(LaunchOptionsData data, String sectionName) {
+ this.data = data;
+ this.sectionName = sectionName;
+ status = Status.OK_STATUS;
+ }
+
+ abstract protected void dispose();
+
+ public IStatus getStatus() {
+ return status;
+ }
+
+ /** Initialize the data for this section (before UI shown). */
+ public abstract void initializeSettings();
+
+ /** Validate the settings and update status. */
+ abstract protected void validate();
+
+ /** Update the UI when data changes. Called after validate(). */
+ protected abstract void updateUI();
+
+ /** Create the UI for this section. */
+ public abstract void createControl(Composite parent);
+
+ /** Create the dialog for the Change... button. */
+ protected abstract AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchOptionsData dialogData);
+ /** Refresh the section after the Change... dialog has been closed. */
+ protected abstract void refresh();
+
+ public Control getControl() {
+ return control;
+ }
+
+ public String getSectionName() {
+ return sectionName;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.IWizardSection#setChangeListener(com.nokia.cdt.internal.debug.launch.wizard2.IWizardSection.ISectionChangeListener)
+ */
+ public void setChangeListener(ISectionChangeListener listener) {
+ this.changeListener = listener;
+ }
+
+ protected void createSection(Composite parent, int acceleratorIndex) {
+ Composite composite = new Composite(parent, SWT.NONE);
+
+ GC gc = new GC(parent);
+ int INDENT = gc.getAdvanceWidth('m') * 4;
+ gc.dispose();
+
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(6, 0).applyTo(composite);
+
+ Label titleLabel = new Label(composite, SWT.NONE);
+ titleLabel.setText(sectionName);
+ titleLabel.setFont(JFaceResources.getBannerFont());
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(titleLabel);
+
+ // spacing
+ Label spacer = new Label(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(spacer);
+
+ descriptionLabel = new Label(composite, SWT.WRAP);
+ GridDataFactory.fillDefaults().grab(true, true).indent(INDENT, 0).applyTo(descriptionLabel);
+
+ String label = MessageFormat.format("{0}&{1}", //$NON-NLS-1$
+ CHANGE_LABEL.substring(0, acceleratorIndex), CHANGE_LABEL.substring(acceleratorIndex));
+ changeButton = new Button(composite, SWT.PUSH);
+ changeButton.setText(label);
+ Point minSize = changeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ GridDataFactory.defaultsFor(changeButton).grab(false, false).hint(minSize.x + INDENT, SWT.DEFAULT).applyTo(changeButton);
+ changeButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ doChange();
+ if (changeListener != null)
+ changeListener.changed();
+ }
+ });
+
+ composite.addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(ControlEvent e) {
+ descriptionLabel.pack();
+ }
+ });
+
+ this.control = composite;
+
+ control.addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ dispose();
+ }
+ });
+
+ validate();
+ updateUI();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#doChange()
+ */
+ protected void doChange() {
+ LaunchOptionsData dialogData = data.copy();
+ AbstractLaunchSettingsDialog dialog = createChangeSettingsDialog(getControl().getShell(), dialogData);
+ if (dialog.open() == Window.OK) {
+ data.apply(dialogData);
+ refresh();
+ }
+ }
+
+ protected static IStatus error(String msg, Object... args) {
+ return new Status(IStatus.ERROR, LaunchPlugin.PLUGIN_ID,
+ MessageFormat.format(msg, args));
+ }
+
+ protected IStatus warning(String msg, Object... args) {
+ return new Status(IStatus.WARNING, LaunchPlugin.PLUGIN_ID,
+ MessageFormat.format(msg, args));
+ }
+}
\ No newline at end of file
--- /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/CommandRunLaunchWizard2.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,91 @@
+package com.nokia.cdt.internal.debug.launch.newwizard;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+import com.nokia.carbide.cdt.builder.EpocEngineHelper;
+import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class CommandRunLaunchWizard2 extends AbstractHandler {
+ /**
+ * The constructor.
+ */
+ public CommandRunLaunchWizard2() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information
+ * from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection sel = HandlerUtil.getCurrentSelection(event);
+ IProject project = null;
+ if (sel instanceof IStructuredSelection) {
+ Object obj = ((IStructuredSelection) sel).getFirstElement();
+ if (obj instanceof IResource)
+ project = ((IResource) obj).getProject();
+ else if (obj instanceof IAdaptable) {
+ IResource rsrc = (IResource)((IAdaptable) obj).getAdapter(IResource.class);
+ if (rsrc != null)
+ project = rsrc.getProject();
+ }
+ if (project == null)
+ throw new ExecutionException("No project in selection");
+
+ ICarbideProjectInfo info = CarbideBuilderPlugin.getBuildManager()
+ .getProjectInfo(project);
+ if (info == null)
+ throw new ExecutionException("Not a Carbide project");
+ List<IPath> mmpFiles = EpocEngineHelper.getMMPFilesForProject(info);
+ IService trkService = RemoteConnectionsActivator.getConnectionTypeProvider().
+ findServiceByID("com.nokia.carbide.trk.support.service.TRKService"); //$NON-NLS-1$
+
+ List<IPath> allExePaths = new ArrayList<IPath>();
+ List<IPath> currBuiltExePaths = new ArrayList<IPath>();
+ List<IPath> allMMPPaths = new ArrayList<IPath>();
+ List<IPath> currBuiltMMPPaths = new ArrayList<IPath>();
+
+ EpocEngineHelper.getPathToAllExecutables(info.getDefaultConfiguration(),
+ allExePaths,
+ currBuiltExePaths,
+ allMMPPaths,
+ currBuiltMMPPaths);
+
+ LaunchWizard wiz = new LaunchWizard(project,
+ info.getDefaultBuildConfigName(),
+ mmpFiles,
+ currBuiltExePaths,
+ EpocEngineHelper.getHostPathForExecutable(info.getDefaultConfiguration(), mmpFiles.get(0)),
+ false, false,
+ ILaunchManager.DEBUG_MODE,
+ trkService
+ );
+ WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wiz);
+ dialog.setPageSize(500, 300);
+ dialog.open();
+ }
+
+ return null;
+ }
+}
--- /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/ConnectToDeviceDialog.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,273 @@
+/*
+* 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 java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+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.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionTypeProvider;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener;
+import com.nokia.carbide.remoteconnections.settings.ui.SettingsWizard;
+
+/**
+ * This dialog allows in-depth configuration of the connection settings.
+ */
+@SuppressWarnings("restriction")
+public class ConnectToDeviceDialog extends AbstractLaunchSettingsDialog implements IConnectionListener {
+ private IConnectionsManager manager;
+ private IConnectionTypeProvider typeProvider;
+ private ComboViewer viewer;
+ private Button editButton;
+ private Label descriptionLabel;
+
+ protected ConnectToDeviceDialog(Shell shell, LaunchOptionsData data) {
+ super(shell, data);
+ manager = RemoteConnectionsActivator.getConnectionsManager();
+ typeProvider = RemoteConnectionsActivator.getConnectionTypeProvider();
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ final Composite composite = initDialogArea(parent,
+ "Change connection",
+ LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_CONNECTION);
+
+ Composite viewerGroup = new Composite(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().applyTo(viewerGroup);
+ GridLayoutFactory.swtDefaults().numColumns(3).applyTo(viewerGroup);
+
+ Label label = new Label(viewerGroup, SWT.NONE);
+ label.setText("Current connection");
+ GridDataFactory.defaultsFor(label).applyTo(label);
+
+ viewer = new ComboViewer(viewerGroup, SWT.READ_ONLY);
+ viewer.setLabelProvider(new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IConnection)
+ return ((IConnection) element).getDisplayName();
+
+ return "No Current connection";
+ }
+ });
+ viewer.setContentProvider(new ArrayContentProvider());
+ Combo combo = viewer.getCombo();
+ GridDataFactory.defaultsFor(combo).grab(true, false).applyTo(combo);
+ viewer.getControl().setData(UID, "combo_viewer"); //$NON-NLS-1$
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (getDialogArea() != null)
+ connectionSelected(getConnectionFromSelection(event.getSelection()));
+ }
+ });
+ manager.addConnectionListener(this);
+
+ editButton = new Button(viewerGroup, SWT.PUSH);
+ editButton.setText("Edit...");
+ GridDataFactory.defaultsFor(editButton).applyTo(editButton);
+ editButton.setData(UID, "edit_button"); //$NON-NLS-1$
+ editButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IConnection connection = getConnectionFromSelection(viewer.getSelection());
+ if (connection != null) {
+ SettingsWizard wizard = new SettingsWizard(connection, data.getService());
+ wizard.open(composite.getShell());
+ }
+ }
+ });
+
+ descriptionLabel = new Label(composite, SWT.WRAP);
+ GridDataFactory.defaultsFor(descriptionLabel).grab(false, true).applyTo(descriptionLabel);
+ composite.addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(ControlEvent e) {
+ descriptionLabel.pack();
+ }
+ });
+
+ setViewerInput(data.getConnection());
+
+ return composite;
+ }
+
+ protected void validate() {
+ IStatus status = ConnectToDeviceSection.revalidate(data);
+
+ if (status.isOK()) {
+ IConnection connection = data.getConnection();
+ if (connection != null) {
+ IConnectedService connectedService = null;
+ Collection<IConnectedService> services = manager.getConnectedServices(connection);
+ if (services != null) {
+ for (IConnectedService service : services) {
+ if (service != null && service.getService().getIdentifier().equals(data.getService().getIdentifier())) {
+ connectedService = service;
+ }
+ }
+ }
+
+ if (connectedService == null) {
+ status = error(MessageFormat.format(
+ "The selected connection does not support {0}",
+ data.getService().getDisplayName()));
+ }
+ else {
+ com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus serviceStatus =
+ connectedService.getStatus();
+ if (!serviceStatus.getEStatus().equals(
+ com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus.UP)) {
+ status = warning("The selected connection may not be usable for debugging:\n {0}",
+ serviceStatus.getLongDescription());
+ }
+ }
+ }
+ }
+ updateStatus(status);
+ }
+
+ /**
+ * Update for a change in the connection. We will attempt to connect to the
+ * device (once) to detect what TRK it is running.
+ */
+ private void updateConnection(IConnection connection) {
+ String standardPNPMessage = ConnectToDeviceSection.getStandardPNPMessage();
+ data.setConnection(connection);
+ if (connection != null) {
+ descriptionLabel.setText(standardPNPMessage);
+ } else {
+ descriptionLabel.setText("No connections are detected or defined. " + standardPNPMessage);
+ }
+
+ }
+
+ public void connectionSelected(IConnection connection) {
+ updateConnection(connection);
+ validate();
+ }
+
+ public void connectionAdded(IConnection connection) {
+ refreshUI();
+ }
+
+ public void connectionRemoved(IConnection connection) {
+ refreshUI();
+ }
+
+ public void currentConnectionSet(IConnection connection) {
+ refreshUI();
+ }
+
+ private Set<IConnectionType> getCompatibleConnectionTypes() {
+ HashSet<IConnectionType> types = new HashSet<IConnectionType>();
+ Collection<String> compatibleTypeIds =
+ typeProvider.getCompatibleConnectionTypeIds(data.getService());
+ for (String typeId : compatibleTypeIds) {
+ types.add(typeProvider.getConnectionType(typeId));
+ }
+ return types;
+ }
+
+ private List<IConnection> getCompatibleConnections() {
+ Set<IConnectionType> types = getCompatibleConnectionTypes();
+
+ List<IConnection> compatibleConnections = new ArrayList<IConnection>();
+ for (IConnection connection : manager.getConnections()) {
+ if (types.contains(connection.getConnectionType()))
+ compatibleConnections.add(connection);
+ }
+ return compatibleConnections;
+ }
+
+ private void setViewerInput(IConnection connection) {
+ List<IConnection> connections = getCompatibleConnections();
+ viewer.setInput(connections);
+
+ if (connections.isEmpty())
+ viewer.getCombo().setEnabled(false);
+ else {
+ viewer.getCombo().setEnabled(true);
+ if (connection == null) {
+ viewer.getCombo().select(0);
+ ISelection selection = viewer.getSelection();
+ connection = getConnectionFromSelection(selection);
+ viewer.setSelection(selection);
+ }
+ else
+ viewer.setSelection(new StructuredSelection(connection));
+ }
+ editButton.setEnabled(!viewer.getSelection().isEmpty());
+
+ // fire listener in case we selected anew or the current connection changed
+ connectionSelected(connection);
+ }
+
+ private IConnection getConnectionFromSelection(ISelection selection) {
+ return (IConnection) ((IStructuredSelection) selection).getFirstElement();
+ }
+
+ private void refreshUI() {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ if (viewer != null && viewer.getContentProvider() != null) {
+ setViewerInput(getConnectionFromSelection(viewer.getSelection()));
+ }
+ }
+ });
+ }
+
+ @Override
+ public boolean close() {
+ manager.addConnectionListener(this);
+ return super.close();
+ }
+}
+
--- /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/ConnectToDeviceSection.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,149 @@
+/*
+* 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 org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener;
+
+/**
+ * Present the "Connect to device" section with a short description.
+ */
+public class ConnectToDeviceSection extends AbstractLaunchWizardSection implements IConnectionListener {
+
+ private static final String NO_CURRENT_CONNECTION_MSG = "No current connection is defined or detected.";
+ private final UnifiedLaunchOptionsPage launchOptionsPage;
+ private final IConnectionsManager manager;
+
+ /**
+ * @param unifiedLaunchOptionsPage
+ *
+ */
+ public ConnectToDeviceSection(LaunchOptionsData data, UnifiedLaunchOptionsPage launchOptionsPage) {
+ super(data, "Connect to device");
+ this.launchOptionsPage = launchOptionsPage;
+ manager = RemoteConnectionsActivator.getConnectionsManager();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.IWizardSection#createComposite(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ createSection(parent, 0);
+ manager.addConnectionListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#dispose()
+ */
+ @Override
+ protected void dispose() {
+ manager.removeConnectionListener(this);
+ }
+
+ public void initializeSettings() {
+ data.setConnection(manager.getCurrentConnection());
+ }
+
+ @Override
+ protected void validate() {
+ status = revalidate(data);
+ }
+
+ /** Get the simple status for the connection state */
+ static IStatus revalidate(LaunchOptionsData data) {
+ IStatus status = Status.OK_STATUS;
+
+ if (data.getConnection() == null) {
+ status = error(NO_CURRENT_CONNECTION_MSG);
+ }
+
+ return status;
+ }
+
+ static String getStandardPNPMessage() {
+ return "You may plug in a device over USB or activate it over WLAN, or create a new connection now for your device or simulator.";
+ }
+
+ @Override
+ protected void updateUI() {
+ if (control == null || control.isDisposed())
+ return;
+
+ String msg;
+ if (data.getConnection() != null)
+ msg = MessageFormat.format("The current connection is now ''{0}''.", data.getConnectionName());
+ else
+ msg = MessageFormat.format("{0} {1}", NO_CURRENT_CONNECTION_MSG, getStandardPNPMessage());
+
+ descriptionLabel.setText(msg);
+ launchOptionsPage.changed();
+ }
+
+ /* (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 ConnectToDeviceDialog(shell, dialogData);
+ }
+
+ protected void refresh() {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ validate();
+ updateUI();
+ }
+ });
+ }
+
+ private void doConnectionsChanged() {
+ data.setConnection(manager.getCurrentConnection());
+ refresh();
+ }
+
+ public void connectionAdded(IConnection connection) {
+ doConnectionsChanged();
+ }
+
+ public void connectionRemoved(IConnection connection) {
+ doConnectionsChanged();
+ }
+
+ public void currentConnectionSet(IConnection connection) {
+ doConnectionsChanged();
+ }
+
+ @Override
+ protected void doChange() {
+ super.doChange();
+ IConnection connection = data.getConnection();
+ if (connection != null && !connection.equals(manager.getCurrentConnection()))
+ manager.setCurrentConnection(connection);
+ }
+}
--- /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/DebugRunProcessDialog.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,579 @@
+/*
+* 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.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent;
+import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;
+import org.eclipse.core.resources.IProject;
+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.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
+import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo;
+import com.nokia.cdt.internal.debug.launch.newwizard.LaunchOptionsData.EExeSelection;
+import com.nokia.cpp.internal.api.utils.core.PathUtils;
+import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils;
+
+/**
+ * This dialog allows in-depth configuration of the debug/run process options.
+ */
+public class DebugRunProcessDialog extends AbstractLaunchSettingsDialog implements ICProjectDescriptionListener {
+ private ComboViewer projectExecutableViewer;
+ private Text remoteProgramEntry;
+ private Button projectExecutableRadioButton;
+ private Button remoteExecutableRadioButton;
+ private Button attachToProcessRadioButton;
+
+ private Label packageInfoLabel;
+ private Button installPackageCheckbox;
+ private Combo sisFile;
+ private Text sisEdit;
+ private Button sisBrowse;
+ private Composite installPackageUI;
+
+ protected DebugRunProcessDialog(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,
+ MessageFormat.format("Change {0} Process", data.getModeLabel()),
+ data.isDebug() ? LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_DEBUG_PROCESS :
+ LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_RUN_PROCESS);
+
+
+ createProcessSelector(composite);
+
+ Label sep = new Label(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().applyTo(sep);
+
+ createPackageConfiguration(composite);
+
+ initUI();
+
+ validate();
+
+ return composite;
+ }
+
+
+ private void createProcessSelector(Composite composite) {
+ Label label;
+
+ label = new Label(composite, SWT.WRAP);
+ label.setText(MessageFormat.format("{0} method:", data.getModeLabel()));
+ label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
+
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);
+
+ Composite radioGroup = new Composite(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(radioGroup);
+ GridLayoutFactory.fillDefaults().extendedMargins(INDENT, 0, 0, 0).numColumns(2).applyTo(radioGroup);
+
+ createProjectExecutableRadioButton(radioGroup);
+ createRemoteExecutableRadioButton(radioGroup);
+
+ label = new Label(radioGroup, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(label);
+
+ createAttachToProcessRadioButton(radioGroup);
+
+ String msg;
+ if (data.isDebug())
+ msg = "Configure how to debug the program. The initial settings reflect the debug capabilities of the selected device and the SIS builder settings.";
+ else
+ msg = "Configure how to run the program.";
+ setMessage(msg);
+
+ switch (data.getExeSelection()) {
+ case USE_PROJECT_EXECUTABLE:
+ projectExecutableRadioButton.setSelection(true);
+ break;
+ case USE_REMOTE_EXECUTABLE:
+ remoteExecutableRadioButton.setSelection(true);
+ break;
+ case ATTACH_TO_PROCESS:
+ attachToProcessRadioButton.setSelection(true);
+ break;
+ }
+ }
+
+
+ private void createPackageConfiguration(Composite composite) {
+ Label label;
+
+ label = new Label(composite, SWT.WRAP);
+ label.setText(MessageFormat.format("Deploy method:", data.getModeLabel()));
+ label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
+
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
+
+ packageInfoLabel = new Label(composite, SWT.WRAP);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(packageInfoLabel);
+ composite.addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(ControlEvent e) {
+ packageInfoLabel.pack();
+ }
+ });
+
+ installPackageCheckbox = new Button(composite, SWT.CHECK);
+ GridDataFactory.fillDefaults().applyTo(installPackageCheckbox);
+
+ installPackageCheckbox.setText("Install package before launch");
+ installPackageUI = new Composite(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().indent(INDENT, 0).applyTo(installPackageUI);
+
+ createSISContents(installPackageUI);
+
+
+ installPackageCheckbox.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ data.setInstallPackage(installPackageCheckbox.getSelection());
+ updatePackageUI();
+ }
+ });
+
+
+ if (data.requiresInstallPackage()) {
+ installPackageCheckbox.setSelection(true);
+ }
+
+ updateSisFile();
+ updatePackageUI();
+ }
+
+ protected void createSISContents(Composite composite) {
+ GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(composite);
+
+ final IProject project = data.getProject();
+ ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
+ if (cpi != null) {
+ final Label sisLabel = new Label(composite, SWT.NONE);
+ sisLabel.setText("SIS File to Install:");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(1, 1).applyTo(sisLabel);
+ sisLabel.setToolTipText("Specify which SIS file to install on the phone prior to launching");
+ sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel");
+
+ sisFile = new Combo(composite, SWT.READ_ONLY);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false).applyTo(sisLabel);
+ sisFile.setToolTipText("Specify which SIS file to install on the phone prior to launching");
+ sisFile.add("None"); //$NON-NLS-1$
+ sisFile.setData(UID, "DebugRunProcessDialog.sisFile");
+
+ sisFile.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateSisFile();
+ }
+ });
+
+ ICarbideBuildConfiguration config = cpi.getDefaultConfiguration();
+ for (ISISBuilderInfo info : config.getSISBuilderInfoList()) {
+ IPath sisPath = info.getSigningType() == ISISBuilderInfo.DONT_SIGN ? info.getUnsignedSISFullPath() : info.getSignedSISFullPath();
+ sisFile.add(sisPath.toOSString());
+ }
+
+ // select the first sis file if any, otherwise select none
+ if (sisFile.getItemCount() > 1) {
+ sisFile.select(1);
+ } else {
+ sisFile.select(0);
+ }
+
+ // listen for events so we can detect if they click on the link below and add new sis info.
+ CoreModel.getDefault().getProjectDescriptionManager().addCProjectDescriptionListener(this, CProjectDescriptionEvent.APPLIED);
+
+ composite.addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ CoreModel.getDefault().getProjectDescriptionManager().removeCProjectDescriptionListener(DebugRunProcessDialog.this);
+ }
+ });
+
+ Link link = new Link(composite, SWT.NONE);
+ link.setText("<a>" + "Modify SIS builder settings for build configuration" + "...</a>");
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).grab(true, false).applyTo(link);
+ link.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ PreferencesUtil.createPropertyDialogOn(getShell(), project, "com.nokia.carbide.cdt.internal.builder.ui.CarbideBuildConfigurationsPage", null, null).open();
+ }
+ });
+ link.setData(UID, "DebugRunProcessDialog.link");
+ } else {
+ // not a Carbide project, just an executable. show a browse/edit combo
+ // to let them select a sis file if they want to.
+ final Label sisLabel = new Label(composite, SWT.NONE);
+ sisLabel.setText("SIS File to Install:"); //$NON-NLS-1$
+ GridDataFactory.swtDefaults().span(2, 1).applyTo(sisLabel);
+ sisLabel.setToolTipText("Specify which SIS file to install on the phone prior to launching");
+ sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel");
+
+ sisEdit = new Text(composite, SWT.BORDER);
+ GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(sisEdit);
+ sisEdit.setToolTipText("Specify which SIS file to install on the phone prior to launching");
+ sisEdit.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ updateSisFile();
+ validate();
+ }
+ });
+ sisEdit.setData(UID, "DebugRunProcessDialog.sisEdit");
+
+ sisBrowse = new Button(composite, SWT.NONE);
+ sisBrowse.setText("Browse...");
+ sisBrowse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ sisBrowse.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
+
+ dialog.setText("Select installation file");
+ dialog.setFilterExtensions(new String[] {"*.sis*", "*.*"});
+ dialog.setFilterNames(new String[] {"Installation Files", "All Files"});
+
+ BrowseDialogUtils.initializeFrom(dialog, sisEdit);
+
+ String result = dialog.open();
+ if (result != null && new File(result).exists()) {
+ sisEdit.setText(result);
+ updateSisFile();
+ validate();
+ }
+ }
+ });
+ sisBrowse.setData(UID, "DebugRunProcessDialog.sisBrowse");
+ }
+ }
+
+
+ /**
+ *
+ */
+ protected void updateSisFile() {
+ String sisPath;
+ if (sisFile != null) {
+ sisPath = sisFile.getSelectionIndex() == 0 ? "" : sisFile.getText(); //$NON-NLS-1$
+ data.setSisPath(sisPath);
+ } else if (sisEdit != null) {
+ sisPath = sisEdit.getText();
+ data.setSisPath(sisPath);
+ }
+ }
+
+
+ private void updatePackageUI() {
+ installPackageUI.setEnabled(data.isInstallPackage());
+ for (Control kid : installPackageUI.getChildren())
+ kid.setEnabled(data.isInstallPackage());
+ }
+
+
+ public void handleEvent(CProjectDescriptionEvent event) {
+ if (getShell().isDisposed()) {
+ return;
+ }
+
+ IProject project = event.getProject() ;
+
+ if (project != data.getProject()) {
+ return;
+ }
+
+ if (sisFile != null) {
+ ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
+ if (cpi != null) {
+ sisFile.removeAll();
+
+ sisFile.add("None");
+
+ ICarbideBuildConfiguration config = cpi.getDefaultConfiguration();
+ for (ISISBuilderInfo info : config.getSISBuilderInfoList()) {
+ IPath sisPath = info.getSigningType() == ISISBuilderInfo.DONT_SIGN ? info.getUnsignedSISFullPath() : info.getSignedSISFullPath();
+ sisFile.add(sisPath.toOSString());
+ }
+
+ // select the first sis file if any, otherwise select none
+ if (sisFile.getItemCount() > 1) {
+ sisFile.select(1);
+ } else {
+ sisFile.select(0);
+ }
+ }
+ }
+ }
+
+
+
+
+
+
+
+ protected void initUI() {
+ projectExecutableViewer.setInput(data.getExes());
+
+ if (data.getExeSelection() == EExeSelection.USE_PROJECT_EXECUTABLE && data.getExeSelectionPath() != null) {
+ projectExecutableViewer.setSelection(new StructuredSelection(data.getExeSelectionPath()));
+ projectExecutableRadioButton.forceFocus();
+ }
+
+ if (data.getExeSelection() == EExeSelection.USE_REMOTE_EXECUTABLE && data.getExeSelectionPath() != null) {
+ IPath exeSelectionPath = createSuggestedRemotePath(data.getExeSelectionPath());
+ remoteProgramEntry.setText(PathUtils.convertPathToWindows(exeSelectionPath));
+ remoteExecutableRadioButton.forceFocus();
+ }
+
+ if (data.getExeSelection() == EExeSelection.ATTACH_TO_PROCESS) {
+ attachToProcessRadioButton.forceFocus();
+ }
+ }
+
+
+ private IPath createSuggestedRemotePath(IPath exeSelectionPath) {
+ String filename = exeSelectionPath.lastSegment();
+ return PathUtils.createPath("C:/sys/bin").append(filename);
+ }
+
+ /**
+ * Allow selecting an executable detected to be built by the program.
+ * @param radioGroup
+ */
+ private void createProjectExecutableRadioButton(Composite radioGroup) {
+ projectExecutableRadioButton = new Button(radioGroup, SWT.RADIO);
+ GridDataFactory.fillDefaults().grab(false, false).applyTo(projectExecutableRadioButton);
+ projectExecutableRadioButton.setText("Launch project &executable:");
+ projectExecutableRadioButton.setData(UID, "radio_project_executable");
+
+ projectExecutableViewer = new ComboViewer(radioGroup, SWT.READ_ONLY);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(projectExecutableViewer.getControl());
+ projectExecutableViewer.getControl().setData(UID, "combo_project_executable");
+
+ projectExecutableViewer.setContentProvider(new ArrayContentProvider());
+ projectExecutableViewer.setLabelProvider(new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IPath)
+ return ((IPath) element).lastSegment();
+ return super.getText(element);
+ }
+ });
+
+ projectExecutableRadioButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (projectExecutableRadioButton.getSelection()) {
+ projectExecutableViewer.getControl().setEnabled(true);
+ data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE);
+
+ validate();
+ } else {
+ projectExecutableViewer.getControl().setEnabled(false);
+ // another button becomes active and sets the new launch process
+ }
+ }
+ });
+
+ projectExecutableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ Object sel = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (sel instanceof IPath) {
+ data.setExeSelectionPath((IPath) sel);
+
+ // track the default remote program from the executable, for easy editing
+ if (remoteProgramEntry != null) {
+ IPath exeSelectionPath = createSuggestedRemotePath(data.getExeSelectionPath());
+ remoteProgramEntry.setText(PathUtils.convertPathToWindows(exeSelectionPath));
+ }
+
+ validate();
+ }
+ }
+ });
+ }
+
+ /**
+ * Allow user to enter an executable path.
+ * @param radioGroup
+ */
+ private void createRemoteExecutableRadioButton(Composite radioGroup) {
+ remoteExecutableRadioButton = new Button(radioGroup, SWT.RADIO);
+ GridDataFactory.fillDefaults().grab(false, false).applyTo(remoteExecutableRadioButton);
+ remoteExecutableRadioButton.setText("Launch &remote program:");
+
+ remoteExecutableRadioButton.setData(UID, "radio_remote_program");
+
+ remoteProgramEntry = new Text(radioGroup, SWT.BORDER);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(remoteProgramEntry);
+
+ remoteProgramEntry.setData(UID, "text_remote_program");
+
+ remoteExecutableRadioButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (remoteExecutableRadioButton.getSelection()) {
+ remoteProgramEntry.setEnabled(true);
+ data.setExeSelection(EExeSelection.USE_REMOTE_EXECUTABLE);
+ String symbianPath = PathUtils.convertPathToWindows(remoteProgramEntry.getText());
+ data.setExeSelectionPath(new Path(symbianPath));
+ validate();
+ } else {
+ remoteProgramEntry.setEnabled(false);
+ // another button becomes active and sets the new launch process
+ }
+ }
+ });
+
+ remoteProgramEntry.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ data.setExeSelectionPath(new Path(remoteProgramEntry.getText().trim()));
+ validate();
+ }
+ });
+
+ }
+
+ /**
+ * Allow user to attach to a process.
+ * @param radioGroup
+ */
+ private void createAttachToProcessRadioButton(Composite radioGroup) {
+ attachToProcessRadioButton = new Button(radioGroup, SWT.RADIO);
+ GridDataFactory.fillDefaults().grab(false, false).applyTo(attachToProcessRadioButton);
+ attachToProcessRadioButton.setText("&Attach to process:");
+
+ attachToProcessRadioButton.setData(UID, "radio_attach_to_process");
+
+ Label label = new Label(radioGroup, SWT.WRAP);
+ GridDataFactory.fillDefaults().grab(false, false).align(SWT.LEFT, SWT.CENTER).applyTo(label);
+
+ label.setText("(selected at launch time)");
+
+ attachToProcessRadioButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (attachToProcessRadioButton.getSelection()) {
+ data.setExeSelection(EExeSelection.ATTACH_TO_PROCESS);
+ data.setExeSelectionPath(null);
+ validate();
+ } else {
+ // another button becomes active and sets the new launch process
+ }
+ }
+ });
+
+ }
+
+ @Override
+ protected void validate() {
+ IStatus status = Status.OK_STATUS;
+
+ // check launch method
+ IPath exePath = data.getExeSelectionPath();
+ switch (data.getExeSelection()) {
+ case USE_PROJECT_EXECUTABLE:
+ if (exePath.isEmpty()) {
+ status = error("The project builds no executables.");
+ }
+ break;
+ case USE_REMOTE_EXECUTABLE:
+ if (exePath.isEmpty()) {
+ status = error("Enter a non-empty executable path.");
+ } else {
+ String exePathString = exePath.toString();
+ char drive = exePathString.charAt(0);
+ char colon = exePathString.length() < 2 ? 0x0 : exePathString.charAt(1);
+ char root = exePathString.length() < 3 ? 0x0 : exePathString.charAt(2);
+ char lastChar = exePathString.charAt(exePathString.length() - 1);
+ if (!Character.isLetter(drive) || colon != ':' || (root != '\\' && root != '/') ||
+ lastChar == '\\' || lastChar == '/' || lastChar == ':') {
+ status = error("The executable path must be absolute.");
+ } else if (exePath.getFileExtension() == null) {
+ status = warning("The executable path should end in a filename.");
+ }
+ }
+ break;
+ case ATTACH_TO_PROCESS:
+ break;
+ }
+
+ // check SIS selection
+ if (data.isInstallPackage()) {
+ if (sisEdit != null) {
+ String text = sisEdit.getText().trim();
+ if (text.length() > 0) {
+ // empty is allowed, but if they specify something, make sure
+ // it exists
+ File file = new File(text);
+ if (!file.exists()) {
+ status = error("The SIS file ''{0}'' does not exist.", text);
+ }
+ }
+ }
+ }
+
+ updateStatus(status);
+ }
+}
+
--- /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/DebugRunProcessSection.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,139 @@
+/*
+* 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 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.EExeSelection;
+import com.nokia.cpp.internal.api.utils.core.PathUtils;
+
+/**
+ *
+ */
+public class DebugRunProcessSection extends AbstractLaunchWizardSection {
+
+ public DebugRunProcessSection(LaunchOptionsData data) {
+ super(data, MessageFormat.format("{0} process", data.getModeLabel()));
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.IWizardSection#createComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ createSection(parent, 1);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#dispose()
+ */
+ @Override
+ protected void dispose() {
+
+ }
+
+ @Override
+ public void initializeSettings() {
+ data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE);
+ if (data.getExes().size() > 0)
+ data.setExeSelectionPath(data.getExes().get(0));
+ else if (data.getDefaultExecutable() != null)
+ data.setExeSelectionPath(data.getDefaultExecutable());
+ }
+
+ /* (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 DebugRunProcessDialog(shell, dialogData);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#refresh()
+ */
+ @Override
+ protected void refresh() {
+ updateUI();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#validate()
+ */
+ @Override
+ protected void validate() {
+
+ status = Status.OK_STATUS;
+
+ switch (data.getExeSelection()) {
+ case USE_PROJECT_EXECUTABLE:
+ if (data.getExeSelectionPath() == null)
+ status = error("This project does not build any executables.",
+ data.getModeLabel().toLowerCase());
+ break;
+ case USE_REMOTE_EXECUTABLE:
+ if (data.getExeSelectionPath() == null)
+ status = error("No remote executable is selected.",
+ data.getModeLabel().toLowerCase());
+ break;
+ case ATTACH_TO_PROCESS:
+ break;
+ }
+
+ // TODO: package
+ }
+
+ @Override
+ protected void updateUI() {
+
+ validate();
+
+ if (status.isOK()) {
+ String mainFormat = "Carbide will {0} and {1}.";
+ String copyOrInstallMsg = "";
+ String runOrLaunchMsg = "";
+
+ switch (data.getExeSelection()) {
+ case USE_PROJECT_EXECUTABLE:
+ runOrLaunchMsg = "launch '" + data.getExeSelectionPath().lastSegment() + "'";
+ break;
+ case USE_REMOTE_EXECUTABLE:
+ runOrLaunchMsg = "launch '" + PathUtils.convertPathToWindows(data.getExeSelectionPath()) + "'";
+ break;
+ case ATTACH_TO_PROCESS:
+ runOrLaunchMsg = "attach to a process selected at launch time";
+ break;
+ }
+
+ copyOrInstallMsg = "copy files to the device";
+
+ String runOrDebugProcessMessage = MessageFormat.format(mainFormat, copyOrInstallMsg, runOrLaunchMsg);
+ descriptionLabel.setText(runOrDebugProcessMessage);
+ } else {
+ descriptionLabel.setText(status.getMessage() + "\n\n" +
+ MessageFormat.format("Click the 'Change...' button to select another {0} method.",
+ data.getModeLabel().toLowerCase()));
+ }
+ }
+
+}
--- /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/IWizardSection.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,53 @@
+/*
+* 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.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ *
+ */
+public interface IWizardSection {
+
+ public interface ISectionChangeListener {
+ void changed();
+ }
+
+ /** Initialize settings once per wizard (before UI is shown) */
+ void initializeSettings();
+
+ void createControl(Composite parent);
+
+ Control getControl();
+
+ /** Get the current status (never <code>null</code>). This serves as the validation status as well
+ * as being displayed in the wizard validation area. */
+ IStatus getStatus();
+
+ /**
+ * @return
+ */
+ String getSectionName();
+
+ /**
+ * Set the listener notified when the Change button is clicked.
+ */
+ void setChangeListener(ISectionChangeListener listener);
+}
--- /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/LaunchOptionsData.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,299 @@
+/*
+* 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.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.osgi.service.prefs.Preferences;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
+
+/**
+ * Data manipulated by the launch wizard and its dialogs.
+ */
+public class LaunchOptionsData {
+ public interface IPathValidator {
+ /**
+ * @param path IPath
+ * @return Error string or <code>null</code> if is valid
+ */
+ String isValidPath(IPath path);
+ }
+
+ // settings detected in project
+ private final List<IPath> mmps;
+ private final List<IPath> exes;
+ private final IPath defaultExecutable;
+ private final IProject project;
+ private final String configurationName;
+ private final IService service;
+ private final boolean isEmulation;
+ private final boolean emulatorOnly;
+ private final String mode;
+ private IConnection connection;
+
+ // overall target
+ public static class LaunchType {
+ private final String launchId;
+
+ public LaunchType(String launchId) {
+ this.launchId = launchId;
+ }
+
+ public boolean isApplicable(LaunchOptionsData data) {
+ return true;
+ }
+
+ public String getLaunchId() {
+ return launchId;
+ }
+ };
+
+ public final static LaunchType APP_TRK = new LaunchType(null);
+ public final static LaunchType SYS_TRK = new LaunchType(null);
+ public final static LaunchType ATTACH_TO_PROCESS_LAUNCH = new LaunchType(null);
+ public final static LaunchType PLATSIM_RUN_MODE = new LaunchType(null);
+ public final static LaunchType PLATSIM_STOP_MODE = new LaunchType(null);
+
+ // settings made in Debug/Run Process section
+ enum EExeSelection {
+ USE_PROJECT_EXECUTABLE,
+ USE_REMOTE_EXECUTABLE,
+ ATTACH_TO_PROCESS,
+ };
+
+ private EExeSelection exeSelection;
+ private IPath exeSelectionPath = Path.EMPTY;
+ private EBuildBeforeLaunchOption buildBeforeLaunch;
+ private boolean installPackage;
+ private String sisPath;
+
+ // settings made in the Other Settings section
+ enum EBuildBeforeLaunchOption {
+ ALWAYS,
+ NEVER,
+ USE_WORKSPACE_SETTING,
+ }
+
+ public LaunchOptionsData(List<IPath> mmps, List<IPath> exes,
+ IPath defaultExecutable, IProject project,
+ String configurationName, boolean isEmulation,
+ boolean emulatorOnly, String mode,
+ IService trkService) {
+ this.mmps = mmps;
+ this.exes = exes;
+ this.defaultExecutable = defaultExecutable;
+ this.project = project;
+ this.configurationName = configurationName;
+ this.isEmulation = isEmulation;
+ this.emulatorOnly = emulatorOnly;
+ this.mode = mode;
+ this.service = trkService;
+ }
+
+ /**
+ * @return the service
+ */
+ public IService getService() {
+ return service;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isDebug() {
+ return mode.equals(ILaunchManager.DEBUG_MODE);
+ }
+
+ public String getModeLabel() {
+ if (mode.equals(ILaunchManager.RUN_MODE))
+ return "Run";
+ else if (mode.equals(ILaunchManager.DEBUG_MODE))
+ return "Debug";
+ else
+ return TextUtils.titleCase(mode);
+
+ }
+
+ /**
+ * Validate the detected and/or configured data
+ * @return IStatus, never <code>null</code>
+ */
+ public IStatus validate() {
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @return
+ * @return
+ */
+ public List<IPath> getExes() {
+ return exes;
+ }
+
+ /**
+ * @return the defaultExecutable
+ */
+ public IPath getDefaultExecutable() {
+ return defaultExecutable;
+ }
+
+ /**
+ * Set the executable selection mode
+ * @param selection
+ */
+ public void setExeSelection(EExeSelection selection) {
+ this.exeSelection = selection;
+ }
+ /**
+ * Set the path for the exe
+ * @param path or <code>null</code>
+ */
+ public void setExeSelectionPath(IPath path) {
+ this.exeSelectionPath = path != null ? path : Path.EMPTY;
+ }
+
+ /**
+ * @return
+ */
+ public EExeSelection getExeSelection() {
+ return exeSelection;
+ }
+
+ public IPath getExeSelectionPath() {
+ return exeSelectionPath;
+ }
+
+ public String getConnectionName() {
+ IConnection connection = getConnection();
+ if (connection == null)
+ return null;
+ return connection.getDisplayName();
+ }
+
+ public void setBuildBeforeLaunchOption(
+ EBuildBeforeLaunchOption setting) {
+ this.buildBeforeLaunch = setting;
+ }
+
+ public EBuildBeforeLaunchOption getBuildBeforeLaunch() {
+ return buildBeforeLaunch;
+ }
+
+ /** Get current workspace setting */
+ public boolean isWorkspaceBuildBeforeLaunch() {
+ // here's how to get the prefs from a plugin's #getPreferenceStore() without violating access
+ String prefId = IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH;
+ int idx = prefId.lastIndexOf('.');
+ String plugin = prefId.substring(0, idx);
+ Preferences node = Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(plugin);
+ return node.getBoolean(prefId, true);
+ }
+
+ /** Get actual launch-time setting */
+ public boolean isCurrentBuildBeforeLaunch() {
+ if (buildBeforeLaunch != EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING)
+ return buildBeforeLaunch == EBuildBeforeLaunchOption.ALWAYS;
+ return isWorkspaceBuildBeforeLaunch();
+ }
+
+ /**
+ * @param selection
+ */
+ public void setInstallPackage(boolean selection) {
+ this.installPackage = selection;
+ }
+
+ /**
+ * @return the installPackage
+ */
+ public boolean isInstallPackage() {
+ return installPackage;
+ }
+
+ /**
+ * @return
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /**
+ * @param sisPath
+ */
+ public void setSisPath(String sisPath) {
+ this.sisPath = sisPath;
+ }
+
+ /**
+ * Copy the data, for use by a transient dialog.
+ * @return new copy of data
+ */
+ public LaunchOptionsData copy() {
+ LaunchOptionsData d = new LaunchOptionsData(
+ mmps, exes, defaultExecutable, project, configurationName,
+ isEmulation, emulatorOnly, mode, service);
+ d.exeSelection = exeSelection;
+ d.exeSelectionPath = exeSelectionPath;
+ d.buildBeforeLaunch = buildBeforeLaunch;
+ d.installPackage = installPackage;
+ d.sisPath = sisPath;
+ d.connection = connection;
+ return d;
+ }
+
+ /**
+ * Apply the given data to the receiver (when a transient dialog is accepted)
+ * @param dialogData
+ */
+ public void apply(LaunchOptionsData dialogData) {
+ exeSelection = dialogData.exeSelection;
+ exeSelectionPath = dialogData.exeSelectionPath;
+ buildBeforeLaunch = dialogData.buildBeforeLaunch;
+ installPackage = dialogData.installPackage;
+ sisPath = dialogData.sisPath;
+ connection = dialogData.connection;
+ }
+
+ /**
+ * @return
+ */
+ public boolean requiresInstallPackage() {
+ return false;
+ }
+
+ public void setConnection(IConnection connection) {
+ this.connection = connection;
+ }
+
+ public IConnection getConnection() {
+ return connection;
+ }
+
+}
--- /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/LaunchWizard.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,183 @@
+/*
+* 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.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IPageChangedListener;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.PageChangedEvent;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+
+/**
+ * New launch wizard for Carbide 3.0.
+ *
+ * See https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=10419
+ */
+public class LaunchWizard extends Wizard {
+
+ private LaunchOptionsData launchData;
+ private UnifiedLaunchOptionsPage mainPage;
+ private Button advancedButton;
+ private boolean advancedEdit;
+ private IPageChangedListener pageChangedListener;
+
+ public LaunchWizard(IProject project, String configurationName,
+ List<IPath> mmps, List<IPath> exes, IPath defaultExecutable,
+ boolean isEmulation, boolean emulatorOnly, String mode,
+ IService trkService) {
+ launchData = new LaunchOptionsData(mmps, exes, defaultExecutable, project, configurationName,
+ isEmulation, emulatorOnly, mode, trkService);
+ mainPage = new UnifiedLaunchOptionsPage(launchData);
+ mainPage.initializeSettings();
+ setWindowTitle("New Launch Configuration Wizard");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ addPage(mainPage);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#setContainer(org.eclipse.jface.wizard.IWizardContainer)
+ */
+ @Override
+ public void setContainer(final IWizardContainer wizardContainer) {
+ super.setContainer(wizardContainer);
+
+ // Thanks, JFace, for making it so hard to know when the UI is ready
+ if (wizardContainer instanceof WizardDialog && advancedButton == null) {
+ pageChangedListener = new IPageChangedListener() {
+
+ public void pageChanged(PageChangedEvent event) {
+ addAdvancedButton();
+ ((WizardDialog)getContainer()).removePageChangedListener(pageChangedListener);
+ }
+ };
+ ((WizardDialog)wizardContainer).addPageChangedListener(pageChangedListener);
+ }
+ }
+
+ protected void addAdvancedButton() {
+ if (advancedButton == null) {
+ Composite parent = (Composite) ((Dialog) getContainer()).buttonBar;
+ if (parent != null) {
+
+ advancedButton = new Button(parent, SWT.CHECK);
+ GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(advancedButton);
+ ((GridLayout) parent.getLayout()).numColumns++;
+ advancedButton.moveBelow(parent.getChildren()[0]);
+
+ advancedButton.setText("Edit advanced settings before launch");
+ advancedButton.setToolTipText(MessageFormat.format(
+ "Before finishing the wizard, edit settings in the ''{0} Configurations'' dialog.",
+ launchData.getModeLabel()));
+ advancedButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateDebugEditButton();
+ }
+ });
+ }
+
+ // Thanks, JFace, for deleting validation messages on the first display
+ mainPage.validatePage();
+ }
+ }
+
+ @Override
+ public boolean canFinish() {
+ if (advancedEdit)
+ return true;
+ return super.canFinish();
+ }
+
+ protected void updateDebugEditButton() {
+ Button finishButton = findFinishButton();
+ if (finishButton != null) {
+ advancedEdit = advancedButton.getSelection();
+ if (advancedEdit) {
+ finishButton.setText("Edit");
+ finishButton.setToolTipText("Click to accept settings and edit advanced settings.");
+ getContainer().updateButtons();
+ } else {
+ finishButton.setText(launchData.getModeLabel());
+ finishButton.setToolTipText("Click to accept settings and launch the program.");
+ getContainer().updateButtons();
+ }
+ }
+ }
+
+ /**
+ * Thanks, SWT and JFace, for making this so difficult
+ * @return the Finish button
+ */
+ private Button findFinishButton() {
+ if (getContainer() instanceof Dialog) {
+ return findFinishButton((Composite) ((Dialog) getContainer()).buttonBar);
+ }
+ return null;
+ }
+
+ /**
+ * @param buttonBar
+ * @return
+ */
+ private Button findFinishButton(Composite parent) {
+ for (Control kid : parent.getChildren()) {
+ if (kid instanceof Button) {
+ if (kid.getData() instanceof Integer && (Integer) kid.getData() == IDialogConstants.FINISH_ID) {
+ return (Button) kid;
+ }
+ }
+ else if (kid instanceof Composite) {
+ Button button = findFinishButton((Composite) kid);
+ if (button != null)
+ return button;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean performFinish() {
+ MessageDialog.openWarning(getShell(), "New Launch Configuration Wizard", "Launching from this wizard not enabled yet");
+ return false;
+ }
+
+}
--- /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/LaunchWizardHelpIds.java Tue Feb 09 15:35:02 2010 -0600
@@ -0,0 +1,37 @@
+/*
+* 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 com.nokia.cdt.internal.debug.launch.LaunchPlugin;
+
+// these are the help context id's for our launch wizard pages and dialogs
+
+public class LaunchWizardHelpIds {
+ /*
+ * Help context ID. Should be: PluginID + "." + <words without '.'>
+ */
+ 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$
+
+}
--- /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 + '!';
+ }
+ }
+}
--- /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();
+
+ }
+}
+
--- /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();
+ }
+}
--- /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:
+ * <p>
+ * Connection to use: container for the Remote Connection selection UI, plus a label
+ * explaining how to handle the case of no connections defined.
+ * <p>
+ * 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.
+ * <p>
+ * 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<IWizardSection> 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>();
+
+
+ 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();
+ }
+}
--- /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=<a>Configure Workspace Settings...</a>
+OtherSettingsDialog.WorkspaceSettingsPageID=org.eclipse.debug.ui.LaunchingPreferencePage