Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2021-01-05 07:10:30 +0000
committerAndrey Loskutov2021-01-05 13:17:47 +0000
commitd3ab09fbec4de49c976c6c0d123a1e4f3a742b56 (patch)
tree80eb6b65ec71e0322d5bbdd7746dee6214ce1c96
parent0c2baeb0bbe9e5a9d2f158e7c120dd4f56b3d081 (diff)
downloadeclipse.platform.debug-d3ab09fbec4de49c976c6c0d123a1e4f3a742b56.tar.gz
eclipse.platform.debug-d3ab09fbec4de49c976c6c0d123a1e4f3a742b56.tar.xz
eclipse.platform.debug-d3ab09fbec4de49c976c6c0d123a1e4f3a742b56.zip
ILaunchConfigurationListener.launchConfigurationAdded() Change-Id: I1e0741a4c718b8ac2c9f51d90ef3681f6926ac95
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java34
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));
+
+ }
+
}

Back to the top