# HG changeset patch # User wpaul # Date 1244486772 18000 # Node ID 0e84cf0560e1fe753c6f9fa7739b940b798698f6 # Parent 2e1a235ea76d6fac99444d4b61cc2f6d39ef0a3f added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins. diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/plugin.xml --- a/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Mon Jun 08 13:46:12 2009 -0500 @@ -262,6 +262,7 @@ point="org.eclipse.ui.startup"> - + + diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/schema/launchCategoryExtension.exsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debuggercdi/com.nokia.cdt.debug.launch/schema/launchCategoryExtension.exsd Mon Jun 08 13:46:12 2009 -0500 @@ -0,0 +1,109 @@ + + + + + + + + + This extension point allows plugins to contribute categories to the Carbide launch wizard. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Carbide 2.1.0 + + + + + + + + + <extension + point="com.nokia.cdt.debug.launch.launchCategoryExtension"> + <category + id="com.xyz.XYZLaunchCategory" + name="My Category" + description="This is my category"/> + </extension> + + + + + + + diff -r 2e1a235ea76d -r 0e84cf0560e1 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 Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Mon Jun 08 13:46:12 2009 -0500 @@ -293,7 +293,7 @@ // or both try { final LaunchCreationWizard wizard = - new LaunchCreationWizard(project, defaultConfigName, mmpPaths, exePaths, defaultExecutable, isX86, useEmulatorByDefault); + new LaunchCreationWizard(project, defaultConfigName, mmpPaths, exePaths, defaultExecutable, isX86, useEmulatorByDefault, mode); Display.getDefault().syncExec(new Runnable() { public void run() { wizard.init(PlatformUI.getWorkbench(), null); diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/messages.properties --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/messages.properties Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/messages.properties Mon Jun 08 13:46:12 2009 -0500 @@ -273,8 +273,6 @@ Trace32ConnectionTab.7=Select Trace32 Config file Trace32ConnectionTab.8=Trace32 Initialization Script\: Trace32ConnectionTab.9=The absolute path on your PC of the Trace32 cmm file. -ContextMainTab.0=The project's current build configuration will be used to determine what kind of debug session to launch. -Launch.common.Exception_occurred_reading_configuration_EXCEPTION= PartialUpgradeAlertDialog.title=Information PartialUpgradeAlertDialog.text=The sis/sisx file you're downloading is rather large. There is a builder option which will build\na partial upgrade sis/sisx file containing only the files that have changed since the last install.\nThis can potentially greatly reduce download and hence debugging time.\nClick the link below to go to the SIS Builder settings if you'd like to enable this feature. PartialUpgradeAlertDialog.dontAskAgain=Don't ask me again diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AbstractLaunchWizard.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AbstractLaunchWizard.java Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AbstractLaunchWizard.java Mon Jun 08 13:46:12 2009 -0500 @@ -22,12 +22,16 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.jface.wizard.Wizard; import java.util.List; public abstract class AbstractLaunchWizard extends Wizard implements ILaunchWizard { + public static final String PHONE_CATEGORY_ID = "com.nokia.cdt.debug.launch.phoneCategory"; //$NON-NLS-1$ + public static final String BOARD_CATEGORY_ID = "com.nokia.cdt.debug.launch.boardCategory"; //$NON-NLS-1$ + private LaunchWizardSummaryPage summaryPage; private String configName = ""; //$NON-NLS-1$ private IProject project; @@ -51,6 +55,14 @@ setDefaultPageImageDescriptor(CarbideUIPlugin.getSharedImages().getImageDescriptor(ICarbideSharedImages.IMG_NEW_LAUNCH_CONFIG_WIZARD_BANNER)); } + public abstract String getLaunchTypeID(); + + public abstract boolean supportsCategory(String categoryId); + + public boolean supportsMode(String mode) { + return DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(getLaunchTypeID()).supportsMode(mode); + } + public String getConfigName() { return configName; } @@ -91,9 +103,9 @@ return binarySelectionPage.getSelectedExeMmpPair(); if (exes != null && !exes.isEmpty()) - return new Pair(exes.get(0), mmps.isEmpty() ? null : mmps.get(0)); + return new Pair(exes.get(0), mmps.isEmpty() ? null : mmps.get(0)); - return new Pair(null, null); + return new Pair(null, null); } public IPath getProcessToLaunchTargetPath() { diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AppTRKLaunchWizard.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AppTRKLaunchWizard.java Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AppTRKLaunchWizard.java Mon Jun 08 13:46:12 2009 -0500 @@ -38,7 +38,17 @@ setWindowTitle(Messages.getString("AppTRKLaunchWizard.1")); //$NON-NLS-1$ } - public boolean performFinish() { + @Override + public String getLaunchTypeID() { + return SettingsData.APP_TRK_LAUNCH_TYPE_ID; + } + + @Override + public boolean supportsCategory(String categoryId) { + return categoryId.equals(PHONE_CATEGORY_ID); + } + + public boolean performFinish() { hasFinished = true; return true; } diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AttachTRKLaunchWizard.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AttachTRKLaunchWizard.java Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AttachTRKLaunchWizard.java Mon Jun 08 13:46:12 2009 -0500 @@ -35,6 +35,16 @@ setWindowTitle(Messages.getString("AttachTRKLaunchWizard.1")); //$NON-NLS-1$ } + @Override + public String getLaunchTypeID() { + return SettingsData.ATTACH_LAUNCH_TYPE_ID; + } + + @Override + public boolean supportsCategory(String categoryId) { + return categoryId.equals(PHONE_CATEGORY_ID); + } + public boolean performFinish() { hasFinished = true; return true; diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCategorySelectionPage.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/LaunchCategorySelectionPage.java Mon Jun 08 13:46:12 2009 -0500 @@ -0,0 +1,255 @@ +/* +* 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.wizard; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.PlatformUI; + +import com.nokia.cdt.internal.debug.launch.LaunchPlugin; +import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.core.Logging; + +class LaunchCategorySelectionPage extends WizardPage implements ISelectionChangedListener, IStructuredContentProvider { + + private LaunchCreationWizard wizard; + private FormBrowser descriptionBrowser; + private TableViewer categorySelectionTableViewer = null; + + private class LaunchCategory { + private String id; + private String name; + private String description; + + LaunchCategory(String id, String name, String description) { + this.id = id; + this.name = name; + this.description = description; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof LaunchCategory) { + LaunchCategory category = (LaunchCategory)obj; + + // just compare the id and name to check for uniqueness + return category.getId().equals(id) && category.getName().equals(name); + } + return false; + } + + @Override + public String toString() { + return name; + } + } + + private List categories = new ArrayList(); + + + public LaunchCategorySelectionPage(LaunchCreationWizard wizard) throws Exception { + super(Messages.getString("LaunchCategorySelectionPage.title")); //$NON-NLS-1$ + setTitle(Messages.getString("LaunchCategorySelectionPage.title")); //$NON-NLS-1$ + setDescription(Messages.getString("LaunchCategorySelectionPage.description")); //$NON-NLS-1$ + + this.wizard = wizard; + descriptionBrowser = new FormBrowser(); + descriptionBrowser.setText(""); //$NON-NLS-1$ + + // add the built in categories + if (wizard.getWizardsForCategory(AbstractLaunchWizard.PHONE_CATEGORY_ID).size() > 0) { + categories.add(new LaunchCategory(AbstractLaunchWizard.PHONE_CATEGORY_ID, + Messages.getString("LaunchCategorySelectionPage.phone"), //$NON-NLS-1$)); + Messages.getString("LaunchCategorySelectionPage.phoneDesc"))); //$NON-NLS-1$)); + } + + if (wizard.getWizardsForCategory(AbstractLaunchWizard.BOARD_CATEGORY_ID).size() > 0) { + categories.add(new LaunchCategory(AbstractLaunchWizard.BOARD_CATEGORY_ID, + Messages.getString("LaunchCategorySelectionPage.board"), //$NON-NLS-1$)); + Messages.getString("LaunchCategorySelectionPage.boardDesc"))); //$NON-NLS-1$)); + } + + loadCategoryExtensions(); + } + + public void createDescriptionIn(Composite composite) { + descriptionBrowser.createControl(composite); + Control c = descriptionBrowser.getControl(); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.widthHint = 200; + c.setLayoutData(gd); + } + + public void setDescriptionText(String text) { + descriptionBrowser.setText(text); + } + + public void moveToNextPage() { + getContainer().showPage(getNextPage()); + } + + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.verticalSpacing = 10; + container.setLayout(layout); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Label label = new Label(container, SWT.NONE); + label.setText(Messages.getString("LaunchCategorySelectionPage.categoryLabel")); //$NON-NLS-1$ + GridData gd = new GridData(); + label.setLayoutData(gd); + + SashForm sashForm = new SashForm(container, SWT.VERTICAL); + gd = new GridData(GridData.FILL_BOTH); + gd.widthHint = 300; + gd.heightHint = 300; + gd.minimumHeight = 230; + sashForm.setLayoutData(gd); + + categorySelectionTableViewer = new TableViewer(sashForm, SWT.BORDER); + categorySelectionTableViewer.setContentProvider(this); + categorySelectionTableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + selectionChanged(new SelectionChangedEvent(categorySelectionTableViewer, categorySelectionTableViewer.getSelection())); + moveToNextPage(); + } + }); + categorySelectionTableViewer.setInput(categories); + categorySelectionTableViewer.addSelectionChangedListener(this); + + createDescriptionIn(sashForm); + sashForm.setWeights(new int[] {75, 25}); + + Dialog.applyDialogFont(container); + setControl(container); + + // select the first element by default + categorySelectionTableViewer.setSelection(new StructuredSelection(categorySelectionTableViewer.getElementAt(0)), true); + + PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), LaunchWizardHelpIds.CATEGORY_SELECTION_PAGE); + } + + public void selectionChanged(SelectionChangedEvent event) { + String description = null; + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); + if (!selection.isEmpty()) { + LaunchCategory selectedCategory = (LaunchCategory)selection.getFirstElement(); + description = selectedCategory.getDescription(); + } + setDescriptionText(description); + } + + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible && categorySelectionTableViewer != null) { + categorySelectionTableViewer.getTable().setFocus(); + } + } + + public Object[] getElements(Object inputElement) { + return categories.toArray(); + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + public String getSelectedCategoryId() { + IStructuredSelection selection = (IStructuredSelection)categorySelectionTableViewer.getSelection(); + LaunchCategory selectedCategory = (LaunchCategory)selection.getFirstElement(); + return selectedCategory.getId(); + } + + private void loadCategoryExtensions() { + // load any category extensions + IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); + IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(LaunchPlugin.PLUGIN_ID + ".launchCategoryExtension"); //$NON-NLS-1$ + IExtension[] extensions = extensionPoint.getExtensions(); + + for (int i = 0; i < extensions.length; i++) { + IExtension extension = extensions[i]; + IConfigurationElement[] elements = extension.getConfigurationElements(); + Check.checkContract(elements.length == 1); + IConfigurationElement element = elements[0]; + + boolean failed = false; + try { + String id = element.getAttribute("id"); //$NON-NLS-1$ + String name = element.getAttribute("name"); //$NON-NLS-1$ + String description = element.getAttribute("description"); //$NON-NLS-1$ + if (id == null || name == null || description == null) { + failed = true; + } else { + if (wizard.getWizardsForCategory(id).size() > 0) { + LaunchCategory category = new LaunchCategory(id, name, description); + if (!categories.contains(category)) { + categories.add(category); + } else { + failed = true; + } + } + } + } + catch (Exception e) { + failed = true; + } + + if (failed) { + LaunchPlugin.log(Logging.newStatus(LaunchPlugin.getDefault(), + IStatus.ERROR, + "Unable to load launchCategoryExtension extension from " + extension.getContributor().getName())); + } + } + } +} diff -r 2e1a235ea76d -r 0e84cf0560e1 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 Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizard.java Mon Jun 08 13:46:12 2009 -0500 @@ -24,7 +24,13 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.jface.viewers.IStructuredSelection; @@ -33,23 +39,30 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; +import java.util.ArrayList; import java.util.List; public class LaunchCreationWizard extends Wizard { private MainExecutableSelectionWizardPage fBinarySelectionPage; private LaunchWizardSummaryPage fEmulationSummaryPage; + private LaunchCategorySelectionPage fCategorySelectionPage; private LaunchWizardSelectionPage fWizardSelectionPage; private ILaunchConfigurationWorkingCopy launchConfig; private boolean shouldOpenLaunchDialog; private IProject project; private String configurationName; + private List wizards = new ArrayList(); public LaunchCreationWizard(IProject project, String configurationName, List mmps, List exes, IPath defaultExecutable, - boolean isEmulation, boolean emulatorOnly) throws Exception { + boolean isEmulation, boolean emulatorOnly, String mode) throws Exception { this.project = project; + this.configurationName = configurationName; + + loadWizards(mmps, exes, defaultExecutable, mode); + // show the binary selection page as only page in main wizard if emulation, // otherwise it will be shown as needed by non-emulation wizards if (isEmulation) { @@ -58,11 +71,10 @@ IPath emulatorPath = getEmulatorPathFromExePath(exes.get(0)); fBinarySelectionPage = new MainExecutableSelectionWizardPage(mmps, exes, defaultExecutable, true, emulatorPath, emulatorOnly, fEmulationSummaryPage); } - else { - fWizardSelectionPage = new LaunchWizardSelectionPage(mmps, exes, defaultExecutable, project, configurationName); + else { + fCategorySelectionPage = new LaunchCategorySelectionPage(this); + fWizardSelectionPage = new LaunchWizardSelectionPage(this, mmps, exes, defaultExecutable, project, configurationName, mode); } - - this.configurationName = configurationName; } public boolean performFinish() { @@ -99,6 +111,7 @@ addPage(fEmulationSummaryPage); } else if (fWizardSelectionPage != null) { + addPage(fCategorySelectionPage); addPage(fWizardSelectionPage); } } @@ -136,4 +149,84 @@ return shouldOpenLaunchDialog; } + public String getSelectedCategoryId() { + return fCategorySelectionPage.getSelectedCategoryId(); + } + + public List getWizardsForCategory(String categoryId) { + List wizardsInCatgegory = new ArrayList(); + for (AbstractLaunchWizard wizard : wizards) { + if (wizard.supportsCategory(categoryId)) { + wizardsInCatgegory.add(wizard); + } + } + return wizardsInCatgegory; + } + + 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); + } + + SophiaLaunchWizard sophiaWizard = new SophiaLaunchWizard(mmps, exes, defaultExecutable, project, configurationName); + if (sophiaWizard.supportsMode(mode)) { + sophiaWizard.addPages(); + wizards.add(sophiaWizard); + } + + 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$ + IExtension[] extensions = extensionPoint.getExtensions(); + + for (int i = 0; i < extensions.length; i++) { + IExtension extension = extensions[i]; + IConfigurationElement[] elements = extension.getConfigurationElements(); + Check.checkContract(elements.length == 1); + IConfigurationElement element = elements[0]; + + boolean failed = false; + try { + Object extObject = element.createExecutableExtension("class"); //$NON-NLS-1$ + if (extObject instanceof ILaunchWizardContributor) { + AbstractLaunchWizard wizard = ((ILaunchWizardContributor)extObject).getWizard(mmps, exes, defaultExecutable, project, configurationName); + if (wizard.supportsMode(mode)) { + wizard.addPages(); + wizards.add(wizard); + } + } else { + failed = true; + } + } + catch (CoreException e) { + failed = true; + } + + if (failed) { + LaunchPlugin.log(Logging.newStatus(LaunchPlugin.getDefault(), + IStatus.ERROR, + "Unable to load launchWizardExtension extension from " + extension.getContributor().getName())); + } + } + } } diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchWizardHelpIds.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchWizardHelpIds.java Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchWizardHelpIds.java Mon Jun 08 13:46:12 2009 -0500 @@ -28,6 +28,8 @@ public static final String WIZARD_BINARY_SELECTION_PAGE = HelpID_Prefix + "wizard_binary_selection_page"; //$NON-NLS-1$ + public static final String CATEGORY_SELECTION_PAGE = HelpID_Prefix + "category_selection_page"; //$NON-NLS-1$ + public static final String WIZARD_SELECTION_PAGE = HelpID_Prefix + "wizard_selection_page"; //$NON-NLS-1$ public static final String WIZARD_SUMMARY_PAGE = HelpID_Prefix + "wizard_summary_page"; //$NON-NLS-1$ diff -r 2e1a235ea76d -r 0e84cf0560e1 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 Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchWizardSelectionPage.java Mon Jun 08 13:46:12 2009 -0500 @@ -16,19 +16,11 @@ */ package com.nokia.cdt.internal.debug.launch.wizard; -import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; @@ -50,76 +42,21 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.ui.PlatformUI; -import com.nokia.cdt.internal.debug.launch.LaunchPlugin; -import com.nokia.cpp.internal.api.utils.core.*; - class LaunchWizardSelectionPage extends WizardSelectionPage implements ISelectionChangedListener, IStructuredContentProvider { + private LaunchCreationWizard mainWizard; private FormBrowser descriptionBrowser; private TableViewer wizardSelectionTableViewer = null; - private List wizards = new ArrayList(); private ILaunchWizard selectedWizard = null; + private boolean inputChanged = false; - - public LaunchWizardSelectionPage(List mmps, List exes, IPath defaultExecutable, IProject project, String configurationName) throws Exception { + public LaunchWizardSelectionPage(LaunchCreationWizard mainWizard, List mmps, List exes, IPath defaultExecutable, IProject project, String configurationName, String mode) throws Exception { super(Messages.getString("LaunchWizardSelectionPage.0")); //$NON-NLS-1$ setTitle(Messages.getString("LaunchWizardSelectionPage.1")); //$NON-NLS-1$ setDescription(Messages.getString("LaunchWizardSelectionPage.2")); //$NON-NLS-1$ + this.mainWizard = mainWizard; descriptionBrowser = new FormBrowser(); descriptionBrowser.setText(""); //$NON-NLS-1$ - - AppTRKLaunchWizard appTRKWizard = new AppTRKLaunchWizard(mmps, exes, defaultExecutable, project, configurationName); - appTRKWizard.addPages(); - wizards.add(appTRKWizard); - - SystemTRKLaunchWizard sysTRKWizard = new SystemTRKLaunchWizard(mmps, exes, defaultExecutable, project, configurationName); - sysTRKWizard.addPages(); - wizards.add(sysTRKWizard); - - Trace32LaunchWizard trace32Wizard = new Trace32LaunchWizard(mmps, exes, defaultExecutable, project, configurationName); - trace32Wizard.addPages(); - wizards.add(trace32Wizard); - - SophiaLaunchWizard sophiaWizard = new SophiaLaunchWizard(mmps, exes, defaultExecutable, project, configurationName); - sophiaWizard.addPages(); - wizards.add(sophiaWizard); - - AttachTRKLaunchWizard attachTRKWizard = new AttachTRKLaunchWizard(mmps, exes, defaultExecutable, project, configurationName); - attachTRKWizard.addPages(); - wizards.add(attachTRKWizard); - - // load any wizard extensions - IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(LaunchPlugin.PLUGIN_ID + ".launchWizardExtension"); //$NON-NLS-1$ - IExtension[] extensions = extensionPoint.getExtensions(); - - for (int i = 0; i < extensions.length; i++) { - IExtension extension = extensions[i]; - IConfigurationElement[] elements = extension.getConfigurationElements(); - Check.checkContract(elements.length == 1); - IConfigurationElement element = elements[0]; - - boolean failed = false; - try { - Object extObject = element.createExecutableExtension("class"); //$NON-NLS-1$ - if (extObject instanceof ILaunchWizardContributor) { - AbstractLaunchWizard wizard = ((ILaunchWizardContributor)extObject).getWizard(mmps, exes, defaultExecutable, project, configurationName); - wizard.addPages(); - wizards.add(wizard); - } else { - failed = true; - } - } - catch (CoreException e) { - failed = true; - } - - if (failed) { - LaunchPlugin.log(Logging.newStatus(LaunchPlugin.getDefault(), - IStatus.ERROR, - "Unable to load launchWizardExtension extension from " + extension.getContributor().getName())); - } - } } public void createDescriptionIn(Composite composite) { @@ -169,7 +106,6 @@ moveToNextPage(); } }); - wizardSelectionTableViewer.setInput(wizards); wizardSelectionTableViewer.addSelectionChangedListener(this); createDescriptionIn(sashForm); @@ -178,9 +114,6 @@ Dialog.applyDialogFont(container); setControl(container); - // select the first element by default - wizardSelectionTableViewer.setSelection(new StructuredSelection(wizardSelectionTableViewer.getElementAt(0)), true); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), LaunchWizardHelpIds.WIZARD_SELECTION_PAGE); } @@ -207,16 +140,25 @@ public void setVisible(boolean visible) { super.setVisible(visible); if (visible && wizardSelectionTableViewer != null) { + wizardSelectionTableViewer.setInput(mainWizard.getWizardsForCategory(mainWizard.getSelectedCategoryId())); + if (inputChanged) { + wizardSelectionTableViewer.setSelection(new StructuredSelection(wizardSelectionTableViewer.getElementAt(0)), true); + } wizardSelectionTableViewer.getTable().setFocus(); } } public Object[] getElements(Object inputElement) { + List wizards = (List)inputElement; return wizards.toArray(); } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - + if (oldInput == null || newInput == null || !oldInput.equals(newInput)) { + inputChanged = true; + } else { + inputChanged = false; + } } public ILaunchWizard getSelectedWizard() { diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/SophiaLaunchWizard.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/SophiaLaunchWizard.java Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/SophiaLaunchWizard.java Mon Jun 08 13:46:12 2009 -0500 @@ -28,59 +28,69 @@ public class SophiaLaunchWizard extends AbstractLaunchWizard { - private SophiaWizardPage fSophiaPage; - private StopModeRomImageWizardPage fRomImgPage; - - private boolean hasFinished = false; + private SophiaWizardPage fSophiaPage; + private StopModeRomImageWizardPage fRomImgPage; + + private boolean hasFinished = false; - public SophiaLaunchWizard(List mmps, List exes, IPath defaultExecutable, IProject project, String configurationName) { - super(project, configurationName, mmps, exes, defaultExecutable, true, false); - setWindowTitle(Messages.getString("SophiaLaunchWizard.1")); //$NON-NLS-1$ - } + public SophiaLaunchWizard(List mmps, List exes, IPath defaultExecutable, IProject project, String configurationName) { + super(project, configurationName, mmps, exes, defaultExecutable, true, false); + setWindowTitle(Messages.getString("SophiaLaunchWizard.1")); //$NON-NLS-1$ + } - public boolean performFinish() { - hasFinished = true; - return true; - } - - public void addPages() { - super.addPages(); - fSophiaPage = new SophiaWizardPage(this); - fRomImgPage = new StopModeRomImageWizardPage(this); - addPage(fSophiaPage); - addPage(fRomImgPage); - addPage(getSummaryPage()); - } + @Override + public String getLaunchTypeID() { + return SettingsData.STI_LAUNCH_TYPE_ID; + } + + @Override + public boolean supportsCategory(String categoryId) { + return categoryId.equals(BOARD_CATEGORY_ID); + } - public String toString() { - return Messages.getString("SophiaLaunchWizard.2"); //$NON-NLS-1$ - } - - public String getDescription() { - return Messages.getString("SophiaLaunchWizard.3"); //$NON-NLS-1$ - } - - public ILaunchConfigurationWorkingCopy createLaunchConfiguration(IPath mmpPath, IPath exePath, IPath processToLaunchTargetPath) { - // if we haven't finished then don't create anything - if (!hasFinished) { - return null; - } + public boolean performFinish() { + hasFinished = true; + return true; + } + + public void addPages() { + super.addPages(); + fSophiaPage = new SophiaWizardPage(this); + fRomImgPage = new StopModeRomImageWizardPage(this); + addPage(fSophiaPage); + addPage(fRomImgPage); + addPage(getSummaryPage()); + } - ILaunchConfigurationWorkingCopy config = null; - try { - // create our config - config = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(SettingsData.STI_LAUNCH_TYPE_ID).newInstance(null, getConfigName()); - - // set the default values - SettingsData.setDefaults(config, SettingsData.LaunchConfig_SophiaSTI, getProject(), mmpPath, exePath); - - // now let the wizard pages update values - fSophiaPage.updateConfiguration(config); - fRomImgPage.updateConfiguration(config); - - } catch (CoreException e) { - e.printStackTrace(); - } - return config; - } + public String toString() { + return Messages.getString("SophiaLaunchWizard.2"); //$NON-NLS-1$ + } + + public String getDescription() { + return Messages.getString("SophiaLaunchWizard.3"); //$NON-NLS-1$ + } + + public ILaunchConfigurationWorkingCopy createLaunchConfiguration(IPath mmpPath, IPath exePath, IPath processToLaunchTargetPath) { + // if we haven't finished then don't create anything + if (!hasFinished) { + return null; + } + + ILaunchConfigurationWorkingCopy config = null; + try { + // create our config + config = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(SettingsData.STI_LAUNCH_TYPE_ID).newInstance(null, getConfigName()); + + // set the default values + SettingsData.setDefaults(config, SettingsData.LaunchConfig_SophiaSTI, getProject(), mmpPath, exePath); + + // now let the wizard pages update values + fSophiaPage.updateConfiguration(config); + fRomImgPage.updateConfiguration(config); + + } catch (CoreException e) { + e.printStackTrace(); + } + return config; + } } diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/SystemTRKLaunchWizard.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/SystemTRKLaunchWizard.java Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/SystemTRKLaunchWizard.java Mon Jun 08 13:46:12 2009 -0500 @@ -37,6 +37,16 @@ setWindowTitle(Messages.getString("SystemTRKLaunchWizard.1")); //$NON-NLS-1$ } + @Override + public String getLaunchTypeID() { + return SettingsData.SYS_TRK_LAUNCH_TYPE_ID; + } + + @Override + public boolean supportsCategory(String categoryId) { + return categoryId.equals(PHONE_CATEGORY_ID); + } + public boolean performFinish() { hasFinished = true; return true; diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/Trace32LaunchWizard.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/Trace32LaunchWizard.java Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/Trace32LaunchWizard.java Mon Jun 08 13:46:12 2009 -0500 @@ -38,6 +38,16 @@ setWindowTitle(Messages.getString("Trace32LaunchWizard.1")); //$NON-NLS-1$ } + @Override + public String getLaunchTypeID() { + return SettingsData.T32_LAUNCH_TYPE_ID; + } + + @Override + public boolean supportsCategory(String categoryId) { + return categoryId.equals(BOARD_CATEGORY_ID); + } + public boolean performFinish() { hasFinished = true; return true; diff -r 2e1a235ea76d -r 0e84cf0560e1 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/messages.properties --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/messages.properties Thu Jun 04 13:57:20 2009 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/messages.properties Mon Jun 08 13:46:12 2009 -0500 @@ -5,6 +5,13 @@ AttachTRKLaunchWizard.2=Attach to Process Launch Configuration AttachTRKLaunchWizard.3=The debugger will attempt to debug a process already running on the phone. LaunchCreationWizard.0=New Launch Configuration Wizard +LaunchCategorySelectionPage.title=Launch Categories +LaunchCategorySelectionPage.description=Select a launch category. +LaunchCategorySelectionPage.phone=Phone +LaunchCategorySelectionPage.board=Board +LaunchCategorySelectionPage.phoneDesc=Launches on a phone using System TRK or Application TRK. +LaunchCategorySelectionPage.boardDesc=Launches on a development board or reference hardware using a JTAG connection. +LaunchCategorySelectionPage.categoryLabel=Select where you want to launch LaunchWizardSelectionPage.0=Launch Wizard LaunchWizardSelectionPage.1=Launch Types LaunchWizardSelectionPage.2=Select a launch type.