blob: bab959fbcd327223800849c0bf7fffcac79dccbc (
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
|
/*******************************************************************************
* Copyright (c) 2017 QNX Software Systems and others.
* 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
*******************************************************************************/
package org.eclipse.cdt.debug.core.launch;
import java.io.IOException;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.IStreamListener;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.debug.core.model.IStreamsProxy;
/**
* A simple process that only spits out a message then terminates.
*
* @since 8.3
*/
public class NullProcess extends PlatformObject implements IProcess {
private final String message;
private final ILaunch launch;
public NullProcess(ILaunch launch, String message) {
this.launch = launch;
this.message = message;
}
@Override
public boolean canTerminate() {
return true;
}
@Override
public boolean isTerminated() {
return true;
}
@Override
public void terminate() throws DebugException {
}
@Override
public String getLabel() {
return launch.getLaunchConfiguration().getName();
}
@Override
public ILaunch getLaunch() {
return launch;
}
@Override
public IStreamsProxy getStreamsProxy() {
return new IStreamsProxy() {
@Override
public void write(String input) throws IOException {
// TODO Auto-generated method stub
}
@Override
public IStreamMonitor getOutputStreamMonitor() {
return new IStreamMonitor() {
@Override
public void removeListener(IStreamListener listener) {
}
@Override
public String getContents() {
return message;
}
@Override
public void addListener(IStreamListener listener) {
}
};
}
@Override
public IStreamMonitor getErrorStreamMonitor() {
return null;
}
};
}
@Override
public void setAttribute(String key, String value) {
}
@Override
public String getAttribute(String key) {
return null;
}
@Override
public int getExitValue() throws DebugException {
return 0;
}
}
|