KickJava   Java API By Example, From Geeks To Geeks.

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


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.IField;
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  */

26 public class JavaWatchpointIFieldRenameParticipant extends RenameParticipant {
27     
28     private IField fField;
29
30     protected boolean initialize(Object JavaDoc element) {
31         fField= (IField) element;
32         try {
33             return !fField.getDeclaringType().isLocal();
34         } catch (JavaModelException e) {
35             return false;
36         }
37     }
38     
39     public String JavaDoc getName() {
40         return RefactoringMessages.JavaWatchpointIFieldRenameParticipant_0; //$NON-NLS-1$
41
}
42
43     public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) {
44         return new RefactoringStatus();
45     }
46
47     /* (non-Javadoc)
48      * @see org.eclipse.jdt.internal.corext.refactoring.participants.IRefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
49      */

50     public Change createChange(IProgressMonitor pm) throws CoreException {
51         return JavaWatchpointFieldNameChange.createChange(fField, getArguments().getNewName());
52     }
53 }
54
Popular Tags