diff options
author | Darin Wright | 2006-08-01 19:07:50 +0000 |
---|---|---|
committer | Darin Wright | 2006-08-01 19:07:50 +0000 |
commit | 40f4d73c180333a9b7f1197ee155ba3a36de7ede (patch) | |
tree | ae726931d269d794694b1d3a44028de55fcb2870 | |
parent | 0ccbc4cf94ee28a83ee51fc62ddb72e1c2743a42 (diff) | |
download | eclipse.platform.debug-40f4d73c180333a9b7f1197ee155ba3a36de7ede.tar.gz eclipse.platform.debug-40f4d73c180333a9b7f1197ee155ba3a36de7ede.tar.xz eclipse.platform.debug-40f4d73c180333a9b7f1197ee155ba3a36de7ede.zip |
Bug 152472 debug platform should not hold locks while notifying context change listeners
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java index 96da8355e..5755ebe7d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java @@ -67,6 +67,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; @@ -174,14 +175,16 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi return fContext; } - protected synchronized void activate(ISelection selection) { - fContext = selection; + protected void activate(final ISelection selection) { + synchronized (this) { + fContext = selection; + } Object[] listeners = fListeners.getListeners(); for (int i = 0; i < listeners.length; i++) { final IDebugContextListener listener = (IDebugContextListener) listeners[i]; SafeRunner.run(new ISafeRunnable() { public void run() throws Exception { - listener.contextActivated(fContext, ContextProvider.this.getPart()); + listener.contextActivated(selection, ContextProvider.this.getPart()); } public void handleException(Throwable exception) { DebugUIPlugin.log(exception); @@ -191,25 +194,31 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi } } - protected synchronized void possibleContextChange(Object element) { - if (fContext instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection) fContext; - if (ss.size() == 1 && ss.getFirstElement().equals(element)) { - Object[] listeners = fListeners.getListeners(); - for (int i = 0; i < listeners.length; i++) { - final IDebugContextListener listener = (IDebugContextListener) listeners[i]; - SafeRunner.run(new ISafeRunnable() { - public void run() throws Exception { - listener.contextChanged(fContext, ContextProvider.this.getPart()); - } - public void handleException(Throwable exception) { - DebugUIPlugin.log(exception); - } - }); - - } + protected void possibleContextChange(Object element) { + synchronized (this) { + if (fContext instanceof IStructuredSelection) { + IStructuredSelection ss = (IStructuredSelection) fContext; + if (!(ss.size() == 1 && ss.getFirstElement().equals(element))) { + return; + } + } else { + return; } } + Object[] listeners = fListeners.getListeners(); + final IStructuredSelection context = new StructuredSelection(element); + for (int i = 0; i < listeners.length; i++) { + final IDebugContextListener listener = (IDebugContextListener) listeners[i]; + SafeRunner.run(new ISafeRunnable() { + public void run() throws Exception { + listener.contextChanged(context, ContextProvider.this.getPart()); + } + public void handleException(Throwable exception) { + DebugUIPlugin.log(exception); + } + }); + + } } } |