01: package org.enhydra.kelp.eclipse.ui.launcher;
02:
03: import java.io.File;
04:
05: import org.eclipse.core.runtime.Path;
06: import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
07: import org.eclipse.debug.ui.CommonTab;
08: import org.eclipse.debug.ui.EnvironmentTab;
09: import org.eclipse.debug.ui.ILaunchConfigurationDialog;
10: import org.eclipse.debug.ui.ILaunchConfigurationTab;
11: import org.eclipse.jdt.core.JavaCore;
12: import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
13: import org.enhydra.tool.ToolBoxInfo;
14:
15: /**
16: * Insert the type's description here.
17: * @see AbstractLaunchConfigurationTabGroup
18: */
19: public class LocalEnhydraApplicationTabGroup extends
20: AbstractLaunchConfigurationTabGroup {
21:
22: String[] serverOptions = { "Tomcat", "JOnAS", "JBoss" };
23: String serverOption = null;
24:
25: /**
26: * Insert the method's description here.
27: * @see AbstractLaunchConfigurationTabGroup#createTabs
28: */
29: public void createTabs(ILaunchConfigurationDialog dialog,
30: String mode) {
31: if (serverOption == null)
32: setServerOption();
33:
34: ILaunchConfigurationTab[] tabs = null;
35:
36: if (serverOptions[1].equals(serverOption)) {
37: tabs = new ILaunchConfigurationTab[] {
38: new EnhydraEnterpriseJOnASMainTab(),
39: new EnhydraEnterpriseJOnASArgumentsTab(),
40: new JavaJRETab(),
41: new EnhydraEnterpriseJOnASSourceLookupTab(),
42: new EnhydraEnterpriseJOnASClasspathTab(),
43: new EnvironmentTab(), new CommonTab() };
44: } else if (serverOptions[2].equals(serverOption)) {
45: tabs = new ILaunchConfigurationTab[] {
46: new EnhydraEnterpriseJBossMainTab(),
47: new EnhydraEnterpriseJBossArgumentsTab(),
48: new JavaJRETab(),
49: new EnhydraEnterpriseJBossSourceLookupTab(),
50: new EnhydraEnterpriseJBossClasspathTab(),
51: new EnvironmentTab(), new CommonTab() };
52: } else {
53: tabs = new ILaunchConfigurationTab[] {
54: new EnhydraMainTab(), new EnhydraArgumentsTab(),
55: new JavaJRETab(), new EnhydraSourceLookupTab(),
56: new EnhydraClasspathTab(), new EnvironmentTab(),
57: new CommonTab() };
58: }
59:
60: setTabs(tabs);
61: }
62:
63: private void setServerOption() {
64: File path = new File(ToolBoxInfo.getEnhydraRoot());
65: path = path.getParentFile();
66: String enhydraRoot = path.getAbsolutePath();
67:
68: // JOnAS
69: File pathJOnAS = new File(enhydraRoot + "/lib/client.jar");
70: // JBoss
71: File pathJBoss = new File(enhydraRoot + "/lib/jboss-common.jar");
72:
73: if (pathJOnAS.exists()) {
74: serverOption = serverOptions[1];
75: } else if (pathJBoss.exists()) {
76: serverOption = serverOptions[2];
77: } else {
78: serverOption = serverOptions[0];
79: }
80: }
81: }
|