Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationGetEnvironment.java')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationGetEnvironment.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationGetEnvironment.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationGetEnvironment.java
new file mode 100644
index 000000000..dbad15519
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationGetEnvironment.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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;
+
+
+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);
+ }
+ });
+ }
+}

Back to the top