# HG changeset patch # User dadubrow # Date 1287585354 18000 # Node ID f0a9f2d04d4ae8f4a932973a6a4d08b4a078dc63 # Parent aa3898248f3926af879cb865c3bbf55b6d234c4f Refactor data model for new launch wizard diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/PhoneLaunchShortcut.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/PhoneLaunchShortcut.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/PhoneLaunchShortcut.java Wed Oct 20 09:35:54 2010 -0500 @@ -22,7 +22,6 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.debug.core.ILaunchConfiguration; -import com.nokia.carbide.remoteconnections.interfaces.IService; import com.nokia.cdt.debug.cw.symbian.SettingsData; import com.nokia.cdt.internal.debug.launch.LaunchPlugin.ILaunchCreationWizardFactory; import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizard; @@ -45,8 +44,7 @@ LaunchPlugin.getDefault().launchProject(project, executable, defaultMMP, mode, new ILaunchCreationWizardFactory() { public ILaunchCreationWizard createLaunchCreationWizard(LaunchOptions launchOptions) throws Exception { - IService trkService = LaunchPlugin.getRunModeDebugService(); - LaunchWizard launchWizard = new LaunchWizard(launchOptions, trkService); + LaunchWizard launchWizard = new LaunchWizard(launchOptions); return launchWizard; }; }); diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchSettingsDialog.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchSettingsDialog.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchSettingsDialog.java Wed Oct 20 09:35:54 2010 -0500 @@ -43,7 +43,7 @@ protected final static String UID = ".uid"; //$NON-NLS-1$ - protected final LaunchWizardData data; + protected final IWizardData data; protected int INDENT; private String title; @@ -53,7 +53,7 @@ * @param parentShell * @param data */ - public AbstractLaunchSettingsDialog(Shell parentShell, LaunchWizardData data) { + public AbstractLaunchSettingsDialog(Shell parentShell, IWizardData data) { super(parentShell); setShellStyle(getShellStyle() | SWT.RESIZE); this.data = data; diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchWizard.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchWizard.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchWizard.java Wed Oct 20 09:35:54 2010 -0500 @@ -40,7 +40,6 @@ import com.nokia.carbide.cpp.ui.CarbideUIPlugin; import com.nokia.carbide.cpp.ui.ICarbideSharedImages; -import com.nokia.carbide.remoteconnections.interfaces.IService; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard; import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions; @@ -52,33 +51,29 @@ */ public abstract class AbstractLaunchWizard extends Wizard implements ILaunchCreationWizard { - private LaunchWizardData launchData; + protected IWizardData launchData; private AbstractUnifiedLaunchOptionsPage mainPage; private Button advancedButton; private boolean advancedEdit; private IPageChangedListener pageChangedListener; private boolean hasFinished; - public AbstractLaunchWizard(LaunchOptions launchOptions, IService dbgService, String title) { - launchData = new LaunchWizardData(launchOptions, dbgService); + public AbstractLaunchWizard(LaunchOptions launchOptions, String title) { + launchData = createWizardData(launchOptions); mainPage = createMainPage(launchData); mainPage.initializeSettings(); setWindowTitle(title); } - protected abstract AbstractUnifiedLaunchOptionsPage createMainPage(LaunchWizardData data); + protected abstract AbstractUnifiedLaunchOptionsPage createMainPage(IWizardData data); + + protected abstract IWizardData createWizardData(LaunchOptions options); - /* (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); diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchWizardSection.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchWizardSection.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchWizardSection.java Wed Oct 20 09:35:54 2010 -0500 @@ -48,7 +48,7 @@ public abstract class AbstractLaunchWizardSection implements IWizardSection { private static final String CHANGE_LABEL = Messages.getString("AbstractLaunchWizardSection.ChangeLabel"); //$NON-NLS-1$ - protected final LaunchWizardData data; + protected final IWizardData data; private String sectionName; protected IStatus status; @@ -59,7 +59,7 @@ protected final AbstractUnifiedLaunchOptionsPage launchOptionsPage; - public AbstractLaunchWizardSection(LaunchWizardData data, String sectionName, AbstractUnifiedLaunchOptionsPage launchOptionsPage) { + public AbstractLaunchWizardSection(IWizardData data, String sectionName, AbstractUnifiedLaunchOptionsPage launchOptionsPage) { this.data = data; this.sectionName = sectionName; this.launchOptionsPage = launchOptionsPage; @@ -85,7 +85,7 @@ public abstract void createControl(Composite parent); /** Create the dialog for the Change... button. */ - protected abstract AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchWizardData dialogData); + protected abstract AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, IWizardData dialogData); /** Refresh the section after the Change... dialog has been closed. */ protected abstract void refresh(); @@ -164,7 +164,7 @@ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#doChange() */ protected void doChange() { - LaunchWizardData dialogData = data.copy(); + IWizardData dialogData = data.copy(); AbstractLaunchSettingsDialog dialog = createChangeSettingsDialog(getControl().getShell(), dialogData); if (dialog.open() == Window.OK) { data.apply(dialogData); diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractUnifiedLaunchOptionsPage.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractUnifiedLaunchOptionsPage.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractUnifiedLaunchOptionsPage.java Wed Oct 20 09:35:54 2010 -0500 @@ -36,10 +36,10 @@ public abstract class AbstractUnifiedLaunchOptionsPage extends WizardPage implements ISectionChangeListener { - protected LaunchWizardData data; + protected IWizardData data; protected ArrayList sections; - protected AbstractUnifiedLaunchOptionsPage(String pageName, LaunchWizardData data) { + protected AbstractUnifiedLaunchOptionsPage(String pageName, IWizardData data) { super(pageName); this.data = data; this.sections = new ArrayList(); @@ -113,7 +113,7 @@ setTitle(Messages.getString("UnifiedLaunchOptionsPage.TitleText")); //$NON-NLS-1$ - if (pageStatus != null && !pageStatus.isOK()) { + if (!pageStatus.isOK()) { setMessage(pageStatus.getMessage(), severityToMsgType(pageStatus.getSeverity())); setPageComplete(pageStatus.getSeverity() < IStatus.ERROR); } diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java Wed Oct 20 09:35:54 2010 -0500 @@ -82,11 +82,13 @@ private Label descriptionLabel; private Button newButton; private IConnectedService currentServiceListener; + private IConnectionWizardData connectionData; - protected ConnectToDeviceDialog(Shell shell, LaunchWizardData data) { + protected ConnectToDeviceDialog(Shell shell, IWizardData data) { super(shell, data); manager = RemoteConnectionsActivator.getConnectionsManager(); typeProvider = RemoteConnectionsActivator.getConnectionTypeProvider(); + connectionData = (IConnectionWizardData) data; } @Override @@ -153,7 +155,7 @@ newButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - SettingsWizard wizard = new SettingsWizard(null, data.getService()); + SettingsWizard wizard = new SettingsWizard(null, connectionData.getService()); wizard.open(composite.getShell()); IConnection connection = wizard.getConnectionToEdit(); setViewerInput(connection); @@ -173,7 +175,7 @@ public void widgetSelected(SelectionEvent e) { IConnection connection = getConnectionFromSelection(viewer.getSelection()); if (connection != null) { - SettingsWizard wizard = new SettingsWizard(connection, data.getService()); + SettingsWizard wizard = new SettingsWizard(connection, connectionData.getService()); wizard.open(composite.getShell()); } } @@ -188,7 +190,7 @@ } }); - setViewerInput(data.getConnection()); + setViewerInput(connectionData.getConnection()); return composite; } @@ -201,17 +203,17 @@ } protected void validate() { - IStatus status = ConnectToDeviceSection.revalidate(data); + IStatus status = ConnectToDeviceSection.revalidate(connectionData); if (status.isOK()) { - IConnection connection = data.getConnection(); + IConnection connection = connectionData.getConnection(); if (connection != null) { IConnectedService connectedService = findConnectedServiceFromConnection(connection); if (connectedService == null) { status = error(MessageFormat.format( Messages.getString("ConnectToDeviceDialog.ServiceNotSupportedError"), //$NON-NLS-1$ - data.getService().getDisplayName())); + connectionData.getService().getDisplayName())); } else { com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus serviceStatus = @@ -236,7 +238,7 @@ private IConnectedService findConnectedServiceFromConnection(IConnection connection) { Collection services = manager.getConnectedServices(connection); for (IConnectedService connectedService : services) { - if (connectedService != null && connectedService.getService().getIdentifier().equals(data.getService().getIdentifier())) { + if (connectedService != null && connectedService.getService().getIdentifier().equals(connectionData.getService().getIdentifier())) { return connectedService; } } @@ -249,7 +251,7 @@ */ private void updateConnection(IConnection connection) { String standardPNPMessage = ConnectToDeviceSection.getStandardPNPMessage(); - data.setConnection(connection); + connectionData.setConnection(connection); if (connection != null) { descriptionLabel.setText(standardPNPMessage); } else { @@ -286,7 +288,7 @@ private Set getCompatibleConnectionTypes() { HashSet types = new HashSet(); Collection compatibleTypeIds = - typeProvider.getCompatibleConnectionTypeIds(data.getService()); + typeProvider.getCompatibleConnectionTypeIds(connectionData.getService()); for (String typeId : compatibleTypeIds) { types.add(typeProvider.getConnectionType(typeId)); } diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceSection.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceSection.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceSection.java Wed Oct 20 09:35:54 2010 -0500 @@ -38,14 +38,16 @@ private static final String NO_CURRENT_CONNECTION_MSG = Messages.getString("ConnectToDeviceSection.NoConnectionMsg"); //$NON-NLS-1$ private final IConnectionsManager manager; + private IConnectionWizardData connectionData; /** * @param unifiedLaunchOptionsPage * */ - public ConnectToDeviceSection(LaunchWizardData data, AbstractUnifiedLaunchOptionsPage launchOptionsPage) { + public ConnectToDeviceSection(IWizardData data, AbstractUnifiedLaunchOptionsPage launchOptionsPage) { super(data, Messages.getString("ConnectToDeviceSection.Title"), launchOptionsPage); //$NON-NLS-1$ manager = RemoteConnectionsActivator.getConnectionsManager(); + connectionData = (IConnectionWizardData) data; } public void createControl(Composite parent) { @@ -59,16 +61,16 @@ } public void initializeSettings() { - data.setConnection(manager.getCurrentConnection()); + connectionData.setConnection(manager.getCurrentConnection()); } @Override protected void validate() { - status = revalidate(data); + status = revalidate(connectionData); } /** Get the simple status for the connection state */ - static IStatus revalidate(LaunchWizardData data) { + static IStatus revalidate(IConnectionWizardData data) { IStatus status = Status.OK_STATUS; if (data.getConnection() == null) { @@ -88,8 +90,8 @@ return; String msg; - if (data.getConnection() != null) - msg = MessageFormat.format(Messages.getString("ConnectToDeviceSection.CurrentConnectionLabel"), data.getConnectionName()); //$NON-NLS-1$ + if (connectionData.getConnection() != null) + msg = MessageFormat.format(Messages.getString("ConnectToDeviceSection.CurrentConnectionLabel"), connectionData.getConnectionName()); //$NON-NLS-1$ else msg = MessageFormat.format("{0} {1}", NO_CURRENT_CONNECTION_MSG, getStandardPNPMessage()); //$NON-NLS-1$ @@ -98,7 +100,7 @@ } @Override - protected AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchWizardData dialogData) { + protected AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, IWizardData dialogData) { return new ConnectToDeviceDialog(shell, dialogData); } @@ -112,7 +114,7 @@ } private void doConnectionsChanged() { - data.setConnection(manager.getCurrentConnection()); + connectionData.setConnection(manager.getCurrentConnection()); refresh(); } @@ -133,15 +135,15 @@ // if no connections are available, immediately offer to create a connection if (manager.getConnections().isEmpty()) { - SettingsWizard wizard = new SettingsWizard(null, data.getService()); + SettingsWizard wizard = new SettingsWizard(null, connectionData.getService()); wizard.open(getControl().getShell()); IConnection newConnection = wizard.getConnectionToEdit(); - data.setConnection(newConnection); + connectionData.setConnection(newConnection); } else { super.doChange(); } - IConnection connection = data.getConnection(); + IConnection connection = connectionData.getConnection(); if (connection != null && !connection.equals(manager.getCurrentConnection())) manager.setCurrentConnection(connection); } diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java Wed Oct 20 09:35:54 2010 -0500 @@ -70,7 +70,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; -import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EExeSelection; +import com.nokia.cdt.internal.debug.launch.newwizard.IDebugRunProcessWizardData.EExeSelection; import com.nokia.cpp.internal.api.utils.core.PathUtils; import com.nokia.cpp.internal.api.utils.core.TextUtils; import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; @@ -95,8 +95,11 @@ private List remotePathEntries = new ArrayList(); private List projectGeneratedRemotePaths; - protected DebugRunProcessDialog(Shell shell, LaunchWizardData data) { + private IDebugRunProcessWizardData debugRunProcessWizardData; + + protected DebugRunProcessDialog(Shell shell, IWizardData data) { super(shell, data); + debugRunProcessWizardData = (IDebugRunProcessWizardData) data; } @@ -203,7 +206,7 @@ msg = Messages.getString("DebugRunProcessDialog.RunConfigureMsg"); //$NON-NLS-1$ setMessage(msg); - switch (data.getExeSelection()) { + switch (debugRunProcessWizardData.getExeSelection()) { case USE_PROJECT_EXECUTABLE: projectExecutableRadioButton.setSelection(true); break; @@ -249,13 +252,13 @@ installPackageCheckbox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - data.setInstallPackage(installPackageCheckbox.getSelection()); + debugRunProcessWizardData.setInstallPackage(installPackageCheckbox.getSelection()); updatePackageUI(); } }); - if (data.isInstallPackage()) { + if (debugRunProcessWizardData.isInstallPackage()) { installPackageCheckbox.setSelection(true); updatePackageUI(); } @@ -327,7 +330,7 @@ validate(); } }); - String sisPath = data.getSisPath(); + String sisPath = debugRunProcessWizardData.getSisPath(); if (sisPath != null) sisEdit.setText(sisPath); sisEdit.setData(UID, "DebugRunProcessDialog.sisEdit"); //$NON-NLS-1$ @@ -384,18 +387,18 @@ String sisPath; if (sisFile != null) { sisPath = sisFile.getSelectionIndex() == 0 ? null : sisFile.getText(); //$NON-NLS-1$ - data.setSisPath(sisPath); + debugRunProcessWizardData.setSisPath(sisPath); } else if (sisEdit != null) { sisPath = sisEdit.getText(); - data.setSisPath(sisPath); + debugRunProcessWizardData.setSisPath(sisPath); } } private void updatePackageUI() { - installPackageUI.setEnabled(data.isInstallPackage()); + installPackageUI.setEnabled(debugRunProcessWizardData.isInstallPackage()); for (Control kid : installPackageUI.getChildren()) - kid.setEnabled(data.isInstallPackage()); + kid.setEnabled(debugRunProcessWizardData.isInstallPackage()); } @@ -422,18 +425,18 @@ } protected void initUI() { - List exes = data.getLaunchableExes(); + List exes = debugRunProcessWizardData.getLaunchableExes(); projectExecutableViewer.setInput(exes); // this path may either be a project-relative or remote path - IPath exeSelectionPath = data.getExeSelectionPath(); + IPath exeSelectionPath = debugRunProcessWizardData.getExeSelectionPath(); if (exeSelectionPath.equals(Path.EMPTY) && !exes.isEmpty()) exeSelectionPath = exes.get(0); if (!Path.EMPTY.equals(exeSelectionPath)) { // keep previous path if possible... IPath remotePath = exeSelectionPath; - if (data.getExes().contains(remotePath)) { + if (debugRunProcessWizardData.getExes().contains(remotePath)) { // unless that was actually a host-side path, which should be converted remotePath = createSuggestedRemotePath(exeSelectionPath); } else { @@ -459,15 +462,15 @@ } } - if (data.getExeSelection() == EExeSelection.USE_PROJECT_EXECUTABLE && exeSelectionPath != null) { + if (debugRunProcessWizardData.getExeSelection() == EExeSelection.USE_PROJECT_EXECUTABLE && exeSelectionPath != null) { projectExecutableViewer.getControl().forceFocus(); } - if (data.getExeSelection() == EExeSelection.USE_REMOTE_EXECUTABLE && exeSelectionPath != null) { + if (debugRunProcessWizardData.getExeSelection() == EExeSelection.USE_REMOTE_EXECUTABLE && exeSelectionPath != null) { remoteProgramViewer.getControl().forceFocus(); } - if (data.getExeSelection() == EExeSelection.ATTACH_TO_PROCESS) { + if (debugRunProcessWizardData.getExeSelection() == EExeSelection.ATTACH_TO_PROCESS) { attachToProcessRadioButton.forceFocus(); } @@ -490,7 +493,7 @@ * @return host path or null */ private IPath getHostFileForRemoteLocation(IPath path) { - for (IPath exe : data.getExes()) { + for (IPath exe : debugRunProcessWizardData.getExes()) { // no... we don't have any knowledge (yet) of the actual install path, // so comparing the exact path will fail if the user edited it. // IPath remoteSuggested = createSuggestedRemotePath(exe); @@ -544,12 +547,12 @@ Object sel = ((IStructuredSelection) event.getSelection()).getFirstElement(); if (sel instanceof IPath) { if (projectExecutableRadioButton.getSelection()) { - data.setExeSelectionPath((IPath) sel); + debugRunProcessWizardData.setExeSelectionPath((IPath) sel); } // track the default remote program from the executable, for easy editing if (remoteProgramViewer != null && !remoteExecutableRadioButton.getSelection()) { - IPath exeSelectionPath = createSuggestedRemotePath(data.getExeSelectionPath()); + IPath exeSelectionPath = createSuggestedRemotePath(debugRunProcessWizardData.getExeSelectionPath()); // path should already be in model remoteProgramViewer.setSelection(new StructuredSelection(exeSelectionPath)); } @@ -563,10 +566,10 @@ private void handleProjectExecutableRadioSelected() { if (projectExecutableRadioButton.getSelection()) { projectExecutableViewer.getControl().setEnabled(true); - data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE); + debugRunProcessWizardData.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE); IPath selectedPath = (IPath) ((IStructuredSelection) projectExecutableViewer.getSelection()).getFirstElement(); if (selectedPath != null) { - data.setExeSelectionPath(selectedPath); + debugRunProcessWizardData.setExeSelectionPath(selectedPath); } validate(); } else { @@ -591,7 +594,7 @@ GridDataFactory.fillDefaults().grab(true, false).applyTo(remoteProgramViewer.getControl()); projectGeneratedRemotePaths = new ArrayList(); - for (IPath launchable : data.getLaunchableExes()) { + for (IPath launchable : debugRunProcessWizardData.getLaunchableExes()) { projectGeneratedRemotePaths.add(createSuggestedRemotePath(launchable)); } @@ -625,7 +628,7 @@ public void modifyText(ModifyEvent e) { IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText().trim()); if (remoteExecutableRadioButton.getSelection()) { - data.setExeSelectionPath(path); + debugRunProcessWizardData.setExeSelectionPath(path); } if (!projectExecutableRadioButton.getSelection()) { @@ -657,9 +660,9 @@ private void handleRemoteExecutableRadioSelected() { if (remoteExecutableRadioButton.getSelection()) { remoteProgramViewer.getControl().setEnabled(true); - data.setExeSelection(EExeSelection.USE_REMOTE_EXECUTABLE); + debugRunProcessWizardData.setExeSelection(EExeSelection.USE_REMOTE_EXECUTABLE); IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText()); - data.setExeSelectionPath(path); + debugRunProcessWizardData.setExeSelectionPath(path); validate(); } else { remoteProgramViewer.getControl().setEnabled(false); @@ -696,8 +699,8 @@ private void handleAttachToProcessRadioSelected() { if (attachToProcessRadioButton.getSelection()) { - data.setExeSelection(EExeSelection.ATTACH_TO_PROCESS); - data.setExeSelectionPath(null); + debugRunProcessWizardData.setExeSelection(EExeSelection.ATTACH_TO_PROCESS); + debugRunProcessWizardData.setExeSelectionPath(null); validate(); } else { // another button becomes active and sets the new launch process @@ -709,8 +712,8 @@ IStatus status = Status.OK_STATUS; // check launch method - IPath exePath = data.getExeSelectionPath(); - switch (data.getExeSelection()) { + IPath exePath = debugRunProcessWizardData.getExeSelectionPath(); + switch (debugRunProcessWizardData.getExeSelection()) { case USE_PROJECT_EXECUTABLE: if (exePath.isEmpty()) { status = error(Messages.getString("DebugRunProcessDialog.NoExesError")); //$NON-NLS-1$ @@ -738,7 +741,7 @@ } // check SIS selection - if (data.isInstallPackage()) { + if (debugRunProcessWizardData.isInstallPackage()) { if (sisEdit != null) { String text = sisEdit.getText().trim(); if (text.length() > 0) { diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java Wed Oct 20 09:35:54 2010 -0500 @@ -29,16 +29,19 @@ 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.LaunchWizardData.EExeSelection; +import com.nokia.cdt.internal.debug.launch.newwizard.IDebugRunProcessWizardData.EExeSelection; import com.nokia.cpp.internal.api.utils.core.PathUtils; /** * */ public class DebugRunProcessSection extends AbstractLaunchWizardSection { + + private IDebugRunProcessWizardData debugRunProcessWizardData; - public DebugRunProcessSection(LaunchWizardData data, AbstractUnifiedLaunchOptionsPage launchOptionsPage) { + public DebugRunProcessSection(IWizardData data, AbstractUnifiedLaunchOptionsPage launchOptionsPage) { super(data, MessageFormat.format(Messages.getString("DebugRunProcessSection.Title"), data.getModeLabel()), launchOptionsPage); //$NON-NLS-1$ + debugRunProcessWizardData = (IDebugRunProcessWizardData) data; } @Override @@ -53,13 +56,13 @@ @Override public void initializeSettings() { - data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE); - if (data.getLaunchableExes().size() > 0) - data.setExeSelectionPath(data.getLaunchableExes().get(0)); - else if (data.getDefaultExecutable() != null) - data.setExeSelectionPath(data.getDefaultExecutable()); - if (Path.EMPTY.equals(data.getExeSelectionPath())) - data.setExeSelection(EExeSelection.ATTACH_TO_PROCESS); + debugRunProcessWizardData.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE); + if (debugRunProcessWizardData.getLaunchableExes().size() > 0) + debugRunProcessWizardData.setExeSelectionPath(debugRunProcessWizardData.getLaunchableExes().get(0)); + else if (debugRunProcessWizardData.getDefaultExecutable() != null) + debugRunProcessWizardData.setExeSelectionPath(debugRunProcessWizardData.getDefaultExecutable()); + if (Path.EMPTY.equals(debugRunProcessWizardData.getExeSelectionPath())) + debugRunProcessWizardData.setExeSelection(EExeSelection.ATTACH_TO_PROCESS); ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(data.getProject()); boolean hasSisInstall = false; @@ -67,7 +70,7 @@ ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); for (ISISBuilderInfo info : config.getSISBuilderInfoList()) { IPath sisPath = info.getSigningType() == ISISBuilderInfo.DONT_SIGN ? info.getUnsignedSISFullPath() : info.getSignedSISFullPath(); - data.setSisPath(sisPath.toOSString()); + debugRunProcessWizardData.setSisPath(sisPath.toOSString()); if (info.isEnabled()) { hasSisInstall = true; break; @@ -75,19 +78,19 @@ } } - if (data.getExeSelection().equals(EExeSelection.ATTACH_TO_PROCESS)) { - data.setInstallPackage(false); + if (debugRunProcessWizardData.getExeSelection().equals(EExeSelection.ATTACH_TO_PROCESS)) { + debugRunProcessWizardData.setInstallPackage(false); } else { - Boolean detectedSysTrk = data.isSysTRKConnection(); // TRUE, FALSE, or null - boolean isSysTrk = detectedSysTrk == Boolean.TRUE || (detectedSysTrk == null && data.isInternalLayout()); - data.setInstallPackage(hasSisInstall || !isSysTrk); + Boolean detectedSysTrk = debugRunProcessWizardData.isSysTRKConnection(); // TRUE, FALSE, or null + boolean isSysTrk = detectedSysTrk == Boolean.TRUE || (detectedSysTrk == null && debugRunProcessWizardData.isInternalLayout()); + debugRunProcessWizardData.setInstallPackage(hasSisInstall || !isSysTrk); } } @Override protected AbstractLaunchSettingsDialog createChangeSettingsDialog( - Shell shell, LaunchWizardData dialogData) { + Shell shell, IWizardData dialogData) { return new DebugRunProcessDialog(shell, dialogData); } @@ -101,14 +104,14 @@ status = Status.OK_STATUS; - switch (data.getExeSelection()) { + switch (debugRunProcessWizardData.getExeSelection()) { case USE_PROJECT_EXECUTABLE: - if (data.getExeSelectionPath() == null) + if (debugRunProcessWizardData.getExeSelectionPath() == null) status = error(Messages.getString("DebugRunProcessSection.NoExesError"), //$NON-NLS-1$ data.getModeLabel().toLowerCase()); break; case USE_REMOTE_EXECUTABLE: - if (data.getExeSelectionPath() == null) + if (debugRunProcessWizardData.getExeSelectionPath() == null) status = error(Messages.getString("DebugRunProcessSection.NoRemoteExeError"), //$NON-NLS-1$ data.getModeLabel().toLowerCase()); break; @@ -116,7 +119,7 @@ break; } - if (data.isInstallPackage() && (data.getSisPath() == null || data.getSisPath().length() == 0)) + if (debugRunProcessWizardData.isInstallPackage() && (debugRunProcessWizardData.getSisPath() == null || debugRunProcessWizardData.getSisPath().length() == 0)) status = error(Messages.getString("DebugRunProcessSection.MustInstallError"), data.getModeLabel().toLowerCase()); //$NON-NLS-1$ } @@ -131,14 +134,14 @@ String copyOrInstallMsg = ""; //$NON-NLS-1$ String runOrLaunchMsg = ""; //$NON-NLS-1$ - switch (data.getExeSelection()) { + switch (debugRunProcessWizardData.getExeSelection()) { case USE_PROJECT_EXECUTABLE: runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), - data.getExeSelectionPath().lastSegment()); //$NON-NLS-1$ + debugRunProcessWizardData.getExeSelectionPath().lastSegment()); //$NON-NLS-1$ break; case USE_REMOTE_EXECUTABLE: runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), - PathUtils.convertPathToWindows(data.getExeSelectionPath().toString())); //$NON-NLS-1$ + PathUtils.convertPathToWindows(debugRunProcessWizardData.getExeSelectionPath().toString())); //$NON-NLS-1$ break; case ATTACH_TO_PROCESS: runOrLaunchMsg = Messages.getString("DebugRunProcessSection.AttachMsg"); //$NON-NLS-1$ @@ -157,8 +160,8 @@ } private String getCopyOrInstallMsg() { - if (data.requiresInstallPackage()) - return MessageFormat.format(Messages.getString("DebugRunProcessSection.InstallMsg"), data.getSisPath()); //$NON-NLS-1$ + if (debugRunProcessWizardData.requiresInstallPackage()) + return MessageFormat.format(Messages.getString("DebugRunProcessSection.InstallMsg"), debugRunProcessWizardData.getSisPath()); //$NON-NLS-1$ else return Messages.getString("DebugRunProcessSection.CopyMsg"); //$NON-NLS-1$ } diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/IConnectionWizardData.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/IConnectionWizardData.java Wed Oct 20 09:35:54 2010 -0500 @@ -0,0 +1,54 @@ +/* +* 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 com.nokia.carbide.remoteconnections.interfaces.IConnection; +import com.nokia.carbide.remoteconnections.interfaces.IService; + +/** + * Interface for connection wizard data + */ +public interface IConnectionWizardData { + + /** + * The service the connection must support + * @return IService + */ + IService getService(); + + /** + * Set the connection + * @param connection IConnection + */ + void setConnection(IConnection connection); + + /** + * Return the connection + * @return IConnection + */ + IConnection getConnection(); + + /** + * Return the connection name or null + * @return String + */ + String getConnectionName(); + + +} diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/IDebugRunProcessWizardData.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/IDebugRunProcessWizardData.java Wed Oct 20 09:35:54 2010 -0500 @@ -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.util.List; + +import org.eclipse.core.runtime.IPath; + +/** + * + */ +public interface IDebugRunProcessWizardData { + + enum EExeSelection { + USE_PROJECT_EXECUTABLE, + USE_REMOTE_EXECUTABLE, + ATTACH_TO_PROCESS, + }; + + /** + * Set the SIS path string + * @param sisPath String + */ + void setSisPath(String sisPath); + + /** + * Return the SIS path string + * @return String + */ + String getSisPath(); + + /** + * Return the install option + * @return boolean + */ + boolean isInstallPackage(); + + /** + * Set the install option + * @param installPackage + */ + void setInstallPackage(boolean installPackage); + + /** + * Return the exe selection + * @return EExeSelection + */ + EExeSelection getExeSelection(); + + /** + * Set exe selection + * @param exeSelection EExeSelection + */ + void setExeSelection(EExeSelection exeSelection); + + /** + * Derive the exe path using the exe selection + * @return IPath + */ + IPath getExePath(); + + /** + * Return all exes + * @return List + */ + List getExes(); + + /** + * Return a list of launchable exes + * @return List + */ + List getLaunchableExes(); + + /** + * Return exe selection path value + * @return IPath + */ + IPath getExeSelectionPath(); + + /** + * Set exe selection path value + * @param path IPath + */ + void setExeSelectionPath(IPath path); + + /** + * Get default executable + * @return IPath + */ + IPath getDefaultExecutable(); + + /** + * Return whether we can detect that the current connection is Sys TRK. + * @return Boolean.TRUE if Sys TRK, Boolean.FALSE if App TRK, or null if unknown + */ + Boolean isSysTRKConnection(); + + /** + * Return whether Carbide is running in an internal layout. + * @return true if the installation includes known internal-only plugins + */ + boolean isInternalLayout(); + + /** + * Return whether the installing is required for this launch + * @return boolean + */ + boolean requiresInstallPackage(); + +} diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/IOtherSettingsWizardData.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/IOtherSettingsWizardData.java Wed Oct 20 09:35:54 2010 -0500 @@ -0,0 +1,56 @@ +/* +* 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; + +/** + * + */ +public interface IOtherSettingsWizardData { + + enum EBuildBeforeLaunchOption { + ALWAYS, + NEVER, + USE_WORKSPACE_SETTING, + } + + /** + * Set the build before launch option + * @param option EBuildBeforeLaunchOption + */ + void setBuildBeforeLaunchOption(EBuildBeforeLaunchOption option); + + /** + * Get the build before launch option + * @return EBuildBeforeLaunchOption + */ + EBuildBeforeLaunchOption getBuildBeforeLaunch(); + + /** + * Return the workspace setting + * @return boolean + */ + boolean isWorkspaceBuildBeforeLaunch(); + + /** + * Return whether to build before launch for this launch + * @return boolean + */ + boolean isCurrentBuildBeforeLaunch(); + +} diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/IWizardData.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/IWizardData.java Wed Oct 20 09:35:54 2010 -0500 @@ -0,0 +1,74 @@ +/* +* 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.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; + +/** + * The main interface for the wizard data + * (implementors will typically also implement section specific interfaces) + */ +public interface IWizardData { + + /** + * @return the label for the launch mode (i.e., "Debug" or "Run") + */ + String getModeLabel(); + + /** + * Create a launch configuration from the data + * @return ILaunchConfigurationWorkingCopy + * @throws CoreException + */ + ILaunchConfigurationWorkingCopy createConfiguration() throws CoreException; + + /** + * Make and return a copy + * @return IWizardData + */ + IWizardData copy(); + + /** + * Set this data from another + * @param launchWizardData IWizardData + */ + void apply(IWizardData launchWizardData); + + /** + * Validate the data + * @return IStatus + */ + IStatus validate(); + + /** + * Return true if this launch is for debug + * @return boolean + */ + boolean isDebug(); + + /** + * Get the project for this launch + * @return IProject + */ + IProject getProject(); + +} diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizard.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizard.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizard.java Wed Oct 20 09:35:54 2010 -0500 @@ -17,7 +17,6 @@ package com.nokia.cdt.internal.debug.launch.newwizard; -import com.nokia.carbide.remoteconnections.interfaces.IService; import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions; /** @@ -27,13 +26,20 @@ */ public class LaunchWizard extends AbstractLaunchWizard { - public LaunchWizard(LaunchOptions launchOptions, IService trkService) { - super(launchOptions, trkService, Messages.getString("LaunchWizard.Title")); //$NON-NLS-1$ - } + public LaunchWizard(LaunchOptions launchOptions) { + super(launchOptions, Messages.getString("LaunchWizard.Title")); //$NON-NLS-1$ + } @Override - protected AbstractUnifiedLaunchOptionsPage createMainPage(LaunchWizardData data) { + protected AbstractUnifiedLaunchOptionsPage createMainPage(IWizardData data) { return new UnifiedLaunchOptionsPage(data); } + @Override + protected IWizardData createWizardData(LaunchOptions launchOptions) { + LaunchWizardData wizardData = new LaunchWizardData(); + wizardData.initialize(launchOptions); + return wizardData; + } + } diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java Wed Oct 20 09:35:54 2010 -0500 @@ -29,14 +29,11 @@ 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.DebugPlugin; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.ui.IDebugUIConstants; import org.osgi.framework.Bundle; -import org.osgi.service.prefs.Preferences; import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; @@ -46,6 +43,7 @@ import com.nokia.carbide.remoteconnections.internal.api.IConnectedService2; import com.nokia.carbide.remoteconnections.internal.registry.Registry; import com.nokia.cdt.debug.cw.symbian.SettingsData; +import com.nokia.cdt.internal.debug.launch.LaunchPlugin; import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions; import com.nokia.cpp.internal.api.utils.core.TextUtils; @@ -55,7 +53,11 @@ * Data manipulated by the launch wizard and its dialogs. */ @SuppressWarnings("restriction") -public class LaunchWizardData extends LaunchOptions { +public class LaunchWizardData extends LaunchOptions implements + IWizardData, + IConnectionWizardData, + IDebugRunProcessWizardData, + IOtherSettingsWizardData { /** * This plugin is only shipped in internal layouts and is used as a fallback * to determine whether Sys TRK is more likely to be available than App TRK @@ -71,7 +73,7 @@ String isValidPath(IPath path); } - private final IService service; + private IService service; // overall target public static class LaunchType { @@ -94,13 +96,6 @@ public final static LaunchType SYS_TRK = new LaunchType(null); public final static LaunchType ATTACH_TO_PROCESS_LAUNCH = 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; @@ -109,14 +104,10 @@ private IConnection connection; private List launchableExes; - // settings made in the Other Settings section - enum EBuildBeforeLaunchOption { - ALWAYS, - NEVER, - USE_WORKSPACE_SETTING, + public LaunchWizardData() { } - public LaunchWizardData(LaunchOptions launchOptions, IService dbgService) { + public void initialize(LaunchOptions launchOptions) { this.mmps = launchOptions.mmps; this.exes = launchOptions.exes; this.defaultExecutable = launchOptions.defaultExecutable; @@ -125,7 +116,7 @@ this.isEmulation = launchOptions.isEmulation; this.emulatorOnly = launchOptions.emulatorOnly; this.mode = launchOptions.mode; - this.service = dbgService; + service = LaunchPlugin.getRunModeDebugService(); } /** @@ -230,12 +221,7 @@ /** 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); + return WizardDataUtils.isWorkspaceBuildBeforeLaunch(); } /** Get actual launch-time setting */ @@ -294,13 +280,15 @@ launchOptions.isEmulation = isEmulation; launchOptions.emulatorOnly = emulatorOnly; launchOptions.mode = mode; - LaunchWizardData d = new LaunchWizardData(launchOptions, service); + LaunchWizardData d = new LaunchWizardData(); + d.initialize(launchOptions); d.exeSelection = exeSelection; d.exeSelectionPath = exeSelectionPath; d.buildBeforeLaunch = buildBeforeLaunch; d.installPackage = installPackage; d.sisPath = sisPath; d.connection = connection; + d.service = service; return d; } @@ -308,7 +296,8 @@ * Apply the given data to the receiver (when a transient dialog is accepted) * @param dialogData */ - public void apply(LaunchWizardData dialogData) { + public void apply(IWizardData launchWizardData) { + LaunchWizardData dialogData = (LaunchWizardData) launchWizardData; exeSelection = dialogData.exeSelection; exeSelectionPath = dialogData.exeSelectionPath; buildBeforeLaunch = dialogData.buildBeforeLaunch; @@ -467,5 +456,6 @@ } config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue); } + } diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsDialog.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsDialog.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsDialog.java Wed Oct 20 09:35:54 2010 -0500 @@ -34,7 +34,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.dialogs.PreferencesUtil; -import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EBuildBeforeLaunchOption; +import com.nokia.cdt.internal.debug.launch.newwizard.IOtherSettingsWizardData.EBuildBeforeLaunchOption; /** * This dialog allows in-depth configuration of the other settings in the launch. @@ -46,9 +46,11 @@ private Button fEnableBuildButton; private Button fWorkspaceSettingsButton; private Link fWorkspaceSettingsLink; + private IOtherSettingsWizardData otherSettingsWizardData; - protected OtherSettingsDialog(Shell shell, LaunchWizardData data) { + protected OtherSettingsDialog(Shell shell, IWizardData data) { super(shell, data); + otherSettingsWizardData = (IOtherSettingsWizardData) data; } @@ -93,7 +95,7 @@ fDisableBuildButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.NEVER); + otherSettingsWizardData.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.NEVER); } }); @@ -108,7 +110,7 @@ fEnableBuildButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.ALWAYS); + otherSettingsWizardData.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.ALWAYS); } }); @@ -123,7 +125,7 @@ fWorkspaceSettingsButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING); + otherSettingsWizardData.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING); } }); @@ -145,7 +147,7 @@ } }); - switch (data.getBuildBeforeLaunch()) { + switch (otherSettingsWizardData.getBuildBeforeLaunch()) { case ALWAYS: fEnableBuildButton.setSelection(true); fEnableBuildButton.setFocus(); @@ -171,7 +173,7 @@ updateStatus(status); String wsState = ""; //$NON-NLS-1$ - if (data.isWorkspaceBuildBeforeLaunch()) + if (otherSettingsWizardData.isWorkspaceBuildBeforeLaunch()) wsState = Messages.getString("OtherSettingsDialog.EnabledLabel"); //$NON-NLS-1$ else wsState = Messages.getString("OtherSettingsDialog.DisabledLabel"); //$NON-NLS-1$ diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsSection.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsSection.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsSection.java Wed Oct 20 09:35:54 2010 -0500 @@ -21,19 +21,21 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; -import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EBuildBeforeLaunchOption; +import com.nokia.cdt.internal.debug.launch.newwizard.IOtherSettingsWizardData.EBuildBeforeLaunchOption; /** * Present the "Build before debug" section with a short description. */ public class OtherSettingsSection extends AbstractLaunchWizardSection { + private IOtherSettingsWizardData otherSettingsWizardData; + /** * */ - public OtherSettingsSection(LaunchWizardData data, AbstractUnifiedLaunchOptionsPage launchOptionsPage) { + public OtherSettingsSection(IWizardData data, AbstractUnifiedLaunchOptionsPage launchOptionsPage) { super(data, Messages.getString("OtherSettingsSection.Title"), launchOptionsPage); //$NON-NLS-1$ - + otherSettingsWizardData = (IOtherSettingsWizardData) data; } /* (non-Javadoc) @@ -51,7 +53,7 @@ } public void initializeSettings() { - data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING); + otherSettingsWizardData.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING); } /* (non-Javadoc) @@ -70,10 +72,10 @@ String msg; String ifWorkspace = ""; //$NON-NLS-1$ - if (data.getBuildBeforeLaunch() == EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING) + if (otherSettingsWizardData.getBuildBeforeLaunch() == EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING) ifWorkspace = Messages.getString("OtherSettingsSection.WorkspaceLabel"); //$NON-NLS-1$ - if (data.isCurrentBuildBeforeLaunch()) + if (otherSettingsWizardData.isCurrentBuildBeforeLaunch()) msg = Messages.getString("OtherSettingsSection.BuildBeforeLabel"); //$NON-NLS-1$ else msg = Messages.getString("OtherSettingsSection.NoBuildBeforeLabel"); //$NON-NLS-1$ @@ -86,7 +88,7 @@ */ @Override protected AbstractLaunchSettingsDialog createChangeSettingsDialog( - Shell shell, LaunchWizardData dialogData) { + Shell shell, IWizardData dialogData) { return new OtherSettingsDialog(shell, dialogData); } diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java Tue Oct 19 14:41:12 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java Wed Oct 20 09:35:54 2010 -0500 @@ -23,7 +23,7 @@ import org.eclipse.core.runtime.Status; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; -import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EExeSelection; +import com.nokia.cdt.internal.debug.launch.newwizard.IDebugRunProcessWizardData.EExeSelection; /** * This page presents three sections: @@ -43,7 +43,7 @@ */ public class UnifiedLaunchOptionsPage extends AbstractUnifiedLaunchOptionsPage { - public UnifiedLaunchOptionsPage(LaunchWizardData data) { + public UnifiedLaunchOptionsPage(IWizardData data) { super(Messages.getString("UnifiedLaunchOptionsPage.Title"), data); //$NON-NLS-1$ setDescription(Messages.getString("UnifiedLaunchOptionsPage.Desc")); //$NON-NLS-1$ @@ -57,17 +57,19 @@ } private IStatus checkBuildProducts() { - if (!data.isCurrentBuildBeforeLaunch()) { + IOtherSettingsWizardData otherSettingsWizardData = (IOtherSettingsWizardData) data; + if (!otherSettingsWizardData.isCurrentBuildBeforeLaunch()) { // check sis files - String sisPath = data.getSisPath(); - if (data.isInstallPackage() && + IDebugRunProcessWizardData debugRunProcessWizardData = (IDebugRunProcessWizardData) data; + String sisPath = debugRunProcessWizardData.getSisPath(); + if (debugRunProcessWizardData.isInstallPackage() && sisPath != null && !new File(sisPath).exists()) { return new Status(IStatus.WARNING, LaunchPlugin.PLUGIN_ID, Messages.getString("UnifiedLaunchOptionsPage.SISFileMissingWarning")); //$NON-NLS-1$ } // check launch file - if (data.getExeSelection().equals(EExeSelection.USE_PROJECT_EXECUTABLE) && - !data.getExePath().toFile().exists()) { + if (debugRunProcessWizardData.getExeSelection().equals(EExeSelection.USE_PROJECT_EXECUTABLE) && + !debugRunProcessWizardData.getExePath().toFile().exists()) { return new Status(IStatus.WARNING, LaunchPlugin.PLUGIN_ID, Messages.getString("UnifiedLaunchOptionsPage.ExeFileMissingWarning")); //$NON-NLS-1$ } diff -r aa3898248f39 -r f0a9f2d04d4a debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/WizardDataUtils.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/WizardDataUtils.java Wed Oct 20 09:35:54 2010 -0500 @@ -0,0 +1,43 @@ +/* +* 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.Platform; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.osgi.service.prefs.Preferences; + + +/** + * + */ +public class WizardDataUtils { + + /** Get current workspace setting */ + public static 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); + } + + +}