From cbabb21a6ee4b3e7f5407f4c2b3a5973cf1b5244 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Mon, 17 May 2010 14:16:14 +0000 Subject: [PATCH] Removes use of static instance of NullProgressMonitor (once canceled it remains to be canceled). --- ...onfigurationDescriptionReferenceTests.java | 25 +++--- .../cdt/internal/index/tests/Bug246129.java | 8 +- .../internal/index/tests/IndexBugsTests.java | 86 +++++++++---------- .../tests/IndexCPPBindingResolutionBugs.java | 14 +-- .../tests/IndexCPPTemplateResolutionTest.java | 8 +- .../index/tests/IndexIncludeTest.java | 42 ++++----- .../index/tests/IndexListenerTest.java | 8 +- .../index/tests/IndexLocationTest.java | 8 +- .../internal/index/tests/IndexNamesTests.java | 13 +-- .../index/tests/IndexProviderManagerTest.java | 10 +-- .../internal/index/tests/IndexSearchTest.java | 70 +++++++-------- .../index/tests/IndexUpdateTests.java | 20 ++--- .../index/tests/TeamSharedIndexTest.java | 52 +++++------ .../pdom/tests/CPPClassTemplateTests.java | 26 +++--- .../pdom/tests/CPPFunctionTemplateTests.java | 10 +-- .../internal/pdom/tests/CPPFunctionTests.java | 8 +- .../cdt/internal/pdom/tests/ClassTests.java | 27 +++--- .../tests/GeneratePDOMApplicationTest.java | 6 +- .../internal/pdom/tests/PDOMCBugsTest.java | 4 +- .../internal/pdom/tests/PDOMCPPBugsTest.java | 14 +-- .../pdom/tests/PDOMProviderTests.java | 32 ++++--- .../core/testplugin/util/BaseTestCase.java | 15 ++-- .../eclipse/cdt/ui/tests/BaseUITestCase.java | 2 +- .../CallHierarchyAcrossProjectsTest.java | 4 +- .../callhierarchy/CallHierarchyBaseTest.java | 5 +- .../callhierarchy/CppCallHierarchyTest.java | 8 +- .../cdt/ui/tests/search/BasicSearchTest.java | 16 ++-- .../DefaultCCommentAutoEditStrategyTest.java | 6 +- .../text/contentassist2/CompletionTests.java | 8 +- .../CompletionTests_PlainC.java | 6 +- .../doctools/CommentOwnerManagerTests.java | 16 ++-- .../typehierarchy/TypeHierarchyBaseTest.java | 5 +- 32 files changed, 298 insertions(+), 284 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/CConfigurationDescriptionReferenceTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/CConfigurationDescriptionReferenceTests.java index 26f37d832d0..d1c798b63b6 100644 --- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/CConfigurationDescriptionReferenceTests.java +++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/CConfigurationDescriptionReferenceTests.java @@ -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 0); } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java index 98bf64bb4ad..eab0b1ad9eb 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java @@ -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(); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java index b9f03a65615..fc7d78833b8 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java @@ -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()); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java index 1185f2c58db..4fce34e6dd1 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java @@ -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); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexIncludeTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexIncludeTest.java index 5177be62996..d4048f2fcac 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexIncludeTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexIncludeTest.java @@ -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)); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexListenerTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexListenerTest.java index 028bba6d9f8..8be862dd17c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexListenerTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexListenerTest.java @@ -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) { diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java index 003f69c3ad6..7625241f2c4 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java @@ -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); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java index dc7aef3179c..34d2706afaa 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java @@ -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]); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexProviderManagerTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexProviderManagerTest.java index dbbfa413924..c4cb84e7459 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexProviderManagerTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexProviderManagerTest.java @@ -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()); } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexSearchTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexSearchTest.java index 670ab8625dc..a9df49d0551 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexSearchTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexSearchTest.java @@ -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]); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java index 54cb32245e4..cab97ae72ea 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java @@ -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 { diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/TeamSharedIndexTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/TeamSharedIndexTest.java index 759abc6e630..de8be49f708 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/TeamSharedIndexTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/TeamSharedIndexTest.java @@ -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); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPClassTemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPClassTemplateTests.java index d950037ed81..51c6d0e5dd1 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPClassTemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPClassTemplateTests.java @@ -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 a; // Foo 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]; diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTemplateTests.java index b22b63d3895..185cf454648 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTemplateTests.java @@ -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 0) { - CCorePlugin.getIndexManager().joinIndexer(time, NPM); + CCorePlugin.getIndexManager().joinIndexer(time, npm()); } } } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CallHierarchyAcrossProjectsTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CallHierarchyAcrossProjectsTest.java index 610ae71fe60..ce1a0fb40c4 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CallHierarchyAcrossProjectsTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CallHierarchyAcrossProjectsTest.java @@ -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()}; } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CallHierarchyBaseTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CallHierarchyBaseTest.java index 9ae7e731e3d..e726a09a18f 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CallHierarchyBaseTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CallHierarchyBaseTest.java @@ -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); } } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CppCallHierarchyTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CppCallHierarchyTest.java index 21c4ca6d839..f1662ceb6c3 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CppCallHierarchyTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/CppCallHierarchyTest.java @@ -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("); diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/BasicSearchTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/BasicSearchTest.java index 8299cc41b62..89d5411b1c0 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/BasicSearchTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/BasicSearchTest.java @@ -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()); } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/DefaultCCommentAutoEditStrategyTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/DefaultCCommentAutoEditStrategyTest.java index 8bb388553ce..87377e8e307 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/DefaultCCommentAutoEditStrategyTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/DefaultCCommentAutoEditStrategyTest.java @@ -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) { diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java index 3dcadcc3f99..abd87e87b0a 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java @@ -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); } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests_PlainC.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests_PlainC.java index 46fa6d653c8..b27f65387a5 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests_PlainC.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests_PlainC.java @@ -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); } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/CommentOwnerManagerTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/CommentOwnerManagerTests.java index 99cc0ab0dde..dd42ee2642c 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/CommentOwnerManagerTests.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/CommentOwnerManagerTests.java @@ -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()); diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/typehierarchy/TypeHierarchyBaseTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/typehierarchy/TypeHierarchyBaseTest.java index e2330f2e010..1f94c84f23b 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/typehierarchy/TypeHierarchyBaseTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/typehierarchy/TypeHierarchyBaseTest.java @@ -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; }