diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/dialogs/NewLaunchConfigEditPage.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/dialogs/NewLaunchConfigEditPage.java index 76d52cabc29..406286e200e 100644 --- a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/dialogs/NewLaunchConfigEditPage.java +++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/dialogs/NewLaunchConfigEditPage.java @@ -135,7 +135,6 @@ public class NewLaunchConfigEditPage extends WizardPage { // tab.setDefaults likely renames it nameText.setText(workingCopy.getName()); } - tab.initializeFrom(workingCopy); CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE); tabItem.setText(tab.getName()); @@ -144,6 +143,11 @@ public class NewLaunchConfigEditPage extends WizardPage { tabItem.setControl(tab.getControl()); } + // Do this after all the tabs have their controls created + for (ILaunchConfigurationTab tab : tabGroup.getTabs()) { + tab.initializeFrom(workingCopy); + } + tabFolder.setSelection(0); } catch (CoreException e) { Activator.log(e); diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/dialogs/NewLaunchConfigTypePage.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/dialogs/NewLaunchConfigTypePage.java index 9ef61a544ea..0936dd9162a 100644 --- a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/dialogs/NewLaunchConfigTypePage.java +++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/dialogs/NewLaunchConfigTypePage.java @@ -10,24 +10,19 @@ *******************************************************************************/ package org.eclipse.cdt.launchbar.ui.internal.dialogs; -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.ILaunchConfigurationType; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.ILaunchGroup; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.progress.UIJob; public class NewLaunchConfigTypePage extends WizardPage { @@ -52,26 +47,6 @@ public class NewLaunchConfigTypePage extends WizardPage { populateItems(); - table.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - super.widgetSelected(e); - type = (ILaunchConfigurationType)table.getSelection()[0].getData(); - setMessage("Initializing. Please wait...", INFORMATION); - UIJob job = new UIJob("Updating Page") { - @Override - public IStatus runInUIThread(IProgressMonitor monitor) { - ((NewLaunchConfigWizard)getWizard()).editPage.changeLaunchConfigType(); - setPageComplete(true); - setMessage(null); - return Status.OK_STATUS; - } - }; - job.setUser(true); - job.schedule(); - } - }); - setControl(comp); } @@ -81,11 +56,13 @@ public class NewLaunchConfigTypePage extends WizardPage { return; table.removeAll(); - + + boolean haveItems = false; for (ILaunchConfigurationType type : DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes()) { if (!type.isPublic() || type.getCategory() != null || !type.supportsMode(group.getMode())) continue; + haveItems = true; TableItem item = new TableItem(table, SWT.NONE); item.setText(type.getName()); ImageDescriptor imageDesc = DebugUITools.getDefaultImageDescriptor(type); @@ -94,8 +71,26 @@ public class NewLaunchConfigTypePage extends WizardPage { item.setData(type); } + if (haveItems) { + table.select(0); + } + setPageComplete(haveItems); + type = null; - setPageComplete(false); + } + + @Override + public boolean canFlipToNextPage() { + return isPageComplete(); + } + + @Override + public IWizardPage getNextPage() { + setMessage("Initializing. Please wait...", INFORMATION); + type = (ILaunchConfigurationType)table.getSelection()[0].getData(); + NewLaunchConfigEditPage editPage = ((NewLaunchConfigWizard)getWizard()).editPage; + editPage.changeLaunchConfigType(); + return editPage; } }