Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2009-01-11 02:08:55 +0000
committerDarin Wright2009-01-11 02:08:55 +0000
commit3b992fa981de141db5fcbe17bd71877a784e6e9a (patch)
tree8dfc2c014eec9349bef0734ee2476741f99503eb
parent2c923fdbd9ae3f70855b37a92a39689b799a53a7 (diff)
downloadeclipse.platform.debug-3b992fa981de141db5fcbe17bd71877a784e6e9a.tar.gz
eclipse.platform.debug-3b992fa981de141db5fcbe17bd71877a784e6e9a.tar.xz
eclipse.platform.debug-3b992fa981de141db5fcbe17bd71877a784e6e9a.zip
[r342] Bug 253257 - Source lookup job data getting overwritten while running
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java58
1 files changed, 35 insertions, 23 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java
index a12c36ce5..5b4045744 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -104,18 +104,14 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplay {
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
protected IStatus run(IProgressMonitor monitor) {
- if (!monitor.isCanceled()) {
- IStackFrame lookupFrame = fTarget;
- ISourceLocator lookupLocator = fLocator;
-
- if (lookupFrame != null && lookupLocator != null && !lookupFrame.isTerminated()) {
- ISourceLookupResult result = null;
- result = DebugUITools.lookupSource(lookupFrame, lookupLocator);
+ if (!monitor.isCanceled()) {
+ if (!fTarget.isTerminated()) {
+ ISourceLookupResult result = DebugUITools.lookupSource(fTarget, fLocator);
synchronized (StackFrameSourceDisplayAdapter.this) {
fPrevResult = (SourceLookupResult)result;
- fPrevFrame = lookupFrame;
+ fPrevFrame = fTarget;
}
- if (!monitor.isCanceled() && fPage != null && !lookupFrame.isTerminated()) {
+ if (!monitor.isCanceled() && !fTarget.isTerminated()) {
new SourceDisplayJob(result, fPage).schedule();
}
}
@@ -127,7 +123,12 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplay {
* @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
*/
public boolean belongsTo(Object family) {
- return getClass().equals(family);
+ // source lookup jobs are a family per workbench page
+ if (family instanceof SourceLookupJob) {
+ SourceLookupJob slj = (SourceLookupJob) family;
+ return slj.fPage.equals(fPage);
+ }
+ return false;
}
}
@@ -150,17 +151,11 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplay {
* @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
*/
public IStatus runInUIThread(IProgressMonitor monitor) {
- ISourceLookupResult result = null;
- IWorkbenchPage page = null;
- synchronized (this) {
- result = fResult;
- page = fPage;
- }
- if (!monitor.isCanceled() && result != null && page != null) {
- DebugUITools.displaySource(result, page);
+ if (!monitor.isCanceled() && fResult != null) {
+ DebugUITools.displaySource(fResult, fPage);
// termination may have occurred while displaying source
if (monitor.isCanceled()) {
- Object artifact = result.getArtifact();
+ Object artifact = fResult.getArtifact();
if (artifact instanceof IStackFrame) {
clearSourceSelection(((IStackFrame)artifact).getThread());
}
@@ -170,6 +165,18 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplay {
return Status.OK_STATUS;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
+ */
+ public boolean belongsTo(Object family) {
+ // source display jobs are a family per workbench page
+ if (family instanceof SourceDisplayJob) {
+ SourceDisplayJob sdj = (SourceDisplayJob) family;
+ return sdj.fPage.equals(fPage);
+ }
+ return false;
+ }
+
}
/* (non-Javadoc)
@@ -179,9 +186,15 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplay {
IStackFrame frame = (IStackFrame)context;
if (!force && frame.equals(fPrevFrame)) {
fPrevResult.updateArtifact(context);
- new SourceDisplayJob(fPrevResult, page).schedule();
+ SourceDisplayJob sdj = new SourceDisplayJob(fPrevResult, page);
+ // cancel any existing source display jobs for this page
+ Job.getJobManager().cancel(sdj);
+ sdj.schedule();
} else {
- new SourceLookupJob(frame, frame.getLaunch().getSourceLocator(), page).schedule();
+ SourceLookupJob slj = new SourceLookupJob(frame, frame.getLaunch().getSourceLocator(), page);
+ // cancel any existing source lookup jobs for this page
+ Job.getJobManager().cancel(slj);
+ slj.schedule();
}
}
@@ -217,7 +230,6 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplay {
if (fPrevFrame.getDebugTarget().equals(target)) {
fPrevFrame = null;
fPrevResult = null;
- Job.getJobManager().cancel(SourceLookupJob.class);
}
}
}

Back to the top