KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > eclipse > ui > launcher > EnhydraArgumentsTab


1 package org.enhydra.kelp.eclipse.ui.launcher;
2
3 import org.eclipse.core.runtime.CoreException;
4 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
5 import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
6 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
7 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
8 import org.enhydra.tool.ToolBoxInfo;
9
10 /**
11  * @author Administrator
12  *
13  * To change this generated comment edit the template variable "typecomment":
14  * Window>Preferences>Java>Templates.
15  * To enable and disable the creation of type comments go to
16  * Window>Preferences>Java>Code Generation.
17  */

18 public class EnhydraArgumentsTab extends JavaArgumentsTab {
19
20     private static final String JavaDoc ENHYDRA_PROGRAM_ARGUMENTS = "conf/multiserver.conf";
21
22     /**
23      * Constructor for EnhydraArgumentsTab.
24      */

25     public EnhydraArgumentsTab() {
26         super();
27     }
28
29
30     /**
31      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
32      */

33     public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
34         super.setDefaults(configuration);
35
36         String JavaDoc progArgs = "";
37         String JavaDoc workDir = "";
38         String JavaDoc prjName = "";
39
40         try {
41             //24.03.2003
42
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Denhydra.home="+"\""+ToolBoxInfo.getEnhydraRoot()+"\"");
43             
44             prjName = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING);
45             // Program arguments defaults to ENHYDRA_PROGRAM_ARGUMENTS
46
progArgs = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, EMPTY_STRING);
47             if (progArgs.compareTo(ENHYDRA_PROGRAM_ARGUMENTS) != 0)
48                 configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ENHYDRA_PROGRAM_ARGUMENTS);
49             // Work directory defaults to <project name>/output
50
workDir = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, EMPTY_STRING);
51             if (progArgs.compareTo(EMPTY_STRING) == 0) {
52                 prjName = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING);
53                 configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, prjName.concat("/output"));
54             }
55         } catch (CoreException e) {
56             JDIDebugUIPlugin.log(e);
57         }
58     }
59
60 }
61
Popular Tags