1 11 17 package org.eclipse.jdt.internal.junit.refactoring; 18 19 import org.eclipse.core.runtime.CoreException; 20 import org.eclipse.core.runtime.IProgressMonitor; 21 import org.eclipse.debug.core.ILaunchConfiguration; 22 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 23 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; 24 import org.eclipse.ltk.core.refactoring.Change; 25 import org.eclipse.ltk.core.refactoring.RefactoringStatus; 26 27 28 class LaunchConfigProjectChange extends Change { 29 30 private ILaunchConfiguration fConfig; 31 private String fNewName; 32 33 public LaunchConfigProjectChange(ILaunchConfiguration config, String newName) { 34 fConfig= config; 35 fNewName= newName; 36 } 37 38 41 public String getName() { 42 return fConfig.getName(); 43 } 44 45 48 public void initializeValidationData(IProgressMonitor pm) { 49 } 51 52 public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException { 53 return new RefactoringStatus(); 54 } 55 56 59 public Change perform(IProgressMonitor pm) throws CoreException { 60 pm.beginTask("", 1); String oldProjectName= fConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String )null); 62 63 ILaunchConfigurationWorkingCopy copy = fConfig.getWorkingCopy(); 64 copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, fNewName); 65 copy.doSave(); 66 pm.worked(1); 67 return new LaunchConfigProjectChange(fConfig, oldProjectName); 68 } 69 70 73 public Object getModifiedElement() { 74 return fConfig; 75 } 76 } | Popular Tags |