diff options
author | eutarass | 2011-09-08 01:11:12 +0000 |
---|---|---|
committer | eutarass | 2011-09-08 01:11:12 +0000 |
commit | 674184886a572f77a4d410f020592ac228e2c11b (patch) | |
tree | 3a1f503ca613d0f582bac9b56f3e9c03f919431f | |
parent | 3519d3334cac6a333c93a0174818fb078e0a4947 (diff) | |
download | org.eclipse.tcf-674184886a572f77a4d410f020592ac228e2c11b.tar.gz org.eclipse.tcf-674184886a572f77a4d410f020592ac228e2c11b.tar.xz org.eclipse.tcf-674184886a572f77a4d410f020592ac228e2c11b.zip |
TCF Debugger: fixed: the debugger should update editor annotations when launch configuration changes.
2 files changed, 62 insertions, 24 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java index fd0c4d6c4..8b8c4b1d7 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java @@ -22,7 +22,11 @@ import java.util.Map; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationListener; +import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.model.ISourceLocator; import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; import org.eclipse.debug.ui.DebugUITools; @@ -139,6 +143,7 @@ public class TCFAnnotationManager { private final HashSet<IWorkbenchWindow> dirty_windows = new HashSet<IWorkbenchWindow>(); private final HashSet<TCFLaunch> dirty_launches = new HashSet<TCFLaunch>(); + private final HashSet<TCFLaunch> changed_launch_cfgs = new HashSet<TCFLaunch>(); private final TCFLaunch.LaunchListener launch_listener = new TCFLaunch.LaunchListener() { @@ -225,7 +230,34 @@ public class TCFAnnotationManager { } }; + private final ILaunchConfigurationListener launch_conf_listener = new ILaunchConfigurationListener() { + + public void launchConfigurationAdded(ILaunchConfiguration cfg) { + } + + public void launchConfigurationChanged(final ILaunchConfiguration cfg) { + displayExec(new Runnable() { + public void run() { + ILaunch[] arr = launch_manager.getLaunches(); + for (ILaunch l : arr) { + if (l instanceof TCFLaunch) { + TCFLaunch t = (TCFLaunch)l; + if (cfg.equals(t.getLaunchConfiguration())) { + changed_launch_cfgs.add(t); + updateAnnotations(null, t); + } + } + } + } + }); + } + + public void launchConfigurationRemoved(ILaunchConfiguration cfg) { + } + }; + private final Display display = Display.getDefault(); + private final ILaunchManager launch_manager = DebugPlugin.getDefault().getLaunchManager(); private int update_active_launch_cnt = 0; private int update_unnotations_cnt = 0; private boolean started; @@ -234,6 +266,7 @@ public class TCFAnnotationManager { public TCFAnnotationManager() { assert Protocol.isDispatchThread(); TCFLaunch.addListener(launch_listener); + launch_manager.addLaunchConfigurationListener(launch_conf_listener); displayExec(new Runnable() { public void run() { if (!PlatformUI.isWorkbenchRunning() || PlatformUI.getWorkbench().isStarting()) { @@ -256,6 +289,7 @@ public class TCFAnnotationManager { if (disposed) return; assert Protocol.isDispatchThread(); disposed = true; + launch_manager.removeLaunchConfigurationListener(launch_conf_listener); TCFLaunch.removeListener(launch_listener); displayExec(new Runnable() { public void run() { @@ -493,10 +527,11 @@ public class TCFAnnotationManager { } }.getE(); } + boolean flush_all = node == null || changed_launch_cfgs.contains(node.launch); Iterator<TCFAnnotation> i = win_info.annotations.iterator(); while (i.hasNext()) { TCFAnnotation a = i.next(); - if (set != null && set.remove(a)) continue; + if (!flush_all && set != null && set.remove(a)) continue; a.dispose(); i.remove(); } @@ -590,6 +625,7 @@ public class TCFAnnotationManager { for (TCFLaunch launch : dirty_launches) { if (launch != null) launch.removePendingClient(TCFAnnotationManager.this); } + changed_launch_cfgs.clear(); dirty_windows.clear(); dirty_launches.clear(); } diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java index ee39cec6c..3f3a4d9e0 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java @@ -904,32 +904,34 @@ public class TCFLaunch extends Launch { public void launchConfigurationChanged(final ILaunchConfiguration cfg) { super.launchConfigurationChanged(cfg); if (!cfg.equals(getLaunchConfiguration())) return; - new TCFTask<Boolean>() { - public void run() { - try { - if (update_memory_maps != null) update_memory_maps.run(); - if (filepath_map != null) { - String s = cfg.getAttribute(TCFLaunchDelegate.ATTR_PATH_MAP, ""); - filepath_map = TCFLaunchDelegate.parsePathMapAttribute(s); - final IPathMap path_map_service = getService(IPathMap.class); - path_map_service.set(filepath_map.toArray(new IPathMap.PathMapRule[filepath_map.size()]), new IPathMap.DoneSet() { - public void doneSet(IToken token, Exception error) { - if (error != null) channel.terminate(error); - done(false); - } - }); + if (channel != null && channel.getState() == IChannel.STATE_OPEN) { + new TCFTask<Boolean>(channel) { + public void run() { + try { + if (update_memory_maps != null) update_memory_maps.run(); + if (filepath_map != null) { + String s = cfg.getAttribute(TCFLaunchDelegate.ATTR_PATH_MAP, ""); + filepath_map = TCFLaunchDelegate.parsePathMapAttribute(s); + final IPathMap path_map_service = getService(IPathMap.class); + path_map_service.set(filepath_map.toArray(new IPathMap.PathMapRule[filepath_map.size()]), new IPathMap.DoneSet() { + public void doneSet(IToken token, Exception error) { + if (error != null) channel.terminate(error); + done(false); + } + }); + } + else { + done(true); + } } - else { - done(true); + catch (Throwable x) { + channel.terminate(x); + done(false); } } - catch (Throwable x) { - channel.terminate(x); - done(false); - } - } - }.getE(); - // TODO: update signal masks when launch configuration changes + }.getE(); + // TODO: update signal masks when launch configuration changes + } } /** Thread safe method */ |