1 11 package org.eclipse.jdt.internal.debug.ui.monitors; 12 13 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.core.runtime.IStatus; 16 import org.eclipse.core.runtime.Status; 17 import org.eclipse.core.runtime.jobs.Job; 18 import org.eclipse.jdt.debug.core.IJavaDebugTarget; 19 import org.eclipse.jface.action.IAction; 20 import org.eclipse.ui.progress.IWorkbenchSiteProgressService; 21 22 25 public class MonitorTraceAction extends MonitorAction { 26 27 30 public void run(IAction action) { 31 32 final IJavaDebugTarget target= getDebugTarget(); 33 if (target == null) { 34 return; 35 } 36 Job job = new Job(MonitorMessages.getString("MonitorsView.4")) { protected IStatus run(IProgressMonitor monitor) { 38 MonitorManager.getDefault().update(target); 39 Runnable r = new Runnable () { 40 public void run() { 41 fView.refreshCurrentViewer(target.supportsMonitorInformation(), false); 42 } 43 }; 44 fView.asyncExec(r); 45 return Status.OK_STATUS; 46 } 47 }; 48 job.setSystem(true); 49 IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) fView.getAdapter(IWorkbenchSiteProgressService.class); 50 if (service == null) { 51 job.schedule(); 52 } else { 53 service.schedule(job); 54 } 55 } 56 57 60 public void update() { 61 boolean enable= false; 62 if (fAction != null) { 63 IJavaDebugTarget target= getDebugTarget(); 64 if (target != null) { 65 enable= target.supportsMonitorInformation(); 66 } 67 fAction.setEnabled(enable); 68 } 69 } 70 } 71 | Popular Tags |