KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > core > refactoring > JavaMethodBreakpointIMethodRenameParticipant


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

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
16 import org.eclipse.jdt.core.IMethod;
17 import org.eclipse.jdt.core.JavaModelException;
18
19 import org.eclipse.ltk.core.refactoring.Change;
20 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
21 import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
22 import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
23
24 /**
25  * Participant for java method breakpoint support of method rename.
26  */

27 public class JavaMethodBreakpointIMethodRenameParticipant extends RenameParticipant {
28
29     private IMethod fMethod;
30
31     public boolean initialize(Object JavaDoc element) {
32         fMethod= (IMethod) element;
33         try {
34             return !fMethod.getDeclaringType().isLocal();
35         } catch (JavaModelException e) {
36             return false;
37         }
38     }
39     
40     public String JavaDoc getName() {
41         return RefactoringMessages.JavaMethodBreakpointIMethodRenameParticipant_0; //$NON-NLS-1$
42
}
43
44     /* (non-Javadoc)
45      * @see org.eclipse.jdt.internal.corext.refactoring.participants.IRefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
46      */

47     public Change createChange(IProgressMonitor pm) throws CoreException {
48         return JavaMethodBreakpointMethodNameChange.createChange(fMethod, getArguments().getNewName());
49     }
50
51     /* (non-Javadoc)
52      * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
53      */

54     public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) {
55         return new RefactoringStatus();
56     }
57 }
58
Popular Tags