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 18 public class EnhydraArgumentsTab extends JavaArgumentsTab { 19 20 private static final String ENHYDRA_PROGRAM_ARGUMENTS = "conf/multiserver.conf"; 21 22 25 public EnhydraArgumentsTab() { 26 super(); 27 } 28 29 30 33 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { 34 super.setDefaults(configuration); 35 36 String progArgs = ""; 37 String workDir = ""; 38 String prjName = ""; 39 40 try { 41 configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Denhydra.home="+"\""+ToolBoxInfo.getEnhydraRoot()+"\""); 43 44 prjName = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING); 45 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 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 |