1
/*******************************************************************************
2
* Copyright (c) 2009 Red Hat, Inc.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Red Hat - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.linuxtools.internal.callgraph.graphlisteners;
13
import org.eclipse.core.runtime.IProgressMonitor;
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.Status;
16
import org.eclipse.core.runtime.jobs.Job;
17
import org.eclipse.linuxtools.internal.callgraph.StapGraph;
18
import org.eclipse.swt.widgets.Display;
21
* A Projectionist is the gguy that operates a movie camera.
25
public class Projectionist extends Job {
26
private StapGraph graph;
27
private int frame_time = 2000;
28
private boolean pause;
34
* @param listener -- the keyListener instantiating this class
35
* @param time -- Amount of time between frames
37
public Projectionist(String name, StapGraph graph, int time) {
40
this.frame_time = time;
46
public IStatus run(IProgressMonitor monitor) {
48
long snapshot = System.currentTimeMillis();
53
} catch (InterruptedException e1) {
60
return Status.OK_STATUS;
62
if (System.currentTimeMillis() - snapshot >= frame_time) {
63
snapshot = System.currentTimeMillis();
65
Display.getDefault().asyncExec(new Runnable() {
76
} catch (InterruptedException e) {
80
if (monitor.isCanceled()) {
85
return Status.CANCEL_STATUS;
89
* Projectionist will pause -- reschedule job to continue