1 11 package org.eclipse.pde.internal.ui.launcher; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.debug.core.ILaunchConfiguration; 15 import org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate; 16 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 17 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; 18 import org.eclipse.pde.internal.ui.IPDEUIConstants; 19 20 public class PDEMigrationDelegate implements ILaunchConfigurationMigrationDelegate { 21 22 public boolean isCandidate(ILaunchConfiguration candidate) throws CoreException { 23 return !candidate.getAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, false); 24 } 25 26 public void migrate(ILaunchConfiguration candidate) throws CoreException { 27 ILaunchConfigurationWorkingCopy wc = candidate.getWorkingCopy(); 28 migrate(wc); 29 wc.doSave(); 30 } 31 32 public void migrate(ILaunchConfigurationWorkingCopy candidate) throws CoreException { 33 if (!candidate.getAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, false)) { 34 candidate.setAttribute(IPDEUIConstants.APPEND_ARGS_EXPLICITLY, true); 35 String args = candidate.getAttribute( 36 IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, 37 ""); StringBuffer buffer = new StringBuffer (LaunchArgumentsHelper.getInitialProgramArguments()); 39 if (args.length() > 0) { 40 buffer.append(" "); buffer.append(args); 42 } 43 candidate.setAttribute( 44 IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, 45 buffer.toString()); 46 } 47 } 48 49 } 50 | Popular Tags |