diff options
author | Sarika Sinha | 2021-01-04 08:38:37 +0000 |
---|---|---|
committer | Sarika Sinha | 2021-01-04 11:14:02 +0000 |
commit | e2d47cf8b6ac0d51dfb3e28d05f13a922c35fec0 (patch) | |
tree | 717f0e450f27cbdf9dd7d39289184baa671623d5 | |
parent | 7a97d4a6db4f4cf5a165013a1f6dc7a5f77e5e46 (diff) | |
download | eclipse.platform.debug-e2d47cf8b6ac0d51dfb3e28d05f13a922c35fec0.tar.gz eclipse.platform.debug-e2d47cf8b6ac0d51dfb3e28d05f13a922c35fec0.tar.xz eclipse.platform.debug-e2d47cf8b6ac0d51dfb3e28d05f13a922c35fec0.zip |
Bug 482711 - [launch] Creating the first launch config does not notify
ILaunchConfigurationListener.launchConfigurationAdded()
Change-Id: I02885791a58c9fe7e800413931383d8b2210bd2f
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java | 6 | ||||
-rw-r--r-- | org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java | 33 |
2 files changed, 37 insertions, 2 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java index caf10c2d7..aae9eab19 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2020 IBM Corporation and others. + * Copyright (c) 2000, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -179,6 +179,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe */ private StepFilterManager fStepFilterManager = null; + public LaunchManager() { + getAllLaunchConfigurations(); + } + /** * Notifies a launch config listener in a safe runnable to handle * exceptions. diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java index 5447884d9..1f16e87e2 100644 --- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java +++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2020 IBM Corporation and others. + * Copyright (c) 2000, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -1873,4 +1873,35 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau assertTrue(t2.isPrototype()); } + @Test + public void testNewInstanceNotifiesListener() throws CoreException { + ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); + final ArrayList<String> added = new ArrayList<>(); + ILaunchConfigurationListener listener = new ILaunchConfigurationListener() { + + @Override + public void launchConfigurationRemoved(ILaunchConfiguration configuration) { + + } + + @Override + public void launchConfigurationChanged(ILaunchConfiguration configuration) { + + } + + @Override + public void launchConfigurationAdded(ILaunchConfiguration configuration) { + added.add("Launch Configuration added"); + + } + }; + launchManager.addLaunchConfigurationListener(listener); + String typeId = "org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"; + + ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(typeId); + type.newInstance(null, "new-lc").doSave(); + assertEquals(1, added.size()); + assertEquals("Launch Configuration added", added.get(0)); + + } } |