# HG changeset patch # User timkelly # Date 1266349452 21600 # Node ID bff887fe7694cdd06de93648d872e39a081184b8 # Parent 885b827031ab25e865f82e487b68590bbaf0bbf8# Parent 15c9cbbf670749061066a945db2e9386a66e5b36 merge commit diff -r 885b827031ab -r bff887fe7694 connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/agent/PCCSDiscoveryAgent.java --- a/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/agent/PCCSDiscoveryAgent.java Tue Feb 16 13:43:06 2010 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/agent/PCCSDiscoveryAgent.java Tue Feb 16 13:44:12 2010 -0600 @@ -21,6 +21,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.Set; import org.eclipse.core.runtime.CoreException; @@ -228,7 +229,7 @@ * @return */ private String createUniqueId(DeviceConnection conn) { - return getClass().getSimpleName() + ": " + conn.friendlyName; //$NON-NLS-1$ + return getClass().getSimpleName() + ": " + conn.friendlyName + ": " + conn.address; //$NON-NLS-1$ } /** @@ -271,8 +272,22 @@ } private void disconnectAll() { - for (IConnection2 connection : connections.values()) { - manager.disconnect(connection); + if (connections.isEmpty()) + return; + Set keySet = connections.keySet(); + for (String key : keySet) { + IConnection2 connection = connections.get(key); + // if manager knows about this connection, disconnect + // otherwise it has already been removed from our system + if (manager.findConnection(connection.getIdentifier()) != null) { + // not removed yet, disconnect only + manager.disconnect(connection); + } else { + // it's been removed from system + // remove it from our list also + connections.remove(key); + } + } } diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java --- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java Tue Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java Tue Feb 16 13:44:12 2010 -0600 @@ -224,18 +224,19 @@ private void setConnectionStatus(IConnection2 connection, boolean isSysTRK, EStatus trkStatus, EStatus traceStatus) { // use trk status EConnectionStatus connectionStatus = service2ConnectionStatus(trkStatus); - // if sys trk, tracing also used - if (isSysTRK && connectionStatus.equals(EConnectionStatus.READY)) { - connectionStatus = service2ConnectionStatus(traceStatus); - } + // NOTE: removing trace status logic for now +// // if sys trk, tracing also used +// if (isSysTRK && connectionStatus.equals(EConnectionStatus.READY)) { +// connectionStatus = service2ConnectionStatus(traceStatus); +// } String shortDesc = getShortDescriptionForStatus(connectionStatus); StringBuilder longDesc = new StringBuilder(Messages.getString("ConnectionStatusReconciler_TRKServicePrefix")); //$NON-NLS-1$ longDesc.append(getServiceStatusString(trkStatus)); - if (isSysTRK) { - longDesc.append(Messages.getString("ConnectionStatusReconciler_TracingServicePrefix")); //$NON-NLS-1$ - longDesc.append(getServiceStatusString(traceStatus)); - } +// if (isSysTRK) { +// longDesc.append(Messages.getString("ConnectionStatusReconciler_TracingServicePrefix")); //$NON-NLS-1$ +// longDesc.append(getServiceStatusString(traceStatus)); +// } connection.setStatus(new ConnectionStatus(connectionStatus, shortDesc, longDesc.toString())); } diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/plugin.xml --- a/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Tue Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Tue Feb 16 13:44:12 2010 -0600 @@ -176,11 +176,11 @@ + class="com.nokia.cdt.internal.debug.launch.BoardLaunchShortcut" + id="com.nokia.cdt.debug.launch.symbianCPPShortcut.board"> @@ -210,23 +210,185 @@ forcePluginActivation="true" property="com.nokia.cdt.debug.launch.isExecutable"/> + + + label="Run Symbian OS Application on board"/> + label="Debug Symbian OS Application on board"/> + description="Runs on a development board or reference hardware using a JTAG connection."/> + description="Debugs on a development board or reference hardware using a JTAG connection."/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -234,7 +396,7 @@ @@ -281,40 +443,4 @@ - - - - - - - - - - - - - - - - - - - - diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AbstractSymbianLaunchShortcut.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/AbstractSymbianLaunchShortcut.java Tue Feb 16 13:44:12 2010 -0600 @@ -0,0 +1,185 @@ +package com.nokia.cdt.internal.debug.launch; + +import java.util.List; + +import org.eclipse.cdt.debug.core.executables.Executable; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.ILaunchShortcut2; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IFileEditorInput; + +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; + +public abstract class AbstractSymbianLaunchShortcut implements ILaunchShortcut2 { + + protected abstract void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode); + + public void launch(IEditorPart editor, String mode) { + // launch an existing config if one exists + ILaunchConfiguration[] configs = getLaunchConfigurations(editor); + if (configs.length > 0) { + // just launch the first one that supports the mode + for (ILaunchConfiguration config : configs) { + try { + if (config.supportsMode(mode)) { + DebugUITools.launch(configs[0], mode); + return; + } + } catch (CoreException e) { + e.printStackTrace(); + } + } + } + + IEditorInput editorInput = editor.getEditorInput(); + if (editorInput instanceof IFileEditorInput) { + IFile file = ((IFileEditorInput)editorInput).getFile(); + if (file != null) { + launchProject(file.getProject(), null, null, mode); + } + } + } + + public void launch(ISelection selection, String mode) { + + // launch an existing config if one exists + ILaunchConfiguration[] configs = getLaunchConfigurations(selection); + if (configs.length > 0) { + // just launch the first one that supports the mode + for (ILaunchConfiguration config : configs) { + try { + if (config.supportsMode(mode)) { + DebugUITools.launch(configs[0], mode); + return; + } + } catch (CoreException e) { + e.printStackTrace(); + } + } + } + + IPath defaultMMP = null; + boolean launched = false; + Executable executable = null; + + if (selection instanceof IStructuredSelection) { + Object firstElement = ((IStructuredSelection) selection).getFirstElement(); + if (firstElement != null && firstElement instanceof Executable) + { + launchProject(((Executable)firstElement).getProject(), (Executable)firstElement, defaultMMP, mode); + launched = true; + } + else + if (firstElement != null && firstElement instanceof IAdaptable) + { + IFile file = (IFile) ((IAdaptable) firstElement).getAdapter(IFile.class); + if (file != null) + { + IPath filePath = file.getLocation(); + if ("mmp".equalsIgnoreCase(filePath.getFileExtension())) + { + defaultMMP = filePath; + } + else + { + executable = new Executable(file.getLocation(), file.getProject(), file); + launchProject(file.getProject(), executable, defaultMMP, mode); + launched = true; + } + } + } + } + + if (!launched) + { + List projects = CarbideBuilderPlugin.getProjectsFromSelection(selection); + if (projects.size() > 0) { + launchProject(projects.get(0), executable, defaultMMP, mode); + } + } + } + + public ILaunchConfiguration[] getLaunchConfigurations(ISelection selection) { + IPath defaultMMP = null; + if (selection instanceof IStructuredSelection) { + Object firstElement = ((IStructuredSelection) selection).getFirstElement(); + if (firstElement != null && firstElement instanceof Executable) + { + return LaunchPlugin.getDefault().getLaunchConfigurations(((Executable)firstElement).getProject(), (Executable)firstElement, defaultMMP); + } + else + if (firstElement != null && firstElement instanceof IAdaptable) + { + IFile file = (IFile) ((IAdaptable) firstElement).getAdapter(IFile.class); + if (file != null) + { + IPath filePath = file.getLocation(); + if ("mmp".equalsIgnoreCase(filePath.getFileExtension())) + { + defaultMMP = filePath; + } + Executable executable = new Executable(file.getLocation(), file.getProject(), file); + return LaunchPlugin.getDefault().getLaunchConfigurations(file.getProject(), executable, defaultMMP); + } + } + } + + List projects = CarbideBuilderPlugin.getProjectsFromSelection(selection); + if (projects.size() > 0) { + return LaunchPlugin.getDefault().getLaunchConfigurations(projects.get(0), null, defaultMMP); + } + return null; + } + + public ILaunchConfiguration[] getLaunchConfigurations(IEditorPart editorpart) { + IEditorInput editorInput = editorpart.getEditorInput(); + if (editorInput instanceof IFileEditorInput) { + IFile file = ((IFileEditorInput)editorInput).getFile(); + if (file != null) { + return LaunchPlugin.getDefault().getLaunchConfigurations(file.getProject(), null, null); + } + } + return null; + } + + public IResource getLaunchableResource(ISelection selection) { + if (selection instanceof IStructuredSelection) { + Object firstElement = ((IStructuredSelection) selection).getFirstElement(); + if (firstElement != null && firstElement instanceof IFile) + { + IFile file = (IFile) firstElement; + return file.getProject(); + } + if (firstElement != null && firstElement instanceof Executable) + { + return ((Executable)firstElement).getProject(); + } + } + List projects = CarbideBuilderPlugin.getProjectsFromSelection(selection); + if (projects.size() > 0) { + return projects.get(0); + } + return null; + } + + public IResource getLaunchableResource(IEditorPart editorpart) { + IEditorInput editorInput = editorpart.getEditorInput(); + if (editorInput instanceof IFileEditorInput) { + IFile file = ((IFileEditorInput)editorInput).getFile(); + if (file != null) { + return file.getProject(); + } + } + return null; + } +} \ No newline at end of file diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/BoardLaunchShortcut.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/BoardLaunchShortcut.java Tue Feb 16 13:44:12 2010 -0600 @@ -0,0 +1,55 @@ +/* +* 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; + +import org.eclipse.cdt.debug.core.executables.Executable; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; + +import com.nokia.cdt.internal.debug.launch.LaunchPlugin.ILaunchCreationWizardFactory; +import com.nokia.cdt.internal.debug.launch.wizard.AbstractLaunchWizard; +import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard; +import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizard; +import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizardInstance; +import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions; + +public class BoardLaunchShortcut extends AbstractSymbianLaunchShortcut { + + @Override + protected void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode) { + LaunchPlugin.getDefault().launchProject(project, executable, defaultMMP, mode, + new ILaunchCreationWizardFactory() { + public ILaunchCreationWizard createLaunchCreationWizard(LaunchOptions launchOptions) throws Exception { + LaunchCreationWizard creationWizard = + LaunchCreationWizardInstance.getInstance().create( + launchOptions.project, + launchOptions.configurationName, + launchOptions.mmps, + launchOptions.exes, + launchOptions.defaultExecutable, + launchOptions.isEmulation, + launchOptions.emulatorOnly, + launchOptions.mode); + creationWizard.setCategoryId(AbstractLaunchWizard.BOARD_CATEGORY_ID); + return creationWizard; + } + }); + } + + +} + diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/EmulatorLaunchShortcut.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/EmulatorLaunchShortcut.java Tue Feb 16 13:44:12 2010 -0600 @@ -0,0 +1,49 @@ +/* +* 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; + +import org.eclipse.cdt.debug.core.executables.Executable; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; + +import com.nokia.cdt.internal.debug.launch.LaunchPlugin.ILaunchCreationWizardFactory; +import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard; +import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizardInstance; +import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions; + +public class EmulatorLaunchShortcut extends AbstractSymbianLaunchShortcut { + + @Override + protected void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode) { + LaunchPlugin.getDefault().launchProject(project, executable, defaultMMP, mode, + new ILaunchCreationWizardFactory() { + public ILaunchCreationWizard createLaunchCreationWizard(LaunchOptions launchOptions) throws Exception { + return LaunchCreationWizardInstance.getInstance().create( + launchOptions.project, + launchOptions.configurationName, + launchOptions.mmps, + launchOptions.exes, + launchOptions.defaultExecutable, + launchOptions.isEmulation, + launchOptions.emulatorOnly, + launchOptions.mode); + } + }); + } + +} + diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Tue Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Tue Feb 16 13:44:12 2010 -0600 @@ -16,23 +16,51 @@ */ package com.nokia.cdt.internal.debug.launch; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.MissingResourceException; +import java.util.ResourceBundle; -import org.eclipse.cdt.core.model.*; +import org.eclipse.cdt.core.model.CModelException; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.IBinary; +import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.executables.Executable; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.*; -import org.eclipse.debug.core.*; -import org.eclipse.debug.ui.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationListener; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchListener; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.ui.AbstractDebugView; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.ui.IDebugView; import org.eclipse.debug.ui.contexts.DebugContextEvent; import org.eclipse.debug.ui.contexts.IDebugContextListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.*; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.*; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IPartListener2; +import org.eclipse.ui.IStartup; +import org.eclipse.ui.IWindowListener; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPartReference; +import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.progress.UIJob; import org.osgi.framework.BundleContext; @@ -46,15 +74,20 @@ import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.IService; -import com.nokia.cdt.debug.cw.symbian.*; -import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizard; -import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizardInstance; +import com.nokia.cdt.debug.cw.symbian.SettingsData; +import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard; +import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions; import com.nokia.cpp.internal.api.utils.core.Logging; /** * The main plugin class to be used in the desktop. */ public class LaunchPlugin extends AbstractUIPlugin implements ILaunchListener, ILaunchConfigurationListener, IStartup { + + public interface ILaunchCreationWizardFactory { + ILaunchCreationWizard createLaunchCreationWizard(LaunchOptions launchOptions) throws Exception; + } + //The shared instance. private static LaunchPlugin plugin; //Resource bundle. @@ -206,7 +239,8 @@ return isX86; } - private ILaunchConfiguration createConfigurationForProject(IProject project, Executable executable, IPath defaultMMP, String mode) throws CoreException { + private ILaunchConfiguration createConfigurationForProject(IProject project, Executable executable, + IPath defaultMMP, String mode, ILaunchCreationWizardFactory wizardFactory) throws CoreException { boolean openLaunchConfigDialog = false; @@ -292,15 +326,17 @@ // which exe to launch or emulator if not required, // which non-emulator launch type, // or both + LaunchOptions launchOptions = new LaunchOptions(); + launchOptions.project = project; + launchOptions.mode = mode; + launchOptions.configurationName = defaultConfigName; + launchOptions.isEmulation = isX86; + launchOptions.emulatorOnly = useEmulatorByDefault; + launchOptions.defaultExecutable = defaultExecutable; + launchOptions.exes = exePaths; + launchOptions.mmps = mmpPaths; try { - final LaunchCreationWizard wizard = - LaunchCreationWizardInstance.getInstance().create(project, defaultConfigName, mmpPaths, exePaths, defaultExecutable, isX86, useEmulatorByDefault, mode); - Display.getDefault().syncExec(new Runnable() { - public void run() { - wizard.init(PlatformUI.getWorkbench(), null); - wizard.openWizard(CUIPlugin.getActiveWorkbenchShell()); - } - }); + final ILaunchCreationWizard wizard = openLaunchCreationWizard(launchOptions, wizardFactory); config = wizard.getLaunchConfiguration(); openLaunchConfigDialog = wizard.shouldOpenLaunchConfigurationDialog(); } @@ -326,6 +362,19 @@ return null; } + private ILaunchCreationWizard openLaunchCreationWizard(LaunchOptions launchOptions, + ILaunchCreationWizardFactory wizardFactory) throws Exception { + final ILaunchCreationWizard wizard = + wizardFactory.createLaunchCreationWizard(launchOptions); + Display.getDefault().syncExec(new Runnable() { + public void run() { + wizard.init(); + wizard.openWizard(CUIPlugin.getActiveWorkbenchShell()); + } + }); + return wizard; + } + public ILaunchConfiguration[] getLaunchConfigurations(IProject project, Executable executable, IPath defaultMMP) { IPath defaultExecutable = null; @@ -368,10 +417,11 @@ return configs.toArray(new ILaunchConfiguration[configs.size()]); } - public void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode) { + public void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode, + ILaunchCreationWizardFactory wizardFactory) { ILaunchConfiguration configuration = null; try { - configuration = createConfigurationForProject(project, executable, defaultMMP, mode); + configuration = createConfigurationForProject(project, executable, defaultMMP, mode, wizardFactory); } catch (CoreException e) { log(e); } @@ -540,7 +590,7 @@ }); } - + public static IService getTRKService() { return RemoteConnectionsActivator.getConnectionTypeProvider(). findServiceByID("com.nokia.carbide.trk.support.service.TRKService"); //$NON-NLS-1$ diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/PhoneLaunchShortcut.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/PhoneLaunchShortcut.java Tue Feb 16 13:44:12 2010 -0600 @@ -0,0 +1,45 @@ +/* +* 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; + +import org.eclipse.cdt.debug.core.executables.Executable; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; + +import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; +import com.nokia.carbide.remoteconnections.interfaces.IConnectionTypeProvider; +import com.nokia.carbide.remoteconnections.interfaces.IService; +import com.nokia.cdt.internal.debug.launch.LaunchPlugin.ILaunchCreationWizardFactory; +import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizard; +import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard; +import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions; + +public class PhoneLaunchShortcut extends AbstractSymbianLaunchShortcut { + + @Override + protected void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode) { + LaunchPlugin.getDefault().launchProject(project, executable, defaultMMP, mode, + new ILaunchCreationWizardFactory() { + public ILaunchCreationWizard createLaunchCreationWizard(LaunchOptions launchOptions) throws Exception { + IConnectionTypeProvider provider = RemoteConnectionsActivator.getConnectionTypeProvider(); + IService trkService = provider.findServiceByID("com.nokia.carbide.trk.support.service.TRKService"); //$NON-NLS-1$ + LaunchWizard launchWizard = new LaunchWizard(launchOptions, trkService); + return launchWizard; + }; + }); + } +} \ No newline at end of file diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianLaunchShortcut.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianLaunchShortcut.java Tue Feb 16 13:43:06 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -/* -* 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; - -import java.util.List; - -import org.eclipse.cdt.debug.core.executables.Executable; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.ILaunchShortcut2; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; - -import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; - -public class SymbianLaunchShortcut implements ILaunchShortcut2 { - - public void launch(IEditorPart editor, String mode) { - // launch an existing config if one exists - ILaunchConfiguration[] configs = getLaunchConfigurations(editor); - if (configs.length > 0) { - // just launch the first one that supports the mode - for (ILaunchConfiguration config : configs) { - try { - if (config.supportsMode(mode)) { - DebugUITools.launch(configs[0], mode); - return; - } - } catch (CoreException e) { - e.printStackTrace(); - } - } - } - - IEditorInput editorInput = editor.getEditorInput(); - if (editorInput instanceof IFileEditorInput) { - IFile file = ((IFileEditorInput)editorInput).getFile(); - if (file != null) { - launchProject(file.getProject(), null, null, mode); - } - } - } - - public void launch(ISelection selection, String mode) { - - // launch an existing config if one exists - ILaunchConfiguration[] configs = getLaunchConfigurations(selection); - if (configs.length > 0) { - // just launch the first one that supports the mode - for (ILaunchConfiguration config : configs) { - try { - if (config.supportsMode(mode)) { - DebugUITools.launch(configs[0], mode); - return; - } - } catch (CoreException e) { - e.printStackTrace(); - } - } - } - - IPath defaultMMP = null; - boolean launched = false; - Executable executable = null; - - if (selection instanceof IStructuredSelection) { - Object firstElement = ((IStructuredSelection) selection).getFirstElement(); - if (firstElement != null && firstElement instanceof Executable) - { - launchProject(((Executable)firstElement).getProject(), (Executable)firstElement, defaultMMP, mode); - launched = true; - } - else - if (firstElement != null && firstElement instanceof IAdaptable) - { - IFile file = (IFile) ((IAdaptable) firstElement).getAdapter(IFile.class); - if (file != null) - { - IPath filePath = file.getLocation(); - if ("mmp".equalsIgnoreCase(filePath.getFileExtension())) - { - defaultMMP = filePath; - } - else - { - executable = new Executable(file.getLocation(), file.getProject(), file); - launchProject(file.getProject(), executable, defaultMMP, mode); - launched = true; - } - } - } - } - - if (!launched) - { - List projects = CarbideBuilderPlugin.getProjectsFromSelection(selection); - if (projects.size() > 0) { - launchProject(projects.get(0), executable, defaultMMP, mode); - } - } - } - - private void launchProject(final IProject project, final Executable executable, final IPath defaultMMP, final String mode) { - LaunchPlugin.getDefault().launchProject(project, executable, defaultMMP, mode); - } - - public ILaunchConfiguration[] getLaunchConfigurations(ISelection selection) { - IPath defaultMMP = null; - if (selection instanceof IStructuredSelection) { - Object firstElement = ((IStructuredSelection) selection).getFirstElement(); - if (firstElement != null && firstElement instanceof Executable) - { - return LaunchPlugin.getDefault().getLaunchConfigurations(((Executable)firstElement).getProject(), (Executable)firstElement, defaultMMP); - } - else - if (firstElement != null && firstElement instanceof IAdaptable) - { - IFile file = (IFile) ((IAdaptable) firstElement).getAdapter(IFile.class); - if (file != null) - { - IPath filePath = file.getLocation(); - if ("mmp".equalsIgnoreCase(filePath.getFileExtension())) - { - defaultMMP = filePath; - } - Executable executable = new Executable(file.getLocation(), file.getProject(), file); - return LaunchPlugin.getDefault().getLaunchConfigurations(file.getProject(), executable, defaultMMP); - } - } - } - - List projects = CarbideBuilderPlugin.getProjectsFromSelection(selection); - if (projects.size() > 0) { - return LaunchPlugin.getDefault().getLaunchConfigurations(projects.get(0), null, defaultMMP); - } - return null; - } - - public ILaunchConfiguration[] getLaunchConfigurations(IEditorPart editorpart) { - IEditorInput editorInput = editorpart.getEditorInput(); - if (editorInput instanceof IFileEditorInput) { - IFile file = ((IFileEditorInput)editorInput).getFile(); - if (file != null) { - return LaunchPlugin.getDefault().getLaunchConfigurations(file.getProject(), null, null); - } - } - return null; - } - - public IResource getLaunchableResource(ISelection selection) { - if (selection instanceof IStructuredSelection) { - Object firstElement = ((IStructuredSelection) selection).getFirstElement(); - if (firstElement != null && firstElement instanceof IFile) - { - IFile file = (IFile) firstElement; - return file.getProject(); - } - if (firstElement != null && firstElement instanceof Executable) - { - return ((Executable)firstElement).getProject(); - } - } - List projects = CarbideBuilderPlugin.getProjectsFromSelection(selection); - if (projects.size() > 0) { - return projects.get(0); - } - return null; - } - - public IResource getLaunchableResource(IEditorPart editorpart) { - IEditorInput editorInput = editorpart.getEditorInput(); - if (editorInput instanceof IFileEditorInput) { - IFile file = ((IFileEditorInput)editorInput).getFile(); - if (file != null) { - return file.getProject(); - } - } - return null; - } -} - diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianProjectPropertyTester.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianProjectPropertyTester.java Tue Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianProjectPropertyTester.java Tue Feb 16 13:44:12 2010 -0600 @@ -16,16 +16,22 @@ */ package com.nokia.cdt.internal.debug.launch; +import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.debug.core.executables.Executable; import org.eclipse.core.expressions.PropertyTester; 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 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.cpp.sdk.core.ISymbianBuildContext; /** * A property tester that determines if a file is an executable. @@ -41,7 +47,13 @@ } if ("isCarbideProject".equals(property)) { //$NON-NLS-1$ return isCarbideProject(receiver); - } + } + if ("isEmulator".equals(property)) { //$NON-NLS-1$ + return isEmulator(receiver); + } + if ("isNotEmulator".equals(property)) { //$NON-NLS-1$ + return !isEmulator(receiver); + } return true; } @@ -81,4 +93,63 @@ return (celement != null && celement instanceof IBinary); } + private boolean isEmulator(Object receiver) { + if (receiver instanceof Executable) { + return isEmulatorBinaryPath(((Executable) receiver).getPath()); + } + if (receiver instanceof IBinary) { + return isEmulatorBinaryPath(((IBinary) receiver).getPath()); + } + if (receiver instanceof IAdaptable) { + IResource res = (IResource) ((IAdaptable) receiver).getAdapter(IResource.class); + if (res != null) { + IProject project = res.getProject(); + if (project != null) { + ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); + if (cpi != null) { + ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); + // just check the platform for the default config + if (buildConfig.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + return true; + } + } + else { + return getIsEmulatorFromExecutablesProject(project); + } + } + } + } + return false; + } + + private boolean getIsEmulatorFromExecutablesProject(IProject project) { + ICProject cProject = CoreModel.getDefault().create(project); + if (cProject != null) { + try { + for (IBinary bin : cProject.getBinaryContainer().getBinaries()) { + if (bin.isExecutable()) { + IPath path = bin.getResource().getLocation(); + if (isEmulatorBinaryPath(path)) { + return true; + } + } + } + } catch (CModelException e) { + } + } + return false; + } + + private boolean isEmulatorBinaryPath(IPath binaryPath) { + if (binaryPath != null) { + for (String segment : binaryPath.segments()) { + if (segment.equalsIgnoreCase("winscw")) //$NON-NLS-1$ + return true; + } + } + + return false; + } + + } diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchSettingsDialog.java Tue Feb 16 13:44:12 2010 -0600 @@ -38,9 +38,9 @@ */ public abstract class AbstractLaunchSettingsDialog extends TitleAreaDialog { - protected final static String UID = ".uid"; + protected final static String UID = ".uid"; //$NON-NLS-1$ - protected final LaunchOptionsData data; + protected final LaunchWizardData data; protected int INDENT; private String title; @@ -50,7 +50,7 @@ * @param parentShell * @param data */ - public AbstractLaunchSettingsDialog(Shell parentShell, LaunchOptionsData data) { + public AbstractLaunchSettingsDialog(Shell parentShell, LaunchWizardData data) { super(parentShell); setShellStyle(getShellStyle() | SWT.RESIZE); this.data = data; @@ -61,7 +61,7 @@ @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); - newShell.setText("New Launch Configuration Wizard"); + newShell.setText(Messages.getString("AbstractLaunchSettingsDialog.Title")); //$NON-NLS-1$ } protected Composite initDialogArea(Composite parent, String title, String helpId) { @@ -115,7 +115,7 @@ setTitle(title); if (status.isOK()) { - setMessage("", IMessageProvider.NONE); + setMessage("", IMessageProvider.NONE); //$NON-NLS-1$ } else { setMessage(status.getMessage(), severityToMsgType(status.getSeverity())); } diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchWizardSection.java Tue Feb 16 13:44:12 2010 -0600 @@ -47,8 +47,8 @@ */ public abstract class AbstractLaunchWizardSection implements IWizardSection { - private static final String CHANGE_LABEL = "Change..."; - protected final LaunchOptionsData data; + private static final String CHANGE_LABEL = Messages.getString("AbstractLaunchWizardSection.ChangeLabel"); //$NON-NLS-1$ + protected final LaunchWizardData data; private String sectionName; protected IStatus status; @@ -56,11 +56,13 @@ protected Button changeButton; protected Composite control; private ISectionChangeListener changeListener; + protected final UnifiedLaunchOptionsPage launchOptionsPage; - public AbstractLaunchWizardSection(LaunchOptionsData data, String sectionName) { + public AbstractLaunchWizardSection(LaunchWizardData data, String sectionName, UnifiedLaunchOptionsPage launchOptionsPage) { this.data = data; this.sectionName = sectionName; + this.launchOptionsPage = launchOptionsPage; status = Status.OK_STATUS; } @@ -83,7 +85,7 @@ public abstract void createControl(Composite parent); /** Create the dialog for the Change... button. */ - protected abstract AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchOptionsData dialogData); + protected abstract AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchWizardData dialogData); /** Refresh the section after the Change... dialog has been closed. */ protected abstract void refresh(); @@ -162,11 +164,12 @@ * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#doChange() */ protected void doChange() { - LaunchOptionsData dialogData = data.copy(); + LaunchWizardData dialogData = data.copy(); AbstractLaunchSettingsDialog dialog = createChangeSettingsDialog(getControl().getShell(), dialogData); if (dialog.open() == Window.OK) { data.apply(dialogData); refresh(); + launchOptionsPage.getWizard().getContainer().getShell().pack(); } } diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/CommandRunLaunchWizard2.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/CommandRunLaunchWizard2.java Tue Feb 16 13:43:06 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -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 mmpFiles = EpocEngineHelper.getMMPFilesForProject(info); - IService trkService = RemoteConnectionsActivator.getConnectionTypeProvider(). - findServiceByID("com.nokia.carbide.trk.support.service.TRKService"); //$NON-NLS-1$ - - List allExePaths = new ArrayList(); - List currBuiltExePaths = new ArrayList(); - List allMMPPaths = new ArrayList(); - List currBuiltMMPPaths = new ArrayList(); - - 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; - } -} diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java Tue Feb 16 13:44:12 2010 -0600 @@ -25,8 +25,11 @@ import java.util.Set; import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; 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.ISelection; @@ -40,11 +43,15 @@ import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.FontMetrics; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; 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.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; @@ -64,11 +71,13 @@ public class ConnectToDeviceDialog extends AbstractLaunchSettingsDialog implements IConnectionListener { private IConnectionsManager manager; private IConnectionTypeProvider typeProvider; + private FontMetrics fm; private ComboViewer viewer; private Button editButton; private Label descriptionLabel; + private Button newButton; - protected ConnectToDeviceDialog(Shell shell, LaunchOptionsData data) { + protected ConnectToDeviceDialog(Shell shell, LaunchWizardData data) { super(shell, data); manager = RemoteConnectionsActivator.getConnectionsManager(); typeProvider = RemoteConnectionsActivator.getConnectionTypeProvider(); @@ -76,17 +85,15 @@ @Override protected Control createDialogArea(Composite parent) { + initializeDialogUnits(parent); final Composite composite = initDialogArea(parent, - "Change connection", + Messages.getString("ConnectToDeviceDialog.Title"), //$NON-NLS-1$ LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_CONNECTION); - Composite viewerGroup = new Composite(composite, SWT.NONE); + Group viewerGroup = new Group(composite, SWT.NONE); + viewerGroup.setText(Messages.getString("ConnectToDeviceDialog.GroupLabel")); //$NON-NLS-1$ 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); + GridLayoutFactory.swtDefaults().applyTo(viewerGroup); viewer = new ComboViewer(viewerGroup, SWT.READ_ONLY); viewer.setLabelProvider(new LabelProvider() { @@ -95,7 +102,7 @@ if (element instanceof IConnection) return ((IConnection) element).getDisplayName(); - return "No Current connection"; + return Messages.getString("ConnectToDeviceDialog.NoCurrentItem"); //$NON-NLS-1$ } }); viewer.setContentProvider(new ArrayContentProvider()); @@ -110,10 +117,45 @@ }); 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$ + final Composite buttonGroup = new Composite(viewerGroup, SWT.NONE); + int w = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN); + int h = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN); + int hs = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING); + int vs = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING); + GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true). + margins(w, h).spacing(hs, vs).applyTo(buttonGroup); + GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).applyTo(buttonGroup); + buttonGroup.setFont(parent.getFont()); + + newButton = new Button(buttonGroup, SWT.PUSH); + newButton.setText(Messages.getString("ConnectToDeviceDialog.NewLabel")); //$NON-NLS-1$ + newButton.setFont(JFaceResources.getDialogFont()); + int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); + Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + widthHint = Math.max(widthHint, minSize.x); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).hint(widthHint, SWT.DEFAULT).applyTo(newButton); + newButton.setData(UID, "newButton"); //$NON-NLS-1$ + newButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + SettingsWizard wizard = new SettingsWizard(null, data.getService()); + wizard.open(composite.getShell()); + IConnection connection = wizard.getConnectionToEdit(); + // note: refresh ASAP so the selection will be valid; but endure a listener event + // which will redo this + refreshUI(); + setViewerInput(connection); + } + }); + + editButton = new Button(buttonGroup, SWT.PUSH); + editButton.setText(Messages.getString("ConnectToDeviceDialog.EditLabel")); //$NON-NLS-1$ + editButton.setFont(JFaceResources.getDialogFont()); + widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH); + minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + widthHint = Math.max(widthHint, minSize.x); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).hint(widthHint, SWT.DEFAULT).applyTo(editButton); + editButton.setData(UID, "editButton"); //$NON-NLS-1$ editButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -139,6 +181,13 @@ return composite; } + private void initializeDialogUnits(Composite parent) { + GC gc = new GC(parent); + gc.setFont(JFaceResources.getDialogFont()); + fm = gc.getFontMetrics(); + gc.dispose(); + } + protected void validate() { IStatus status = ConnectToDeviceSection.revalidate(data); @@ -157,7 +206,7 @@ if (connectedService == null) { status = error(MessageFormat.format( - "The selected connection does not support {0}", + Messages.getString("ConnectToDeviceDialog.ServiceNotSupportedError"), //$NON-NLS-1$ data.getService().getDisplayName())); } else { @@ -165,7 +214,7 @@ 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}", + status = warning(Messages.getString("ConnectToDeviceDialog.ServiceNotAvailWarning"), //$NON-NLS-1$ serviceStatus.getLongDescription()); } } @@ -184,7 +233,7 @@ if (connection != null) { descriptionLabel.setText(standardPNPMessage); } else { - descriptionLabel.setText("No connections are detected or defined. " + standardPNPMessage); + descriptionLabel.setText(Messages.getString("ConnectToDeviceDialog.NoConnectionsText") + standardPNPMessage); //$NON-NLS-1$ } } diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceSection.java Tue Feb 16 13:44:12 2010 -0600 @@ -35,17 +35,15 @@ */ 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 static final String NO_CURRENT_CONNECTION_MSG = Messages.getString("ConnectToDeviceSection.NoConnectionMsg"); //$NON-NLS-1$ private final IConnectionsManager manager; /** * @param unifiedLaunchOptionsPage * */ - public ConnectToDeviceSection(LaunchOptionsData data, UnifiedLaunchOptionsPage launchOptionsPage) { - super(data, "Connect to device"); - this.launchOptionsPage = launchOptionsPage; + public ConnectToDeviceSection(LaunchWizardData data, UnifiedLaunchOptionsPage launchOptionsPage) { + super(data, Messages.getString("ConnectToDeviceSection.Title"), launchOptionsPage); //$NON-NLS-1$ manager = RemoteConnectionsActivator.getConnectionsManager(); } @@ -69,7 +67,7 @@ } /** Get the simple status for the connection state */ - static IStatus revalidate(LaunchOptionsData data) { + static IStatus revalidate(LaunchWizardData data) { IStatus status = Status.OK_STATUS; if (data.getConnection() == null) { @@ -80,7 +78,7 @@ } 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."; + return Messages.getString("ConnectToDeviceSection.StdPNPMsg"); //$NON-NLS-1$ } @Override @@ -90,16 +88,16 @@ String msg; if (data.getConnection() != null) - msg = MessageFormat.format("The current connection is now ''{0}''.", data.getConnectionName()); + msg = MessageFormat.format(Messages.getString("ConnectToDeviceSection.CurrentConnectionLabel"), data.getConnectionName()); //$NON-NLS-1$ else - msg = MessageFormat.format("{0} {1}", NO_CURRENT_CONNECTION_MSG, getStandardPNPMessage()); + msg = MessageFormat.format("{0} {1}", NO_CURRENT_CONNECTION_MSG, getStandardPNPMessage()); //$NON-NLS-1$ descriptionLabel.setText(msg); launchOptionsPage.changed(); } @Override - protected AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchOptionsData dialogData) { + protected AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchWizardData dialogData) { return new ConnectToDeviceDialog(shell, dialogData); } diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java Tue Feb 16 13:44:12 2010 -0600 @@ -64,7 +64,7 @@ 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.cdt.internal.debug.launch.newwizard.LaunchWizardData.EExeSelection; import com.nokia.cpp.internal.api.utils.core.PathUtils; import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; @@ -85,7 +85,7 @@ private Button sisBrowse; private Composite installPackageUI; - protected DebugRunProcessDialog(Shell shell, LaunchOptionsData data) { + protected DebugRunProcessDialog(Shell shell, LaunchWizardData data) { super(shell, data); } @@ -96,7 +96,7 @@ @Override protected Control createDialogArea(Composite parent) { Composite composite = initDialogArea(parent, - MessageFormat.format("Change {0} Process", data.getModeLabel()), + MessageFormat.format(Messages.getString("DebugRunProcessDialog.ChangeProcessMsg"), data.getModeLabel()), //$NON-NLS-1$ data.isDebug() ? LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_DEBUG_PROCESS : LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_RUN_PROCESS); @@ -120,7 +120,7 @@ Label label; label = new Label(composite, SWT.WRAP); - label.setText(MessageFormat.format("{0} method:", data.getModeLabel())); + label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.ModeLabel"), data.getModeLabel())); //$NON-NLS-1$ label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); GridDataFactory.fillDefaults().grab(true, false).applyTo(composite); @@ -139,9 +139,9 @@ 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."; + msg = Messages.getString("DebugRunProcessDialog.DebugConfigureMsg"); //$NON-NLS-1$ else - msg = "Configure how to run the program."; + msg = Messages.getString("DebugRunProcessDialog.RunConfigureMsg"); //$NON-NLS-1$ setMessage(msg); switch (data.getExeSelection()) { @@ -161,7 +161,7 @@ Label label; label = new Label(composite, SWT.WRAP); - label.setText(MessageFormat.format("Deploy method:", data.getModeLabel())); + label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.DeployLabel"), data.getModeLabel())); //$NON-NLS-1$ label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); @@ -178,7 +178,7 @@ installPackageCheckbox = new Button(composite, SWT.CHECK); GridDataFactory.fillDefaults().applyTo(installPackageCheckbox); - installPackageCheckbox.setText("Install package before launch"); + installPackageCheckbox.setText(Messages.getString("DebugRunProcessDialog.InstallBeforeLaunchLabel")); //$NON-NLS-1$ installPackageUI = new Composite(composite, SWT.NONE); GridDataFactory.fillDefaults().indent(INDENT, 0).applyTo(installPackageUI); @@ -194,8 +194,9 @@ }); - if (data.requiresInstallPackage()) { + if (data.isInstallPackage()) { installPackageCheckbox.setSelection(true); + updatePackageUI(); } updateSisFile(); @@ -209,16 +210,16 @@ ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); if (cpi != null) { final Label sisLabel = new Label(composite, SWT.NONE); - sisLabel.setText("SIS File to Install:"); + sisLabel.setText(Messages.getString("DebugRunProcessDialog.SISFileLabel")); //$NON-NLS-1$ 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"); + sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ + sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$ 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.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ sisFile.add("None"); //$NON-NLS-1$ - sisFile.setData(UID, "DebugRunProcessDialog.sisFile"); + sisFile.setData(UID, "DebugRunProcessDialog.sisFile"); //$NON-NLS-1$ sisFile.addSelectionListener(new SelectionAdapter() { @Override @@ -251,44 +252,44 @@ }); Link link = new Link(composite, SWT.NONE); - link.setText("" + "Modify SIS builder settings for build configuration" + "..."); + link.setText("" + Messages.getString("DebugRunProcessDialog.SISConfigLinkText") + "..."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 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(); + PreferencesUtil.createPropertyDialogOn(getShell(), project, "com.nokia.carbide.cdt.internal.builder.ui.CarbideBuildConfigurationsPage", null, null).open(); //$NON-NLS-1$ } }); - link.setData(UID, "DebugRunProcessDialog.link"); + link.setData(UID, "DebugRunProcessDialog.link"); //$NON-NLS-1$ } 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"); + sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ + sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$ 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.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ sisEdit.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { updateSisFile(); validate(); } }); - sisEdit.setData(UID, "DebugRunProcessDialog.sisEdit"); + sisEdit.setData(UID, "DebugRunProcessDialog.sisEdit"); //$NON-NLS-1$ sisBrowse = new Button(composite, SWT.NONE); - sisBrowse.setText("Browse..."); + sisBrowse.setText(Messages.getString("DebugRunProcessDialog.BrowseLabel")); //$NON-NLS-1$ 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"}); + dialog.setText(Messages.getString("DebugRunProcessDialog.Title")); //$NON-NLS-1$ + dialog.setFilterExtensions(new String[] {"*.sis*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ + dialog.setFilterNames(new String[] {Messages.getString("DebugRunProcessDialog.InstallFilterName"), Messages.getString("DebugRunProcessDialog.AllFilterName")}); //$NON-NLS-1$ //$NON-NLS-2$ BrowseDialogUtils.initializeFrom(dialog, sisEdit); @@ -300,7 +301,7 @@ } } }); - sisBrowse.setData(UID, "DebugRunProcessDialog.sisBrowse"); + sisBrowse.setData(UID, "DebugRunProcessDialog.sisBrowse"); //$NON-NLS-1$ } } @@ -311,7 +312,7 @@ protected void updateSisFile() { String sisPath; if (sisFile != null) { - sisPath = sisFile.getSelectionIndex() == 0 ? "" : sisFile.getText(); //$NON-NLS-1$ + sisPath = sisFile.getSelectionIndex() == 0 ? null : sisFile.getText(); //$NON-NLS-1$ data.setSisPath(sisPath); } else if (sisEdit != null) { sisPath = sisEdit.getText(); @@ -344,7 +345,7 @@ if (cpi != null) { sisFile.removeAll(); - sisFile.add("None"); + sisFile.add(Messages.getString("DebugRunProcessDialog.NoneItem")); //$NON-NLS-1$ ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); for (ISISBuilderInfo info : config.getSISBuilderInfoList()) { @@ -392,7 +393,7 @@ private IPath createSuggestedRemotePath(IPath exeSelectionPath) { String filename = exeSelectionPath.lastSegment(); - return PathUtils.createPath("C:/sys/bin").append(filename); + return PathUtils.createPath("C:/sys/bin").append(filename); //$NON-NLS-1$ } /** @@ -402,12 +403,12 @@ 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"); + projectExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchProjectExeLabel")); //$NON-NLS-1$ + projectExecutableRadioButton.setData(UID, "radio_project_executable"); //$NON-NLS-1$ projectExecutableViewer = new ComboViewer(radioGroup, SWT.READ_ONLY); GridDataFactory.fillDefaults().grab(true, false).applyTo(projectExecutableViewer.getControl()); - projectExecutableViewer.getControl().setData(UID, "combo_project_executable"); + projectExecutableViewer.getControl().setData(UID, "combo_project_executable"); //$NON-NLS-1$ projectExecutableViewer.setContentProvider(new ArrayContentProvider()); projectExecutableViewer.setLabelProvider(new LabelProvider() { @@ -469,14 +470,14 @@ private void createRemoteExecutableRadioButton(Composite radioGroup) { remoteExecutableRadioButton = new Button(radioGroup, SWT.RADIO); GridDataFactory.fillDefaults().grab(false, false).applyTo(remoteExecutableRadioButton); - remoteExecutableRadioButton.setText("Launch &remote program:"); + remoteExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgLabel")); //$NON-NLS-1$ - remoteExecutableRadioButton.setData(UID, "radio_remote_program"); + remoteExecutableRadioButton.setData(UID, "radio_remote_program"); //$NON-NLS-1$ remoteProgramEntry = new Text(radioGroup, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(remoteProgramEntry); - remoteProgramEntry.setData(UID, "text_remote_program"); + remoteProgramEntry.setData(UID, "text_remote_program"); //$NON-NLS-1$ remoteExecutableRadioButton.addSelectionListener(new SelectionAdapter() { @Override @@ -514,14 +515,14 @@ private void createAttachToProcessRadioButton(Composite radioGroup) { attachToProcessRadioButton = new Button(radioGroup, SWT.RADIO); GridDataFactory.fillDefaults().grab(false, false).applyTo(attachToProcessRadioButton); - attachToProcessRadioButton.setText("&Attach to process:"); + attachToProcessRadioButton.setText(Messages.getString("DebugRunProcessDialog.AttachLabel")); //$NON-NLS-1$ - attachToProcessRadioButton.setData(UID, "radio_attach_to_process"); + attachToProcessRadioButton.setData(UID, "radio_attach_to_process"); //$NON-NLS-1$ 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)"); + label.setText(Messages.getString("DebugRunProcessDialog.AttachAddlMsg")); //$NON-NLS-1$ attachToProcessRadioButton.addSelectionListener(new SelectionAdapter() { @Override @@ -552,12 +553,12 @@ switch (data.getExeSelection()) { case USE_PROJECT_EXECUTABLE: if (exePath.isEmpty()) { - status = error("The project builds no executables."); + status = error(Messages.getString("DebugRunProcessDialog.NoExesError")); //$NON-NLS-1$ } break; case USE_REMOTE_EXECUTABLE: if (exePath.isEmpty()) { - status = error("Enter a non-empty executable path."); + status = error(Messages.getString("DebugRunProcessDialog.EnterPathError")); //$NON-NLS-1$ } else { String exePathString = exePath.toString(); char drive = exePathString.charAt(0); @@ -566,9 +567,9 @@ 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."); + status = error(Messages.getString("DebugRunProcessDialog.AbsolutePathError")); //$NON-NLS-1$ } else if (exePath.getFileExtension() == null) { - status = warning("The executable path should end in a filename."); + status = warning(Messages.getString("DebugRunProcessDialog.FilePathError")); //$NON-NLS-1$ } } break; @@ -585,7 +586,7 @@ // it exists File file = new File(text); if (!file.exists()) { - status = error("The SIS file ''{0}'' does not exist.", text); + status = error(Messages.getString("DebugRunProcessDialog.SISFileExistError"), text); //$NON-NLS-1$ } } } diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java Tue Feb 16 13:44:12 2010 -0600 @@ -19,11 +19,16 @@ import java.text.MessageFormat; +import org.eclipse.core.runtime.IPath; 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.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.LaunchWizardData.EExeSelection; import com.nokia.cpp.internal.api.utils.core.PathUtils; /** @@ -31,8 +36,8 @@ */ public class DebugRunProcessSection extends AbstractLaunchWizardSection { - public DebugRunProcessSection(LaunchOptionsData data) { - super(data, MessageFormat.format("{0} process", data.getModeLabel())); + public DebugRunProcessSection(LaunchWizardData data, UnifiedLaunchOptionsPage launchOptionsPage) { + super(data, MessageFormat.format(Messages.getString("DebugRunProcessSection.Title"), data.getModeLabel()), launchOptionsPage); //$NON-NLS-1$ } @Override @@ -52,11 +57,20 @@ data.setExeSelectionPath(data.getExes().get(0)); else if (data.getDefaultExecutable() != null) data.setExeSelectionPath(data.getDefaultExecutable()); + ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(data.getProject()); + if (cpi != null) { + data.setInstallPackage(!data.isSysTRKConnection()); + ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); + for (ISISBuilderInfo info : config.getSISBuilderInfoList()) { + IPath sisPath = info.getSigningType() == ISISBuilderInfo.DONT_SIGN ? info.getUnsignedSISFullPath() : info.getSignedSISFullPath(); + data.setSisPath(sisPath.toOSString()); + } + } } @Override protected AbstractLaunchSettingsDialog createChangeSettingsDialog( - Shell shell, LaunchOptionsData dialogData) { + Shell shell, LaunchWizardData dialogData) { return new DebugRunProcessDialog(shell, dialogData); } @@ -73,52 +87,60 @@ switch (data.getExeSelection()) { case USE_PROJECT_EXECUTABLE: if (data.getExeSelectionPath() == null) - status = error("This project does not build any executables.", + status = error(Messages.getString("DebugRunProcessSection.NoExesError"), //$NON-NLS-1$ data.getModeLabel().toLowerCase()); break; case USE_REMOTE_EXECUTABLE: if (data.getExeSelectionPath() == null) - status = error("No remote executable is selected.", + status = error(Messages.getString("DebugRunProcessSection.NoRemoteExeError"), //$NON-NLS-1$ data.getModeLabel().toLowerCase()); break; case ATTACH_TO_PROCESS: break; } - - // TODO: package + + if (data.isInstallPackage() && (data.getSisPath() == null || data.getSisPath().length() == 0)) + status = error(Messages.getString("DebugRunProcessSection.MustInstallError")); //$NON-NLS-1$ } - + @Override protected void updateUI() { validate(); if (status.isOK()) { - String mainFormat = "Carbide will {0} and {1}."; - String copyOrInstallMsg = ""; - String runOrLaunchMsg = ""; + String mainFormat = Messages.getString("DebugRunProcessSection.MainFormat"); //$NON-NLS-1$ + String copyOrInstallMsg = ""; //$NON-NLS-1$ + String runOrLaunchMsg = ""; //$NON-NLS-1$ switch (data.getExeSelection()) { case USE_PROJECT_EXECUTABLE: - runOrLaunchMsg = "launch '" + data.getExeSelectionPath().lastSegment() + "'"; + runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), data.getExeSelectionPath().lastSegment()); //$NON-NLS-1$ break; case USE_REMOTE_EXECUTABLE: - runOrLaunchMsg = "launch '" + PathUtils.convertPathToWindows(data.getExeSelectionPath()) + "'"; + runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), PathUtils.convertPathToWindows(data.getExeSelectionPath())); //$NON-NLS-1$ break; case ATTACH_TO_PROCESS: - runOrLaunchMsg = "attach to a process selected at launch time"; + runOrLaunchMsg = Messages.getString("DebugRunProcessSection.AttachMsg"); //$NON-NLS-1$ break; } - copyOrInstallMsg = "copy files to the device"; + copyOrInstallMsg = getCopyOrInstallMsg(); 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.", + descriptionLabel.setText(status.getMessage() + "\n\n" + //$NON-NLS-1$ + MessageFormat.format(Messages.getString("DebugRunProcessSection.ChangeMsg"), //$NON-NLS-1$ data.getModeLabel().toLowerCase())); } } + private String getCopyOrInstallMsg() { + if (data.isSysTRKConnection() || !data.isInstallPackage()) + return Messages.getString("DebugRunProcessSection.CopyMsg"); //$NON-NLS-1$ + else + return MessageFormat.format(Messages.getString("DebugRunProcessSection.InstallMsg"), data.getSisPath()); //$NON-NLS-1$ + } + } diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchOptionsData.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchOptionsData.java Tue Feb 16 13:43:06 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,299 +0,0 @@ -/* -* 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 null if is valid - */ - String isValidPath(IPath path); - } - - // settings detected in project - private final List mmps; - private final List 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 mmps, List 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 null - */ - public IStatus validate() { - return Status.OK_STATUS; - } - - /** - * @return - * @return - */ - public List 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 null - */ - 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; - } - -} diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizard.java Tue Feb 16 13:44:12 2010 -0600 @@ -18,14 +18,12 @@ 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.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 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; @@ -38,31 +36,32 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; 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; /** * New launch wizard for Carbide 3.0. * * See https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=10419 */ -public class LaunchWizard extends Wizard { +public class LaunchWizard extends Wizard implements ILaunchCreationWizard { - private LaunchOptionsData launchData; + private LaunchWizardData launchData; private UnifiedLaunchOptionsPage mainPage; private Button advancedButton; private boolean advancedEdit; private IPageChangedListener pageChangedListener; + private boolean hasFinished; - public LaunchWizard(IProject project, String configurationName, - List mmps, List exes, IPath defaultExecutable, - boolean isEmulation, boolean emulatorOnly, String mode, - IService trkService) { - launchData = new LaunchOptionsData(mmps, exes, defaultExecutable, project, configurationName, - isEmulation, emulatorOnly, mode, trkService); + public LaunchWizard(LaunchOptions launchOptions, IService trkService) { + launchData = new LaunchWizardData(launchOptions, trkService); mainPage = new UnifiedLaunchOptionsPage(launchData); mainPage.initializeSettings(); - setWindowTitle("New Launch Configuration Wizard"); + setWindowTitle(Messages.getString("LaunchWizard.Title")); //$NON-NLS-1$ } /* (non-Javadoc) @@ -103,9 +102,9 @@ ((GridLayout) parent.getLayout()).numColumns++; advancedButton.moveBelow(parent.getChildren()[0]); - advancedButton.setText("Edit advanced settings before launch"); + advancedButton.setText(Messages.getString("LaunchWizard.AdvancedLabel")); //$NON-NLS-1$ advancedButton.setToolTipText(MessageFormat.format( - "Before finishing the wizard, edit settings in the ''{0} Configurations'' dialog.", + Messages.getString("LaunchWizard.AdvancedTip"), //$NON-NLS-1$ launchData.getModeLabel())); advancedButton.addSelectionListener(new SelectionAdapter() { @Override @@ -132,12 +131,12 @@ if (finishButton != null) { advancedEdit = advancedButton.getSelection(); if (advancedEdit) { - finishButton.setText("Edit"); - finishButton.setToolTipText("Click to accept settings and edit advanced settings."); + finishButton.setText(Messages.getString("LaunchWizard.EditLabel")); //$NON-NLS-1$ + finishButton.setToolTipText(Messages.getString("LaunchWizard.EditTip")); //$NON-NLS-1$ getContainer().updateButtons(); } else { finishButton.setText(launchData.getModeLabel()); - finishButton.setToolTipText("Click to accept settings and launch the program."); + finishButton.setToolTipText(Messages.getString("LaunchWizard.FinishTip")); //$NON-NLS-1$ getContainer().updateButtons(); } } @@ -176,8 +175,33 @@ @Override public boolean performFinish() { - MessageDialog.openWarning(getShell(), "New Launch Configuration Wizard", "Launching from this wizard not enabled yet"); - return false; + hasFinished = true; + return true; + } + + public boolean shouldOpenLaunchConfigurationDialog() { + return hasFinished && advancedEdit; } + public ILaunchConfigurationWorkingCopy getLaunchConfiguration() { + if (!hasFinished) + return null; + + ILaunchConfigurationWorkingCopy config = null; + try { + config = launchData.createConfiguration(); + } catch (CoreException e) { + LaunchPlugin.log(e); + } + + return config; + } + + public void init() { + } + + public int openWizard(Shell shell) { + WizardDialog dialog = new WizardDialog(shell, this); + return dialog.open(); + } } diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.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/LaunchWizardData.java Tue Feb 16 13:44:12 2010 -0600 @@ -0,0 +1,404 @@ +/* +* 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.Collection; +import java.util.List; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +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.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.service.prefs.Preferences; + +import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; +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.IService; +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.wizard.LaunchOptions; +import com.nokia.cpp.internal.api.utils.core.TextUtils; + +import cwdbg.PreferenceConstants; + +/** + * Data manipulated by the launch wizard and its dialogs. + */ +@SuppressWarnings("restriction") +public class LaunchWizardData extends LaunchOptions { + public interface IPathValidator { + /** + * @param path IPath + * @return Error string or null if is valid + */ + String isValidPath(IPath path); + } + + private final IService service; + + // overall target + public static class LaunchType { + private final String launchId; + + public LaunchType(String launchId) { + this.launchId = launchId; + } + + public boolean isApplicable(LaunchWizardData 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; + private IConnection connection; + + // settings made in the Other Settings section + enum EBuildBeforeLaunchOption { + ALWAYS, + NEVER, + USE_WORKSPACE_SETTING, + } + + public LaunchWizardData(LaunchOptions launchOptions, IService trkService) { + this.mmps = launchOptions.mmps; + this.exes = launchOptions.exes; + this.defaultExecutable = launchOptions.defaultExecutable; + this.project = launchOptions.project; + this.configurationName = launchOptions.configurationName; + this.isEmulation = launchOptions.isEmulation; + this.emulatorOnly = launchOptions.emulatorOnly; + this.mode = launchOptions.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 Messages.getString("LaunchWizardData.RunModeLabel"); //$NON-NLS-1$ + else if (mode.equals(ILaunchManager.DEBUG_MODE)) + return Messages.getString("LaunchWizardData.DebugModeLabel"); //$NON-NLS-1$ + else + return TextUtils.titleCase(mode); + + } + + /** + * Validate the detected and/or configured data + * @return IStatus, never null + */ + public IStatus validate() { + return Status.OK_STATUS; + } + + /** + * @return + * @return + */ + public List 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 null + */ + 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; + } + + /** + * @return + */ + public String getSisPath() { + return sisPath; + } + + /** + * Copy the data, for use by a transient dialog. + * @return new copy of data + */ + public LaunchWizardData copy() { + LaunchOptions launchOptions = new LaunchOptions(); + launchOptions.mmps = mmps; + launchOptions.exes = exes; + launchOptions.defaultExecutable = defaultExecutable; + launchOptions.project = project; + launchOptions.configurationName = configurationName; + launchOptions.isEmulation = isEmulation; + launchOptions.emulatorOnly = emulatorOnly; + launchOptions.mode = mode; + LaunchWizardData d = new LaunchWizardData(launchOptions, 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(LaunchWizardData dialogData) { + exeSelection = dialogData.exeSelection; + exeSelectionPath = dialogData.exeSelectionPath; + buildBeforeLaunch = dialogData.buildBeforeLaunch; + installPackage = dialogData.installPackage; + sisPath = dialogData.sisPath; + connection = dialogData.connection; + } + + /** + * @return + */ + public boolean requiresInstallPackage() { + return !isSysTRKConnection() || installPackage; + } + + public void setConnection(IConnection connection) { + this.connection = connection; + } + + public IConnection getConnection() { + return connection; + } + + public ILaunchConfigurationWorkingCopy createConfiguration() throws CoreException { + String launchTypeId = getApplicableLaunchTypeId(); + ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(launchTypeId); + ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, configurationName); + initializeConfigSettings(launchTypeId, config); + + return config; + } + + private void initializeConfigSettings(String launchTypeId, ILaunchConfigurationWorkingCopy config) { + IPath exePath = getExePath(); + IPath mmpPath = getMmpPath(exePath); + if (launchTypeId.equals(SettingsData.APP_TRK_LAUNCH_TYPE_ID)) { + SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath); + } + else if (launchTypeId.equals(SettingsData.SYS_TRK_LAUNCH_TYPE_ID)) { + SettingsData.setDefaults(config, SettingsData.LaunchConfig_SysTRK, project, mmpPath, exePath); + } + else if (launchTypeId.equals(SettingsData.ATTACH_LAUNCH_TYPE_ID)) { + SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath); + } + addBuildOptions(config); + // always set the current connection id + config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, Registry.CURRENT_CONNECTION_ID); + if (installPackage) + config.setAttribute(PreferenceConstants.J_PN_SisFileHostPath, sisPath); + } + + private IPath getMmpPath(IPath exePath) { + if (!mmps.isEmpty()) { + for (int i = 0; i < exes.size(); i++) { + IPath exe = exes.get(i); + if (exe.lastSegment().equals(exePath.lastSegment())) + return mmps.get(i); + } + } + return null; + } + + private IPath getExePath() { + if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS)) + return exes.get(0); + return exeSelectionPath; + } + + private IConnectedService getConnectedService() { + if (connection != null) { + Collection connectedServices = + RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection); + for (IConnectedService connectedService : connectedServices) { + if (connectedService.getService().getIdentifier().equals(service.getIdentifier())) + return connectedService; + } + } + return null; + } + + public boolean isSysTRKConnection() { + IConnectedService connectedService = getConnectedService(); + if (connectedService instanceof IConnectedService2) { + String value = ((IConnectedService2) connectedService).getProperties().get("is-system-trk"); //$NON-NLS-1$ + return Boolean.parseBoolean(value); + } + return false; + } + + private String getApplicableLaunchTypeId() { + if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS)) + return SettingsData.ATTACH_LAUNCH_TYPE_ID; + else if (!installPackage || isSysTRKConnection()) + return SettingsData.SYS_TRK_LAUNCH_TYPE_ID; + else + return SettingsData.APP_TRK_LAUNCH_TYPE_ID; + } + + private void addBuildOptions(ILaunchConfigurationWorkingCopy config) { + int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING; + switch (buildBeforeLaunch) { + case NEVER: + buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED; + break; + case ALWAYS: + buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED; + break; + } + config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue); + } +} + diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsDialog.java Tue Feb 16 13:44:12 2010 -0600 @@ -35,7 +35,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.dialogs.PreferencesUtil; -import com.nokia.cdt.internal.debug.launch.newwizard.LaunchOptionsData.EBuildBeforeLaunchOption; +import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EBuildBeforeLaunchOption; /** * This dialog allows in-depth configuration of the other settings in the launch. @@ -48,7 +48,7 @@ private Button fWorkspaceSettingsButton; private Link fWorkspaceSettingsLink; - protected OtherSettingsDialog(Shell shell, LaunchOptionsData data) { + protected OtherSettingsDialog(Shell shell, LaunchWizardData data) { super(shell, data); } @@ -59,12 +59,12 @@ @Override protected Control createDialogArea(Composite parent) { Composite composite = initDialogArea(parent, - "Other Settings", + Messages.getString("OtherSettingsDialog.Title"), //$NON-NLS-1$ 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."; + String description = Messages.getString("OtherSettingsDialog.Desc1") + //$NON-NLS-1$ + Messages.getString("OtherSettingsDialog.Desc2") + //$NON-NLS-1$ + Messages.getString("OtherSettingsDialog.Desc3"); //$NON-NLS-1$ final Label label = new Label(composite, SWT.WRAP); label.setText(description); @@ -89,7 +89,7 @@ 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"); + fDisableBuildButton.setData(UID, "OtherSettingsDialog.disableBuildButton"); //$NON-NLS-1$ GridDataFactory.fillDefaults().span(2, 1).applyTo(fDisableBuildButton); @@ -104,7 +104,7 @@ 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"); + fEnableBuildButton.setData(UID, "OtherSettingsDialog.enableBuildButon"); //$NON-NLS-1$ GridDataFactory.fillDefaults().span(2, 1).applyTo(fEnableBuildButton); @@ -119,7 +119,7 @@ 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"); + fWorkspaceSettingsButton.setData(UID, "OtherSettingsDialog.workspaceSettingsButton"); //$NON-NLS-1$ GridDataFactory.swtDefaults().span(1, 1).applyTo(fWorkspaceSettingsButton); @@ -133,7 +133,7 @@ fWorkspaceSettingsLink = new Link(radio, SWT.NONE); fWorkspaceSettingsLink.setText(Messages.getString("OtherSettingsDialog.WorkspaceSettingsLinkLabel")); //$NON-NLS-1$ - fWorkspaceSettingsLink.setData(UID, "OtherSettingsDialog.workspaceSettingsLink"); + fWorkspaceSettingsLink.setData(UID, "OtherSettingsDialog.workspaceSettingsLink"); //$NON-NLS-1$ GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(true, false).span(1, 1).applyTo(fWorkspaceSettingsLink); @@ -173,11 +173,11 @@ IStatus status = Status.OK_STATUS; updateStatus(status); - String wsState = ""; + String wsState = ""; //$NON-NLS-1$ if (data.isWorkspaceBuildBeforeLaunch()) - wsState = " (enabled)"; + wsState = Messages.getString("OtherSettingsDialog.EnabledLabel"); //$NON-NLS-1$ else - wsState = " (disabled)"; + wsState = Messages.getString("OtherSettingsDialog.DisabledLabel"); //$NON-NLS-1$ fWorkspaceSettingsButton.setText( Messages.getString("OtherSettingsDialog.WorkspaceSettingsButtonLabel") + //$NON-NLS-1$ diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsSection.java Tue Feb 16 13:44:12 2010 -0600 @@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; -import com.nokia.cdt.internal.debug.launch.newwizard.LaunchOptionsData.EBuildBeforeLaunchOption; +import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EBuildBeforeLaunchOption; /** * Present the "Build before debug" section with a short description. @@ -31,8 +31,8 @@ /** * */ - public OtherSettingsSection(LaunchOptionsData data) { - super(data, "Other settings"); + public OtherSettingsSection(LaunchWizardData data, UnifiedLaunchOptionsPage launchOptionsPage) { + super(data, Messages.getString("OtherSettingsSection.Title"), launchOptionsPage); //$NON-NLS-1$ } @@ -69,16 +69,16 @@ protected void updateUI() { String msg; - String ifWorkspace = ""; + String ifWorkspace = ""; //$NON-NLS-1$ if (data.getBuildBeforeLaunch() == EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING) - ifWorkspace = " (workspace setting)"; + ifWorkspace = Messages.getString("OtherSettingsSection.WorkspaceLabel"); //$NON-NLS-1$ if (data.isCurrentBuildBeforeLaunch()) - msg = "Carbide will build the project before launch"; + msg = Messages.getString("OtherSettingsSection.BuildBeforeLabel"); //$NON-NLS-1$ else - msg = "Carbide will not build the project before launch"; + msg = Messages.getString("OtherSettingsSection.NoBuildBeforeLabel"); //$NON-NLS-1$ - descriptionLabel.setText(msg + ifWorkspace + "."); + descriptionLabel.setText(msg + ifWorkspace + "."); //$NON-NLS-1$ } /* (non-Javadoc) @@ -86,7 +86,7 @@ */ @Override protected AbstractLaunchSettingsDialog createChangeSettingsDialog( - Shell shell, LaunchOptionsData dialogData) { + Shell shell, LaunchWizardData dialogData) { return new OtherSettingsDialog(shell, dialogData); } diff -r 885b827031ab -r bff887fe7694 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 Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java Tue Feb 16 13:44:12 2010 -0600 @@ -46,7 +46,7 @@ */ public class UnifiedLaunchOptionsPage extends WizardPage implements ISectionChangeListener { - private final LaunchOptionsData data; + private final LaunchWizardData data; private ArrayList sections; @@ -57,10 +57,10 @@ * @param project * @param configurationName */ - public UnifiedLaunchOptionsPage(LaunchOptionsData data) { - super("Configure Launch Settings"); + public UnifiedLaunchOptionsPage(LaunchWizardData data) { + super(Messages.getString("UnifiedLaunchOptionsPage.Title")); //$NON-NLS-1$ - setDescription("Configure the connection and process to launch."); + setDescription(Messages.getString("UnifiedLaunchOptionsPage.Desc")); //$NON-NLS-1$ this.data = data; this.sections = new ArrayList(); @@ -71,10 +71,10 @@ section = new ConnectToDeviceSection(data, this); sections.add(section); - section = new DebugRunProcessSection(data); + section = new DebugRunProcessSection(data, this); sections.add(section); - section = new OtherSettingsSection(data); + section = new OtherSettingsSection(data, this); sections.add(section); } @@ -116,9 +116,9 @@ if (status.isOK()) continue; if (builder.length() > 0) - builder.append("\n"); + builder.append("\n"); //$NON-NLS-1$ - builder.append(MessageFormat.format("{0}: {1}", + builder.append(MessageFormat.format("{0}: {1}", //$NON-NLS-1$ section.getSectionName(), status.getMessage())); severity = Math.max(severity, status.getSeverity()); @@ -131,7 +131,7 @@ pageStatus = data.validate(); } - setTitle("Configure launch configuration"); + setTitle(Messages.getString("UnifiedLaunchOptionsPage.TitleText")); //$NON-NLS-1$ if (pageStatus != null && !pageStatus.isOK()) { setMessage(pageStatus.getMessage(), severityToMsgType(pageStatus.getSeverity())); diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties Tue Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties Tue Feb 16 13:44:12 2010 -0600 @@ -1,11 +1,79 @@ +AbstractLaunchSettingsDialog.Title=New Launch Configuration Wizard +AbstractLaunchWizardSection.ChangeLabel=Change... +ConnectToDeviceDialog.EditLabel=Edit... +ConnectToDeviceDialog.GroupLabel=Current connection +ConnectToDeviceDialog.NewLabel=New... +ConnectToDeviceDialog.NoConnectionsText=No connections are detected or defined. +ConnectToDeviceDialog.NoCurrentItem=No Current connection +ConnectToDeviceDialog.ServiceNotAvailWarning=The selected connection may not be usable for debugging:\n {0} +ConnectToDeviceDialog.ServiceNotSupportedError=The selected connection does not support {0} +ConnectToDeviceDialog.Title=Change connection +ConnectToDeviceSection.CurrentConnectionLabel=The current connection is now ''{0}''. +ConnectToDeviceSection.NoConnectionMsg=No current connection is defined or detected. +ConnectToDeviceSection.StdPNPMsg=You may plug in a device over USB or activate it over WLAN, or create a new connection now for your device. +ConnectToDeviceSection.Title=Connect to device +DebugRunProcessDialog.AbsolutePathError=The executable path must be absolute. +DebugRunProcessDialog.AllFilterName=All Files +DebugRunProcessDialog.AttachAddlMsg=(selected at launch time) +DebugRunProcessDialog.AttachLabel=&Attach to process: +DebugRunProcessDialog.BrowseLabel=Browse... +DebugRunProcessDialog.ChangeProcessMsg=Change {0} Process +DebugRunProcessDialog.DebugConfigureMsg=Configure how to debug the program. The initial settings reflect the debug capabilities of the selected device and the SIS builder settings. +DebugRunProcessDialog.DeployLabel=Deploy method: +DebugRunProcessDialog.EnterPathError=Enter a non-empty executable path. +DebugRunProcessDialog.FilePathError=The executable path should end in a filename. +DebugRunProcessDialog.InstallBeforeLaunchLabel=Install package before launch +DebugRunProcessDialog.InstallFilterName=Installation Files +DebugRunProcessDialog.LaunchProjectExeLabel=Launch project &executable: +DebugRunProcessDialog.LaunchRemoteProgLabel=Launch &remote program: +DebugRunProcessDialog.ModeLabel={0} method: +DebugRunProcessDialog.NoExesError=The project builds no executables. +DebugRunProcessDialog.NoneItem=None +DebugRunProcessDialog.RunConfigureMsg=Configure how to run the program. +DebugRunProcessDialog.SISConfigLinkText=Modify SIS builder settings for build configuration +DebugRunProcessDialog.SISFileExistError=The SIS file ''{0}'' does not exist. +DebugRunProcessDialog.SISFileLabel=SIS File to Install: +DebugRunProcessDialog.SISQueryTip=Specify which SIS file to install on the phone prior to launching +DebugRunProcessDialog.Title=Select installation file +DebugRunProcessSection.AttachMsg=attach to a process selected at launch time +DebugRunProcessSection.ChangeMsg=Click the 'Change...' button to select another {0} method. +DebugRunProcessSection.CopyMsg=copy files to the device +DebugRunProcessSection.InstallMsg=install "{0}" +DebugRunProcessSection.LaunchFormat=launch ''{0}'' +DebugRunProcessSection.MainFormat=Carbide will {0} and {1}. +DebugRunProcessSection.MustInstallError=Carbide must install a package to debug this project. +DebugRunProcessSection.NoExesError=This project does not build any executables. +DebugRunProcessSection.NoRemoteExeError=No remote executable is selected. +DebugRunProcessSection.Title={0} process +LaunchWizard.AdvancedLabel=Edit advanced settings before launch +LaunchWizard.AdvancedTip=Before finishing the wizard, edit settings in the ''{0} Configurations'' dialog. +LaunchWizard.EditLabel=Edit +LaunchWizard.EditTip=Click to accept settings and edit advanced settings. +LaunchWizard.FinishTip=Click to accept settings and launch the program. +LaunchWizard.Title=New Launch Configuration Wizard +LaunchWizardData.DebugModeLabel=Debug +LaunchWizardData.RunModeLabel=Run OtherSettingsDialog.Title=Build Options Selection +OtherSettingsDialog.Desc1=Build the project before launch? +OtherSettingsDialog.Desc2=This can take a very long time in some projects and build systems. +OtherSettingsDialog.Desc3=On the other hand, you must remember to build the project yourself if you make changes. +OtherSettingsDialog.Title=Other Settings 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.DisabledLabel=\ (disabled) OtherSettingsDialog.EnableButtonLabel=Enable build before launch OtherSettingsDialog.EnableButtonToolTip=Always build project before launching (this may impact launch performance) +OtherSettingsDialog.EnabledLabel=\ (enabled) OtherSettingsDialog.WorkspaceSettingsButtonLabel=Use workspace settings OtherSettingsDialog.WorkspaceSettingsButtonToolTip=Use workspace setting for "Build (if required) before Launch" OtherSettingsDialog.WorkspaceSettingsLinkLabel=Configure Workspace Settings... OtherSettingsDialog.WorkspaceSettingsPageID=org.eclipse.debug.ui.LaunchingPreferencePage +OtherSettingsSection.BuildBeforeLabel=Carbide will build the project before launch +OtherSettingsSection.NoBuildBeforeLabel=Carbide will not build the project before launch +OtherSettingsSection.Title=Other settings +OtherSettingsSection.WorkspaceLabel=\ (workspace setting) +UnifiedLaunchOptionsPage.Desc=Configure the connection and process to launch. +UnifiedLaunchOptionsPage.Title=Configure Launch Settings +UnifiedLaunchOptionsPage.TitleText=Configure launch configuration diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/ILaunchCreationWizard.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/wizard/ILaunchCreationWizard.java Tue Feb 16 13:44:12 2010 -0600 @@ -0,0 +1,31 @@ +/* +* 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.wizard; + +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.swt.widgets.Shell; + +public interface ILaunchCreationWizard { + + void init(); + + int openWizard(Shell shell); + + ILaunchConfigurationWorkingCopy getLaunchConfiguration(); + + boolean shouldOpenLaunchConfigurationDialog(); +} diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizard.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizard.java Tue Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizard.java Tue Feb 16 13:44:12 2010 -0600 @@ -30,11 +30,9 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; import com.nokia.carbide.cpp.ui.CarbideUIPlugin; import com.nokia.carbide.cpp.ui.ICarbideSharedImages; @@ -44,11 +42,10 @@ import com.nokia.cpp.internal.api.utils.core.Logging; import com.nokia.cpp.internal.api.utils.core.Pair; -public class LaunchCreationWizard extends Wizard { +public class LaunchCreationWizard extends Wizard implements ILaunchCreationWizard { private MainExecutableSelectionWizardPage fBinarySelectionPage; private LaunchWizardSummaryPage fEmulationSummaryPage; - private LaunchCategorySelectionPage fCategorySelectionPage; private LaunchWizardSelectionPage fWizardSelectionPage; private BuildOptionsSelectionPage fBuildOptionsSelectionPage; private ILaunchConfigurationWorkingCopy launchConfig; @@ -56,6 +53,7 @@ private IProject project; private String configurationName; private List wizards = new ArrayList(); + private String categoryId; public LaunchCreationWizard(IProject project, String configurationName, List mmps, List exes, IPath defaultExecutable, @@ -76,7 +74,6 @@ fBinarySelectionPage = new MainExecutableSelectionWizardPage(mmps, exes, defaultExecutable, true, emulatorPath, emulatorOnly, fEmulationSummaryPage); } else { - fCategorySelectionPage = new LaunchCategorySelectionPage(this); fWizardSelectionPage = new LaunchWizardSelectionPage(this, mmps, exes, defaultExecutable, project, configurationName, mode); } } @@ -117,7 +114,6 @@ addPage(fEmulationSummaryPage); } else if (fWizardSelectionPage != null) { - addPage(fCategorySelectionPage); addPage(fWizardSelectionPage); } } @@ -127,7 +123,7 @@ return true; } - public void init(IWorkbench workbench, IStructuredSelection selection) { + public void init() { setWindowTitle(Messages.getString("LaunchCreationWizard.0")); //$NON-NLS-1$ setDefaultPageImageDescriptor(CarbideUIPlugin.getSharedImages().getImageDescriptor(ICarbideSharedImages.IMG_NEW_LAUNCH_CONFIG_WIZARD_BANNER)); } @@ -155,8 +151,12 @@ return shouldOpenLaunchDialog; } - public String getSelectedCategoryId() { - return fCategorySelectionPage.getSelectedCategoryId(); + public void setCategoryId(String categoryId) { + this.categoryId = categoryId; + } + + public String getCategoryId() { + return categoryId; } public List getWizardsForCategory(String categoryId) { @@ -170,30 +170,12 @@ } private void loadWizards(List mmps, List exes, IPath defaultExecutable, String mode) { - AppTRKLaunchWizard appTRKWizard = new AppTRKLaunchWizard(mmps, exes, defaultExecutable, project, configurationName); - if (appTRKWizard.supportsMode(mode)) { - appTRKWizard.addPages(); - wizards.add(appTRKWizard); - } - - SystemTRKLaunchWizard sysTRKWizard = new SystemTRKLaunchWizard(mmps, exes, defaultExecutable, project, configurationName); - if (sysTRKWizard.supportsMode(mode)) { - sysTRKWizard.addPages(); - wizards.add(sysTRKWizard); - } - Trace32LaunchWizard trace32Wizard = new Trace32LaunchWizard(mmps, exes, defaultExecutable, project, configurationName); if (trace32Wizard.supportsMode(mode)) { trace32Wizard.addPages(); wizards.add(trace32Wizard); } - AttachTRKLaunchWizard attachTRKWizard = new AttachTRKLaunchWizard(mmps, exes, defaultExecutable, project, configurationName); - if (attachTRKWizard.supportsMode(mode)) { - attachTRKWizard.addPages(); - wizards.add(attachTRKWizard); - } - // load any wizard extensions IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(LaunchPlugin.PLUGIN_ID + ".launchWizardExtension"); //$NON-NLS-1$ diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchOptions.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/wizard/LaunchOptions.java Tue Feb 16 13:44:12 2010 -0600 @@ -0,0 +1,19 @@ +package com.nokia.cdt.internal.debug.launch.wizard; + +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; + +public class LaunchOptions { + + public IProject project; + public String mode; + public String configurationName; + public boolean isEmulation; // aka isX86 + public boolean emulatorOnly; // aka useEmulationByDefault + public IPath defaultExecutable; + public List exes; + public List mmps; + +} \ No newline at end of file diff -r 885b827031ab -r bff887fe7694 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchWizardSelectionPage.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchWizardSelectionPage.java Tue Feb 16 13:43:06 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchWizardSelectionPage.java Tue Feb 16 13:44:12 2010 -0600 @@ -146,7 +146,7 @@ public void setVisible(boolean visible) { super.setVisible(visible); if (visible && wizardSelectionTableViewer != null) { - wizardSelectionTableViewer.setInput(mainWizard.getWizardsForCategory(mainWizard.getSelectedCategoryId())); + wizardSelectionTableViewer.setInput(mainWizard.getWizardsForCategory(mainWizard.getCategoryId())); if (inputChanged) { wizardSelectionTableViewer.setSelection(new StructuredSelection(wizardSelectionTableViewer.getElementAt(0)), true); }