mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 15:45:25 +02:00
launch bar: corrected edit dialog handling of adding of new LC
- launch bar launch config was not handling add of another launch config correctly - it was just resetting itself to handle new LC. This cannot really be done because this dialog is bound to launch group and new lc may not be part of it and may not even support the mode current dialog is in. Also that make missyncronization between LC stored in parent and LC stored in getTabViewer which can cause other nasty problems. So let parent handle adding (which only handles locatio change) and for duplication we just open a new dialog and close current one. Change-Id: I2dde5c3af26d901d1f4b18cad84a83a9857a6ca9
This commit is contained in:
parent
03ab4beaf8
commit
fd58fed7e4
1 changed files with 13 additions and 16 deletions
|
@ -35,6 +35,7 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.progress.UIJob;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class LaunchConfigurationEditDialog extends LaunchConfigurationPropertiesDialog {
|
||||
|
@ -104,21 +105,11 @@ public class LaunchConfigurationEditDialog extends LaunchConfigurationProperties
|
|||
return composite;
|
||||
}
|
||||
|
||||
protected String getLaunchButtonText() {
|
||||
return DebugPlugin.getDefault().getLaunchManager().getLaunchMode(getMode()).getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
// Do nothing since we now have the buttons created above.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
|
||||
// update the dialog with the new config
|
||||
getTabViewer().setInput(configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buttonPressed(int buttonId) {
|
||||
switch (buttonId) {
|
||||
|
@ -145,17 +136,23 @@ public class LaunchConfigurationEditDialog extends LaunchConfigurationProperties
|
|||
case DUPLICATE_ID:
|
||||
final ILaunchConfiguration original = getLaunchConfiguration();
|
||||
final String newName = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(original.getName());
|
||||
new Job(Messages.LaunchConfigurationEditDialog_6) {
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
final Shell shell = getParentShell();
|
||||
final LaunchGroupExtension group = getLaunchGroup();
|
||||
|
||||
new UIJob(Messages.LaunchConfigurationEditDialog_6) {
|
||||
@Override
|
||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||
try {
|
||||
ILaunchConfigurationWorkingCopy newWorkingCopy = original.copy(newName);
|
||||
newWorkingCopy.doSave();
|
||||
return Status.OK_STATUS;
|
||||
final ILaunchConfigurationWorkingCopy newWorkingCopy = original.copy(newName);
|
||||
final ILaunchConfiguration newConfig = newWorkingCopy.doSave();
|
||||
new LaunchConfigurationEditDialog(shell, newConfig, group).open();
|
||||
} catch (CoreException e) {
|
||||
return e.getStatus();
|
||||
}
|
||||
};
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}.schedule();
|
||||
cancelPressed();
|
||||
break;
|
||||
case LAUNCH_ID:
|
||||
okPressed();
|
||||
|
|
Loading…
Add table
Reference in a new issue