Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2009-11-03 20:59:24 +0000
committerDarin Wright2009-11-03 20:59:24 +0000
commita4ada607ce454d849b04403d6b6f3235da1d740e (patch)
treebe26ee770f10d1dedd5170fae778573e37b0ba1a
parentfc5de13a7691edc4fd289f07586d86ee5885ff54 (diff)
downloadeclipse.platform.debug-a4ada607ce454d849b04403d6b6f3235da1d740e.tar.gz
eclipse.platform.debug-a4ada607ce454d849b04403d6b6f3235da1d740e.tar.xz
eclipse.platform.debug-a4ada607ce454d849b04403d6b6f3235da1d740e.zip
Bug 41353 - [launching] Launch config templates
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java2
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java24
2 files changed, 25 insertions, 1 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
index fdec4f8ea..a3b50009b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
@@ -747,7 +747,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
* @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setTemplate(org.eclipse.debug.core.ILaunchConfiguration, boolean)
*/
public void setTemplate(ILaunchConfiguration template, boolean copy) throws CoreException {
- if (template.isWorkingCopy()) {
+ if (template != null && template.isWorkingCopy()) {
throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugCoreMessages.LaunchConfigurationWorkingCopy_6));
}
if (template == null) {
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
index 4b635aa33..6f64069ea 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
@@ -1147,6 +1147,30 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
assertNull(wc.getAttribute("String1", (String)null));
}
+
+ /**
+ * Tests that setting a configuration's template to null cleans its template
+ * association.
+ *
+ * @throws CoreException
+ */
+ public void testUnTemplate() throws CoreException {
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "test-un-template");
+ ILaunchConfigurationWorkingCopy t1 = newEmptyConfiguration(null, "template-un");
+ t1.setAttribute("COMMON", "TEMPLATE-1");
+ t1.setAttribute("T1", "T1");
+ t1.setAttribute("String1", "String2");
+ ILaunchConfiguration template = t1.doSave();
+ wc.setTemplate(template, true);
+ ILaunchConfiguration configuration = wc.doSave();
+ assertEquals(template, configuration.getTemplate());
+ wc = configuration.getWorkingCopy();
+ wc.setTemplate(null, false);
+ configuration = wc.doSave();
+ assertNull(configuration.getTemplate());
+ ILaunchConfiguration[] children = t1.getTemplateChildren();
+ assertEquals(0, children.length);
+ }
}

Back to the top