Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-01-09 05:29:35 -0500
committerUwe Stieber2015-01-09 05:29:35 -0500
commitf887c4890bf0bc0c79adfa01d56fe7bd00b48bf5 (patch)
tree3c78ba7ea6489ed056f08f2ded74a74bf5d7e654
parentefb1d23573e5ad4ae4305e5749b6ba71ad2a3a77 (diff)
downloadorg.eclipse.tcf-f887c4890bf0bc0c79adfa01d56fe7bd00b48bf5.tar.gz
org.eclipse.tcf-f887c4890bf0bc0c79adfa01d56fe7bd00b48bf5.tar.xz
org.eclipse.tcf-f887c4890bf0bc0c79adfa01d56fe7bd00b48bf5.zip
Terminals: Fix Bug 454963 - please add ECLIPSE_HOME and ECLIPSE_WORKSPACE environment variables to launched local terminal
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java
index 1c9d62535..3586e004e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java
@@ -10,9 +10,16 @@
package org.eclipse.tcf.te.ui.terminals.local.types;
import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import org.eclipse.cdt.utils.pty.PTY;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.URIUtil;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalServiceOutputStreamMonitorListener;
import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
@@ -118,6 +125,30 @@ public class LocalConnectorType extends AbstractConnectorType {
envp = (String[])properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT);
}
+ // Set the ECLIPSE_HOME and ECLIPSE_WORKSPACE environment variables
+ List<String> envpList = new ArrayList<String>();
+ if (envp != null) envpList.addAll(Arrays.asList(envp));
+
+ // ECLIPSE_HOME
+ String eclipseHomeLocation = System.getProperty("eclipse.home.location"); //$NON-NLS-1$
+ if (eclipseHomeLocation != null) {
+ try {
+ URI uri = URIUtil.fromString(eclipseHomeLocation);
+ File f = URIUtil.toFile(uri);
+ envpList.add("ECLIPSE_HOME=" + f.getAbsolutePath()); //$NON-NLS-1$
+ } catch (URISyntaxException e) { /* ignored on purpose */ }
+ }
+
+ // ECLIPSE_WORKSPACE
+ if (ResourcesPlugin.getWorkspace() != null
+ && ResourcesPlugin.getWorkspace().getRoot() != null
+ && ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
+ envpList.add("ECLIPSE_WORKSPACE=" + ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); //$NON-NLS-1$
+ }
+
+ // Convert back into a string array
+ envp = envpList.toArray(new String[envpList.size()]);
+
Assert.isTrue(image != null || process != null);
// Construct the terminal settings store

Back to the top