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
|
/*******************************************************************************
* Copyright (c) 2007, 2013 Wind River Systems, Inc. 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
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.internal.services.remote;
import java.util.Map;
import org.eclipse.tcf.core.Command;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.services.IProcessesV1;
public class ProcessesV1Proxy extends ProcessesProxy implements IProcessesV1 {
public ProcessesV1Proxy(IChannel channel) {
super(channel);
}
public String getName() {
return IProcessesV1.NAME;
}
@Override
public IToken start(String directory, String file,
String[] command_line, Map<String,String> environment,
Map<String,Object> params, final DoneStart done) {
return new Command(channel, this,
"start", new Object[]{ directory, file, command_line, //$NON-NLS-1$
toEnvStringArray(environment), params }) {
@SuppressWarnings("unchecked")
@Override
public void done(Exception error, Object[] args) {
ProcessContext ctx = null;
if (error == null) {
assert args.length == 2;
error = toError(args[0]);
if (args[1] != null) ctx = new ProcessContextInfo((Map<String,Object>)args[1]);
}
done.doneStart(token, error, ctx);
}
}.token;
}
@Override
public IToken setWinSize(String id, int col, int row, final DoneCommand done) {
return new Command(channel, this, "setWinSize", new Object[]{ id, col, row }) { //$NON-NLS-1$
@Override
public void done(Exception error, Object[] args) {
if (error == null) {
assert args.length == 1;
error = toError(args[0]);
}
done.doneCommand(token, error);
}
}.token;
}
@Override
public IToken getCapabilities(final String id, final DoneGetCapabilities done) {
return new Command(channel, this, "getCapabilities", new Object[]{ id }) { //$NON-NLS-1$
@SuppressWarnings("unchecked")
@Override
public void done(Exception error, Object[] args) {
Map<String, Object> properties = null;
if (error == null) {
assert args.length == 2;
error = toError(args[0]);
if (args[1] != null) {
properties = (Map<String, Object>)args[1];
}
}
done.doneGetCapabilities(token, error, properties);
}
}.token;
}
}
|