mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
fix one more race condition in unit tests, and _testAlias in NamespaceTests
This commit is contained in:
parent
63d86012bd
commit
807f6f54de
3 changed files with 30 additions and 4 deletions
|
@ -62,7 +62,7 @@ public class NamespaceTests extends PDOMTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
public void _testAlias() throws Exception {
|
||||
public void testAlias() throws Exception {
|
||||
/* Find all the namespace */
|
||||
IBinding[] namespaces = pdom.findBindings(Pattern.compile("namespace1"), false, INDEX_FILTER, NULL_MONITOR);
|
||||
assertEquals(1, namespaces.length);
|
||||
|
|
|
@ -133,10 +133,14 @@ public class PDOMManager implements IPDOMManager, IWritableIndexManager, IListen
|
|||
* change events.
|
||||
*/
|
||||
public void startup() {
|
||||
// the model listener is attached outside of the job in
|
||||
// order to avoid a race condition where its not noticed
|
||||
// that new projects are being created
|
||||
final CoreModel model = CoreModel.getDefault();
|
||||
model.addElementChangedListener(fCModelListener);
|
||||
|
||||
Job startup= new Job(Messages.PDOMManager_StartJob_name) {
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
CoreModel model = CoreModel.getDefault();
|
||||
model.addElementChangedListener(fCModelListener);
|
||||
ICProject[] projects;
|
||||
try {
|
||||
projects = model.getCModel().getCProjects();
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
|
@ -124,6 +127,25 @@ class PDOMCPPNamespace extends PDOMCPPBinding implements ICPPNamespace, ICPPName
|
|||
return true;
|
||||
}
|
||||
|
||||
public IBinding[] getMemberBindings() throws DOMException {fail(); return null;}
|
||||
public IBinding[] getMemberBindings() throws DOMException {
|
||||
IBinding[] result = null;
|
||||
final List preresult = new ArrayList();
|
||||
try {
|
||||
getIndex().accept(new IBTreeVisitor() {
|
||||
public int compare(int record) throws CoreException {
|
||||
return 0;
|
||||
}
|
||||
public boolean visit(int record) throws CoreException {
|
||||
preresult.add(getLinkageImpl().getNode(record));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
result = (IBinding[]) preresult.toArray(new IBinding[preresult.size()]);
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void addUsingDirective(IASTNode directive) throws DOMException {fail();}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue