mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
Bug Fixing
This commit is contained in:
parent
ed0afd6243
commit
e425b0ea7b
3 changed files with 24 additions and 6 deletions
|
@ -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
|
2004-06-15 Bogdan Gheorghe
|
||||||
Fix for Bug 60490: "Selected resource" option should only be enabled/disabled
|
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
|
based on selections in the Navigator and C/C++ Projects views - search now
|
||||||
|
|
|
@ -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.another_type=Another type named ''{0} is referenced in ''{1}''
|
||||||
RenameTypeRefactoring.wrong_element=Rename refactoring does not handle this type of element.
|
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.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.comment=text reference update in a comment
|
||||||
TextMatchFinder.string=text reference update in a string literal
|
TextMatchFinder.string=text reference update in a string literal
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentElementNameLength() {
|
private int getCurrentElementNameLength() {
|
||||||
if(fCElement == null)
|
if(fCElement == null)
|
||||||
return 0;
|
return 0;
|
||||||
String name = fCElement.getElementName();
|
String name = fCElement.getElementName();
|
||||||
|
@ -142,7 +142,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
||||||
return name.length();
|
return name.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentElementNameStartPos() {
|
private int getCurrentElementNameStartPos() {
|
||||||
if(fCElement == null)
|
if(fCElement == null)
|
||||||
return 0;
|
return 0;
|
||||||
String name = fCElement.getElementName();
|
String name = fCElement.getElementName();
|
||||||
|
@ -152,15 +152,24 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
||||||
return ((CElement)fCElement).getIdStartPos();
|
return ((CElement)fCElement).getIdStartPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getElementQualifiedName(ICElement element) throws CModelException{
|
private String getElementQualifiedName(ICElement element) throws CModelException{
|
||||||
if(!eligibleForRefactoring(element)){
|
if(!eligibleForRefactoring(element)){
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
StringBuffer name = new StringBuffer();
|
StringBuffer name = new StringBuffer();
|
||||||
if(element instanceof IFunctionDeclaration){
|
if(element instanceof IFunctionDeclaration){
|
||||||
// add the whole signature
|
|
||||||
IFunctionDeclaration function = (IFunctionDeclaration)element;
|
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(getElementQualifiedName(element.getParent()));
|
||||||
|
}
|
||||||
name.append("::");
|
name.append("::");
|
||||||
name.append(function.getSignature());
|
name.append(function.getSignature());
|
||||||
} else {
|
} else {
|
||||||
|
@ -309,6 +318,10 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
||||||
if (pm.isCanceled())
|
if (pm.isCanceled())
|
||||||
throw new OperationCanceledException();
|
throw new OperationCanceledException();
|
||||||
|
|
||||||
|
if (fReferences.length == 0){
|
||||||
|
result.addFatalError(RefactoringCoreMessages.getString("RenameTypeRefactoring.no_files"));
|
||||||
|
}
|
||||||
|
|
||||||
if (result.hasFatalError())
|
if (result.hasFatalError())
|
||||||
return result;
|
return result;
|
||||||
// more checks go here
|
// more checks go here
|
||||||
|
@ -562,7 +575,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
||||||
|
|
||||||
private static ICElement findEnclosingElements(ICElement element, String newName) {
|
private static ICElement findEnclosingElements(ICElement element, String newName) {
|
||||||
ICElement enclosing= element.getParent();
|
ICElement enclosing= element.getParent();
|
||||||
while (enclosing != null){
|
while ((enclosing != null) && (!(enclosing instanceof ITranslationUnit))){
|
||||||
if (newName.equals(enclosing.getElementName()))
|
if (newName.equals(enclosing.getElementName()))
|
||||||
return enclosing;
|
return enclosing;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue