diff options
author | Markus Duft | 2017-01-20 12:35:20 +0000 |
---|---|---|
committer | Sarika Sinha | 2017-02-06 08:46:20 +0000 |
commit | ab220976ddfb22a8b3230f3598f6dc0a2baac501 (patch) | |
tree | bfe409dc90926d6224e1d7eadca48fd70e5ddd73 /org.eclipse.debug.tests | |
parent | 11d8e4118051e4830ab9676c41821f63848387e5 (diff) | |
download | eclipse.platform.debug-ab220976ddfb22a8b3230f3598f6dc0a2baac501.tar.gz eclipse.platform.debug-ab220976ddfb22a8b3230f3598f6dc0a2baac501.tar.xz eclipse.platform.debug-ab220976ddfb22a8b3230f3598f6dc0a2baac501.zip |
Bug 508718 - Allow groups to catch up with renames in launch configs
This change registers a global listener in the LaunchManager that
handles updating launch groups whenever a member of that group is
renamed.
This relies on the workings of the ILaunchmanager#getMovedFrom method.
Change-Id: Ie1a617b6e826b0a1b6adb0a1b962dc18484f071a
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Diffstat (limited to 'org.eclipse.debug.tests')
-rw-r--r-- | org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java index b2bb6ce27..41cfda559 100644 --- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java +++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java @@ -5,9 +5,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; import java.util.List; -import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.core.runtime.CoreException; @@ -274,17 +272,22 @@ public class LaunchGroupTests extends AbstractLaunchTest { assertTrue("history[2] should be Test1", history[2].contentsEqual(t1)); //$NON-NLS-1$ } - protected Set<ILaunch> findRunningLaunch(ILaunchConfiguration cfg) { - Set<ILaunch> result = new HashSet<>(); - for (ILaunch l : getLaunchManager().getLaunches()) { - if (l.isTerminated()) { - continue; - } - if (l.getLaunchConfiguration().equals(cfg)) { - result.add(l); - } - } - return result; + public void testRename() throws Exception { + ILaunchConfiguration t1 = getLaunchConfiguration("Test1"); //$NON-NLS-1$ + ILaunchConfiguration t2 = getLaunchConfiguration("Test2"); //$NON-NLS-1$ + ILaunchConfiguration grp = createLaunchGroup(DEF_GRP_NAME, createLaunchGroupElement(t1, GroupElementPostLaunchAction.NONE, null, false), createLaunchGroupElement(t2, GroupElementPostLaunchAction.NONE, null, false)); + + ILaunchConfigurationWorkingCopy workingCopy = t1.getWorkingCopy(); + workingCopy.rename("AnotherTest"); //$NON-NLS-1$ + workingCopy.doSave(); + + assertTrue("name should not be transiently updated", grp.getName().equals(DEF_GRP_NAME)); //$NON-NLS-1$ + + // need to re-fetch configuration + grp = getLaunchConfiguration(DEF_GRP_NAME); + List<GroupLaunchElement> elements = GroupLaunchConfigurationDelegate.createLaunchElements(grp); + + assertTrue("group element should be updated", elements.get(0).name.equals("AnotherTest")); //$NON-NLS-1$//$NON-NLS-2$ } private static DummyStream attachDummyProcess(final ILaunch l) { @@ -382,8 +385,9 @@ public class LaunchGroupTests extends AbstractLaunchTest { @Override public void launchAdded(ILaunch launch) { - if (launch.getLaunchConfiguration().equals(cfg)) + if (launch.getLaunchConfiguration().equals(cfg)) { stream = attachDummyProcess(launch); + } } @Override |