OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 23 matching lines...) Expand all Loading... |
34 * @param method the {@link Method} to rename, not <code>null</code>. | 34 * @param method the {@link Method} to rename, not <code>null</code>. |
35 */ | 35 */ |
36 public RenameMethodProcessor(Method method) { | 36 public RenameMethodProcessor(Method method) { |
37 super(method); | 37 super(method); |
38 } | 38 } |
39 | 39 |
40 @Override | 40 @Override |
41 public RefactoringStatus checkNewElementName(String newName) throws CoreExcept
ion { | 41 public RefactoringStatus checkNewElementName(String newName) throws CoreExcept
ion { |
42 RefactoringStatus result = Checks.checkMethodName(newName); | 42 RefactoringStatus result = Checks.checkMethodName(newName); |
43 result.merge(super.checkNewElementName(newName)); | 43 result.merge(super.checkNewElementName(newName)); |
| 44 // method "call()" cannot be renamed |
| 45 if (getCurrentElementName().equals("call")) { |
| 46 result.addFatalError(RefactoringCoreMessages.RenameMethodProcessor_isCall)
; |
| 47 } |
| 48 // done |
44 return result; | 49 return result; |
45 } | 50 } |
46 | 51 |
47 @Override | 52 @Override |
48 public String getIdentifier() { | 53 public String getIdentifier() { |
49 return IDENTIFIER; | 54 return IDENTIFIER; |
50 } | 55 } |
51 | 56 |
52 @Override | 57 @Override |
53 public Object getNewElement() { | 58 public Object getNewElement() { |
54 return member.getDeclaringType().getMethod(getNewElementName(), null); | 59 return member.getDeclaringType().getMethod(getNewElementName(), null); |
55 } | 60 } |
56 | 61 |
57 @Override | 62 @Override |
58 public String getProcessorName() { | 63 public String getProcessorName() { |
59 return RefactoringCoreMessages.RenameMethodProcessor_name; | 64 return RefactoringCoreMessages.RenameMethodProcessor_name; |
60 } | 65 } |
61 | 66 |
62 @Override | 67 @Override |
63 public boolean isApplicable() throws CoreException { | 68 public boolean isApplicable() throws CoreException { |
64 return RefactoringAvailabilityTester.isRenameAvailable((Method) member); | 69 return RefactoringAvailabilityTester.isRenameAvailable((Method) member); |
65 } | 70 } |
66 | 71 |
67 } | 72 } |
OLD | NEW |