1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

Bug Fixing

This commit is contained in:
Hoda Amer 2004-06-16 19:29:36 +00:00
parent ed0afd6243
commit e425b0ea7b
3 changed files with 24 additions and 6 deletions

View file

@ -1,3 +1,6 @@
2004-06-16 Hoda Amer
Fix for PR 66730: [Refactoring] Renaming a class does not change .cpp file.
2004-06-15 Bogdan Gheorghe
Fix for Bug 60490: "Selected resource" option should only be enabled/disabled
based on selections in the Navigator and C/C++ Projects views - search now

View file

@ -346,6 +346,8 @@ RenameTypeRefactoring.member_type=Member Type declared inside ''{0}'' is named {
RenameTypeRefactoring.another_type=Another type named ''{0} is referenced in ''{1}''
RenameTypeRefactoring.wrong_element=Rename refactoring does not handle this type of element.
RenameTypeRefactoring.virtual_method=Renaming a virtual method. Consider renaming the base and derived class methods (if any).
RenameTypeRefactoring.no_files=No files are found.
TextMatchFinder.comment=text reference update in a comment
TextMatchFinder.string=text reference update in a string literal

View file

@ -131,7 +131,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
return name;
}
public int getCurrentElementNameLength() {
private int getCurrentElementNameLength() {
if(fCElement == null)
return 0;
String name = fCElement.getElementName();
@ -142,7 +142,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
return name.length();
}
public int getCurrentElementNameStartPos() {
private int getCurrentElementNameStartPos() {
if(fCElement == null)
return 0;
String name = fCElement.getElementName();
@ -152,15 +152,24 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
return ((CElement)fCElement).getIdStartPos();
}
public String getElementQualifiedName(ICElement element) throws CModelException{
private String getElementQualifiedName(ICElement element) throws CModelException{
if(!eligibleForRefactoring(element)){
return "";
} else {
StringBuffer name = new StringBuffer();
if(element instanceof IFunctionDeclaration){
// add the whole signature
IFunctionDeclaration function = (IFunctionDeclaration)element;
if((element instanceof IMethodDeclaration) && ( ((IMethodDeclaration)element).isFriend() )){
// go up until you hit a namespace or a translation unit.
ICElement parent = (ICElement) element.getParent();
while (!(parent instanceof INamespace) && (!(parent instanceof ITranslationUnit) )){
parent = parent.getParent();
}
name.append(getElementQualifiedName(parent));
}else {
// add the whole signature
name.append(getElementQualifiedName(element.getParent()));
}
name.append("::");
name.append(function.getSignature());
} else {
@ -308,7 +317,11 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
pm.setTaskName(RefactoringCoreMessages.getString("RenameTypeRefactoring.checking")); //$NON-NLS-1$
if (pm.isCanceled())
throw new OperationCanceledException();
if (fReferences.length == 0){
result.addFatalError(RefactoringCoreMessages.getString("RenameTypeRefactoring.no_files"));
}
if (result.hasFatalError())
return result;
// more checks go here
@ -562,7 +575,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
private static ICElement findEnclosingElements(ICElement element, String newName) {
ICElement enclosing= element.getParent();
while (enclosing != null){
while ((enclosing != null) && (!(enclosing instanceof ITranslationUnit))){
if (newName.equals(enclosing.getElementName()))
return enclosing;
else