From a42bdd4da8c8b181bd98cfa3d448b1a1a6fe6fc9 Mon Sep 17 00:00:00 2001 From: Hoda Amer Date: Tue, 8 Jun 2004 17:05:30 +0000 Subject: [PATCH] Bug Fixing --- core/org.eclipse.cdt.ui/ChangeLog | 4 +++ .../rename/RenameElementProcessor.java | 30 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 510367fdcc3..9c8b91dbfdc 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,7 @@ +2004-06-08 Hoda Amer + Fixes for bugs 62780, 62783, 62784 + * refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java + 2004-06-08 Alain Magloire Fix for bug 65173 diff --git a/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java b/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java index e60448c3802..123d9fc742b 100644 --- a/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java +++ b/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java @@ -587,14 +587,40 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc return result; } - private boolean eligibleForRefactoring(ICElement element){ + private boolean isConstructorOrDestructor(IFunctionDeclaration function) throws CModelException{ + // check declarations + if(function instanceof IMethodDeclaration){ + IMethodDeclaration method = (IMethodDeclaration)function; + if((method.isConstructor()) || (method.isDestructor())) + return true; + } + // check definitions + String returnType = function.getReturnType(); + if(( returnType == null) || (returnType.length() == 0) ) + return true; + + if(getCurrentElementName().startsWith("~")) + return true; + + return false; + } + + private boolean eligibleForRefactoring(ICElement element) throws CModelException{ if((element == null) || (!(element instanceof ISourceReference)) || (element instanceof ITranslationUnit) || (element instanceof IMacro) || (element instanceof IInclude)){ return false; - } else { + } else // disabling renaming of constructors and destructors + if(element instanceof IFunctionDeclaration){ + IFunctionDeclaration function = (IFunctionDeclaration)element; + if (isConstructorOrDestructor(function)) + return false; + else + return true; + } + else { return true; } }