mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 16:56:04 +02:00
Removes use of static instance of NullProgressMonitor (once canceled it remains to be canceled).
This commit is contained in:
parent
d85865bdb3
commit
cbabb21a6e
32 changed files with 298 additions and 284 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.core.settings.model;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -44,6 +43,7 @@ public class CConfigurationDescriptionReferenceTests extends BaseTestCase {
|
|||
return suite(CConfigurationDescriptionReferenceTests.class, "_");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
p1 = CProjectHelper.createCCProject("p1", "bin");
|
||||
p2 = CProjectHelper.createCCProject("p2", "bin");
|
||||
|
@ -215,15 +215,15 @@ public class CConfigurationDescriptionReferenceTests extends BaseTestCase {
|
|||
} finally {
|
||||
if (p1 != null)
|
||||
try {
|
||||
p1.getProject().delete(true, NPM);
|
||||
p1.getProject().delete(true, npm());
|
||||
} catch (CoreException e){}
|
||||
if (p2 != null)
|
||||
try {
|
||||
p2.getProject().delete(true, NPM);
|
||||
p2.getProject().delete(true, npm());
|
||||
} catch (CoreException e){}
|
||||
if (p3 != null)
|
||||
try {
|
||||
p3.getProject().delete(true, NPM);
|
||||
p3.getProject().delete(true, npm());
|
||||
} catch (CoreException e){}
|
||||
}
|
||||
}
|
||||
|
@ -240,20 +240,21 @@ public class CConfigurationDescriptionReferenceTests extends BaseTestCase {
|
|||
assertEquals(expected.length, actual.length);
|
||||
|
||||
List actualIds = new ArrayList();
|
||||
for(int i=0; i<actual.length; i++) {
|
||||
actualIds.add(actual[i].getId());
|
||||
for (ICConfigurationDescription element : actual) {
|
||||
actualIds.add(element.getId());
|
||||
}
|
||||
// check for each ID, don't use a Set so we detect duplicates
|
||||
for(int i=0; i<expected.length; i++) {
|
||||
assertTrue(expected[i].getId()+" is missing", actualIds.contains(expected[i].getId()));
|
||||
for (ICConfigurationDescription element : expected) {
|
||||
assertTrue(element.getId()+" is missing", actualIds.contains(element.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
for(Iterator i = Arrays.asList(new ICProject[]{p1,p2,p3,p4}).iterator(); i.hasNext(); ) {
|
||||
ICProject project = (ICProject) i.next();
|
||||
for (Object element : Arrays.asList(new ICProject[]{p1,p2,p3,p4})) {
|
||||
ICProject project = (ICProject) element;
|
||||
try {
|
||||
project.getProject().delete(true, NPM);
|
||||
project.getProject().delete(true, npm());
|
||||
} catch(CoreException ce) {
|
||||
// try next one..
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2009, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -131,7 +131,7 @@ public class Bug246129 extends IndexTestBase {
|
|||
CoreModel.newIncludeEntry(fProject.getPath(), null,
|
||||
fIncludeFolder.getLocation()) };
|
||||
|
||||
fProject.setRawPathEntries(entries, NPM);
|
||||
fProject.setRawPathEntries(entries, npm());
|
||||
|
||||
// However, the scanner info provider used by the unit tests
|
||||
// needs separate setup, and this one must be complete.
|
||||
|
@ -151,7 +151,7 @@ public class Bug246129 extends IndexTestBase {
|
|||
fFalseFriendsAccepted = falseFriendDirectory.exists();
|
||||
|
||||
CCorePlugin.getIndexManager().reindex(fProject);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, npm()));
|
||||
fIndex = CCorePlugin.getIndexManager().getIndex(fProject);
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class Bug246129 extends IndexTestBase {
|
|||
private void assertSymbolInIndex(String symbolName) throws Exception {
|
||||
IIndexBinding[] bindings = fIndex.findBindings(
|
||||
symbolName
|
||||
.toCharArray(), false, IndexFilter.ALL, NPM);
|
||||
.toCharArray(), false, IndexFilter.ALL, npm());
|
||||
assertTrue(bindings.length > 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -279,13 +279,13 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
private void waitForIndexer() throws InterruptedException {
|
||||
final IIndexManager indexManager = CCorePlugin.getIndexManager();
|
||||
assertTrue(indexManager.joinIndexer(INDEX_WAIT_TIME, NPM));
|
||||
assertTrue(indexManager.joinIndexer(INDEX_WAIT_TIME, npm()));
|
||||
long waitms= 1;
|
||||
while (waitms < 2000 && indexManager.isIndexerSetupPostponed(fCProject)) {
|
||||
Thread.sleep(waitms);
|
||||
waitms *= 2;
|
||||
}
|
||||
assertTrue(indexManager.joinIndexer(INDEX_WAIT_TIME, NPM));
|
||||
assertTrue(indexManager.joinIndexer(INDEX_WAIT_TIME, npm()));
|
||||
}
|
||||
|
||||
protected Pattern[] getPattern(String qname) {
|
||||
|
@ -364,7 +364,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
IIndex index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bs= index.findBindings("A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bs= index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bs.length);
|
||||
assertTrue(bs[0] instanceof ICPPClassType);
|
||||
assertEquals(2, ((ICPPClassType)bs[0]).getDeclaredMethods().length);
|
||||
|
@ -372,13 +372,13 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
index.releaseReadLock();
|
||||
}
|
||||
|
||||
file.setContents(new ByteArrayInputStream(content[1].getBytes()), true, false, NPM);
|
||||
file.setContents(new ByteArrayInputStream(content[1].getBytes()), true, false, npm());
|
||||
waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
|
||||
|
||||
index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bs= index.findBindings("A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bs= index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bs.length);
|
||||
assertTrue(bs[0] instanceof ICPPClassType);
|
||||
assertEquals(3, ((ICPPClassType)bs[0]).getDeclaredMethods().length);
|
||||
|
@ -399,13 +399,13 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
content.append("unsigned int arrayDataSize = sizeof(arrayData);\n");
|
||||
int indexOfDecl = content.indexOf(varName);
|
||||
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEX_WAIT_TIME, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEX_WAIT_TIME, npm()));
|
||||
IFile file= createFile(getProject(), fileName, content.toString());
|
||||
// must be done in a reasonable amount of time
|
||||
waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= fIndex.findBindings(getPattern("arrayDataSize"), true, IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= fIndex.findBindings(getPattern("arrayDataSize"), true, IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
IIndexBinding binding= bindings[0];
|
||||
|
@ -429,7 +429,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= fIndex.findBindings("e20070206".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), NPM);
|
||||
IBinding[] bindings= fIndex.findBindings("e20070206".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof IEnumerator);
|
||||
} finally {
|
||||
|
@ -482,7 +482,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
assertEquals(true, i.isSystemInclude());
|
||||
assertEquals(0, i.getNameOffset());
|
||||
assertEquals(0, i.getNameLength());
|
||||
IIndexBinding[] bindings= fIndex.findBindings("y".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= fIndex.findBindings("y".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof IVariable);
|
||||
} finally {
|
||||
|
@ -521,7 +521,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= fIndex.findBindings(getPattern("ns162011::function162011"), true, IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= fIndex.findBindings(getPattern("ns162011::function162011"), true, IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
IIndexBinding binding= bindings[0];
|
||||
|
@ -676,7 +676,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= fIndex.findBindings("S20070201".toCharArray(), IndexFilter.getFilter(ILinkage.C_LINKAGE_ID), NPM);
|
||||
IBinding[] bindings= fIndex.findBindings("S20070201".toCharArray(), IndexFilter.getFilter(ILinkage.C_LINKAGE_ID), npm());
|
||||
assertEquals(2, bindings.length);
|
||||
|
||||
IBinding struct, typedef;
|
||||
|
@ -710,7 +710,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= fIndex.findBindings("S20070201".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), NPM);
|
||||
IBinding[] bindings= fIndex.findBindings("S20070201".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), npm());
|
||||
assertEquals(2, bindings.length);
|
||||
|
||||
IBinding struct, typedef;
|
||||
|
@ -745,7 +745,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= fIndex.findBindings("T20070213".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), NPM);
|
||||
IBinding[] bindings= fIndex.findBindings("T20070213".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
ITypedef td= (ITypedef) bindings[0];
|
||||
|
@ -765,10 +765,10 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
fIndex.acquireReadLock();
|
||||
try {
|
||||
// double check if file was indexed
|
||||
IBinding[] bindings= fIndex.findBindings("UPDATED20070213".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), NPM);
|
||||
IBinding[] bindings= fIndex.findBindings("UPDATED20070213".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
bindings= fIndex.findBindings("T20070213".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), NPM);
|
||||
bindings= fIndex.findBindings("T20070213".toCharArray(), IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID), npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
ITypedef td= (ITypedef) bindings[0];
|
||||
|
@ -798,7 +798,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
IIndex index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bs= index.findBindings("var".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bs= index.findBindings("var".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bs.length);
|
||||
assertTrue(bs[0] instanceof ICPPVariable);
|
||||
assertTrue(((ICPPVariable)bs[0]).getType() instanceof ICPPClassType);
|
||||
|
@ -807,13 +807,13 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
index.releaseReadLock();
|
||||
}
|
||||
|
||||
file.setContents(new ByteArrayInputStream(content[1].getBytes()), true, false, NPM);
|
||||
file.setContents(new ByteArrayInputStream(content[1].getBytes()), true, false, npm());
|
||||
waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
|
||||
|
||||
index= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bs= index.findBindings("var".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bs= index.findBindings("var".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bs.length);
|
||||
assertTrue(bs[0] instanceof ICPPVariable);
|
||||
assertTrue(((ICPPVariable)bs[0]).getType() instanceof ICPPClassType);
|
||||
|
@ -1053,7 +1053,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
}
|
||||
};
|
||||
|
||||
IBinding[] bindings= fIndex.findBindings(new char[][]{{'a'},{'b'},{'c'},{'f'}}, NON_CLASS, NPM);
|
||||
IBinding[] bindings= fIndex.findBindings(new char[][]{{'a'},{'b'},{'c'},{'f'}}, NON_CLASS, npm());
|
||||
assertEquals(1,bindings.length);
|
||||
} finally {
|
||||
fIndex.releaseReadLock();
|
||||
|
@ -1083,7 +1083,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
IIndex index= CCorePlugin.getIndexManager().getIndex(new ICProject[]{fCProject, p2});
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= index.findBindings("StructA_T".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= index.findBindings("StructA_T".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
IIndexBinding binding= bindings[0];
|
||||
IIndexName[] names= index.findReferences(binding);
|
||||
|
@ -1132,7 +1132,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
IIndex index= indexManager.getIndex(fCProject);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = index.findBindings("v".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings = index.findBindings("v".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
IIndexBinding binding = bindings[0];
|
||||
assertTrue(binding instanceof IVariable);
|
||||
|
@ -1171,7 +1171,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= fIndex.findBindings("Bug200239".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= fIndex.findBindings("Bug200239".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
IIndexName[] refs= fIndex.findReferences(bindings[0]);
|
||||
assertEquals(3, refs.length);
|
||||
|
@ -1197,7 +1197,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= fIndex.findBindings("Bug200239".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= fIndex.findBindings("Bug200239".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
IIndexName[] refs= fIndex.findReferences(bindings[0]);
|
||||
assertEquals(3, refs.length);
|
||||
|
@ -1216,12 +1216,12 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
waitForIndexer();
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= fIndex.findBindings("bug200553_A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= fIndex.findBindings("bug200553_A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
checkTypedefDepth((ITypedef) bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings("bug200553_B".toCharArray(), IndexFilter.ALL, NPM);
|
||||
bindings= fIndex.findBindings("bug200553_B".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
checkTypedefDepth((ITypedef) bindings[0]);
|
||||
|
@ -1233,12 +1233,12 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
waitForIndexer();
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= fIndex.findBindings("bug200553_A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= fIndex.findBindings("bug200553_A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
checkTypedefDepth((ITypedef) bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings("bug200553_B".toCharArray(), IndexFilter.ALL, NPM);
|
||||
bindings= fIndex.findBindings("bug200553_B".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
checkTypedefDepth((ITypedef) bindings[0]);
|
||||
|
@ -1265,12 +1265,12 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
waitForIndexer();
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= fIndex.findBindings("bug200553_A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= fIndex.findBindings("bug200553_A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
checkTypedefDepth((ITypedef) bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings("bug200553_B".toCharArray(), IndexFilter.ALL, NPM);
|
||||
bindings= fIndex.findBindings("bug200553_B".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
checkTypedefDepth((ITypedef) bindings[0]);
|
||||
|
@ -1282,12 +1282,12 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
waitForIndexer();
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings= fIndex.findBindings("bug200553_A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= fIndex.findBindings("bug200553_A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
checkTypedefDepth((ITypedef) bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings("bug200553_B".toCharArray(), IndexFilter.ALL, NPM);
|
||||
bindings= fIndex.findBindings("bug200553_B".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ITypedef);
|
||||
checkTypedefDepth((ITypedef) bindings[0]);
|
||||
|
@ -1339,7 +1339,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings("func_209049".toCharArray(),
|
||||
IndexFilter.ALL, NPM);
|
||||
IndexFilter.ALL, npm());
|
||||
IFunctionType ft = ((IFunction) bindings[0]).getType();
|
||||
assertEquals("void (long long int)", ASTTypeUtil.getType(ft));
|
||||
} finally {
|
||||
|
@ -1364,7 +1364,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings("staticInHeader".toCharArray(),
|
||||
IndexFilter.ALL, NPM);
|
||||
IndexFilter.ALL, npm());
|
||||
IFunction func = (IFunction) bindings[0];
|
||||
assertTrue(func.isStatic());
|
||||
IIndexName[] refs = fIndex.findReferences(func);
|
||||
|
@ -1391,7 +1391,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings("staticConstInHeader".toCharArray(),
|
||||
IndexFilter.ALL, NPM);
|
||||
IndexFilter.ALL, npm());
|
||||
IVariable var = (IVariable) bindings[0];
|
||||
assertTrue(var.isStatic());
|
||||
IIndexName[] refs = fIndex.findReferences(var);
|
||||
|
@ -1418,7 +1418,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings("staticInHeader".toCharArray(),
|
||||
IndexFilter.C_DECLARED_OR_IMPLICIT, NPM);
|
||||
IndexFilter.C_DECLARED_OR_IMPLICIT, npm());
|
||||
IFunction func = (IFunction) bindings[0];
|
||||
assertTrue(func.isStatic());
|
||||
IIndexName[] refs = fIndex.findReferences(func);
|
||||
|
@ -1445,7 +1445,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings("staticConstInHeader".toCharArray(),
|
||||
IndexFilter.C_DECLARED_OR_IMPLICIT, NPM);
|
||||
IndexFilter.C_DECLARED_OR_IMPLICIT, npm());
|
||||
IVariable var = (IVariable) bindings[0];
|
||||
assertTrue(var.isStatic());
|
||||
IIndexName[] refs = fIndex.findReferences(var);
|
||||
|
@ -1467,7 +1467,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
waitForIndexer();
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings("ok".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings = fIndex.findBindings("ok".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
} finally {
|
||||
fIndex.releaseReadLock();
|
||||
|
@ -1493,7 +1493,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings(new char[][] { "MyClass".toCharArray(),
|
||||
"method".toCharArray() }, IndexFilter.ALL, NPM);
|
||||
"method".toCharArray() }, IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
IIndexName[] decls = fIndex.findDeclarations(bindings[0]);
|
||||
assertEquals(2, decls.length);
|
||||
|
@ -1525,7 +1525,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings(new char[][] { "unrelated".toCharArray(),
|
||||
"b".toCharArray() }, IndexFilter.ALL, NPM);
|
||||
"b".toCharArray() }, IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
IIndexName[] decls = fIndex.findNames(bindings[0], IIndex.FIND_ALL_OCCURRENCES);
|
||||
assertEquals(2, decls.length);
|
||||
|
@ -1553,9 +1553,9 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
waitForIndexer();
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings("bug227088".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings = fIndex.findBindings("bug227088".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(0, bindings.length);
|
||||
bindings = fIndex.findBindings("ok".toCharArray(), IndexFilter.ALL, NPM);
|
||||
bindings = fIndex.findBindings("ok".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
IIndexName[] decls = fIndex.findNames(bindings[0], IIndex.FIND_ALL_OCCURRENCES);
|
||||
assertEquals(2, decls.length);
|
||||
|
@ -1741,7 +1741,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
waitUntilFileIsIndexed(file, 4000);
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings("a".toCharArray(), false, IndexFilter.ALL_DECLARED, NPM);
|
||||
IIndexBinding[] bindings = fIndex.findBindings("a".toCharArray(), false, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
IIndexName[] refs = fIndex.findNames(bindings[0], IIndex.FIND_REFERENCES);
|
||||
assertEquals(2, refs.length);
|
||||
|
@ -1762,7 +1762,7 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
waitUntilFileIsIndexed(file, 4000);
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] bindings = fIndex.findBindings("Y".toCharArray(), false, IndexFilter.ALL_DECLARED, NPM);
|
||||
IIndexBinding[] bindings = fIndex.findBindings("Y".toCharArray(), false, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
ICPPClassType ct= (ICPPClassType) bindings[0];
|
||||
final ICPPBase[] bases = ct.getBases();
|
||||
|
|
|
@ -97,9 +97,9 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
|||
public void testBug208558() throws CoreException {
|
||||
IIndex index= getIndex();
|
||||
|
||||
IIndexMacro[] macrosA= index.findMacros("OBJ".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexMacro[] macrosB= index.findMacros("FUNC".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexMacro[] macrosC= index.findMacros("FUNC2".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IIndexMacro[] macrosA= index.findMacros("OBJ".toCharArray(), IndexFilter.ALL, npm());
|
||||
IIndexMacro[] macrosB= index.findMacros("FUNC".toCharArray(), IndexFilter.ALL, npm());
|
||||
IIndexMacro[] macrosC= index.findMacros("FUNC2".toCharArray(), IndexFilter.ALL, npm());
|
||||
|
||||
assertEquals(1, macrosA.length);
|
||||
assertEquals(1, macrosB.length);
|
||||
|
@ -126,12 +126,12 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
|||
assertEquals(1, func2.getParameterList().length);
|
||||
assertEquals("A", new String(func2.getParameterList()[0]));
|
||||
|
||||
IIndexBinding[] bindings= index.findBindings(Pattern.compile(".*"), false, IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] bindings= index.findBindings(Pattern.compile(".*"), false, IndexFilter.ALL, npm());
|
||||
assertEquals(3, bindings.length);
|
||||
|
||||
IIndexBinding foo= index.findBindings("foo".toCharArray(), IndexFilter.ALL, NPM)[0];
|
||||
IIndexBinding bar= index.findBindings("bar".toCharArray(), IndexFilter.ALL, NPM)[0];
|
||||
IIndexBinding baz= index.findBindings("baz".toCharArray(), IndexFilter.ALL, NPM)[0];
|
||||
IIndexBinding foo= index.findBindings("foo".toCharArray(), IndexFilter.ALL, npm())[0];
|
||||
IIndexBinding bar= index.findBindings("bar".toCharArray(), IndexFilter.ALL, npm())[0];
|
||||
IIndexBinding baz= index.findBindings("baz".toCharArray(), IndexFilter.ALL, npm())[0];
|
||||
|
||||
assertEquals("foo", foo.getName());
|
||||
assertEquals("bar", bar.getName());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,7 +10,6 @@
|
|||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.index.tests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -64,6 +63,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
|||
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
||||
/**
|
||||
* Tests for exercising resolution of template bindings against IIndex
|
||||
*/
|
||||
|
@ -1173,7 +1173,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public boolean acceptBinding(IBinding binding) throws CoreException {
|
||||
return !(binding instanceof ICPPSpecialization);
|
||||
}
|
||||
}, NPM)[0];
|
||||
}, npm())[0];
|
||||
|
||||
ICPPClassType b4= (ICPPClassType) getIndex().findBindings(new char[][] {"A".toCharArray(), "B".toCharArray()}, new IndexFilter() {
|
||||
@Override
|
||||
|
@ -1185,7 +1185,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}, NPM)[0];
|
||||
}, npm())[0];
|
||||
|
||||
assertFalse(b0 instanceof ICPPSpecialization);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -63,7 +63,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
IPathEntry[] entries= new IPathEntry[] {
|
||||
CoreModel.newIncludeEntry(fProject.getPath(),
|
||||
null, fProject.getResource().getLocation())};
|
||||
fProject.setRawPathEntries(entries, NPM);
|
||||
fProject.setRawPathEntries(entries, npm());
|
||||
}
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(fProject);
|
||||
}
|
||||
|
@ -93,13 +93,13 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
}
|
||||
|
||||
private void waitForIndexer() {
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, npm()));
|
||||
}
|
||||
|
||||
private void checkHeader(boolean all) throws Exception {
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] result= fIndex.findBindings(Pattern.compile(".*included"), true, IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] result= fIndex.findBindings(Pattern.compile(".*included"), true, IndexFilter.ALL, npm());
|
||||
assertEquals(all ? 2 : 1, result.length);
|
||||
} finally {
|
||||
fIndex.releaseReadLock();
|
||||
|
@ -114,10 +114,10 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
|
||||
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
file.setContents(new ByteArrayInputStream( "int included; int CONTEXT;\n".getBytes()), false, false, NPM);
|
||||
file.setContents(new ByteArrayInputStream( "int included; int CONTEXT;\n".getBytes()), false, false, npm());
|
||||
file.setLocalTimeStamp(timestamp+1000);
|
||||
}
|
||||
}, NPM);
|
||||
}, npm());
|
||||
assertTrue("Timestamp was not increased", file.getLocalTimeStamp() >= timestamp);
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, 4000);
|
||||
fIndex.acquireReadLock();
|
||||
|
@ -126,10 +126,10 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
assertNotNull("Can't find " + file.getLocation(), ifile);
|
||||
assertTrue("timestamp not ok", ifile.getTimestamp() >= timestamp);
|
||||
|
||||
IIndexBinding[] result= fIndex.findBindings(Pattern.compile("testInclude_cpp"), true, IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] result= fIndex.findBindings(Pattern.compile("testInclude_cpp"), true, IndexFilter.ALL, npm());
|
||||
assertEquals(1, result.length);
|
||||
|
||||
result= fIndex.findBindings("testInclude_cpp".toCharArray(), IndexFilter.ALL, NPM);
|
||||
result= fIndex.findBindings("testInclude_cpp".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, result.length);
|
||||
} finally {
|
||||
fIndex.releaseReadLock();
|
||||
|
@ -248,9 +248,9 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
assertEquals(0, fIndex.findBindings("notIncluded_20070404".toCharArray(), IndexFilter.ALL, NPM).length);
|
||||
assertEquals(1, fIndex.findBindings("source_20070404".toCharArray(), IndexFilter.ALL, NPM).length);
|
||||
IBinding[] bindings= fIndex.findBindings("ctx_20070404x".toCharArray(), IndexFilter.ALL, NPM);
|
||||
assertEquals(0, fIndex.findBindings("notIncluded_20070404".toCharArray(), IndexFilter.ALL, npm()).length);
|
||||
assertEquals(1, fIndex.findBindings("source_20070404".toCharArray(), IndexFilter.ALL, npm()).length);
|
||||
IBinding[] bindings= fIndex.findBindings("ctx_20070404x".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof IVariable);
|
||||
} finally {
|
||||
|
@ -266,8 +266,8 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
assertEquals(0, fIndex.findBindings("notIncluded_20070404".toCharArray(), IndexFilter.ALL, NPM).length);
|
||||
IBinding[] bindings= fIndex.findBindings("ctx_20070404y".toCharArray(), IndexFilter.ALL, NPM);
|
||||
assertEquals(0, fIndex.findBindings("notIncluded_20070404".toCharArray(), IndexFilter.ALL, npm()).length);
|
||||
IBinding[] bindings= fIndex.findBindings("ctx_20070404y".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0] instanceof IVariable);
|
||||
} finally {
|
||||
|
@ -296,7 +296,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] binding= fIndex.findBindings("ok_1_220358".toCharArray(), IndexFilter.ALL_DECLARED, NPM);
|
||||
IIndexBinding[] binding= fIndex.findBindings("ok_1_220358".toCharArray(), IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, binding.length);
|
||||
assertTrue(binding[0] instanceof IVariable);
|
||||
} finally {
|
||||
|
@ -308,7 +308,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
TestSourceReader.waitUntilFileIsIndexed(fIndex, h2, INDEXER_WAIT_TIME);
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] binding= fIndex.findBindings("ok_2_220358".toCharArray(), IndexFilter.ALL_DECLARED, NPM);
|
||||
IIndexBinding[] binding= fIndex.findBindings("ok_2_220358".toCharArray(), IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, binding.length);
|
||||
assertTrue(binding[0] instanceof IVariable);
|
||||
} finally {
|
||||
|
@ -351,7 +351,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
TestSourceReader.waitUntilFileIsIndexed(fIndex, s1, INDEXER_WAIT_TIME);
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
assertEquals(1, fIndex.findBindings("a20070426".toCharArray(), IndexFilter.ALL_DECLARED, NPM).length);
|
||||
assertEquals(1, fIndex.findBindings("a20070426".toCharArray(), IndexFilter.ALL_DECLARED, npm()).length);
|
||||
IIndexFile ifile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(header));
|
||||
assertNotNull(ifile);
|
||||
IIndexInclude[] includes= fIndex.findIncludedBy(ifile);
|
||||
|
@ -369,7 +369,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
TestSourceReader.waitUntilFileIsIndexed(fIndex, s1, INDEXER_WAIT_TIME);
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
assertEquals(1, fIndex.findBindings("b20070426".toCharArray(), IndexFilter.ALL_DECLARED, NPM).length);
|
||||
assertEquals(1, fIndex.findBindings("b20070426".toCharArray(), IndexFilter.ALL_DECLARED, npm()).length);
|
||||
IIndexFile ifile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(header));
|
||||
assertNotNull(ifile);
|
||||
IIndexInclude[] includes= fIndex.findIncludedBy(ifile);
|
||||
|
@ -452,7 +452,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
private void standardCheckUpdateIncludes(IFile header, IFile s1, String tag) throws Exception {
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
assertEquals(1, fIndex.findBindings(tag.toCharArray(), IndexFilter.ALL_DECLARED, NPM).length);
|
||||
assertEquals(1, fIndex.findBindings(tag.toCharArray(), IndexFilter.ALL_DECLARED, npm()).length);
|
||||
|
||||
IIndexFile ifile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(header));
|
||||
IIndexFile sfile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(s1));
|
||||
|
@ -493,7 +493,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
private void checkUpdateIncludes1(IFile header, IFile s1, String tag) throws Exception {
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
assertEquals(1, fIndex.findBindings(tag.toCharArray(), IndexFilter.ALL_DECLARED, NPM).length);
|
||||
assertEquals(1, fIndex.findBindings(tag.toCharArray(), IndexFilter.ALL_DECLARED, npm()).length);
|
||||
|
||||
IIndexFile ifile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(header));
|
||||
IIndexFile sfile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(s1));
|
||||
|
@ -524,7 +524,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
private void checkUpdateIncludes2(IFile header, IFile s1, String tag) throws Exception {
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
assertEquals(1, fIndex.findBindings(tag.toCharArray(), IndexFilter.ALL_DECLARED, NPM).length);
|
||||
assertEquals(1, fIndex.findBindings(tag.toCharArray(), IndexFilter.ALL_DECLARED, npm()).length);
|
||||
|
||||
IIndexFile ifile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(header));
|
||||
IIndexFile sfile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(s1));
|
||||
|
@ -559,7 +559,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
|||
private void checkUpdateIncludes3(IFile header, IFile s1, String tag) throws Exception {
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
assertEquals(1, fIndex.findBindings(tag.toCharArray(), IndexFilter.ALL_DECLARED, NPM).length);
|
||||
assertEquals(1, fIndex.findBindings(tag.toCharArray(), IndexFilter.ALL_DECLARED, npm()).length);
|
||||
|
||||
IIndexFile ifile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(header));
|
||||
IIndexFile sfile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(s1));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -38,12 +38,14 @@ public class IndexListenerTest extends BaseTestCase {
|
|||
return suite(IndexListenerTest.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
fProject1 = CProjectHelper.createCCProject("testIndexListener1", null, IPDOMManager.ID_FAST_INDEXER);
|
||||
fProject2 = CProjectHelper.createCCProject("testIndexListener2", null, IPDOMManager.ID_FAST_INDEXER);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(2000, new NullProgressMonitor()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
CProjectHelper.delete(fProject1);
|
||||
CProjectHelper.delete(fProject2);
|
||||
|
@ -53,7 +55,7 @@ public class IndexListenerTest extends BaseTestCase {
|
|||
final Object mutex= new Object();
|
||||
final int[] state= new int[] {0, 0, 0};
|
||||
IIndexManager im= CCorePlugin.getIndexManager();
|
||||
assertTrue(im.joinIndexer(10000, NPM));
|
||||
assertTrue(im.joinIndexer(10000, npm()));
|
||||
|
||||
IIndexerStateListener listener = new IIndexerStateListener() {
|
||||
public void indexChanged(IIndexerStateEvent event) {
|
||||
|
@ -96,7 +98,7 @@ public class IndexListenerTest extends BaseTestCase {
|
|||
final List projects= new ArrayList();
|
||||
IIndexManager im= CCorePlugin.getIndexManager();
|
||||
|
||||
assertTrue(im.joinIndexer(10000, NPM));
|
||||
assertTrue(im.joinIndexer(10000, npm()));
|
||||
IIndexChangeListener listener = new IIndexChangeListener() {
|
||||
public void indexChanged(IIndexChangeEvent event) {
|
||||
synchronized (mutex) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 Symbian Software Systems and others.
|
||||
* Copyright (c) 2006, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -160,7 +160,7 @@ public class IndexLocationTest extends BaseTestCase {
|
|||
File location = new File(CProjectHelper.freshDir(), "external2.h");
|
||||
createExternalFile(location, "struct External {};\n");
|
||||
IFolder content= cproject.getProject().getFolder("content");
|
||||
content.createLink(new Path(location.getParentFile().getAbsolutePath()), IResource.NONE, NPM);
|
||||
content.createLink(new Path(location.getParentFile().getAbsolutePath()), IResource.NONE, npm());
|
||||
|
||||
CCorePlugin.getIndexManager().reindex(cproject);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, new NullProgressMonitor()));
|
||||
|
@ -168,7 +168,7 @@ public class IndexLocationTest extends BaseTestCase {
|
|||
IIndex index = CCorePlugin.getIndexManager().getIndex(cproject);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bs= index.findBindings("External".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bs= index.findBindings("External".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bs.length);
|
||||
IIndexName[] nms= index.findNames(bs[0], IIndex.FIND_ALL_OCCURRENCES);
|
||||
assertEquals(1, nms.length);
|
||||
|
@ -202,7 +202,7 @@ public class IndexLocationTest extends BaseTestCase {
|
|||
waitForIndexer(cproject);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bs= index.findBindings("External".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bs= index.findBindings("External".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bs.length);
|
||||
IIndexName[] nms= index.findNames(bs[0], IIndex.FIND_ALL_OCCURRENCES);
|
||||
assertEquals(1, nms.length);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -48,12 +48,14 @@ public class IndexNamesTests extends BaseTestCase {
|
|||
return suite(IndexNamesTests.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws CoreException {
|
||||
fCProject= CProjectHelper.createCCProject("__encNamesTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||
CCorePlugin.getIndexManager().reindex(fCProject);
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws CoreException {
|
||||
if (fCProject != null) {
|
||||
CProjectHelper.delete(fCProject);
|
||||
|
@ -74,7 +76,7 @@ public class IndexNamesTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
protected void waitForIndexer() {
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, npm()));
|
||||
}
|
||||
|
||||
protected Pattern[] getPattern(String qname) {
|
||||
|
@ -105,7 +107,7 @@ public class IndexNamesTests extends BaseTestCase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] mainBS= fIndex.findBindings(getPattern("main"), true, IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] mainBS= fIndex.findBindings(getPattern("main"), true, IndexFilter.ALL, npm());
|
||||
assertLength(1, mainBS);
|
||||
IIndexBinding mainB= mainBS[0];
|
||||
|
||||
|
@ -164,7 +166,7 @@ public class IndexNamesTests extends BaseTestCase {
|
|||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
IIndexBinding[] mainBS= fIndex.findBindings(getPattern("main"), true, IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] mainBS= fIndex.findBindings(getPattern("main"), true, IndexFilter.ALL, npm());
|
||||
assertLength(1, mainBS);
|
||||
IIndexBinding mainB= mainBS[0];
|
||||
|
||||
|
@ -266,8 +268,7 @@ public class IndexNamesTests extends BaseTestCase {
|
|||
IIndexFile ifile= fIndex.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file));
|
||||
IIndexName[] names= ifile.findNames(0, content.length());
|
||||
int j= 0;
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
IIndexName indexName = names[i];
|
||||
for (IIndexName indexName : names) {
|
||||
if (indexName.isReference() && indexName.toString().equals("vm")) {
|
||||
assertEquals(couldbepolymorphic[j], indexName.couldBePolymorphicMethodCall());
|
||||
assertEquals(container[j], fIndex.findBinding(indexName).getQualifiedName()[0]);
|
||||
|
|
|
@ -231,7 +231,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
|
|||
}
|
||||
};
|
||||
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, NPM); // ensure IPM is called only once under test conditions
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, npm()); // ensure IPM is called only once under test conditions
|
||||
setExpectedNumberOfLoggedNonOKStatusObjects(3); // foo, bar and baz have no compatible fragments available
|
||||
|
||||
ipm.reset(VERSION_405); ipm.startup();
|
||||
|
@ -286,7 +286,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
|
|||
}
|
||||
};
|
||||
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, NPM); // ensure IPM is called only once under test conditions
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, npm()); // ensure IPM is called only once under test conditions
|
||||
setExpectedNumberOfLoggedNonOKStatusObjects(1); // contentA has no compatible fragments available
|
||||
|
||||
ipm.reset(VERSION_502); ipm.startup();
|
||||
|
@ -336,7 +336,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
|
|||
core.setProjectDescription(project, pd);
|
||||
|
||||
index= CCorePlugin.getIndexManager().getIndex(cproject);
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, npm());
|
||||
|
||||
DPT.reset(DP1);
|
||||
changeConfigRelations(project, ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE);
|
||||
|
@ -502,14 +502,14 @@ public class IndexProviderManagerTest extends IndexTestBase {
|
|||
ICProjectDescription pd= core.getProjectDescription(project);
|
||||
pd.setActiveConfiguration(pd.getConfigurationById(cfg.getId()));
|
||||
core.setProjectDescription(project, pd);
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, npm());
|
||||
}
|
||||
|
||||
private void changeConfigRelations(IProject project, int option) throws CoreException {
|
||||
ICProjectDescription pd= core.getProjectDescription(project);
|
||||
pd.setConfigurationRelations(option);
|
||||
core.setProjectDescription(project, pd);
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(8000, npm());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,42 +109,42 @@ public class IndexSearchTest extends IndexTestBase {
|
|||
|
||||
IIndexBinding[] bindings;
|
||||
|
||||
bindings= fIndex.findBindings(pcl, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pcl, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsClass(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(scl.toCharArray(), INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(scl.toCharArray(), INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsClass(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(pcl, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pcl, false, INDEX_FILTER, npm());
|
||||
assertEquals(3, bindings.length);
|
||||
checkIsClass(bindings[0]);
|
||||
checkIsClass(bindings[1]);
|
||||
checkIsClass(bindings[2]);
|
||||
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pcl}, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pcl}, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsClass(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(new char[][]{sns.toCharArray(), scl.toCharArray()}, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new char[][]{sns.toCharArray(), scl.toCharArray()}, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsClass(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pcl}, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pcl}, false, INDEX_FILTER, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
checkIsClass(bindings[0]);
|
||||
checkIsClass(bindings[1]);
|
||||
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pns, pcl}, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pns, pcl}, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsClass(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(new char[][]{sns.toCharArray(), sns.toCharArray(), scl.toCharArray()}, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new char[][]{sns.toCharArray(), sns.toCharArray(), scl.toCharArray()}, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsClass(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pns, pcl}, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pns, pcl}, false, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsClass(bindings[0]);
|
||||
}
|
||||
|
@ -157,28 +157,28 @@ public class IndexSearchTest extends IndexTestBase {
|
|||
|
||||
IIndexBinding[] bindings;
|
||||
|
||||
bindings= fIndex.findBindings(pns, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pns, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsNamespace(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(sns, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(sns, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsNamespace(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(pns, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pns, false, INDEX_FILTER, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
checkIsNamespace(bindings[0]);
|
||||
checkIsNamespace(bindings[1]);
|
||||
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pns}, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pns}, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsNamespace(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(new char[][]{sns, sns}, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new char[][]{sns, sns}, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsNamespace(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pns}, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new Pattern[]{pns, pns}, false, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsNamespace(bindings[0]);
|
||||
}
|
||||
|
@ -189,11 +189,11 @@ public class IndexSearchTest extends IndexTestBase {
|
|||
IIndexBinding[] bindings;
|
||||
|
||||
// the binding in the unnamed namespace is not visible in global scope.
|
||||
bindings= fIndex.findBindings(pcl, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pcl, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0].isFileLocal());
|
||||
|
||||
bindings= fIndex.findBindings(pcl.pattern().toCharArray(), INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pcl.pattern().toCharArray(), INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertTrue(bindings[0].isFileLocal());
|
||||
}
|
||||
|
@ -207,32 +207,32 @@ public class IndexSearchTest extends IndexTestBase {
|
|||
IIndexBinding[] bindings;
|
||||
|
||||
// enumerators are found in global scope
|
||||
bindings= fIndex.findBindings(pEnumerator, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pEnumerator, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsEnumerator(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(pEnumerator, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pEnumerator, false, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsEnumerator(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(new Pattern[]{pEnumeration, pEnumerator}, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new Pattern[]{pEnumeration, pEnumerator}, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
bindings= fIndex.findBindings(new char[][]{sEnumeration, sEnumerator}, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new char[][]{sEnumeration, sEnumerator}, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
bindings= fIndex.findBindings(new Pattern[]{pEnumeration, pEnumerator}, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(new Pattern[]{pEnumeration, pEnumerator}, false, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
bindings= fIndex.findBindings(pEnumeration, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pEnumeration, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsEnumeration(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(sEnumeration, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(sEnumeration, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsEnumeration(bindings[0]);
|
||||
|
||||
bindings= fIndex.findBindings(pEnumeration, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pEnumeration, false, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
checkIsEnumeration(bindings[0]);
|
||||
}
|
||||
|
@ -242,30 +242,30 @@ public class IndexSearchTest extends IndexTestBase {
|
|||
|
||||
Pattern pEnumAndEnumeration= Pattern.compile("E20061017", Pattern.CASE_INSENSITIVE);
|
||||
Pattern pEnumeration= Pattern.compile("E20061017");
|
||||
bindings= fIndex.findBindings(pEnumAndEnumeration, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pEnumAndEnumeration, true, INDEX_FILTER, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
bindings= fIndex.findBindings(pEnumeration, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pEnumeration, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
pEnumAndEnumeration= Pattern.compile("E2006101.*", Pattern.CASE_INSENSITIVE);
|
||||
pEnumeration= Pattern.compile("E2006101.*");
|
||||
bindings= fIndex.findBindings(pEnumAndEnumeration, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pEnumAndEnumeration, true, INDEX_FILTER, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
bindings= fIndex.findBindings(pEnumeration, true, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pEnumeration, true, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
Pattern macro1= Pattern.compile("Foo", Pattern.CASE_INSENSITIVE);
|
||||
Pattern macro2= Pattern.compile("Foo");
|
||||
bindings= fIndex.findMacroContainers(macro1, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findMacroContainers(macro1, INDEX_FILTER, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
bindings= fIndex.findMacroContainers(macro2, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findMacroContainers(macro2, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
macro1= Pattern.compile("Foo.*", Pattern.CASE_INSENSITIVE);
|
||||
macro2= Pattern.compile("Foo.*");
|
||||
bindings= fIndex.findMacroContainers(macro1, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findMacroContainers(macro1, INDEX_FILTER, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
bindings= fIndex.findMacroContainers(macro2, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findMacroContainers(macro2, INDEX_FILTER, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
}
|
||||
|
||||
|
@ -276,12 +276,12 @@ public class IndexSearchTest extends IndexTestBase {
|
|||
|
||||
IIndexBinding[] bindings;
|
||||
|
||||
bindings= fIndex.findBindings(pFunc, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pFunc, false, INDEX_FILTER, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
checkIsFunction(bindings[0]);
|
||||
checkIsFunction(bindings[1]);
|
||||
|
||||
bindings= fIndex.findBindings(pVar, false, INDEX_FILTER, NPM);
|
||||
bindings= fIndex.findBindings(pVar, false, INDEX_FILTER, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
checkIsVariable(bindings[0]);
|
||||
checkIsVariable(bindings[1]);
|
||||
|
|
|
@ -100,7 +100,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
if (fCProject == null) {
|
||||
fCProject= CProjectHelper.createCProject("indexUpdateTestsC", null, IPDOMManager.ID_FAST_INDEXER);
|
||||
}
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(new ICProject[] {fCProject, fCppProject});
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
}
|
||||
IProject project= cpp ? fCppProject.getProject() : fCProject.getProject();
|
||||
fHeader= TestSourceReader.createFile(project, "header.h", fContents[++fContentUsed].toString());
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm()));
|
||||
}
|
||||
|
||||
private void setupFile(int totalFileVersions, boolean cpp) throws Exception {
|
||||
|
@ -122,7 +122,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
IProject project= cpp ? fCppProject.getProject() : fCProject.getProject();
|
||||
fFile= TestSourceReader.createFile(project, "file" + (cpp ? ".cpp" : ".c"), fContents[++fContentUsed].toString());
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, fFile, INDEXER_WAIT_TIME);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm()));
|
||||
}
|
||||
|
||||
private void updateFile() throws Exception {
|
||||
|
@ -137,12 +137,12 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
public void tearDown() throws Exception {
|
||||
fIndex= null;
|
||||
if (fFile != null) {
|
||||
fFile.delete(true, NPM);
|
||||
fFile.delete(true, npm());
|
||||
}
|
||||
if (fHeader != null) {
|
||||
fHeader.delete(true, NPM);
|
||||
fHeader.delete(true, npm());
|
||||
}
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
for (int i = 0; i < nchars.length; i++) {
|
||||
nchars[i]= names[i].toCharArray();
|
||||
}
|
||||
return fIndex.findBindings(nchars, IndexFilter.ALL_DECLARED, NPM)[0];
|
||||
return fIndex.findBindings(nchars, IndexFilter.ALL_DECLARED, npm())[0];
|
||||
}
|
||||
|
||||
private String msg() {
|
||||
|
@ -555,7 +555,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
final char[] nchars = name.toCharArray();
|
||||
final String refType = name + " &";
|
||||
final String constRefType = "const " + refType;
|
||||
IIndexBinding[] ctors= fIndex.findBindings(new char[][]{nchars, nchars}, IndexFilter.ALL_DECLARED_OR_IMPLICIT, NPM);
|
||||
IIndexBinding[] ctors= fIndex.findBindings(new char[][]{nchars, nchars}, IndexFilter.ALL_DECLARED_OR_IMPLICIT, npm());
|
||||
|
||||
int count= 0;
|
||||
for (int i = 0; i < ctors.length; i++) {
|
||||
|
@ -574,7 +574,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
}
|
||||
checkCppConstructor((ICPPConstructor) ctors[0], new String[]{"", constRefType}, m2);
|
||||
|
||||
IIndexBinding[] assignmentOps= fIndex.findBindings(new char[][]{nchars, "operator =".toCharArray()}, IndexFilter.ALL_DECLARED_OR_IMPLICIT, NPM);
|
||||
IIndexBinding[] assignmentOps= fIndex.findBindings(new char[][]{nchars, "operator =".toCharArray()}, IndexFilter.ALL_DECLARED_OR_IMPLICIT, npm());
|
||||
count= 0;
|
||||
for (int i = 0; i < assignmentOps.length; i++) {
|
||||
IIndexBinding assignmentOp= assignmentOps[i];
|
||||
|
@ -934,7 +934,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
|
||||
fHeader= TestSourceReader.createFile(fHeader.getParent(), fHeader.getName(), fContents[0].toString().replaceAll("globalVar", "newVar"));
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, fHeader, INDEXER_WAIT_TIME);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm()));
|
||||
|
||||
fIndex.acquireReadLock();
|
||||
try {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -88,7 +88,7 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
mj.join(); // in order we are sure the indexer task has been scheduled before joining the indexer
|
||||
|
||||
fPDOMManager.setIndexerId(project, IPDOMManager.ID_FAST_INDEXER);
|
||||
assertTrue(fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM));
|
||||
assertTrue(fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm()));
|
||||
return project;
|
||||
} finally {
|
||||
mj.dispose();
|
||||
|
@ -103,8 +103,8 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
workspace.run(new IWorkspaceRunnable() {
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
IProjectDescription desc= IDEWorkbenchPlugin.getPluginWorkspace().newProjectDescription(prjName);
|
||||
prjHandle.create(desc, NPM);
|
||||
prjHandle.open(0, NPM);
|
||||
prjHandle.create(desc, npm());
|
||||
prjHandle.open(0, npm());
|
||||
}
|
||||
}, null);
|
||||
pj.join(); // in order we are sure the indexer task has been scheduled before joining the indexer
|
||||
|
@ -121,7 +121,7 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
IIndex index= fPDOMManager.getIndex(prj);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] binding= index.findBindings(var.toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] binding= index.findBindings(var.toCharArray(), IndexFilter.ALL, npm());
|
||||
int count= 0;
|
||||
assertTrue(binding.length < 2);
|
||||
if (binding.length == 1) {
|
||||
|
@ -144,13 +144,13 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
checkVariable(prj, "c", 1);
|
||||
|
||||
// export the project.
|
||||
fPDOMManager.export(prj, loc, 0, NPM);
|
||||
fPDOMManager.export(prj, loc, 0, npm());
|
||||
|
||||
// set indexer to the fake one.
|
||||
fPDOMManager.setIndexerId(prj, FakeIndexer.ID);
|
||||
IndexerPreferences.setScope(prj.getProject(), IndexerPreferences.SCOPE_PROJECT_SHARED);
|
||||
new ProjectScope(prj.getProject()).getNode(CCorePlugin.PLUGIN_ID).flush();
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
checkVariable(prj, "a", 0);
|
||||
checkVariable(prj, "b", 0);
|
||||
checkVariable(prj, "c", 0);
|
||||
|
@ -180,8 +180,8 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
// export the project.
|
||||
IndexerPreferences.setScope(prj.getProject(), IndexerPreferences.SCOPE_PROJECT_SHARED);
|
||||
new ProjectScope(prj.getProject()).getNode(CCorePlugin.PLUGIN_ID).flush();
|
||||
fPDOMManager.export(prj, loc, 0, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.export(prj, loc, 0, npm());
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
|
||||
// change file
|
||||
changeFile(prj);
|
||||
|
@ -201,7 +201,7 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
final IFile file = prj.getProject().getFile("a.cpp");
|
||||
final File location = file.getLocation().toFile();
|
||||
final long lm= location.lastModified();
|
||||
file.setContents(new ByteArrayInputStream("int d;".getBytes()), true, false, NPM);
|
||||
file.setContents(new ByteArrayInputStream("int d;".getBytes()), true, false, npm());
|
||||
if (location.lastModified() == lm) {
|
||||
location.setLastModified(lm+1000);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
private void deleteAndWait(ICProject prj) throws CoreException {
|
||||
ModelJoiner dj= new ModelJoiner();
|
||||
try {
|
||||
prj.getProject().delete(false, true, NPM);
|
||||
prj.getProject().delete(false, true, npm());
|
||||
dj.join();
|
||||
} finally {
|
||||
dj.dispose();
|
||||
|
@ -226,14 +226,14 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
checkVariable(prj, "c", 1);
|
||||
|
||||
// export the project.
|
||||
fPDOMManager.export(prj, loc, 0, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.export(prj, loc, 0, npm());
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
|
||||
// set indexer to the fake one.
|
||||
fPDOMManager.setIndexerId(prj, FakeIndexer.ID);
|
||||
IndexerPreferences.setScope(prj.getProject(), IndexerPreferences.SCOPE_PROJECT_SHARED);
|
||||
new ProjectScope(prj.getProject()).getNode(CCorePlugin.PLUGIN_ID).flush();
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
checkVariable(prj, "a", 0);
|
||||
checkVariable(prj, "b", 0);
|
||||
checkVariable(prj, "c", 0);
|
||||
|
@ -262,8 +262,8 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
// export the project.
|
||||
IndexerPreferences.setScope(prj.getProject(), IndexerPreferences.SCOPE_PROJECT_SHARED);
|
||||
new ProjectScope(prj.getProject()).getNode(CCorePlugin.PLUGIN_ID).flush();
|
||||
fPDOMManager.export(prj, loc, 0, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.export(prj, loc, 0, npm());
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
|
||||
// add file
|
||||
TestSourceReader.createFile(prj.getProject(), "d.cpp", "int d;");
|
||||
|
@ -288,14 +288,14 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
checkVariable(prj, "c", 1);
|
||||
|
||||
// export the project.
|
||||
fPDOMManager.export(prj, loc, 0, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.export(prj, loc, 0, npm());
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
|
||||
// set indexer to the fake one.
|
||||
fPDOMManager.setIndexerId(prj, FakeIndexer.ID);
|
||||
IndexerPreferences.setScope(prj.getProject(), IndexerPreferences.SCOPE_PROJECT_SHARED);
|
||||
new ProjectScope(prj.getProject()).getNode(CCorePlugin.PLUGIN_ID).flush();
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
checkVariable(prj, "a", 0);
|
||||
checkVariable(prj, "b", 0);
|
||||
checkVariable(prj, "c", 0);
|
||||
|
@ -325,11 +325,11 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
// export the project.
|
||||
IndexerPreferences.setScope(prj.getProject(), IndexerPreferences.SCOPE_PROJECT_SHARED);
|
||||
new ProjectScope(prj.getProject()).getNode(CCorePlugin.PLUGIN_ID).flush();
|
||||
fPDOMManager.export(prj, loc, 0, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.export(prj, loc, 0, npm());
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
|
||||
// delete file
|
||||
prj.getProject().getFile("a.cpp").delete(true, NPM);
|
||||
prj.getProject().getFile("a.cpp").delete(true, npm());
|
||||
deleteAndWait(prj);
|
||||
unregisterProject(prj);
|
||||
|
||||
|
@ -350,20 +350,20 @@ public class TeamSharedIndexTest extends IndexTestBase {
|
|||
checkVariable(prj, "c", 1);
|
||||
|
||||
// export the project.
|
||||
fPDOMManager.export(prj, loc, 0, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.export(prj, loc, 0, npm());
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
|
||||
// set indexer to the fake one.
|
||||
fPDOMManager.setIndexerId(prj, FakeIndexer.ID);
|
||||
IndexerPreferences.setScope(prj.getProject(), IndexerPreferences.SCOPE_PROJECT_SHARED);
|
||||
new ProjectScope(prj.getProject()).getNode(CCorePlugin.PLUGIN_ID).flush();
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
fPDOMManager.joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
checkVariable(prj, "a", 0);
|
||||
checkVariable(prj, "b", 0);
|
||||
checkVariable(prj, "c", 0);
|
||||
|
||||
// delete file
|
||||
prj.getProject().getFile("a.cpp").delete(true, NPM);
|
||||
prj.getProject().getFile("a.cpp").delete(true, npm());
|
||||
deleteAndWait(prj);
|
||||
unregisterProject(prj);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -61,8 +61,8 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
protected void setUpSections(int sections) throws Exception {
|
||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
for(int i=0; i<contents.length; i++) {
|
||||
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), contents[i].toString());
|
||||
for (StringBuffer content : contents) {
|
||||
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString());
|
||||
}
|
||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||
for(int i=0; i<5 && !CCoreInternals.getPDOMManager().isProjectRegistered(cproject); i++) {
|
||||
|
@ -80,7 +80,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
pdom.releaseReadLock();
|
||||
}
|
||||
pdom= null;
|
||||
cproject.getProject().delete(true, NPM);
|
||||
cproject.getProject().delete(true, npm());
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -96,8 +96,8 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
// Foo<A> a;
|
||||
// Foo<B> b;
|
||||
public void testSpecializations() throws Exception {
|
||||
IBinding[] as= pdom.findBindings(new char[][]{{'a'}}, IndexFilter.ALL, NPM);
|
||||
IBinding[] bs= pdom.findBindings(new char[][]{{'b'}}, IndexFilter.ALL, NPM);
|
||||
IBinding[] as= pdom.findBindings(new char[][]{{'a'}}, IndexFilter.ALL, npm());
|
||||
IBinding[] bs= pdom.findBindings(new char[][]{{'b'}}, IndexFilter.ALL, npm());
|
||||
|
||||
assertEquals(1, as.length);
|
||||
assertEquals(1, bs.length);
|
||||
|
@ -136,7 +136,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
// };
|
||||
public void testSimpleDefinition() throws Exception {
|
||||
assertDeclarationCount(pdom, "D", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'D'}}, IndexFilter.ALL_DECLARED, NPM);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'D'}}, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, b.length);
|
||||
assertTrue(b[0] instanceof ICPPClassTemplate);
|
||||
ICPPClassTemplate ct= (ICPPClassTemplate) b[0];
|
||||
|
@ -155,7 +155,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
// };
|
||||
public void testDefinition() throws Exception {
|
||||
assertDeclarationCount(pdom, "D", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'D'}}, IndexFilter.ALL_DECLARED, NPM);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'D'}}, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, b.length);
|
||||
assertTrue(b[0] instanceof ICPPClassTemplate);
|
||||
ICPPClassTemplate ct= (ICPPClassTemplate) b[0];
|
||||
|
@ -181,7 +181,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
// };
|
||||
public void testDefinition2() throws Exception {
|
||||
assertDeclarationCount(pdom, "E", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'E'}}, IndexFilter.ALL_DECLARED, NPM);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'E'}}, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, b.length);
|
||||
assertTrue(b[0] instanceof ICPPClassTemplate);
|
||||
ICPPClassTemplate ct= (ICPPClassTemplate) b[0];
|
||||
|
@ -231,7 +231,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
// foo->f(*new A());
|
||||
// }
|
||||
public void testFunctionPointer() throws Exception {
|
||||
IIndexFragmentBinding[] bs= pdom.findBindings(new char[][] {"foo".toCharArray()}, IndexFilter.ALL, NPM);
|
||||
IIndexFragmentBinding[] bs= pdom.findBindings(new char[][] {"foo".toCharArray()}, IndexFilter.ALL, npm());
|
||||
assertEquals(1, bs.length);
|
||||
assertInstance(bs[0], ICPPVariable.class);
|
||||
ICPPVariable var= (ICPPVariable) bs[0];
|
||||
|
@ -267,7 +267,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
|
||||
{
|
||||
// template
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'D'}}, IndexFilter.ALL_DECLARED, NPM);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'D'}}, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(2, b.length);
|
||||
assertTrue(!(b[0] instanceof ICPPClassTemplate) || !(b[1] instanceof ICPPClassTemplate));
|
||||
int i= b[0] instanceof ICPPClassTemplate ? 0 : 1;
|
||||
|
@ -283,7 +283,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
|
||||
{
|
||||
assertDeclarationCount(pdom, "dn", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {"dn".toCharArray()}, IndexFilter.ALL, NPM);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {"dn".toCharArray()}, IndexFilter.ALL, npm());
|
||||
assertEquals(1, b.length);
|
||||
assertInstance(b[0], ICPPVariable.class);
|
||||
ICPPVariable var= (ICPPVariable) b[0];
|
||||
|
@ -301,7 +301,7 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
|
||||
{
|
||||
assertDeclarationCount(pdom, "dint", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {"dint".toCharArray()}, IndexFilter.ALL, NPM);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {"dint".toCharArray()}, IndexFilter.ALL, npm());
|
||||
assertEquals(1, b.length);
|
||||
assertTrue(b[0] instanceof ICPPVariable);
|
||||
ICPPVariable var= (ICPPVariable) b[0];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -46,8 +46,8 @@ public class CPPFunctionTemplateTests extends PDOMTestBase {
|
|||
protected void setUpSections(int sections) throws Exception {
|
||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
for(int i=0; i<contents.length; i++) {
|
||||
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), contents[i].toString());
|
||||
for (StringBuffer content : contents) {
|
||||
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), content.toString());
|
||||
}
|
||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||
CCorePlugin.getIndexManager().reindex(cproject);
|
||||
|
@ -62,7 +62,7 @@ public class CPPFunctionTemplateTests extends PDOMTestBase {
|
|||
pdom.releaseReadLock();
|
||||
}
|
||||
pdom= null;
|
||||
cproject.getProject().delete(true, NPM);
|
||||
cproject.getProject().delete(true, npm());
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -88,7 +88,7 @@ public class CPPFunctionTemplateTests extends PDOMTestBase {
|
|||
// }
|
||||
public void testSimpleInstantiation() throws Exception {
|
||||
setUpSections(1);
|
||||
IBinding[] bs= pdom.findBindings(new char[][]{"foo".toCharArray()}, IndexFilter.ALL_DECLARED, NPM);
|
||||
IBinding[] bs= pdom.findBindings(new char[][]{"foo".toCharArray()}, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(2, bs.length);
|
||||
assertInstance(bs[0], ICPPFunctionTemplate.class);
|
||||
assertInstance(bs[1], ICPPFunctionTemplate.class);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 IBM Corporation.
|
||||
* Copyright (c) 2006, 2010 IBM Corporation.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -64,7 +64,7 @@ public class CPPFunctionTests extends PDOMTestBase {
|
|||
|
||||
public void testPointerToFunctionType() throws Exception {
|
||||
assertDeclarationCount(pdom, "int2intPtr", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {"int2intPtr".toCharArray()}, IndexFilter.ALL, NPM);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {"int2intPtr".toCharArray()}, IndexFilter.ALL, npm());
|
||||
assertEquals(1, b.length);
|
||||
assertInstance(b[0], ICPPVariable.class);
|
||||
ICPPVariable v= (ICPPVariable) b[0];
|
||||
|
@ -202,8 +202,8 @@ public class CPPFunctionTests extends PDOMTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < seen.length; i++) {
|
||||
assertTrue(seen[i]);
|
||||
for (boolean element : seen) {
|
||||
assertTrue(element);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 QNX Software Systems and others.
|
||||
* Copyright (c) 2006, 2010 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -62,7 +62,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
}
|
||||
|
||||
public void test1() throws Exception {
|
||||
IBinding[] Bs = pdom.findBindings(Pattern.compile("B"), true, IndexFilter.ALL, NPM);
|
||||
IBinding[] Bs = pdom.findBindings(Pattern.compile("B"), true, IndexFilter.ALL, npm());
|
||||
assertEquals(1, Bs.length);
|
||||
ICPPClassType B = (ICPPClassType)Bs[0];
|
||||
ICPPMethod[] Bmethods = B.getAllDeclaredMethods();
|
||||
|
@ -79,8 +79,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
}
|
||||
|
||||
private ICPPMethod findMethod(ICPPMethod[] bmethods, String name) {
|
||||
for (int i = 0; i < bmethods.length; i++) {
|
||||
ICPPMethod method = bmethods[i];
|
||||
for (ICPPMethod method : bmethods) {
|
||||
if (method.getName().equals(name)) {
|
||||
return method;
|
||||
}
|
||||
|
@ -89,7 +88,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
}
|
||||
|
||||
public void testNested() throws Exception {
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("NestedA"), false, IndexFilter.ALL_DECLARED, NPM);
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("NestedA"), false, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
ICPPClassType NestedA = (ICPPClassType)bindings[0];
|
||||
ICPPClassType[] nested = NestedA.getNestedClasses();
|
||||
|
@ -112,7 +111,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
}
|
||||
|
||||
public void test147903() throws Exception {
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("pr147903"), false, IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("pr147903"), false, IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
ICPPNamespaceScope ns = ((ICPPNamespace)bindings[0]).getNamespaceScope();
|
||||
bindings = ns.find("testRef");
|
||||
|
@ -125,15 +124,15 @@ public class ClassTests extends PDOMTestBase {
|
|||
|
||||
/* Test friend relationships between classes */
|
||||
public void testFriend() throws Exception {
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("ClassA"), true, IndexFilter.ALL_DECLARED, NPM);
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("ClassA"), true, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
ICPPClassType classA = (ICPPClassType) bindings[0];
|
||||
|
||||
bindings = pdom.findBindings(Pattern.compile("ClassC"), true, IndexFilter.ALL_DECLARED, NPM);
|
||||
bindings = pdom.findBindings(Pattern.compile("ClassC"), true, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
ICPPClassType classC = (ICPPClassType) bindings[0];
|
||||
|
||||
bindings = pdom.findBindings(Pattern.compile("functionB"), false, IndexFilter.ALL_DECLARED, NPM);
|
||||
bindings = pdom.findBindings(Pattern.compile("functionB"), false, IndexFilter.ALL_DECLARED, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
ICPPFunction funcB = (ICPPFunction) bindings[0];
|
||||
|
||||
|
@ -149,7 +148,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
public void noTest_testConstructor() throws Exception {
|
||||
// the source does not define Class1, so it is no surprise that the test is failing.
|
||||
//TODO PDOM doesn't have information on constructor
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("Class1"), false, IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("Class1"), false, IndexFilter.ALL, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
assertTrue(bindings[0] instanceof ICPPClassType);
|
||||
assertTrue(bindings[1] instanceof ICPPMethod);
|
||||
|
@ -163,7 +162,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
assertEquals(offset("constructor.cpp","Class1::Class1") + 8, loc.getNodeOffset()); //character offset
|
||||
|
||||
/* Member initialization */
|
||||
bindings = pdom.findBindings(Pattern.compile("number"), false, IndexFilter.ALL, NPM);
|
||||
bindings = pdom.findBindings(Pattern.compile("number"), false, IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
|
||||
IName[] refs = pdom.findNames(bindings[0], IIndex.FIND_REFERENCES);
|
||||
|
@ -181,7 +180,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
return binding instanceof ICPPConstructor;
|
||||
}
|
||||
};
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("C"), false, JUST_CONSTRUCTORS, NPM);
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("C"), false, JUST_CONSTRUCTORS, npm());
|
||||
// expecting C(int) and C(const C &)
|
||||
assertEquals(2, bindings.length);
|
||||
}
|
||||
|
@ -193,14 +192,14 @@ public class ClassTests extends PDOMTestBase {
|
|||
return binding instanceof ICPPConstructor;
|
||||
}
|
||||
};
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("D"), false, JUST_CONSTRUCTORS, NPM);
|
||||
IBinding[] bindings = pdom.findBindings(Pattern.compile("D"), false, JUST_CONSTRUCTORS, npm());
|
||||
// expecting just D(D &)
|
||||
assertEquals(1, bindings.length);
|
||||
}
|
||||
|
||||
public void testClassScope_bug185408() throws Exception {
|
||||
char[][] name= {"B".toCharArray(), "bf".toCharArray()};
|
||||
IBinding[] bindings= pdom.findBindings(name, IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings= pdom.findBindings(name, IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
IScope classScope= bindings[0].getScope();
|
||||
|
||||
|
|
|
@ -233,9 +233,9 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
|||
wpdom.acquireReadLock();
|
||||
try {
|
||||
assertEquals(1, wpdom.findBindings(new char[][] { "foo"
|
||||
.toCharArray() }, CLinkage, NPM).length);
|
||||
.toCharArray() }, CLinkage, npm()).length);
|
||||
assertEquals(0, wpdom.findBindings(new char[][] { "foo"
|
||||
.toCharArray() }, CPPLinkage, NPM).length);
|
||||
.toCharArray() }, CPPLinkage, npm()).length);
|
||||
} finally {
|
||||
wpdom.releaseReadLock();
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
|||
public void verifyProject2Content(WritablePDOM wpdom) throws Exception {
|
||||
wpdom.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= wpdom.findBindings(Pattern.compile(".*"), true, IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings= wpdom.findBindings(Pattern.compile(".*"), true, IndexFilter.ALL, npm());
|
||||
assertEquals(2, bindings.length);
|
||||
|
||||
int b= bindings[0].getName().equals("A") ? 1 : 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -81,7 +81,7 @@ public class PDOMCBugsTest extends BaseTestCase {
|
|||
// typedef int (*J)(J);
|
||||
public void test192165() throws Exception {
|
||||
pdom.acquireReadLock();
|
||||
IBinding[] bindings= pdom.findBindings(Pattern.compile(".*"), false, IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings= pdom.findBindings(Pattern.compile(".*"), false, IndexFilter.ALL, npm());
|
||||
assertEquals(7, bindings.length);
|
||||
Set bnames= new HashSet();
|
||||
for (IBinding binding : bindings) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -54,12 +54,14 @@ public class PDOMCPPBugsTest extends BaseTestCase {
|
|||
return suite(PDOMCPPBugsTest.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
cproject= CProjectHelper.createCCProject("PDOMBugsTest"+System.currentTimeMillis(), "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, npm()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
if (cproject != null) {
|
||||
cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, new NullProgressMonitor());
|
||||
|
@ -154,6 +156,7 @@ public class PDOMCPPBugsTest extends BaseTestCase {
|
|||
pdom.acquireWriteLock();
|
||||
try {
|
||||
Thread other= new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
pdom.acquireReadLock();
|
||||
|
@ -180,6 +183,7 @@ public class PDOMCPPBugsTest extends BaseTestCase {
|
|||
pdom.acquireReadLock();
|
||||
try {
|
||||
Thread other= new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
pdom.acquireReadLock();
|
||||
|
@ -205,7 +209,7 @@ public class PDOMCPPBugsTest extends BaseTestCase {
|
|||
public void test191679() throws Exception {
|
||||
IProject project= cproject.getProject();
|
||||
IFolder cHeaders= cproject.getProject().getFolder("cHeaders");
|
||||
cHeaders.create(true, true, NPM);
|
||||
cHeaders.create(true, true, npm());
|
||||
LanguageManager lm= LanguageManager.getInstance();
|
||||
|
||||
IFile cHeader= TestSourceReader.createFile(cHeaders, "cSource.c", "void foo(int i){}");
|
||||
|
@ -213,13 +217,13 @@ public class PDOMCPPBugsTest extends BaseTestCase {
|
|||
|
||||
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||
CCorePlugin.getIndexManager().reindex(cproject);
|
||||
CCorePlugin.getIndexManager().joinIndexer(10000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(10000, npm());
|
||||
|
||||
final PDOM pdom= (PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject);
|
||||
pdom.acquireReadLock();
|
||||
try {
|
||||
{ // test reference to 'foo' was resolved correctly
|
||||
IIndexBinding[] ib= pdom.findBindings(new char[][]{"foo".toCharArray()}, IndexFilter.ALL, NPM);
|
||||
IIndexBinding[] ib= pdom.findBindings(new char[][]{"foo".toCharArray()}, IndexFilter.ALL, npm());
|
||||
assertEquals(2, ib.length);
|
||||
if (ib[0] instanceof ICPPBinding) {
|
||||
IIndexBinding h= ib[0]; ib[0]= ib[1]; ib[1]= h;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -55,12 +55,12 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
{
|
||||
ICProject cproject= CProjectHelper.createCCProject("foo"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||
TestSourceReader.createFile(cproject.getProject(), new Path("/this.h"), "class A {};\n\n");
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
||||
|
||||
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
} finally {
|
||||
index.releaseReadLock();
|
||||
|
@ -76,7 +76,7 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
final URI baseURI= new File("c:/ExternalSDK/").toURI();
|
||||
final ICProject cproject2= CProjectHelper.createCCProject("bar"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||
TestSourceReader.createFile(cproject2.getProject(), new Path("/source.cpp"), "namespace X { class A {}; }\n\n");
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
||||
|
||||
|
||||
IndexProviderManager ipm= CCoreInternals.getPDOMManager().getIndexProviderManager();
|
||||
|
@ -107,9 +107,10 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject2);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
bindings= index.findBindingsForPrefix("A".toCharArray(), false, new IndexFilter() {
|
||||
@Override
|
||||
public boolean acceptBinding(IBinding binding) {
|
||||
return binding instanceof ICPPClassType;
|
||||
}
|
||||
|
@ -128,12 +129,12 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
{
|
||||
ICProject cproject= CProjectHelper.createCCProject("foo"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||
TestSourceReader.createFile(cproject.getProject(), new Path("/this.h"), "class A {};\n\n");
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
||||
|
||||
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
} finally {
|
||||
index.releaseReadLock();
|
||||
|
@ -148,12 +149,12 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
|
||||
final ICProject cproject3= CProjectHelper.createCCProject("bar"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||
TestSourceReader.createFile(cproject3.getProject(), new Path("/source.cpp"), "namespace Y { class A {}; }\n\n");
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
||||
|
||||
final URI baseURI= new File("c:/ExternalSDK/").toURI();
|
||||
final ICProject cproject2= CProjectHelper.createCCProject("baz"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||
TestSourceReader.createFile(cproject2.getProject(), new Path("/source.cpp"), "namespace X { class A {}; }\n\n");
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
||||
|
||||
|
||||
|
||||
|
@ -186,10 +187,11 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject2);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertEquals(1, index.findDefinitions(bindings[0]).length);
|
||||
bindings= index.findBindingsForPrefix("A".toCharArray(), false, new IndexFilter() {
|
||||
@Override
|
||||
public boolean acceptBinding(IBinding binding) {
|
||||
return binding instanceof ICPPClassType;
|
||||
}
|
||||
|
@ -205,10 +207,11 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject3);
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertEquals(1, index.findDefinitions(bindings[0]).length);
|
||||
bindings= index.findBindingsForPrefix("A".toCharArray(), false, new IndexFilter() {
|
||||
@Override
|
||||
public boolean acceptBinding(IBinding binding) {
|
||||
return binding instanceof ICPPClassType;
|
||||
}
|
||||
|
@ -224,10 +227,11 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
IIndex index= CCorePlugin.getIndexManager().getIndex(new ICProject[]{cproject2, cproject3});
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IBinding[] bindings= index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
|
||||
assertEquals(1, bindings.length);
|
||||
assertEquals(1, index.findDefinitions(bindings[0]).length);
|
||||
bindings= index.findBindingsForPrefix("A".toCharArray(), false, new IndexFilter() {
|
||||
@Override
|
||||
public boolean acceptBinding(IBinding binding) {
|
||||
return binding instanceof ICPPClassType;
|
||||
}
|
||||
|
@ -250,7 +254,7 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
{
|
||||
ICProject cproject= CProjectHelper.createCCProject("foo"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||
TestSourceReader.createFile(cproject.getProject(), new Path("/this.h"), "class A {};\n\n");
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
||||
ResourceContainerRelativeLocationConverter cvr= new ResourceContainerRelativeLocationConverter(cproject.getProject());
|
||||
CCoreInternals.getPDOMManager().exportProjectPDOM(cproject, tempPDOM, cvr);
|
||||
CProjectHelper.delete(cproject);
|
||||
|
@ -269,7 +273,7 @@ public class PDOMProviderTests extends PDOMTestBase {
|
|||
final URI baseURI= new File("c:/ExternalSDK/").toURI();
|
||||
final ICProject cproject2= CProjectHelper.createCCProject("baz"+System.currentTimeMillis(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||
TestSourceReader.createFile(cproject2.getProject(), new Path("/source.cpp"), "namespace X { class A {}; }\n\n");
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(3000, npm());
|
||||
|
||||
IndexProviderManager ipm= CCoreInternals.getPDOMManager().getIndexProviderManager();
|
||||
ipm.addIndexProvider(new ReadOnlyPDOMProviderBridge(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -39,14 +39,11 @@ import org.eclipse.cdt.internal.core.pdom.PDOMManager;
|
|||
import org.eclipse.core.resources.IResourceStatus;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.ILogListener;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
||||
public class BaseTestCase extends TestCase {
|
||||
protected static final IProgressMonitor NPM= new NullProgressMonitor();
|
||||
|
||||
private boolean fExpectFailure= false;
|
||||
private int fBugnumber= 0;
|
||||
private int fExpectedLoggedNonOK= 0;
|
||||
|
@ -58,7 +55,11 @@ public class BaseTestCase extends TestCase {
|
|||
public BaseTestCase(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
public NullProgressMonitor npm() {
|
||||
return new NullProgressMonitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
CPPASTNameBase.sAllowRecursionBindings= false;
|
||||
|
@ -283,12 +284,12 @@ public class BaseTestCase extends TestCase {
|
|||
|
||||
protected void waitForIndexer(ICProject project) throws InterruptedException {
|
||||
final PDOMManager indexManager = CCoreInternals.getPDOMManager();
|
||||
assertTrue(indexManager.joinIndexer(10000, NPM));
|
||||
assertTrue(indexManager.joinIndexer(10000, npm()));
|
||||
long waitms= 1;
|
||||
while (waitms < 2000 && !indexManager.isProjectRegistered(project)) {
|
||||
Thread.sleep(waitms);
|
||||
waitms *= 2;
|
||||
}
|
||||
assertTrue(indexManager.joinIndexer(10000, NPM));
|
||||
assertTrue(indexManager.joinIndexer(10000, npm()));
|
||||
}
|
||||
}
|
|
@ -144,7 +144,7 @@ public class BaseUITestCase extends BaseTestCase {
|
|||
index.releaseReadLock();
|
||||
int time= (int) (endTime- System.currentTimeMillis());
|
||||
if (time > 0) {
|
||||
CCorePlugin.getIndexManager().joinIndexer(time, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(time, npm());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -46,7 +46,7 @@ public class CallHierarchyAcrossProjectsTest extends CallHierarchyBaseTest {
|
|||
|
||||
fCProject2= CProjectHelper.createCCProject("__chTest_2__", "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
CCorePlugin.getIndexManager().setIndexerId(fCProject2, IPDOMManager.ID_FAST_INDEXER);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(new ICProject[] {fCProject, fCProject2});
|
||||
TestScannerProvider.sIncludes= new String[]{fCProject.getProject().getLocation().toOSString(), fCProject2.getProject().getLocation().toOSString()};
|
||||
}
|
||||
|
|
|
@ -52,12 +52,11 @@ public class CallHierarchyBaseTest extends BaseUITestCase {
|
|||
CallHierarchyUI.setIsJUnitTest(true);
|
||||
String prjName= "chTest"+sProjectCounter++;
|
||||
fCProject= CProjectHelper.createCCProject(prjName, "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
IViewReference[] refs= page.getViewReferences();
|
||||
for (int i = 0; i < refs.length; i++) {
|
||||
IViewReference viewReference = refs[i];
|
||||
for (IViewReference viewReference : refs) {
|
||||
page.setPartState(viewReference, IWorkbenchPage.STATE_RESTORED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -301,7 +301,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
IFile cppFile= createFile(getProject(), "s.cpp", cppSource);
|
||||
CEditor editor= openEditor(cFile);
|
||||
waitForIndexer(fIndex, cppFile, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
|
||||
editor.selectAndReveal(cSource.indexOf("cfunc"), 2);
|
||||
openCallHierarchy(editor);
|
||||
|
@ -347,7 +347,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
CEditor editor= openEditor(cFile);
|
||||
waitForIndexer(fIndex, cppFile, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
|
||||
editor.selectAndReveal(cSource.indexOf("cfunc"), 2);
|
||||
openCallHierarchy(editor, false);
|
||||
|
@ -416,7 +416,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
|
|||
IFile file= createFile(getProject(), "testTemplates.cpp", source);
|
||||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
waitForIndexer(fIndex, file, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
|
||||
CEditor editor= openEditor(file);
|
||||
int pos= source.indexOf("f(");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -82,7 +82,7 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
if (fCProject != null) {
|
||||
fCProject.getProject().delete(true, NPM);
|
||||
fCProject.getProject().delete(true, npm());
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
|
||||
public void testNoIndexerEnabled_158955() throws Exception {
|
||||
// rebuild the index with no indexer
|
||||
CCorePlugin.getIndexManager().setIndexerId(fCProject, IIndexManager.ID_NO_INDEXER);
|
||||
CCorePlugin.getIndexManager().setIndexerId(fCProject, IPDOMManager.ID_NO_INDEXER);
|
||||
CCorePlugin.getIndexManager().reindex(fCProject);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
|
||||
|
@ -293,7 +293,7 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
public void run(boolean fork, boolean cancelable,
|
||||
IRunnableWithProgress runnable)
|
||||
throws InvocationTargetException, InterruptedException {
|
||||
runnable.run(NPM);
|
||||
runnable.run(npm());
|
||||
}
|
||||
}, query);
|
||||
assertTrue(result[0] instanceof PDOMSearchResult);
|
||||
|
@ -313,7 +313,7 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
|
||||
String newContent= "void bar() {}";
|
||||
IFile file = fCProject.getProject().getFile(new Path("references.cpp"));
|
||||
file.setContents(new ByteArrayInputStream(newContent.getBytes()), IResource.FORCE, NPM);
|
||||
file.setContents(new ByteArrayInputStream(newContent.getBytes()), IResource.FORCE, npm());
|
||||
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
|
||||
|
@ -331,7 +331,7 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
// whitespace s.t. new match offset is same as older
|
||||
String newContent= "void bar() { foo(); }";
|
||||
IFile file = fCProject.getProject().getFile(new Path("references.cpp"));
|
||||
file.setContents(new ByteArrayInputStream(newContent.getBytes()), IResource.FORCE, NPM);
|
||||
file.setContents(new ByteArrayInputStream(newContent.getBytes()), IResource.FORCE, npm());
|
||||
runEventQueue(1000);
|
||||
IIndexManager indexManager = CCorePlugin.getIndexManager();
|
||||
indexManager.update(new ICElement[] {fCProject}, IIndexManager.UPDATE_ALL);
|
||||
|
@ -340,7 +340,7 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
assertOccurrences(query, 2);
|
||||
|
||||
String newContent2= "void bar() {foo(); foo();}";
|
||||
file.setContents(new ByteArrayInputStream(newContent2.getBytes()), IResource.FORCE, NPM);
|
||||
file.setContents(new ByteArrayInputStream(newContent2.getBytes()), IResource.FORCE, npm());
|
||||
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null);
|
||||
assertTrue(indexManager.joinIndexer(360000, new NullProgressMonitor()));
|
||||
|
||||
|
@ -353,7 +353,7 @@ public class BasicSearchTest extends BaseUITestCase {
|
|||
}
|
||||
|
||||
private void assertOccurrences(PDOMSearchQuery query, int expected) {
|
||||
query.run(NPM);
|
||||
query.run(npm());
|
||||
PDOMSearchResult result= (PDOMSearchResult) query.getSearchResult();
|
||||
assertEquals(expected, result.getMatchCount());
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -57,6 +57,7 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
|
|||
/*
|
||||
* @see org.eclipse.cdt.core.testplugin.util.BaseTestCase#setUp()
|
||||
*/
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
fOptions= CCorePlugin.getOptions();
|
||||
|
@ -65,6 +66,7 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
|
|||
/*
|
||||
* @see junit.framework.TestCase#tearDown()
|
||||
*/
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
CCorePlugin.setOptions(fOptions);
|
||||
super.tearDown();
|
||||
|
@ -583,7 +585,7 @@ public class DefaultCCommentAutoEditStrategyTest extends AbstractAutoEditTest {
|
|||
}
|
||||
} finally {
|
||||
if(cproject!=null) {
|
||||
cproject.getProject().delete(true, NPM);
|
||||
cproject.getProject().delete(true, npm());
|
||||
}
|
||||
}
|
||||
} catch(CoreException ce) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -837,11 +837,11 @@ public class CompletionTests extends AbstractContentAssistTest {
|
|||
};
|
||||
String disturbContent= readTaggedComment(DISTURB_FILE_NAME);
|
||||
IFile dfile= createFile(fProject, DISTURB_FILE_NAME, disturbContent);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, npm()));
|
||||
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
|
||||
|
||||
dfile.delete(true, NPM);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, NPM));
|
||||
dfile.delete(true, npm());
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, npm()));
|
||||
assertCompletionResults(fCursorOffset, expected2, AbstractContentAssistTest.COMPARE_REP_STRINGS);
|
||||
}
|
||||
|
||||
|
|
|
@ -232,11 +232,11 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
|||
};
|
||||
String disturbContent= readTaggedComment(DISTURB_FILE_NAME);
|
||||
IFile dfile= createFile(fProject, DISTURB_FILE_NAME, disturbContent);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, NPM));
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, npm()));
|
||||
assertCompletionResults(expected);
|
||||
|
||||
dfile.delete(true, NPM);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, NPM));
|
||||
dfile.delete(true, npm());
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(8000, npm()));
|
||||
assertCompletionResults(expected2);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Symbian Software Systems and others.
|
||||
* Copyright (c) 2008, 2010 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -37,6 +37,7 @@ public class CommentOwnerManagerTests extends BaseTestCase {
|
|||
|
||||
IProject projectA, projectB, projectC;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
manager= DocCommentOwnerManager.getInstance();
|
||||
|
||||
|
@ -50,6 +51,7 @@ public class CommentOwnerManagerTests extends BaseTestCase {
|
|||
OWNER_3= manager.getOwner("org.cdt.test.DCOM3");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
if(projectA != null) {
|
||||
CProjectHelper.delete(CoreModel.getDefault().create(projectA));
|
||||
|
@ -99,13 +101,13 @@ public class CommentOwnerManagerTests extends BaseTestCase {
|
|||
assertEquals(OWNER_3.getID(), manager.getCommentOwner(projectC.getFile("foo/bar/baz")).getID());
|
||||
assertEquals(OWNER_3.getID(), manager.getCommentOwner(projectC.getFolder("foo/bar")).getID());
|
||||
|
||||
projectA.close(NPM);
|
||||
projectB.close(NPM);
|
||||
projectC.close(NPM);
|
||||
projectA.close(npm());
|
||||
projectB.close(npm());
|
||||
projectC.close(npm());
|
||||
|
||||
projectA.open(NPM);
|
||||
projectB.open(NPM);
|
||||
projectC.open(NPM);
|
||||
projectA.open(npm());
|
||||
projectB.open(npm());
|
||||
projectC.open(npm());
|
||||
|
||||
assertEquals(OWNER_2.getID(), manager.getCommentOwner(projectA).getID());
|
||||
assertEquals(OWNER_2.getID(), manager.getCommentOwner(projectA.getFile("foo/bar/baz")).getID());
|
||||
|
|
|
@ -56,7 +56,7 @@ public class TypeHierarchyBaseTest extends BaseUITestCase {
|
|||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
fCProject= CProjectHelper.createCCProject("__thTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM);
|
||||
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm());
|
||||
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||
}
|
||||
|
||||
|
@ -128,8 +128,7 @@ public class TypeHierarchyBaseTest extends BaseUITestCase {
|
|||
if (focus instanceof Text) {
|
||||
Composite parent= focus.getParent();
|
||||
Control[] children= parent.getChildren();
|
||||
for (int j = 0; j < children.length; j++) {
|
||||
Control child = children[j];
|
||||
for (Control child : children) {
|
||||
if (child instanceof Tree) {
|
||||
return (Tree) child;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue