+ environment API
diff --git a/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/console/JavaScriptConsoleUtil.java b/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/console/JavaScriptConsoleUtil.java
index 6161877..2daa05d 100644
--- a/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/console/JavaScriptConsoleUtil.java
+++ b/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/console/JavaScriptConsoleUtil.java
@@ -1,10 +1,12 @@
package org.eclipse.dltk.javascript.console;
-import java.io.File;
import java.io.IOException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.dltk.console.ScriptConsoleServer;
+import org.eclipse.dltk.core.environment.EnvironmentManager;
+import org.eclipse.dltk.core.environment.IExecutionEnvironment;
+import org.eclipse.dltk.core.environment.IFileHandle;
import org.eclipse.dltk.javascript.core.JavaScriptNature;
import org.eclipse.dltk.javascript.launching.JavaScriptLaunchingPlugin;
import org.eclipse.dltk.launching.ScriptLaunchUtil;
@@ -21,8 +23,11 @@
String[] args = new String[] { "127.0.0.1", port, id };
- File scriptFile = JavaScriptLaunchingPlugin.getDefault()
- .getConsoleProxy().toFile();
+ // TODO: Add environments support
+ IExecutionEnvironment exeEnv = (IExecutionEnvironment) EnvironmentManager
+ .getLocalEnvironment().getAdapter(IExecutionEnvironment.class);
+ IFileHandle scriptFile = JavaScriptLaunchingPlugin.getDefault()
+ .getConsoleProxy(exeEnv);
ScriptLaunchUtil.runScript(JavaScriptNature.NATURE_ID, scriptFile,
null, null, args, null);
}
diff --git a/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/internal/launching/GenericJavaScriptInstallType.java b/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/internal/launching/GenericJavaScriptInstallType.java
index 944b2ca..5ad2457 100644
--- a/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/internal/launching/GenericJavaScriptInstallType.java
+++ b/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/internal/launching/GenericJavaScriptInstallType.java
@@ -10,11 +10,17 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.dltk.core.environment.EnvironmentPathUtils;
+import org.eclipse.dltk.core.environment.IDeployment;
+import org.eclipse.dltk.core.environment.IEnvironment;
+import org.eclipse.dltk.core.environment.IFileHandle;
+import org.eclipse.dltk.core.internal.environment.LocalEnvironment;
import org.eclipse.dltk.internal.launching.AbstractInterpreterInstallType;
import org.eclipse.dltk.javascript.core.JavaScriptNature;
import org.eclipse.dltk.javascript.launching.JavaScriptLaunchingPlugin;
@@ -37,7 +43,7 @@
return "Generic Rhino install";
}
- public LibraryLocation[] getDefaultLibraryLocations(File installLocation,
+ public LibraryLocation[] getDefaultLibraryLocations(IFileHandle installLocation,
EnvironmentVariable[] variables, IProgressMonitor monitor) {
Bundle bundle = Platform.getBundle(EMBEDDED_RHINO_BUNDLE_ID);
@@ -48,9 +54,13 @@
try {
File fl = new File(new URI(resolve.toString())).getParentFile()
- .getParentFile().getParentFile().getParentFile();
- return new LibraryLocation[] { new LibraryLocation(new Path(fl
- .getAbsolutePath())) };
+ .getParentFile().getParentFile().getParentFile();
+ IEnvironment env = LocalEnvironment.getInstance();
+ Path localPath = new Path(fl
+ .getAbsolutePath());
+ IPath fullPath = EnvironmentPathUtils.getFullPath(env, localPath);
+ LibraryLocation location = new LibraryLocation(fullPath);
+ return new LibraryLocation[] { location };
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -84,11 +94,11 @@
environment.remove("DISPLAY");
}
- public IStatus validateInstallLocation(File installLocation) {
+ public IStatus validateInstallLocation(IFileHandle installLocation) {
return Status.OK_STATUS;
}
- protected File createPathFile() throws IOException {
+ protected IPath createPathFile(IDeployment deployment) throws IOException {
// this method should not be used
throw new RuntimeException("This method should not be used");
}
diff --git a/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/launching/JavaScriptLaunchingPlugin.java b/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/launching/JavaScriptLaunchingPlugin.java
index 701af93..4cbcf71 100644
--- a/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/launching/JavaScriptLaunchingPlugin.java
+++ b/plugins/org.eclipse.dltk.javascript.launching/src/org/eclipse/dltk/javascript/launching/JavaScriptLaunchingPlugin.java
@@ -3,8 +3,11 @@
import java.io.IOException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
-import org.eclipse.dltk.utils.DeployHelper;
+import org.eclipse.dltk.core.environment.IDeployment;
+import org.eclipse.dltk.core.environment.IExecutionEnvironment;
+import org.eclipse.dltk.core.environment.IFileHandle;
import org.osgi.framework.BundleContext;
/**
@@ -55,8 +58,11 @@
return PLUGIN_ID;
}
- public IPath getConsoleProxy() throws IOException {
- return DeployHelper.deploy(this, "console").append("ConsoleProxy.js");
+ public IFileHandle getConsoleProxy(IExecutionEnvironment exeEnv) throws IOException {
+ IDeployment deployment = exeEnv.createDeployment();
+ IPath path = deployment.add(this.getBundle(), "console");
+ path.append("ConsoleProxy.js");
+ return deployment.getFile(path);
}
}
\ No newline at end of file