diff options
author | Sarika Sinha | 2021-01-05 07:10:30 +0000 |
---|---|---|
committer | Andrey Loskutov | 2021-01-05 13:17:47 +0000 |
commit | d3ab09fbec4de49c976c6c0d123a1e4f3a742b56 (patch) | |
tree | 80eb6b65ec71e0322d5bbdd7746dee6214ce1c96 | |
parent | 0c2baeb0bbe9e5a9d2f158e7c120dd4f56b3d081 (diff) | |
download | eclipse.platform.debug-d3ab09fbec4de49c976c6c0d123a1e4f3a742b56.tar.gz eclipse.platform.debug-d3ab09fbec4de49c976c6c0d123a1e4f3a742b56.tar.xz eclipse.platform.debug-d3ab09fbec4de49c976c6c0d123a1e4f3a742b56.zip |
Bug 482711 - [launch] Creating the first launch config does not notifyY20210115-1200Y20210113-0120Y20210112-1200I20210118-1800I20210117-1940I20210117-1800I20210116-1800I20210116-0340I20210115-1810I20210114-1800I20210114-0510I20210114-0310I20210112-1800I20210112-0850I20210111-1800I20210110-1800I20210109-1830I20210108-1800
ILaunchConfigurationListener.launchConfigurationAdded()
Change-Id: I1e0741a4c718b8ac2c9f51d90ef3681f6926ac95
3 files changed, 39 insertions, 7 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java index 205163956..65e78f5b2 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 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 @@ -591,6 +591,9 @@ public class DebugPlugin extends Plugin { public synchronized ILaunchManager getLaunchManager() { if (fLaunchManager == null) { fLaunchManager = new LaunchManager(); + fLaunchManager.getAllLaunchConfigurations(); + // monitor launch configuration renames for launch groups + fLaunchManager.addLaunchConfigurationListener(new GroupMemberChangeListener()); } return fLaunchManager; } @@ -726,9 +729,6 @@ public class DebugPlugin extends Plugin { manager.registerAdapters(actionFactory, ILaunch.class); manager.registerAdapters(actionFactory, IProcess.class); manager.registerAdapters(actionFactory, IDebugElement.class); - - // monitor launch configuration renames for launch groups - getLaunchManager().addLaunchConfigurationListener(new GroupMemberChangeListener()); } /** 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..4caad68bf 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 @@ -1120,7 +1120,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe * * @return all launch configuration handles */ - private synchronized List<ILaunchConfiguration> getAllLaunchConfigurations() { + public synchronized List<ILaunchConfiguration> getAllLaunchConfigurations() { if (fLaunchConfigurationIndex == null) { try { fLaunchConfigurationIndex = new ArrayList<>(20); 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..4c5b200ac 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,36 @@ 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)); + + } + } |