mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Launch Bar - fix up how the new config wizard runs.
Only change the type when we're flipping to the next page. Also fixes the order of initialization of the tabs to eliminate the NPEs that were happening. Change-Id: I9bb0a5d3ff646e4ca340f9c461e3a3c88f89e557 Reviewed-on: https://git.eclipse.org/r/34010 Tested-by: Hudson CI Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
parent
c5ce43974e
commit
a104dc4f6d
2 changed files with 28 additions and 29 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue