* some tcl improvements
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractScriptLaunchConfigurationDelegate.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractScriptLaunchConfigurationDelegate.java
index fadd09c..676bba3 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractScriptLaunchConfigurationDelegate.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractScriptLaunchConfigurationDelegate.java
@@ -86,14 +86,14 @@
* message, lower level exception, and error code.
*
* @param message
- * the status message
+ * the status message
* @param exception
- * lower level exception associated with the error, or
- * <code>null</code> if none
+ * lower level exception associated with the error, or
+ * <code>null</code> if none
* @param code
- * error code
+ * error code
* @throws CoreException
- * the "abort" core exception
+ * the "abort" core exception
*/
protected void abort(String message, Throwable exception, int code)
throws CoreException {
@@ -114,11 +114,11 @@
* configuration, or <code>null</code> if none.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the Interpreter install specified by the given launch
- * configuration, or <code>null</code> if none
+ * configuration, or <code>null</code> if none
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public IInterpreterInstall getInterpreterInstall(
ILaunchConfiguration configuration) throws CoreException {
@@ -130,12 +130,13 @@
* configuration exists and returns the Interpreter install.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the Interpreter install specified by the given launch
- * configuration
+ * configuration
* @exception CoreException
- * if unable to retrieve the attribute, the attribute is unspecified,
- * or if the home location is unspecified or does not exist
+ * if unable to retrieve the attribute, the attribute is
+ * unspecified, or if the home location is unspecified or
+ * does not exist
*/
public IInterpreterInstall verifyInterpreterInstall(
ILaunchConfiguration configuration) throws CoreException {
@@ -175,11 +176,11 @@
* launch configuration, or <code>null</code> if none.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the Interpreter connector identifier specified by the given
- * launch configuration, or <code>null</code> if none
+ * launch configuration, or <code>null</code> if none
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public String getDebugConnectorId(ILaunchConfiguration configuration)
throws CoreException {
@@ -195,11 +196,11 @@
* specified.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the buildpath specified by the given launch configuration,
- * possibly an empty array
+ * possibly an empty array
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public String[] getBuildpath(ILaunchConfiguration configuration)
throws CoreException {
@@ -227,12 +228,12 @@
* bootpath.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the bootpath specified by the given launch configuration. An
- * empty bootpath is specified by an empty array, and <code>null</code>
- * represents a default bootpath.
+ * empty bootpath is specified by an empty array, and
+ * <code>null</code> represents a default bootpath.
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public String[] getBootpath(ILaunchConfiguration configuration)
throws CoreException {
@@ -282,11 +283,11 @@
* appended to the boot buildpath.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return a description of the boot buildpath specified by the given launch
- * configuration.
+ * configuration.
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*
*/
public String[][] getBootpathExt(ILaunchConfiguration configuration)
@@ -421,11 +422,11 @@
* or <code>null</code> if none.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the Script project specified by the given launch configuration,
- * or <code>null</code> if none
+ * or <code>null</code> if none
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public static IScriptProject getScriptProject(
ILaunchConfiguration configuration) throws CoreException {
@@ -449,11 +450,11 @@
* configuration, or <code>null</code> if none.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the Script project name specified by the given launch
- * configuration, or <code>null</code> if none
+ * configuration, or <code>null</code> if none
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public static String getScriptProjectName(ILaunchConfiguration configuration)
throws CoreException {
@@ -467,11 +468,11 @@
* or <code>null</code> if none.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the main type name specified by the given launch configuration,
- * or <code>null</code> if none
+ * or <code>null</code> if none
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public static String getMainScriptName(ILaunchConfiguration configuration)
throws CoreException {
@@ -491,11 +492,11 @@
* arguments are specified.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the program arguments specified by the given launch
- * configuration, possibly an empty string
+ * configuration, possibly an empty string
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public String[] getScriptArguments(ILaunchConfiguration configuration)
throws CoreException {
@@ -513,11 +514,11 @@
* Interpreter arguments are specified.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the Interpreter arguments specified by the given launch
- * configuration, possibly an empty string
+ * configuration, possibly an empty string
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
protected final String[] getInterpreterArguments(
ILaunchConfiguration configuration) throws CoreException {
@@ -536,10 +537,10 @@
* launch configuration, or <code>null</code> if none.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the <code>Map</code> of Interpreter-specific attributes
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public Map getInterpreterSpecificAttributesMap(
ILaunchConfiguration configuration) throws CoreException {
@@ -555,11 +556,11 @@
* configuration, or <code>null</code> if none.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the working directory specified by the given launch
- * configuration, or <code>null</code> if none
+ * configuration, or <code>null</code> if none
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public String getWorkingDirectory(ILaunchConfiguration configuration,
IEnvironment environment) throws CoreException {
@@ -571,11 +572,11 @@
* configuration, or <code>null</code> if none.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the working directory path specified by the given launch
- * configuration, or <code>null</code> if none
+ * configuration, or <code>null</code> if none
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public IPath getWorkingDirectoryPath(ILaunchConfiguration configuration)
throws CoreException {
@@ -604,11 +605,11 @@
* <code>null</code> if none is specified.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the working directory specified by the given launch
- * configuration, or <code>null</code> if none
+ * configuration, or <code>null</code> if none
* @exception CoreException
- * if unable to retrieve the attribute
+ * if unable to retrieve the attribute
*/
public String verifyWorkingDirectory(ILaunchConfiguration configuration,
IEnvironment environment) throws CoreException {
@@ -673,10 +674,11 @@
* configuration, and returns the script type name.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @return the main type name specified by the given launch configuration
* @exception CoreException
- * if unable to retrieve the attribute or the attribute is unspecified
+ * if unable to retrieve the attribute or the attribute is
+ * unspecified
*/
public String verifyMainScriptName(ILaunchConfiguration configuration)
throws CoreException {
@@ -697,15 +699,7 @@
if (mainScriptName.length() == 0) {
return null;
}
- IProject project = getScriptProject(configuration).getProject();
- String loc = null;
- URI location = project.getLocationURI();
- if (location == null) {
- loc = project.getLocation().toOSString();
- return null;
- } else {
- loc = location.getPath();
- }
+ String loc = getProjectLocation(configuration);
IPath environmentLocation = new Path(loc).append(mainScriptName);
IFileHandle file = scriptEnvironment.getFile(environmentLocation);
@@ -975,15 +969,15 @@
* launching the given configuration.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @param mode
- * launch node
+ * launch node
* @param project
- * project containing the launched resource
+ * project containing the launched resource
* @return Interpreter runner to use when launching the given configuration
- * in the given mode
+ * in the given mode
* @throws CoreException
- * if a Interpreter runner cannot be determined
+ * if a Interpreter runner cannot be determined
*
*/
public IInterpreterRunner getInterpreterRunner(
@@ -1010,10 +1004,10 @@
* given configuration or <code>null</code> if unspecified.
*
* @param configuration
- * launch configuration
+ * launch configuration
* @throws CoreException
- * if unable to access associated attribute or if unable to resolve a
- * variable in an environment variable's value
+ * if unable to access associated attribute or if unable to
+ * resolve a variable in an environment variable's value
*
*/
public String[] getEnvironment(ILaunchConfiguration configuration)
@@ -1029,7 +1023,8 @@
* @param configuration
* @return default working directory or <code>null</code> if none
* @throws CoreException
- * if an exception occurs computing the default working directory
+ * if an exception occurs computing the default working
+ * directory
*
*/
protected IPath getDefaultWorkingDirectory(
@@ -1050,17 +1045,9 @@
.getEnvironment(scriptProject);
String mainScriptName = verifyMainScriptName(configuration);
if (mainScriptName.length() == 0) {
- return null;
+ return new Path(getProjectLocation(configuration));
}
- IProject project = getScriptProject(configuration).getProject();
- String loc = null;
- URI location = project.getLocationURI();
- if (location == null) {
- loc = project.getLocation().toOSString();
- return null;
- } else {
- loc = location.getPath();
- }
+ String loc = getProjectLocation(configuration);
IPath environmentLocation = new Path(loc).append(mainScriptName);
IFileHandle file = environment.getFile(environmentLocation);
@@ -1071,6 +1058,20 @@
return null;
}
+ private String getProjectLocation(ILaunchConfiguration configuration)
+ throws CoreException {
+ IProject project = getScriptProject(configuration).getProject();
+ String loc = null;
+ URI location = project.getLocationURI();
+ if (location == null) {
+ loc = project.getLocation().toOSString();
+ return null;
+ } else {
+ loc = location.getPath();
+ }
+ return loc;
+ }
+
protected String getNatureId(ILaunchConfiguration configuration)
throws CoreException {
return configuration.getAttribute(