Skip to main content
summaryrefslogtreecommitdiffstats
blob: c20e85ee7e365747d5fd7aeb754f32c94e3bd124 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*******************************************************************************
 * Copyright (c) 2009 Red Hat, Inc.
 * 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
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Red Hat - initial API and implementation
 *******************************************************************************/

package org.eclipse.linuxtools.callgraph;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;


public class SystemTapCommandParser extends Job {

	private String filePath;
	private String returnText;
	private boolean printIsDone;
	public CallgraphView stapview;
	private String testOutput;
	public boolean useColours;
	private boolean graphingMode;
	private boolean processFinished;


	public boolean isProcessFinished() {
		return processFinished;
	}


	public void setProcessFinished(boolean processFinished) {
		this.processFinished = processFinished;
	}


	public SystemTapCommandParser(String name, String filePath, CallgraphView sview, 
			boolean useColours,
			boolean scheduleGraph, String configName) {
		super(name);
		this.filePath = filePath;
		this.stapview = sview;
		this.useColours = useColours;
		this.graphingMode = scheduleGraph;
		this.processFinished=false;
	}

	
	public String getCommand() {
		return filePath;
	}

	/**
	 * Convenience method to set this.filePath.
	 * Currently not used.
	 * 
	 * @param filePath - filePath to be set
	 */
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	@Override
	protected IStatus run(IProgressMonitor monitor) {
		
			if (graphingMode) {
				//Delegate to graphing parser instead of this one
				StapGraphParser p = new StapGraphParser();
				p.setFile(filePath);
				p.schedule();
				
//				String text = Helper.getMainConsoleTextByName(configName);
//				returnText = "       " + configName+"\n"; //$NON-NLS-1$ //$NON-NLS-2$
//				returnText += dashes() + "\n\n"; //$NON-NLS-1$
//				setText(text);
//
//				
//				SystemTapUIJob uijob = new SystemTapUIJob("SystemTapUIJob", this, this.useColours); //$NON-NLS-1$
//				uijob.schedule();
			
				return Status.OK_STATUS;
			}

		return Status.OK_STATUS;
	}

	public synchronized void setText(String text) {
		returnText += text;
	}

	public synchronized String getText() {
		String tmp = returnText;
		returnText = ""; //$NON-NLS-1$
		return tmp;
	}

	public synchronized void setDone() {
		printIsDone = true;
	}
	
	public synchronized void clearDone() {
		printIsDone = false;
	}
	
	public synchronized boolean checkDone() {
		return printIsDone;
	}
	
	public String getTestOutput() {
		return testOutput;
	}
	
	public IStatus testRun(IProgressMonitor m) {
		return run(m);
	}

	
}

Back to the top