blob: 523aead4f6044a4dcb66862f9b68d372661ff414 (
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
|
/*******************************************************************************
* Copyright (c) 2014 Wind River Systems, 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:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.te.tcf.remote.core.operation;
import static java.text.MessageFormat.format;
import java.util.Map;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.services.IProcesses;
import org.eclipse.tcf.services.IProcesses.DoneGetEnvironment;
import org.eclipse.tcf.services.IProcessesV1;
import org.eclipse.tcf.te.tcf.core.Tcf;
import org.eclipse.tcf.te.tcf.remote.core.nls.Messages;
public class TCFOperationGetEnvironment extends TCFOperation<Map<String,String>> {
private final IPeer fPeer;
public TCFOperationGetEnvironment(IPeer peer) {
fPeer = peer;
}
@Override
protected void doExecute() {
IChannel channel = Tcf.getChannelManager().getChannel(fPeer);
if (channel == null) {
setError(createStatus(format(Messages.TCFOperationGetEnvironment_errorNoChannel, fPeer.getName()), null));
return;
}
IProcesses psvc = channel.getRemoteService(IProcessesV1.class);
if (psvc == null) {
psvc = channel.getRemoteService(IProcesses.class);
}
if (psvc == null) {
setError(createStatus(format(Messages.TCFOperationGetEnvironment_errorNoProcessesService, fPeer.getName()), null));
return;
}
psvc.getEnvironment(new DoneGetEnvironment() {
@Override
public void doneGetEnvironment(IToken token, Exception error, Map<String, String> environment) {
if (shallAbort(error))
return;
setResult(environment);
}
});
}
}
|