01: package org.enhydra.kelp.eclipse.ui.launcher;
02:
03: import org.eclipse.core.runtime.CoreException;
04: import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
05: import org.eclipse.debug.ui.DebugUITools;
06: import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
07: import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
08: import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
09: import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
10: import org.enhydra.tool.ToolBoxInfo;
11:
12: import java.io.File;
13:
14: /**
15: * @author Administrator
16: *
17: * To change this generated comment edit the template variable "typecomment":
18: * Window>Preferences>Java>Templates.
19: * To enable and disable the creation of type comments go to
20: * Window>Preferences>Java>Code Generation.
21: */
22: public class EnhydraEnterpriseJBossArgumentsTab extends
23: JavaArgumentsTab {
24:
25: private static final String ENHYDRA_PROGRAM_ARGUMENTS = "";
26:
27: /**
28: * Constructor for EnhydraEnterpriseJBossArgumentsTab.
29: */
30: public EnhydraEnterpriseJBossArgumentsTab() {
31: super ();
32: }
33:
34: /**
35: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
36: */
37: public void setDefaults(
38: ILaunchConfigurationWorkingCopy configuration) {
39: super .setDefaults(configuration);
40:
41: String progArgs = "";
42: String prjName = "";
43:
44: try {
45: //24.03.2003
46: File path = new File(ToolBoxInfo.getEnhydraRoot());
47: path = path.getParentFile();
48: String enhydraRoot = path.getAbsolutePath();
49:
50: String projLounchPath = DebugUITools.getSelectedResource()
51: .getProject().getLocation().makeAbsolute()
52: .toString();
53:
54: String args = "-Djava.library.path=" + enhydraRoot
55: + File.separator + "lib" + File.pathSeparator
56: + enhydraRoot + File.separator + "enhydra"
57: + File.separator + "bin"
58: + "\n-Djboss.server.base.url=file:\""
59: + projLounchPath + File.separator + "application"
60: + File.separator + "output" + File.separator
61: + "server\"" + "\n-Djboss.server.base.dir=\""
62: + projLounchPath + File.separator + "application"
63: + File.separator + "output" + File.separator
64: + "server\"";
65:
66: configuration
67: .setAttribute(
68: IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
69: args);
70:
71: progArgs = configuration
72: .getAttribute(
73: IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
74: EMPTY_STRING);
75:
76: // Work directory defaults to <project name>/output
77: //workDir = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, EMPTY_STRING);
78:
79: if (progArgs.compareTo(EMPTY_STRING) == 0) {
80: prjName = configuration
81: .getAttribute(
82: IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
83: EMPTY_STRING);
84: configuration
85: .setAttribute(
86: IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
87: prjName);
88: }
89: } catch (CoreException e) {
90: JDIDebugUIPlugin.log(e);
91: }
92: }
93:
94: }
|