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

Bug Fixing

This commit is contained in:
Hoda Amer 2004-06-07 19:39:07 +00:00
parent 3d0734f6ca
commit c6b58b792f
4 changed files with 41 additions and 16 deletions

View file

@ -1,3 +1,6 @@
2004-06-07 Hoda Amer
Fix for PR 65369 : [CModel] Duplicate namespace declarations in views when namespace defined twice in a file
2004-06-07 Alain Magloire 2004-06-07 Alain Magloire
Fix for PR 65524 Fix for PR 65524

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.model;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
@ -435,6 +436,26 @@ public class CModelBuilder {
String nsName = (nsDef.getName() == null ) String nsName = (nsDef.getName() == null )
? "" //$NON-NLS-1$ ? "" //$NON-NLS-1$
: nsDef.getName().toString(); : nsDef.getName().toString();
// check if there is another namespace with the same name for the same parent
boolean alreadyThere = false;
Namespace oldElement = null;
List siblings = parent.getChildrenOfType(ICElement.C_NAMESPACE);
if(siblings.size() > 0){
Iterator i = siblings.iterator();
while (i.hasNext()){
Namespace n = (Namespace)i.next();
if(n.getElementName().equals(nsName)){
alreadyThere = true;
oldElement = n;
}
}
}
if( (alreadyThere) && (oldElement != null)) {
return oldElement;
} else {
// this is the first namespace
Namespace element = new Namespace (parent, nsName ); Namespace element = new Namespace (parent, nsName );
// add to parent // add to parent
parent.addChild(element); parent.addChild(element);
@ -443,10 +464,10 @@ public class CModelBuilder {
element.setPos(nsDef.getStartingOffset(), nsDef.getEndingOffset() - nsDef.getStartingOffset()); element.setPos(nsDef.getStartingOffset(), nsDef.getEndingOffset() - nsDef.getStartingOffset());
element.setLines( nsDef.getStartingLine(), nsDef.getEndingLine() ); element.setLines( nsDef.getStartingLine(), nsDef.getEndingLine() );
element.setTypeName(type); element.setTypeName(type);
this.newElements.put(element, element.getElementInfo()); this.newElements.put(element, element.getElementInfo());
return element; return element;
} }
}
private Enumeration createEnumeration(Parent parent, IASTEnumerationSpecifier enumSpecifier) throws CModelException{ private Enumeration createEnumeration(Parent parent, IASTEnumerationSpecifier enumSpecifier) throws CModelException{
// create element // create element

View file

@ -1,3 +1,6 @@
2004-06-07 Hoda Amer
Fix for bug 63395 : [Refactoring] a template class does not refactor its constructor
2004-06-07 Bogdan Gheorghe 2004-06-07 Bogdan Gheorghe
Fix for Bug 60772 Fix for Bug 60772

View file

@ -413,13 +413,11 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
ICSearchConstants.TYPE, ICSearchConstants.DECLARATIONS, false )); ICSearchConstants.TYPE, ICSearchConstants.DECLARATIONS, false ));
} }
IStructure structure = (IStructure) fCElement; IStructure structure = (IStructure) fCElement;
if(structure.getElementType() == ICElement.C_CLASS){
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix + QUALIFIER + structure.getElementName(), orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix + QUALIFIER + structure.getElementName(),
ICSearchConstants.METHOD, ICSearchConstants.ALL_OCCURRENCES, false )); ICSearchConstants.METHOD, ICSearchConstants.ALL_OCCURRENCES, false ));
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix + QUALIFIER + TELTA + structure.getElementName(), orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix + QUALIFIER + TELTA + structure.getElementName(),
ICSearchConstants.METHOD, ICSearchConstants.ALL_OCCURRENCES, false )); ICSearchConstants.METHOD, ICSearchConstants.ALL_OCCURRENCES, false ));
} }
}
else if(fCElement instanceof IMethod){ else if(fCElement instanceof IMethod){
if(updateReferences){ if(updateReferences){
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix, orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,