Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2005-06-03 11:08:08 -0400
committerDarin Wright2005-06-03 11:08:08 -0400
commit4db7c92d739f31bddccd132c0b2ccd1f3cc5e9d6 (patch)
treee0a10e15d86352cb9a125177cd8d1c72b4243cf7
parent421e94c73f52a5852de0e271d1d962e5ffb8a569 (diff)
downloadeclipse.platform.debug-4db7c92d739f31bddccd132c0b2ccd1f3cc5e9d6.tar.gz
eclipse.platform.debug-4db7c92d739f31bddccd132c0b2ccd1f3cc5e9d6.tar.xz
eclipse.platform.debug-4db7c92d739f31bddccd132c0b2ccd1f3cc5e9d6.zip
Bug 98256 - Debugger failure freezing the IDE
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java73
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties1
3 files changed, 73 insertions, 3 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
index 7cc933254..14bec9505 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
@@ -16,6 +16,7 @@ import java.util.Iterator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
@@ -36,6 +37,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowActionDelegate, IViewActionDelegate, IActionDelegate2, ISelectionListener, INullSelectionListener {
@@ -70,6 +72,47 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
*/
private DebugRequestJob fBackgroundJob = null;
+ /**
+ * Background job to update enablement.
+ */
+ private UpdateEnablementJob fUpdateEnablementJob = new UpdateEnablementJob();
+
+ /**
+ * Used to schedule jobs, or <code>null</code> if none
+ */
+ private IWorkbenchSiteProgressService fProgressService = null;
+
+ class UpdateEnablementJob extends Job {
+
+ IAction targetAction = null;
+ ISelection targetSelection = null;
+
+ public UpdateEnablementJob() {
+ super(ActionMessages.AbstractDebugActionDelegate_1);
+ setPriority(Job.INTERACTIVE);
+ setSystem(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IStatus run(IProgressMonitor monitor) {
+ IAction action = null;
+ ISelection selection = null;
+ synchronized (this) {
+ action = targetAction;
+ selection = targetSelection;
+ }
+ update(action, selection);
+ return Status.OK_STATUS;
+ }
+
+ public synchronized void setTargets(IAction action, ISelection selection) {
+ targetAction = action;
+ targetSelection = selection;
+ }
+ }
+
class DebugRequestJob extends Job {
private Object[] fElements = null;
@@ -176,7 +219,7 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
fBackgroundJob = new DebugRequestJob(DebugUIPlugin.removeAccelerators(action.getText()));
}
fBackgroundJob.setTargets(selection.toArray());
- fBackgroundJob.schedule();
+ schedule(fBackgroundJob);
}
/**
@@ -247,7 +290,12 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
boolean wasInitialized= initialize(action, s);
if (!wasInitialized) {
if (getView() != null) {
- update(action, s);
+ if (isRunInBackground()) {
+ fUpdateEnablementJob.setTargets(action, s);
+ schedule(fUpdateEnablementJob);
+ } else {
+ update(action, s);
+ }
}
}
}
@@ -292,6 +340,7 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
*/
public void init(IViewPart view) {
fViewPart = view;
+ fProgressService = (IWorkbenchSiteProgressService) view.getAdapter(IWorkbenchSiteProgressService.class);
}
/**
@@ -355,7 +404,12 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
* @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- update(getAction(), selection);
+ if (isRunInBackground()) {
+ fUpdateEnablementJob.setTargets(getAction(), selection);
+ schedule(fUpdateEnablementJob);
+ } else {
+ update(getAction(), selection);
+ }
}
protected void setAction(IAction action) {
@@ -419,4 +473,17 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
*/
public void init(IAction action) {
}
+
+ /**
+ * Schedules the given job with this action's progress service
+ *
+ * @param job
+ */
+ private void schedule(Job job) {
+ if (fProgressService == null) {
+ job.schedule();
+ } else {
+ fProgressService.schedule(job);
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
index abd9ebb07..cdadfbfaa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
@@ -153,4 +153,6 @@ public class ActionMessages extends NLS {
public static String AssignValueAction_5;
public static String AbstractDebugActionDelegate_0;
+
+ public static String AbstractDebugActionDelegate_1;
} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
index 041a68bd2..63b7d595a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
@@ -94,6 +94,7 @@ AbstractLaunchHistoryAction_2=Debug
AbstractLaunchHistoryAction_3=Profile
AbstractLaunchHistoryAction_4=Launch
AbstractDebugActionDelegate_0=Error
+AbstractDebugActionDelegate_1=Update debug action enablement
ToggleDetailPaneAction_1=Vertical View Orientation
ToggleDetailPaneAction_2=Place the Detail Pane Underneath the Main Tree View

Back to the top