1 11 package org.eclipse.jdt.internal.debug.core.refactoring; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.jdt.core.IJavaElement; 16 import org.eclipse.jdt.core.IPackageFragment; 17 import org.eclipse.jdt.core.IType; 18 import org.eclipse.jdt.core.JavaModelException; 19 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; 20 import org.eclipse.ltk.core.refactoring.Change; 21 import org.eclipse.ltk.core.refactoring.RefactoringStatus; 22 import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; 23 import org.eclipse.ltk.core.refactoring.participants.MoveParticipant; 24 25 26 28 public class LaunchConfigurationITypeMoveParticipant extends MoveParticipant { 29 30 private IType fType; 31 private IJavaElement fDestination; 32 33 36 protected boolean initialize(Object element) { 37 fType= (IType)element; 38 try { 39 IType declaringType= fType; 41 while (declaringType != null) { 42 if (fType.isLocal()) { 43 return false; 44 } 45 declaringType= declaringType.getDeclaringType(); 46 } 47 } catch (JavaModelException e) { 48 JDIDebugUIPlugin.log(e); 49 } 50 Object destination= getArguments().getDestination(); 51 if (destination instanceof IPackageFragment || destination instanceof IType) { 52 fDestination= (IJavaElement) destination; 53 return true; 54 } 55 return false; 56 } 57 58 61 public String getName() { 62 return RefactoringMessages.LaunchConfigurationParticipant_0; 63 } 64 65 68 public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) { 69 return new RefactoringStatus(); 70 } 71 72 75 public Change createChange(IProgressMonitor pm) throws CoreException { 76 return JDTDebugRefactoringUtil.createChangesForTypeMove(fType, fDestination); 77 } 78 79 } 80 | Popular Tags |