001: package org.enhydra.kelp.eclipse.ui.launcher;
002:
003: import org.eclipse.core.runtime.CoreException;
004: import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
005: import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
006: import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
007: import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
008: import org.enhydra.tool.ToolBoxInfo;
009:
010: import java.io.File;
011:
012: /**
013: * @author Administrator
014: *
015: * To change this generated comment edit the template variable "typecomment":
016: * Window>Preferences>Java>Templates.
017: * To enable and disable the creation of type comments go to
018: * Window>Preferences>Java>Code Generation.
019: */
020: public class EnhydraArgumentsTab extends JavaArgumentsTab {
021:
022: private static final String ENHYDRA_PROGRAM_ARGUMENTS = "start";
023:
024: /**
025: * Constructor for EnhydraArgumentsTab.
026: */
027: public EnhydraArgumentsTab() {
028: super ();
029: }
030:
031: /**
032: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
033: */
034: public void setDefaults(
035: ILaunchConfigurationWorkingCopy configuration) {
036: super .setDefaults(configuration);
037:
038: String progArgs = "";
039: String prjName = "";
040:
041: try {
042: //24.03.2003
043: File path = new File(ToolBoxInfo.getEnhydraRoot());
044: path = path.getParentFile();
045: String enhydraRoot = path.getAbsolutePath();
046:
047: //configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-cp " + enhydraRoot + File.separator + "lib" + File.separator + "common" + File.separator + "ow_jonas_bootstrap.jar");
048:
049: prjName = configuration
050: .getAttribute(
051: IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
052: EMPTY_STRING);
053:
054: String args = "-Dclasspath=" + "\n-Dcatalina.base="
055: + "application" + File.separator + "bin"
056: + File.separator + "application"
057: + "\n-Dcatalina.home=" + enhydraRoot
058: + "\n-Djava.io.tmpdir=" + enhydraRoot
059: + File.separator + "temp" + "\n-Xmx256m";
060:
061: configuration
062: .setAttribute(
063: IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
064: args);
065:
066: //String classPath = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, EMPTY_STRING);
067: //classPath = classPath + File.pathSeparator + enhydraRoot + File.separator + "lib" + File.separator + "ext" + File.separator + "entray.jar";
068: //configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classPath);
069: //configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, classPath);
070:
071: // Program arguments defaults to ENHYDRA_PROGRAM_ARGUMENTS
072: progArgs = configuration
073: .getAttribute(
074: IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
075: EMPTY_STRING);
076: if (progArgs.compareTo(ENHYDRA_PROGRAM_ARGUMENTS) != 0)
077: configuration
078: .setAttribute(
079: IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
080: ENHYDRA_PROGRAM_ARGUMENTS);
081:
082: // Work directory defaults to <project name>/output
083: //workDir = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, EMPTY_STRING);
084:
085: if (progArgs.compareTo(EMPTY_STRING) == 0) {
086: prjName = configuration
087: .getAttribute(
088: IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
089: EMPTY_STRING);
090: configuration
091: .setAttribute(
092: IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
093: prjName);
094: }
095: } catch (CoreException e) {
096: JDIDebugUIPlugin.log(e);
097: }
098: }
099:
100: }
|