1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26: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
Fix for PR 65524

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.model;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
@ -435,17 +436,37 @@ public class CModelBuilder {
String nsName = (nsDef.getName() == null )
? "" //$NON-NLS-1$
: nsDef.getName().toString();
Namespace element = new Namespace (parent, nsName );
// add to parent
parent.addChild(element);
element.setIdPos(nsDef.getNameOffset(),
(nsName.length() == 0) ? type.length() : (nsDef.getNameEndOffset() - nsDef.getNameOffset()));
element.setPos(nsDef.getStartingOffset(), nsDef.getEndingOffset() - nsDef.getStartingOffset());
element.setLines( nsDef.getStartingLine(), nsDef.getEndingLine() );
element.setTypeName(type);
// check if there is another namespace with the same name for the same parent
boolean alreadyThere = false;
Namespace oldElement = null;
this.newElements.put(element, element.getElementInfo());
return element;
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 );
// add to parent
parent.addChild(element);
element.setIdPos(nsDef.getNameOffset(),
(nsName.length() == 0) ? type.length() : (nsDef.getNameEndOffset() - nsDef.getNameOffset()));
element.setPos(nsDef.getStartingOffset(), nsDef.getEndingOffset() - nsDef.getStartingOffset());
element.setLines( nsDef.getStartingLine(), nsDef.getEndingLine() );
element.setTypeName(type);
this.newElements.put(element, element.getElementInfo());
return element;
}
}
private Enumeration createEnumeration(Parent parent, IASTEnumerationSpecifier enumSpecifier) throws CModelException{

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
Fix for Bug 60772

View file

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