From 0fc265dc4efe9fd97719cb510f08c7d70306a7b0 Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Thu, 23 Jul 2015 13:31:22 -0400 Subject: [PATCH] launchbar: fixes in config edit wizard page - removed code that did nothing - added dispose code to restore lc dialog otherwise if you cancel cannot bring any sort of lc dialog again - added code to have unique lc name as suggestion Change-Id: Ia33abed6019edb097cc775f00cbfea1629e9720b --- .../dialogs/NewLaunchConfigEditPage.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/dialogs/NewLaunchConfigEditPage.java b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/dialogs/NewLaunchConfigEditPage.java index e07ae5ef3fc..5106f560110 100644 --- a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/dialogs/NewLaunchConfigEditPage.java +++ b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/dialogs/NewLaunchConfigEditPage.java @@ -104,7 +104,7 @@ public class NewLaunchConfigEditPage extends WizardPage { if (name.isEmpty()) { return Messages.NewLaunchConfigEditPage_4; } - + ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); if (manager.isExistingLaunchConfigurationName(name)) { ILaunchConfiguration config = ((LaunchManager) manager).findLaunchConfiguration(name); @@ -125,20 +125,19 @@ public class NewLaunchConfigEditPage extends WizardPage { return; try { String initialMode = ((NewLaunchConfigWizard) getWizard()).modePage.selectedGroup.getMode(); - workingCopy = type.newInstance(null, Messages.NewLaunchConfigEditPage_6); + ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); + String name = manager.generateLaunchConfigurationName("launchConfiguration"); //$NON-NLS-1$ + workingCopy = type.newInstance(null, name); tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(workingCopy, initialMode); for (CTabItem item : tabFolder.getItems()) item.dispose(); LaunchConfigurationsDialog.setCurrentlyVisibleLaunchConfigurationDialog(launchConfigurationDialog); tabGroup.createTabs(launchConfigurationDialog, initialMode); - boolean firstTab = true; + for (ILaunchConfigurationTab tab : tabGroup.getTabs()) { tab.setLaunchConfigurationDialog(launchConfigurationDialog); tab.createControl(tabFolder); tab.setDefaults(workingCopy); - if (firstTab) { - firstTab = false; - } } // Do this after all the tabs have their controls created @@ -164,6 +163,7 @@ public class NewLaunchConfigEditPage extends WizardPage { } } + boolean performFinish() { if (workingCopy == null) return false; @@ -173,6 +173,11 @@ public class NewLaunchConfigEditPage extends WizardPage { return true; } + @Override + public void dispose() { + LaunchConfigurationsDialog.setCurrentlyVisibleLaunchConfigurationDialog(null); + } + public void validateFields() { // page is not complete unless we finish validation successfully setPageComplete(false); @@ -228,6 +233,13 @@ public class NewLaunchConfigEditPage extends WizardPage { return workingCopy; } + @Override + public void launchConfigurationAdded(ILaunchConfiguration configuration) { + if (getLaunchConfiguration() == null) + return; + super.launchConfigurationAdded(configuration); + } + @Override public LaunchGroupExtension getLaunchGroup() { return NewLaunchConfigEditPage.this.getLaunchGroup();