01: /*******************************************************************************
02: * Copyright (c) 2004, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.jobs.actions;
11:
12: import org.eclipse.core.internal.jobs.JobManager;
13: import org.eclipse.core.runtime.Platform;
14: import org.eclipse.core.runtime.jobs.Job;
15: import org.eclipse.jface.action.IAction;
16: import org.eclipse.jface.viewers.ISelection;
17: import org.eclipse.ui.IWorkbenchWindow;
18: import org.eclipse.ui.IWorkbenchWindowActionDelegate;
19:
20: /**
21: * This class is not really sample code. This action is used to gather debugging
22: * information about the internal state of the background job scheduling
23: * mechanism.
24: */
25: public class DebugJobManagerAction implements
26: IWorkbenchWindowActionDelegate {
27: public DebugJobManagerAction() {
28: super ();
29: }
30:
31: public void dispose() {
32: //
33: }
34:
35: public void init(IWorkbenchWindow window) {
36: //
37: }
38:
39: public void run(IAction action) {
40: System.out
41: .println("**** BEGIN DUMP JOB MANAGER INFORMATION ****"); //$NON-NLS-1$
42: Job[] jobs = Platform.getJobManager().find(null);
43: for (int i = 0; i < jobs.length; i++) {
44: System.out
45: .println("" + jobs[i].getClass().getName() + " state: " + JobManager.printState(jobs[i].getState())); //$NON-NLS-1$ //$NON-NLS-2$
46: }
47: System.out
48: .println("**** END DUMP JOB MANAGER INFORMATION ****"); //$NON-NLS-1$
49: }
50:
51: public void selectionChanged(IAction action, ISelection selection) {
52: //
53: }
54: }
|