Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2006-04-12 13:11:14 -0400
committerDoug Schaefer2006-04-12 13:11:14 -0400
commitc394f40e489dd37280520439c09530c1c4a9e61f (patch)
tree93675fecb6128a0d5c6fe2b0101661838bed71bd
parent160774ed3d29b0766ed646ac6eae690d7ff1ddd4 (diff)
downloadorg.eclipse.cdt-c394f40e489dd37280520439c09530c1c4a9e61f.tar.gz
org.eclipse.cdt-c394f40e489dd37280520439c09530c1c4a9e61f.tar.xz
org.eclipse.cdt-c394f40e489dd37280520439c09530c1c4a9e61f.zip
Testing the scalability of the Commit Files dialog. No really, I've removed the old indexer, search and type cache and have fixed all the compile errors that doing so caused. A number of features are disabled to be re-enabled later.
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java1
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/internal/DefaultIndexerDependencyCalculator.java76
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/suite/AllManagedBuildUITests.java9
-rw-r--r--core/org.eclipse.cdt.core.tests/.classpath2
-rw-r--r--core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF2
-rw-r--r--core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DOMSourceIndexerPerfTests.java244
-rw-r--r--core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DOMSourceIndexerTests.java876
-rw-r--r--core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DependencyTests.java790
-rw-r--r--core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexerOffsetTests.java103
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2FileBasePluginTest.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMFileBasePluginTest.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseBaseTest.java33
-rw-r--r--core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/BaseTestFramework.java18
-rw-r--r--core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/RegressionTestSuite.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/SearchRegressionTests.java1633
-rw-r--r--core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/SelectionRegressionTest.java5
-rw-r--r--core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/BaseSearchTest.java179
-rw-r--r--core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java287
-rw-r--r--core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java256
-rw-r--r--core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java368
-rw-r--r--core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ParseTestOnSearchFiles.java66
-rw-r--r--core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/SearchTestSuite.java34
-rw-r--r--core/org.eclipse.cdt.core/.classpath4
-rw-r--r--core/org.eclipse.cdt.core/META-INF/MANIFEST.MF19
-rw-r--r--core/org.eclipse.cdt.core/browser/ChangeLog-browser108
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java366
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeCacheChangedListener.java32
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java209
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfoVisitor.java18
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeReference.java91
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java47
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java330
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeReference.java245
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java419
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/UnknownTypeInfo.java41
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ChangeCollector.java451
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ITypeHierarchy.java171
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ITypeHierarchyChangedListener.java29
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchy.java582
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyBuilder.java129
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyMessages.java50
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyMessages.properties17
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/BasicJob.java116
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/ITypeCache.java214
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob.java93
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob2.java92
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerJob.java157
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerJob2.java166
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob.java186
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob2.java229
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/SubTypeLocatorJob.java67
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java895
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheDelta.java60
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheManager.java471
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheMessages.java50
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheMessages.properties23
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java275
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeLocatorJob.java67
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeParser.java955
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/ArrayUtil.java53
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/DelegatedProgressMonitor.java249
-rw-r--r--core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/util/SimpleStack.java84
-rw-r--r--core/org.eclipse.cdt.core/dependency/ChangeLog74
-rw-r--r--core/org.eclipse.cdt.core/dependency/org/eclipse/cdt/internal/core/sourcedependency/DependencyQueryJob.java205
-rw-r--r--core/org.eclipse.cdt.core/dependency/org/eclipse/cdt/internal/core/sourcedependency/Node.java45
-rw-r--r--core/org.eclipse.cdt.core/dependency/org/eclipse/cdt/internal/core/sourcedependency/UpdateDependency.java129
-rw-r--r--core/org.eclipse.cdt.core/index/ChangeLog587
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/ICDTIndexer.java184
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/IIndexChangeListener.java19
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/IIndexDelta.java46
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/IIndexStorage.java30
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/IndexChangeEvent.java33
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/Indexer.java70
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/CIndexStorageEntry.java95
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/FunctionEntry.java51
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ICIndexStorageEntry.java48
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java58
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IFunctionEntry.java19
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndex.java146
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndexEntry.java27
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndexQuery.java93
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java36
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndexerRunner.java35
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/INamedEntry.java23
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IQueryResult.java16
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ITypeEntry.java50
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IndexRequest.java37
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/NamedEntry.java49
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/StringMatcher.java395
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/TypeEntry.java62
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/CIndexStorage.java502
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java238
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/ICIndexStorageConstants.java88
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/InMemoryIndex.java297
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IncludeEntry.java240
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IncludeEntryHashedArray.java84
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/Index.java825
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexEntryNotSupportedException.java21
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexPathVariableEntry.java70
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexPathVariableEntryHashedArray.java117
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexedFileEntry.java76
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexedFileEntryHashedArray.java107
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexerOutput.java345
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/Util.java373
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/WordEntry.java534
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/WordEntryHashedArray.java83
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/Block.java63
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/BlocksIndexInput.java490
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/BlocksIndexOutput.java221
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/CodeByteStream.java343
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/Field.java381
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/FileListBlock.java116
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/GammaCompressedIndexBlock.java260
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/IndexBlock.java83
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/IndexInput.java173
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/IndexOutput.java46
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/IndexSummary.java392
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/MergeFactory.java301
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/SafeRandomAccessFile.java31
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/io/SimpleIndexInput.java211
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagEntry.java286
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsAddCompilationUnitToIndex.java45
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsAddFileToIndex.java75
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsConsoleParser.java92
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsFileReader.java176
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsHeader.java101
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsIndexAll.java418
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsIndexRequest.java74
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsIndexer.java567
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsIndexerRunner.java178
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsRemoveFromIndex.java61
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsSaveIndex.java57
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/AbstractIndexerRunner.java343
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CGenerateIndexVisitor.java292
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CPPGenerateIndexVisitor.java475
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CleanEncounteredHeaders.java64
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMAddCompilationUnitToIndex.java45
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMAddFileToIndex.java87
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMAddFolderToIndex.java130
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMIndexAllProject.java134
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMIndexRequest.java63
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMRemoveFolderFromIndex.java74
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMRemoveFromIndex.java59
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMSaveIndex.java58
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMSourceIndexer.java688
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMSourceIndexerRunner.java487
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexEncoderUtil.java101
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexVisitorUtil.java257
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexerOutputWrapper.java177
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/IndexDelta.java63
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/Int.java21
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/nullindexer/NullIndexer.java101
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/HashtableOfInt.java93
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/SimpleLookupTable.java153
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java559
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexProblemHandler.java59
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexerModelListener.java132
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/ReadWriteMonitor.java85
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java9
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILanguage.java13
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/IQualifiedTypeName.java (renamed from core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java)2
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/QualifiedTypeName.java (renamed from core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java)2
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/Signature.java (renamed from core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/Signature.java)2
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/util/TypeUtil.java (renamed from core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeUtil.java)34
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java3
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java11
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java72
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/DOMSearchUtil.java219
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/IPDOM.java19
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/IPDOMResolver.java32
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/IPDOMWriter.java (renamed from core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/LimitTo.java)22
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java36
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java44
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java47
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java46
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java39
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java5
-rw-r--r--core/org.eclipse.cdt.core/search/ChangeLog422
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/BasicSearchMatch.java335
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java235
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/DOMSearchUtil.java569
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchConstants.java202
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchPattern.java39
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchResultCollector.java62
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchScope.java46
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ILineLocatable.java16
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/IMatch.java60
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/IMatchLocatable.java15
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/IMatchLocator.java34
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/IOffsetLocatable.java19
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/LineLocatable.java30
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/OffsetLocatable.java59
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/OrPattern.java117
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java274
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchFor.java20
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/AcceptMatchOperation.java57
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/CSearchScope.java276
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/CWorkspaceScope.java97
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/IIndexSearchRequestor.java21
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/IndexSelector.java126
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/PathCollector.java56
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/PatternSearchJob.java183
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java780
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java282
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/DerivedTypesPattern.java121
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java206
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FriendPattern.java126
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/IncludePattern.java144
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MacroDeclarationPattern.java144
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java680
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java333
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java165
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/IIndexJob.java47
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/IndexingJob.java117
-rw-r--r--core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/JobManager.java549
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java27
-rw-r--r--core/org.eclipse.cdt.ui.tests/META-INF/MANIFEST.MF2
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java90
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMDisplaySearchNames.java262
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/FilterIndexerViewDialog.java692
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerFilterManager.java44
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeLeaf.java196
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeParent.java283
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerQuery.java254
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerView.java618
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerViewPluginImages.java150
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/OpenIndexerViewAction.java80
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java3
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/regression/ContentAssistRegressionTests.java1853
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/regression/RefactoringRegressionTests.java1344
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/regression/RegressionTestsUISuite.java50
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionProposalsBaseTest.java56
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java8
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionProposalsBaseTest.java10
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selectiontests/BaseSelectionTestsIndexer.java39
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selectiontests/CPPSelectionTestsCTagsIndexer.java25
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selectiontests/CPPSelectionTestsDOMIndexer.java14
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selectiontests/CPPSelectionTestsNoIndexer.java23
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selectiontests/CSelectionTestsCTagsIndexer.java15
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selectiontests/CSelectionTestsDOMIndexer.java14
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selectiontests/CSelectionTestsNoIndexer.java23
-rw-r--r--core/org.eclipse.cdt.ui/.classpath1
-rw-r--r--core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF9
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingContentProvider.java364
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingElementComparer.java26
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingElementFilter.java24
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingLabelProvider.java44
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingMessages.java47
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingMessages.properties31
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPart.java1624
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPerspectiveFactory.java234
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingViewerSorter.java20
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ElementTableViewer.java66
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ElementTreeViewer.java56
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/LexicalSortingAction.java61
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/MembersView.java266
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/MembersViewContentProvider.java152
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/NamespacesView.java246
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/NamespacesViewContentProvider.java170
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/NamespacesViewLabelProvider.java36
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/OpenProjectAction.java218
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ProjectActionGroup.java109
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ProjectsView.java266
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ProjectsViewContentProvider.java155
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/ToggleLinkingAction.java40
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypeInfoComparator.java86
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypeInfoSorter.java79
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypesView.java243
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypesViewContentProvider.java112
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypesViewLabelProvider.java36
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/OpenTypeAction.java160
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/CHierarchyPerspectiveFactory.java67
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/EnableMemberFilterAction.java49
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/FocusOnSelectionAction.java69
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/FocusOnTypeAction.java133
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/FocusOnTypeDialog.java39
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/HierarchyLabelProvider.java193
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/HierarchyViewerSorter.java180
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/HistoryAction.java58
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/HistoryDropDownAction.java94
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/HistoryListAction.java181
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/ITypeHierarchyLifeCycleListener.java26
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/ITypeHierarchyViewPart.java69
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/MethodsContentProvider.java128
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/MethodsLabelProvider.java135
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/MethodsViewer.java295
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/OpenTypeHierarchyAction.java251
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/OpenTypeHierarchyUtil.java175
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/OpenTypeInHierarchyAction.java128
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/OpenTypeInHierarchyDialog.java38
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/SelectionProviderMediator.java200
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/ShowInheritedMembersAction.java57
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/ShowQualifiedTypeNamesAction.java51
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/SortByDefiningTypeAction.java56
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/SubTypeHierarchyViewer.java93
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/SuperTypeHierarchyViewer.java79
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/ToggleLinkingAction.java41
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/ToggleOrientationAction.java72
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/ToggleViewAction.java63
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/TypeHierarchyContentProvider.java296
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/TypeHierarchyLifeCycle.java273
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/TypeHierarchyMessages.java51
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/TypeHierarchyMessages.properties105
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/TypeHierarchyViewPart.java1570
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/TypeHierarchyViewer.java174
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeInfoLabelProvider.java154
-rw-r--r--core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeSelectionDialog.java61
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/Checks.java262
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/CompositeChange.java199
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/IProcessorBasedRefactoring.java28
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/IQualifiedNameUpdatingRefactoring.java43
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/IRefactoringProcessor.java43
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/IReferenceUpdating.java35
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/IRenameProcessor.java28
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/IRenameRefactoring.java40
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/IResourceModifications.java93
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/ITextUpdating.java80
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/ListenerList.java151
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/NullChange.java43
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/RefactoringCoreMessages.java66
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/RefactoringSearchEngine.java160
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/RefactoringStyles.java24
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/RenameProcessor.java68
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/RenameRefactoring.java156
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/ResourceUtil.java83
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/SearchResultGroup.java60
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/TextChangeManager.java117
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/UndoManager.java373
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/Change.java136
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/ChangeAbortException.java82
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/ChangeContext.java168
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/Context.java24
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/IChange.java124
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/IChangeExceptionHandler.java37
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/ICompositeChange.java34
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/IRefactoring.java55
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/IUndoManager.java128
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/IUndoManagerListener.java30
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/Refactoring.java93
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/RefactoringStatus.java453
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/RefactoringStatusCodes.java57
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/RefactoringStatusEntry.java243
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/base/UndoManagerAdapter.java30
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/changes/AbstractTextChange.java209
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/changes/TextBufferEditor.java120
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/changes/TextChange.java572
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/changes/TextFileChange.java239
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/changes/TranslationUnitChange.java57
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/changes/UndoTextChange.java30
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/refactoring.properties793
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java754
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/AbortChangeExceptionHandler.java30
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/ChangeElement.java94
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/ChangeElementContentProvider.java231
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/ChangeElementLabelProvider.java152
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/ChangeElementTreeViewer.java175
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/ChangeExceptionHandler.java107
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/CheckConditionsOperation.java89
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/CreateChangeOperation.java156
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/DefaultChangeElement.java123
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/ErrorWizardPage.java141
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/IChangePreviewViewer.java53
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/IPreviewWizardPage.java29
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/IStatusContextViewer.java48
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/ListDialog.java95
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/PerformChangeOperation.java219
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/PerformRefactoringUtil.java128
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/PreviewWizardPage.java368
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/PseudoCChangeElement.java163
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringErrorDialogUtil.java60
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringExecutionHelper.java223
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringMessages.java49
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringPreferences.java56
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringSaveHelper.java121
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringStarter.java83
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringStatusContentProvider.java30
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringStatusDialog.java104
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringStatusEntryLabelProvider.java36
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringStatusViewer.java346
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringWizard.java510
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringWizardDialog.java101
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringWizardDialog2.java578
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RefactoringWizardPage.java98
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RenameElementWizard.java25
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RenameInputWizardPage.java201
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/RenameRefactoringWizard.java83
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/StatusContextViewerDescriptor.java35
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/TextChangePreviewViewer.java191
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/TextEditChangeElement.java116
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/TextInputWizardPage.java170
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/UserInputWizardPage.java153
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/UserInterfaceStarter.java82
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/actions/RedoRefactoringAction.java123
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/actions/RenameRefactoringAction.java133
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/actions/UndoManagerAction.java187
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/actions/UndoRefactoringAction.java121
-rw-r--r--core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/ui/refactoring/refactoringui.properties585
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/Assert.java145
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/textmanipulation/GroupDescription.java3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/CodeFormatterUtil.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/MainActionGroup.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/SourceAttachmentBlock.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java250
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ExternalSearchDocumentProvider.java12
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ExternalSearchFile.java28
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/FindDeclarationsAction.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/FindReferencesAction.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchContentProvider.java40
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMatch.java49
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java208
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java297
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java369
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchScopeFactory.java185
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTableContentProvider.java53
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchUtil.java97
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/DOMQuery.java330
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/ElementNameSorter.java50
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java274
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/NewSearchResultCollector.java174
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchBindingQuery.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchElementQuery.java65
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchPage.java34
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchPatternQuery.java43
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchQuery.java63
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchTextSelectionQuery.java58
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/ParentNameSorter.java52
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PathNameSorter.java60
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/AddToIndexAction.java94
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindAction.java334
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindDeclarationsAction.java35
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindDeclarationsInWorkingSetAction.java65
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindDeclarationsProjectAction.java57
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindRefsAction.java44
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindRefsInWorkingSetAction.java69
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindRefsProjectAction.java56
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/GroupAction.java40
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsAction.java266
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDefinitionAction.java268
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/SelectionParseAction.java209
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/SortAction.java41
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/WorkingSetFindAction.java35
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java84
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor.java659
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/ProblemsLabelDecorator.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/StatusBarUpdater.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/BaseClassInfo.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/BaseClassesLabelProvider.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/IBaseClassInfo.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewBaseClassSelectionDialog.java75
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java65
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassWizardUtil.java149
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java265
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/RefactoringActionGroup.java290
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CTagsIndexerBlock.java73
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/DOMSourceIndexerBlock.java58
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassCreationWizardPage.java237
466 files changed, 1270 insertions, 73122 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java
index 785514bc36..c200c8b178 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java
@@ -35,7 +35,6 @@ import org.eclipse.cdt.managedbuilder.core.tests.ResourceBuildCoreTests;
*/
public class AllManagedBuildTests {
public static void main(String[] args) {
- CCorePlugin.getDefault().getCoreModel().getIndexManager().reset();
junit.textui.TestRunner.run(AllManagedBuildTests.suite());
}
public static Test suite() {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/internal/DefaultIndexerDependencyCalculator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/internal/DefaultIndexerDependencyCalculator.java
index be8bd7cd37..8b45a4ba0b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/internal/DefaultIndexerDependencyCalculator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/internal/DefaultIndexerDependencyCalculator.java
@@ -10,22 +10,10 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.makegen.internal;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.search.ICSearchConstants;
-import org.eclipse.cdt.core.search.ICSearchScope;
-import org.eclipse.cdt.core.search.SearchEngine;
-import org.eclipse.cdt.internal.core.search.PathCollector;
-import org.eclipse.cdt.internal.core.search.PatternSearchJob;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
/**
* @since 2.0
@@ -36,37 +24,39 @@ public class DefaultIndexerDependencyCalculator implements IManagedDependencyGen
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#findDependencies(org.eclipse.core.resources.IResource)
*/
public IResource[] findDependencies(IResource resource, IProject project) {
- PathCollector pathCollector = new PathCollector();
- ICSearchScope scope = SearchEngine.createWorkspaceScope();
- CSearchPattern pattern = CSearchPattern.createPattern(resource.getLocation().toOSString(), ICSearchConstants.INCLUDE, ICSearchConstants.REFERENCES, ICSearchConstants.EXACT_MATCH, true);
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- indexManager.performConcurrentJob(
- new PatternSearchJob(
- (CSearchPattern) pattern,
- scope,
- pathCollector,
- indexManager),
- ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
- null, null);
-
- // We will get back an array of resource names relative to the workspace
- String[] deps = pathCollector.getPaths();
-
- // Convert them to something useful
- List depList = new ArrayList();
- IResource res = null;
- IWorkspaceRoot root = null;
- if (project != null) {
- root = project.getWorkspace().getRoot();
- }
- for (int index = 0; index < deps.length; ++index) {
- res = root.findMember(deps[index]);
- if (res != null) {
- depList.add(res);
- }
- }
-
- return (IResource[]) depList.toArray(new IResource[depList.size()]);
+// PathCollector pathCollector = new PathCollector();
+// ICSearchScope scope = SearchEngine.createWorkspaceScope();
+// CSearchPattern pattern = CSearchPattern.createPattern(resource.getLocation().toOSString(), ICSearchConstants.INCLUDE, ICSearchConstants.REFERENCES, ICSearchConstants.EXACT_MATCH, true);
+// IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
+// indexManager.performConcurrentJob(
+// new PatternSearchJob(
+// (CSearchPattern) pattern,
+// scope,
+// pathCollector,
+// indexManager),
+// ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
+// null, null);
+//
+// // We will get back an array of resource names relative to the workspace
+// String[] deps = pathCollector.getPaths();
+//
+// // Convert them to something useful
+// List depList = new ArrayList();
+// IResource res = null;
+// IWorkspaceRoot root = null;
+// if (project != null) {
+// root = project.getWorkspace().getRoot();
+// }
+// for (int index = 0; index < deps.length; ++index) {
+// res = root.findMember(deps[index]);
+// if (res != null) {
+// depList.add(res);
+// }
+// }
+//
+// return (IResource[]) depList.toArray(new IResource[depList.size()]);
+ // TODO this needs to be redone to fit on the PDOM
+ return new IResource[0];
}
/* (non-Javadoc)
diff --git a/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/suite/AllManagedBuildUITests.java b/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/suite/AllManagedBuildUITests.java
index ddf342e7bc..65cba819d2 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/suite/AllManagedBuildUITests.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/suite/AllManagedBuildUITests.java
@@ -10,20 +10,17 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.tests.suite;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.managedbuilder.ui.tests.TestCProjectPlatformPage;
-import org.eclipse.cdt.managedbuilder.ui.tests.TestCustomPageManager;
-
-
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.cdt.managedbuilder.ui.tests.TestCProjectPlatformPage;
+import org.eclipse.cdt.managedbuilder.ui.tests.TestCustomPageManager;
+
/**
*
*/
public class AllManagedBuildUITests {
public static void main(String[] args) {
- CCorePlugin.getDefault().getCoreModel().getIndexManager().reset();
junit.textui.TestRunner.run(AllManagedBuildUITests.suite());
}
public static Test suite() {
diff --git a/core/org.eclipse.cdt.core.tests/.classpath b/core/org.eclipse.cdt.core.tests/.classpath
index 00fb667f64..74bbb31abb 100644
--- a/core/org.eclipse.cdt.core.tests/.classpath
+++ b/core/org.eclipse.cdt.core.tests/.classpath
@@ -5,8 +5,6 @@
<classpathentry kind="src" path="model"/>
<classpathentry kind="src" path="parser"/>
<classpathentry kind="src" path="suite"/>
- <classpathentry kind="src" path="indexer"/>
- <classpathentry kind="src" path="search"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="regression"/>
diff --git a/core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF
index 135e710c55..883d0e71c9 100644
--- a/core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF
@@ -7,7 +7,6 @@ Bundle-ClassPath: cdtcoretests.jar
Bundle-Activator: org.eclipse.cdt.core.testplugin.CTestPlugin
Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.core.cdescriptor.tests,
- org.eclipse.cdt.core.indexer.tests,
org.eclipse.cdt.core.internal.errorparsers.tests,
org.eclipse.cdt.core.model.failedTests,
org.eclipse.cdt.core.model.tests,
@@ -16,7 +15,6 @@ Export-Package: org.eclipse.cdt.core.cdescriptor.tests,
org.eclipse.cdt.core.parser.tests.ast2,
org.eclipse.cdt.core.parser.tests.prefix,
org.eclipse.cdt.core.parser.tests.scanner2,
- org.eclipse.cdt.core.search.tests,
org.eclipse.cdt.core.suite,
org.eclipse.cdt.core.testplugin,
org.eclipse.cdt.core.testplugin.util,
diff --git a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DOMSourceIndexerPerfTests.java b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DOMSourceIndexerPerfTests.java
deleted file mode 100644
index 6a5e8cd8f2..0000000000
--- a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DOMSourceIndexerPerfTests.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 19, 2003
- */
-package org.eclipse.cdt.core.indexer.tests;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorOperation;
-import org.eclipse.cdt.core.index.IIndexChangeListener;
-import org.eclipse.cdt.core.index.IIndexDelta;
-import org.eclipse.cdt.core.index.IndexChangeEvent;
-import org.eclipse.cdt.core.testplugin.CProjectHelper;
-import org.eclipse.cdt.core.testplugin.CTestPlugin;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-/**
- * @author bgheorgh
- */
-public class DOMSourceIndexerPerfTests extends TestCase {
- IProject testProject;
- DOMSourceIndexer sourceIndexer;
- IndexManager indexManager;
- static long timeC = 0;
- static long timeCPP = 0;
- static int countC = 0;
- static int countCPP = 0;
- static final int MAXCOUNT = 10;
-
- /**
- * @param name
- */
- public DOMSourceIndexerPerfTests(String name) {
- super(name);
- }
-
- public void resetIndexer(final String indexerId){
- if ( testProject != null) {
- ICDescriptorOperation op = new ICDescriptorOperation() {
-
- public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
- descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
- descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,indexerId);
- }
- };
- try {
- CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(testProject, op, new NullProgressMonitor());
- CCorePlugin.getDefault().getCoreModel().getIndexManager().indexerChangeNotification(testProject);
- } catch (CoreException e) {}
- }
- }
-
- public static void main(String[] args) {}
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- testProject = CProjectHelper.createCCProject("IndexerTestProject", "bin").getProject(); //$NON-NLS-1$
- assertNotNull("Unable to create project", testProject); //$NON-NLS-1$
-
- resetIndexer(CCorePlugin.DEFAULT_INDEXER_UNIQ_ID);
- indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- sourceIndexer = (DOMSourceIndexer) indexManager.getIndexerForProject(testProject);
- }
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() {
- try {
- super.tearDown();
- } catch (Exception e1) {}
- //Delete project
- if (testProject.exists()) {
- try {
- System.gc();
- System.runFinalization();
- testProject.delete(true, null);
- } catch (CoreException e) {
- fail(getMessage(e.getStatus()));
- }
- }
- }
-
- /**
- * Makes error message from multistatus
- *
- * @param status
- * @return
- */
- private String getMessage(IStatus status) {
- StringBuffer message = new StringBuffer("["); //$NON-NLS-1$
- message.append(status.getMessage());
- if (status.isMultiStatus()) {
- IStatus children[] = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- message.append(getMessage(children[i]));
- }
- }
- message.append("]"); //$NON-NLS-1$
- return message.toString();
- }
-
- public static Test suite() {
- timeC = 0;
- timeCPP = 0;
- countC = 0;
- countCPP = 0;
- TestSuite suite = new TestSuite(DOMSourceIndexerPerfTests.class.getName());
- Test t1 = new DOMSourceIndexerPerfTests("testC"); //$NON-NLS-1$
- Test t2 = new DOMSourceIndexerPerfTests("testCPP"); //$NON-NLS-1$
-
- for (int i = 0; i < MAXCOUNT; i++) {
- suite.addTest(t1);
- suite.addTest(t2);
- }
- return suite;
-
- }
- /**
- * Unpack archive contents to project directory
- *
- * @param name - name of archive file w/o extension
- * @param mask - pattern to check file extensions
- * @return - list of files which fit to pattern
- */
-
- private ArrayList unzip(String name, String mask) {
- ArrayList lst = new ArrayList(20);
-
- byte[] buffer = new byte[512];
- String archname = "resources/zips/" + name + ".zip";
- ZipFile zipFile = null;
-
- try {
- zipFile = new ZipFile(CTestPlugin.getDefault().getFileInPlugin(new Path(archname)));
- IPath projPath = testProject.getLocation();
- Enumeration entries = zipFile.entries();
-
- while (entries.hasMoreElements()) {
- ZipEntry entry = (ZipEntry)entries.nextElement();
- if (!entry.isDirectory()) {
- IPath entryPath = projPath.append(entry.getName());
- InputStream in = zipFile.getInputStream(entry);
- OutputStream out = new FileOutputStream(entryPath.toFile());
- for (int n = in.read(buffer); n >= 0; n = in.read(buffer))
- out.write(buffer, 0, n);
- in.close();
- out.close();
- if (entryPath.lastSegment().endsWith(mask)) {
- lst.add(entryPath.lastSegment());
- }
- }
- }
- zipFile.close();
- } catch (IOException e) {
- fail("Unzip error with " + archname + " : " + e.getLocalizedMessage());
- }
- return lst;
- }
-
- /**
- * Adds files from list to index and counts indexing time
- *
- * @param lst - list of file names to be added
- * @return - time (in ms) spent for indexing
- */
- private long indexFiles(ArrayList lst) {
- // wait for finish of other indexing processes, if any
- while(indexManager.awaitingJobsCount()>0) {
- try { Thread.sleep(20);
- } catch (InterruptedException e) {}
- }
- System.gc();
- long t0 = System.currentTimeMillis();
- for (int i=0; i<lst.size(); i++) {
- IFile f = testProject.getProject().getFile((String)(lst.get(i)));
- sourceIndexer.addResource(testProject, f);
- }
- while(indexManager.awaitingJobsCount()>0) {
- try { Thread.sleep(20);
- } catch (InterruptedException e) {}
- }
- return (System.currentTimeMillis() - t0);
- }
-
- /**
- * Test C source indexation
- * @throws Exception
- */
- public void testC() throws Exception {
- long t0 = indexFiles(unzip("perf1", ".c"));
- timeC += t0; countC++;
- System.out.println("Index performance: " + t0 + " ms on C source[" + countC + "]");
- if (countC == MAXCOUNT) {
- System.out.println("Average performance on " + MAXCOUNT + " C passes: " + (timeC/MAXCOUNT));
- }
- }
-
- /**
- * Test C++ source indexation
- * @throws Exception
- */
- public void testCPP() throws Exception {
- long t0 = indexFiles(unzip("perf2", ".cpp"));
- timeCPP += t0; countCPP++;
- System.out.println("Index performance: " + t0 + " ms on C++ source[" + countCPP + "]");
- if (countCPP == MAXCOUNT) {
- System.out.println("Average performance on " + MAXCOUNT + " C++ passes: " + (timeCPP/MAXCOUNT));
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DOMSourceIndexerTests.java b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DOMSourceIndexerTests.java
deleted file mode 100644
index 68e7cc57eb..0000000000
--- a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DOMSourceIndexerTests.java
+++ /dev/null
@@ -1,876 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 19, 2003
- */
-package org.eclipse.cdt.core.indexer.tests;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import java.security.MessageDigest;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorOperation;
-import org.eclipse.cdt.core.index.IIndexChangeListener;
-import org.eclipse.cdt.core.index.IIndexDelta;
-import org.eclipse.cdt.core.index.IndexChangeEvent;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.testplugin.CProjectHelper;
-import org.eclipse.cdt.core.testplugin.CTestPlugin;
-import org.eclipse.cdt.core.tests.FailingTest;
-import org.eclipse.cdt.internal.core.index.IEntryResult;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.index.IQueryResult;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexerRunner;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-/**
- * @author bgheorgh
- */
-public class DOMSourceIndexerTests extends TestCase implements IIndexChangeListener {
- IFile file;
- IProject testProject;
- NullProgressMonitor monitor;
- IndexManager indexManager;
- DOMSourceIndexer sourceIndexer;
- boolean fileIndexed;
-
- static final String sourceIndexerID = "org.eclipse.cdt.core.originalsourceindexer"; //$NON-NLS-1$
- public static final int TIMEOUT = 50;
- /**
- * Constructor for IndexManagerTest.
- * @param name
- */
- public DOMSourceIndexerTests(String name) {
- super(name);
- }
-
- public void resetIndexState() {
- fileIndexed = false;
- }
-
- public void resetIndexer(final String indexerId){
- if ( testProject != null) {
- ICDescriptorOperation op = new ICDescriptorOperation() {
-
- public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
- descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
- descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,indexerId);
- }
- };
- try {
- CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(testProject, op, new NullProgressMonitor());
- CCorePlugin.getDefault().getCoreModel().getIndexManager().indexerChangeNotification(testProject);
- } catch (CoreException e) {}
- }
- }
-
- public void waitForIndex(int maxSec) throws Exception {
- int delay = 0;
- while (fileIndexed != true && delay < (maxSec * 1000))
- {
- Thread.sleep(TIMEOUT);
- delay += TIMEOUT;
- }
- }
-
- public static void main(String[] args) {
- }
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
-
- monitor = new NullProgressMonitor();
-
- //Create temp project
- testProject = createProject("IndexerTestProject"); //$NON-NLS-1$
- IPath pathLoc = CCorePlugin.getDefault().getStateLocation();
-
- File indexFile = new File(pathLoc.append("3915980774.index").toOSString()); //$NON-NLS-1$
- if (indexFile.exists())
- indexFile.delete();
-
- if (testProject==null)
- fail("Unable to create project"); //$NON-NLS-1$
-
- resetIndexer(CCorePlugin.DEFAULT_INDEXER_UNIQ_ID);
- //The DOM Source Indexer checks to see if a file has any scanner info
- //set prior to indexing it in order to increase efficiency. We need to let it know
- //that it is running in test mode in order to allow for this scanner info test to be skipped
- DOMSourceIndexerRunner.setSkipScannerInfoTest(true);
-
-
- indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- //indexManager.reset();
- //Get the indexer used for the test project
- sourceIndexer = (DOMSourceIndexer) indexManager.getIndexerForProject(testProject);
- sourceIndexer.addIndexChangeListener(this);
- }
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() {
- try {
- super.tearDown();
- sourceIndexer.removeIndexChangeListener(this);
- } catch (Exception e1) {
- }
- //Delete project
- if (testProject.exists()) {
- try {
- System.gc();
- System.runFinalization();
- testProject.delete(true, monitor);
- } catch (CoreException e) {
- fail(getMessage(e.getStatus()));
- }
- }
- }
-
- private String getMessage(IStatus status) {
- StringBuffer message = new StringBuffer("["); //$NON-NLS-1$
- message.append(status.getMessage());
- if (status.isMultiStatus()) {
- IStatus children[] = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- message.append(getMessage(children[i]));
- }
- }
- message.append("]"); //$NON-NLS-1$
- return message.toString();
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(DOMSourceIndexerTests.class.getName());
-
- suite.addTest(new DOMSourceIndexerTests("testAddNewFileToIndex")); //$NON-NLS-1$
- suite.addTest(new DOMSourceIndexerTests("testForwardDeclarations")); //$NON-NLS-1$
- suite.addTest(new DOMSourceIndexerTests("testIndexAll")); //$NON-NLS-1$
- suite.addTest(new FailingTest(new DOMSourceIndexerTests("testIndexContents"))); //$NON-NLS-1$
- suite.addTest(new DOMSourceIndexerTests("testMacros")); //$NON-NLS-1$
- suite.addTest(new FailingTest(new DOMSourceIndexerTests("testRefs"))); //$NON-NLS-1$
- suite.addTest(new DOMSourceIndexerTests("testExactDeclarations")); //$NON-NLS-1$
- suite.addTest(new FailingTest(new DOMSourceIndexerTests("testRemoveFileFromIndex"))); //$NON-NLS-1$
- suite.addTest(new DOMSourceIndexerTests("testRemoveProjectFromIndex")); //$NON-NLS-1$
- suite.addTest(new DOMSourceIndexerTests("testIndexShutdown")); //$NON-NLS-1$
-
-
- return suite;
-
- }
- /*
- * Utils
- */
- private IProject createProject(String projectName) throws CoreException {
- ICProject cPrj = CProjectHelper.createCCProject(projectName, "bin"); //$NON-NLS-1$
- return cPrj.getProject();
- }
-
- private IFile importFile(String fileName, String resourceLocation)throws Exception {
- resetIndexState();
- //Obtain file handle
- file = testProject.getProject().getFile(fileName);
- //Create file input stream
- monitor = new NullProgressMonitor();
- if (!file.exists()) {
- file.create(new FileInputStream(
- CTestPlugin.getDefault().getFileInPlugin(new Path(resourceLocation))),
- false, monitor);
- }
- waitForIndex(20); // only wait 20 seconds max.
- return file;
- }
-
- /*
- * Start of tests
- */
- public void testIndexAll() throws Exception {
-
- //Add a file to the project
-
- importFile("mail.cpp","resources/indexer/mail.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- IIndex ind = sourceIndexer.getIndex(testProject.getFullPath(),true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
-
- IQueryResult[] qresults = ind.getPrefix(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
- IEntryResult[] eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
- IEntryResult[] eresultsDecls = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
-
- assertTrue("Query Results exist", qresults != null); //$NON-NLS-1$
- assertTrue("Entry Results exist", eresults != null); //$NON-NLS-1$
-
- String [] queryResultModel = {"IndexedFile(1: /IndexerTestProject/mail.cpp)"}; //$NON-NLS-1$
- String [] entryResultModel ={"EntryResult: word=typeDefn/C/Mail, refs={ 1 }, offsets={ [ 294] }", //$NON-NLS-1$
- "EntryResult: word=typeDefn/C/Unknown, refs={ 1 }, offsets={ [ 2738] }", //$NON-NLS-1$
- "EntryResult: word=typeDefn/C/container, refs={ 1 }, offsets={ [ 21084] }", //$NON-NLS-1$
- "EntryResult: word=typeDefn/C/first_class, refs={ 1 }, offsets={ [ 2506] }", //$NON-NLS-1$
- "EntryResult: word=typeDefn/C/postcard, refs={ 1 }, offsets={ [ 2298] }", //$NON-NLS-1$
- };
-
- String [] entryResultDeclsModel = {
- "EntryResult: word=typeDecl/D/Mail, refs={ 1 }, offsets={ [ 294] }", //$NON-NLS-1$
- "EntryResult: word=typeDecl/D/first_class, refs={ 1 }, offsets={ [ 2506] }", //$NON-NLS-1$
- "EntryResult: word=typeDecl/D/postcard, refs={ 1 }, offsets={ [ 2298] }", //$NON-NLS-1$
- };
- String[] entryResultNameModel = {"Mail","Unknown","container","first_class","postcard"};
- int[] entryResultMetaModel = {IIndex.TYPE};
- int[] entryResultTypeModel = {IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS};
- int[] entryResultRefModel = {IIndex.DEFINITION};
-
- if (qresults.length != queryResultModel.length)
- fail("Query Result length different from model"); //$NON-NLS-1$
-
- if (eresults.length != entryResultModel.length)
- fail("Entry Result length different from model"); //$NON-NLS-1$
-
- if (eresultsDecls.length != entryResultDeclsModel.length)
- fail("Entry Result length different from model"); //$NON-NLS-1$
-
- for (int i=0; i<qresults.length;i++)
- {
- assertEquals(queryResultModel[i],qresults[i].toString());
- }
-
- for (int i=0;i<eresults.length; i++)
- {
- assertEquals(entryResultNameModel[i],eresults[i].getName());
- assertEquals(entryResultMetaModel[0],eresults[i].getMetaKind());
- assertEquals(entryResultTypeModel[i],eresults[i].getKind());
- assertEquals(entryResultRefModel[0],eresults[i].getRefKind());
- }
- }
-
- public void testAddNewFileToIndex() throws Exception{
-
-
- //Add a file to the project
- importFile("mail.cpp","resources/indexer/mail.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //Make sure project got added to index
- IPath testProjectPath = testProject.getFullPath();
- IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
- //Add a new file to the project, give it some time to index
-
- importFile("DocumentManager.h","resources/indexer/DocumentManager.h"); //$NON-NLS-1$ //$NON-NLS-2$
-
- importFile("DocumentManager.cpp","resources/indexer/DocumentManager.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- ind = sourceIndexer.getIndex(testProjectPath,true,true);
-
- String name = "CDocumentManager"; //$NON-NLS-1$
-
- String[] entryResultNameModel = {"CDocumentManager"};
- int[] entryResultMetaModel = {IIndex.TYPE};
- int[] entryResultTypeModel = {IIndex.TYPE_CLASS};
- int[] entryResultRefModel = {IIndex.DEFINITION};
-
- IEntryResult[] eresults =ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DEFINITION, name);
- IEntryResult[] bogRe = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
- assertTrue("Entry Result exists", eresults != null); //$NON-NLS-1$
-
- if (eresults.length != entryResultNameModel.length)
- fail("Entry Result length different from model"); //$NON-NLS-1$
-
- for (int i=0;i<eresults.length; i++)
- {
- assertEquals(entryResultNameModel[i],eresults[i].getName());
- assertEquals(entryResultMetaModel[i],eresults[i].getMetaKind());
- assertEquals(entryResultTypeModel[i],eresults[i].getKind());
- assertEquals(entryResultRefModel[i],eresults[i].getRefKind());
- }
- }
-
- public void testRemoveProjectFromIndex() throws Exception{
-
-
- //Add a file to the project
- importFile("mail.cpp","resources/indexer/mail.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //Make sure project got added to index
- IPath testProjectPath = testProject.getFullPath();
- IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
- //Delete the project
- safeDelete(testProject);
-
- //See if the index is still there
- ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index deleted",ind == null); //$NON-NLS-1$
- }
-
- /**
- * @param testProject
- */
- private void safeDelete(IProject testProject) throws InterruptedException, CoreException {
- System.gc();
- System.runFinalization();
- try {
- testProject.delete(true, monitor);
- } catch (CoreException e) {
- Thread.sleep(5000);
- testProject.delete(true, monitor);
- }
-
- }
-
- public void testRemoveFileFromIndex() throws Exception{
-
- //Add a file to the project
- importFile("mail.cpp","resources/indexer/mail.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //Make sure project got added to index
- IPath testProjectPath = testProject.getFullPath();
- IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
- importFile("DocumentManager.h","resources/indexer/DocumentManager.h"); //$NON-NLS-1$ //$NON-NLS-2$
- importFile("DocumentManager.cpp","resources/indexer/DocumentManager.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- ind = sourceIndexer.getIndex(testProjectPath,true,true);
-
- //Do a "before" deletion comparison
- //ind = indexManager.getIndex(testProjectPath,true,true);
- IEntryResult[] eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
- IEntryResult[] eresultsDecls = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
-
- assertTrue("Entry result found for typdeDefn/", eresults != null); //$NON-NLS-1$
-
- String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }, offsets={ [ 2127] }",
- "EntryResult: word=typeDecl/C/Mail, refs={ 3 }, offsets={ [ 294] }",
- "EntryResult: word=typeDecl/C/Unknown, refs={ 3 }, offsets={ [ 2738] }",
- "EntryResult: word=typeDecl/C/container, refs={ 3 }, offsets={ [ 21084] }",
- "EntryResult: word=typeDecl/C/first_class, refs={ 3 }, offsets={ [ 2506] }",
- "EntryResult: word=typeDecl/C/postcard, refs={ 3 }, offsets={ [ 2298] }",
- "EntryResult: word=typeDecl/D/Mail, refs={ 3 }, offsets={ [ 294] }",
- "EntryResult: word=typeDecl/D/first_class, refs={ 3 }, offsets={ [ 2506] }",
- "EntryResult: word=typeDecl/D/postcard, refs={ 3 }, offsets={ [ 2298] }",
- "EntryResult: word=typeDecl/V/PO_Box, refs={ 3 }, offsets={ [ 21371] }",
- "EntryResult: word=typeDecl/V/index, refs={ 3 }, offsets={ [ 21303, 21846] }",
- "EntryResult: word=typeDecl/V/mail, refs={ 3 }, offsets={ [ 21336, 21912] }",
- "EntryResult: word=typeDecl/V/size, refs={ 3 }, offsets={ [ 21927] }",
- "EntryResult: word=typeDecl/V/temp, refs={ 3 }, offsets={ [ 21964] }",
- "EntryResult: word=typeDecl/V/x, refs={ 3 }, offsets={ [ 21201, 21526] }"};
-
- String[] entryResultNameModel = {"CDocumentManager","Mail","Unknown","container","first_class","postcard","PO_Box", "size","temp","x"};
- int[] entryResultMetaModel = {IIndex.TYPE};
- int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS, IIndex.TYPE, IIndex.TYPE, IIndex.VAR, IIndex.VAR};
- int[] entryResultRefModel = {IIndex.DEFINITION};
-
- if (eresults.length != entryResultNameModel.length)
- fail("Entry Result length different from model"); //$NON-NLS-1$
-
- for (int i=0;i<eresults.length; i++)
- {
- assertEquals(entryResultNameModel[i],eresults[i].getName());
- assertEquals(entryResultMetaModel[0],eresults[i].getMetaKind());
- assertEquals(entryResultTypeModel[i],eresults[i].getKind());
- assertEquals(entryResultRefModel[0],eresults[i].getRefKind());
- }
- //Delete mail.cpp from the project, give some time to remove index
- IResource resourceHdl = testProject.findMember("mail.cpp") ; //$NON-NLS-1$
- // Cleaning up file handles before delete
- System.gc();
- System.runFinalization();
- resetIndexState();
- resourceHdl.delete(true,monitor);
- waitForIndex(10); // wait up to 10 seconds for the index to be deleted.
-
- //See if the index is still there
- ind = sourceIndexer.getIndex(testProjectPath,true,true);
- eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
- assertTrue("Entry exists", eresults != null); //$NON-NLS-1$
-
- String [] entryResultAfterModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }, offsets={ [ 2127] }"}; //$NON-NLS-1$ //$NON-NLS-2$
-
- String[] entryResultANameModel = {"CDocumentManager"};
- int[] entryResultAMetaModel = {IIndex.TYPE};
- int[] entryResultATypeModel = {IIndex.TYPE_CLASS};
- int[] entryResultARefModel = {IIndex.DEFINITION};
-
- if (eresults.length != entryResultANameModel.length)
- fail("Entry Result length different from model"); //$NON-NLS-1$
-
- for (int i=0;i<eresults.length; i++)
- {
- assertEquals(entryResultANameModel[i],eresults[i].getName());
- assertEquals(entryResultAMetaModel[0],eresults[i].getMetaKind());
- assertEquals(entryResultATypeModel[0],eresults[i].getKind());
- assertEquals(entryResultARefModel[0],eresults[i].getRefKind());
- }
- }
-
- public void testIndexContents() throws Exception{
-
- //Add a new file to the project
- importFile("extramail.cpp","resources/indexer/extramail.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //Make sure project got added to index
- IPath testProjectPath = testProject.getFullPath();
- IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$ //$NON-NLS-2$
-
- IEntryResult[] typerefreesults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.REFERENCE);
- assertTrue("Type Ref Results exist", typerefreesults != null); //$NON-NLS-1$
-
- String[] entryResultDeclNameModel = {"Mail/Y/X/Z","first_class/Y/X/Z", "postcard/Y/X/Z", "test/Y/X/Z", "int32", "index", "mail",};
- String[] entryResultDefnNameModel = {"Mail/Y/X/Z", "Unknown/Y/X/Z", "container/Y/X/Z", "first_class/Y/X/Z", "postcard/Y/X/Z", "PO_Box", "size", "temp", "x", "x/Z" };
- int[] entryResultMetaModel = {IIndex.TYPE};
- int[] entryResultDefnTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS,
- IIndex.VAR,IIndex.VAR,IIndex.VAR,IIndex.VAR,IIndex.VAR};
- int[] entryResultDeclTypeModel = {IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_ENUM, IIndex.TYPE_TYPEDEF,IIndex.VAR,IIndex.VAR};
-
-
- IEntryResult[] typedeclresults =ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
- IEntryResult[] typedefinitionsresults = ind.getEntries(IIndex.TYPE, IIndex.ANY , IIndex.DEFINITION);
- assertTrue("Type Decl Results exist", typedeclresults != null); //$NON-NLS-1$
-
- if (typedefinitionsresults.length != entryResultDefnNameModel.length)
- fail("Entry Result length different from model for typeDefn"); //$NON-NLS-1$
-
- for (int i=0;i<typedeclresults.length; i++)
- {
- assertEquals(entryResultDefnNameModel[i],typedefinitionsresults[i].getName());
- assertEquals(entryResultMetaModel[0],typedefinitionsresults[i].getMetaKind());
- assertEquals(entryResultDefnTypeModel[i],typedefinitionsresults[i].getKind());
- assertEquals(IIndex.DEFINITION,typedefinitionsresults[i].getRefKind());
- }
-
- String[] entryResultTNameModel = {"int32" };
- int[] entryResultTMetaModel = {IIndex.TYPE};
- int[] entryResultTTypeModel = {IIndex.TYPE_TYPEDEF};
- int[] entryResultTRefModel = {IIndex.DECLARATION};
-
-
- IEntryResult[] typedefresults =ind.getEntries(IIndex.TYPE, IIndex.TYPE_TYPEDEF, IIndex.DECLARATION);
- assertTrue("Type Def Results exist", typedefresults != null); //$NON-NLS-1$
-
- if (typedefresults.length != entryResultTNameModel.length)
- fail("Entry Result length different from model for typeDef"); //$NON-NLS-1$
-
- for (int i=0;i<typedefresults.length; i++)
- {
- assertEquals(entryResultTNameModel[i],typedefresults[i].getName());
- assertEquals(entryResultTMetaModel[i],typedefresults[i].getMetaKind());
- assertEquals(entryResultTTypeModel[i],typedefresults[i].getKind());
- assertEquals(entryResultTRefModel[i],typedefresults[i].getRefKind());
- }
-
- String[] entryResultNNameModel = {"X/Z", "Y/X/Z" , "Z" };
- int[] entryResultNMetaModel = {IIndex.NAMESPACE};
- int[] entryResultNRefModel = {IIndex.DEFINITION};
-
- IEntryResult[] namespaceresults =ind.getEntries(IIndex.NAMESPACE, IIndex.ANY, IIndex.DEFINITION);
- assertTrue("Namespace Results exist", namespaceresults != null); //$NON-NLS-1$
-
- if (namespaceresults.length != entryResultNNameModel.length)
- fail("Entry Result length different from model for namespace"); //$NON-NLS-1$
-
- for (int i=0;i<namespaceresults.length; i++)
- {
- assertEquals(entryResultNNameModel[i],namespaceresults[i].getName());
- assertEquals(entryResultNMetaModel[0],namespaceresults[i].getMetaKind());
- assertEquals(entryResultNRefModel[0],namespaceresults[i].getRefKind());
- }
-
- String[] entryResultFNameModel = {"array/container/Y/X/Z", "index/container/Y/X/Z" , "postage/Mail/Y/X/Z","sz/container/Y/X/Z", "type/Mail/Y/X/Z"};
- int[] entryResultFMetaModel = {IIndex.FIELD};
- int[] entryResultFRefModel = {IIndex.DEFINITION};
-
- IEntryResult[] fieldresults =ind.getEntries(IIndex.FIELD, IIndex.ANY, IIndex.DEFINITION);
- assertTrue("Field Results exist", fieldresults != null); //$NON-NLS-1$
-
- if (fieldresults.length != entryResultFNameModel.length)
- fail("Entry Result length different from model for fieldDecl"); //$NON-NLS-1$
-
- for (int i=0;i<fieldresults.length; i++)
- {
- assertEquals(entryResultFNameModel[i],fieldresults[i].getName());
- assertEquals(entryResultFMetaModel[0],fieldresults[i].getMetaKind());
- assertEquals(entryResultFRefModel[0],fieldresults[i].getRefKind());
- }
-
- String[] entryResultENameModel = {"bye/Y/X/Z", "cool/Y/X/Z" , "hi/Y/X/Z", "why/Y/X/Z"};
- int[] entryResultEMetaModel = {IIndex.ENUMTOR};
- int[] entryResultERefModel = {IIndex.DECLARATION};
-
-
- IEntryResult[] enumeratorresults =ind.getEntries(IIndex.ENUMTOR, IIndex.ANY, IIndex.DECLARATION);
- assertTrue("Enumerator Results exist", enumeratorresults != null); //$NON-NLS-1$
-
- if (enumeratorresults.length != entryResultENameModel.length)
- fail("Entry Result length different from model for enumtorDecl"); //$NON-NLS-1$
-
- for (int i=0;i<enumeratorresults.length; i++)
- {
- assertEquals(entryResultENameModel[i],enumeratorresults[i].getName());
- assertEquals(entryResultEMetaModel[0],enumeratorresults[i].getMetaKind());
- assertEquals(entryResultERefModel[0],enumeratorresults[i].getRefKind());
- }
-
- String[] entryResultFNNameModel = {"doSomething"};
- int[] entryResultFNMetaModel = {IIndex.FUNCTION};
- int[] entryResultFNRefModel = {IIndex.DECLARATION};
-
- IEntryResult[] functionresults =ind.getEntries(IIndex.FUNCTION, IIndex.ANY, IIndex.DECLARATION);
-
- if (functionresults.length != entryResultFNNameModel.length)
- fail("Entry Result length different from model for functionDecl"); //$NON-NLS-1$
-
- for (int i=0;i<functionresults.length; i++)
- {
- assertEquals(entryResultFNNameModel[i],functionresults[i].getName());
- assertEquals(entryResultFNMetaModel[0],functionresults[i].getMetaKind());
- assertEquals(entryResultFNRefModel[0],functionresults[i].getRefKind());
- }
-
-
- String[] entryResultMNameDefnModel = {"Mail/Mail/Y/X/Z", "Unknown/Unknown/Y/X/Z" , "container/container/Y/X/Z", "first_class/first_class/Y/X/Z",
- "print/Unknown/Y/X/Z","print/first_class/Y/X/Z", "print/postcard/Y/X/Z", "size/container/Y/X/Z", "~container/container/Y/X/Z"};
- int[] entryResultMMetaDefnModel = {IIndex.METHOD};
- int[] entryResultMRefDefnModel = {IIndex.DEFINITION};
-
-
- String [] entryResultMNameDeclModel = {"operator =/container/Y/X/Z", "operator []/container/Y/X/Z","print/Mail/Y/X/Z"};
- int[] entryResultMMetaDeclModel = {IIndex.METHOD};
- int[] entryResultMRefDeclModel = {IIndex.DECLARATION};
-
- IEntryResult[] methodresults =ind.getEntries(IIndex.METHOD, IIndex.ANY, IIndex.DECLARATION);
- assertTrue("Entry exists", methodresults != null); //$NON-NLS-1$
-
- if (methodresults.length != entryResultMNameDeclModel.length)
- fail("Entry Result length different from model for functionDecl"); //$NON-NLS-1$
-
- for (int i=0;i<methodresults.length; i++)
- {
- assertEquals(entryResultMNameDeclModel[i],methodresults[i].getName());
- assertEquals(entryResultMMetaDeclModel[0],methodresults[i].getMetaKind());
- assertEquals(entryResultMRefDeclModel[0],methodresults[i].getRefKind());
- }
-
- }
-
- public void testRefs() throws Exception{
- //Add a new file to the project
- importFile("reftest.cpp","resources/indexer/reftest.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //Make sure project got added to index
- IPath testProjectPath = testProject.getFullPath();
- IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
-
- String[] entryResultNameModel = {"C/B/A","ForwardA/A", "e1/B/A", "x/B/A"};
- int[] entryResultMetaModel = {IIndex.TYPE};
- int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_ENUM, IIndex.VAR};
- int[] entryResultRefModel = {IIndex.REFERENCE};
-
-
- IEntryResult[] typerefresults = ind.getEntries(IIndex.TYPE,IIndex.ANY,IIndex.REFERENCE);
- assertTrue("Entry exists",typerefresults != null); //$NON-NLS-1$
-
- if (typerefresults.length != entryResultNameModel.length)
- fail("Entry Result length different from model for typeRef"); //$NON-NLS-1$
-
- for (int i=0;i<typerefresults.length; i++)
- {
- assertEquals(entryResultNameModel[i],typerefresults[i].getName());
- assertEquals(entryResultMetaModel[0],typerefresults[i].getMetaKind());
- assertEquals(entryResultTypeModel[i],typerefresults[i].getKind());
- assertEquals(entryResultRefModel[0],typerefresults[i].getRefKind());
- }
-
-
- String[] entryResultFNameModel = {"something/A"};
- int[] entryResultFMetaModel = {IIndex.FUNCTION};
- int[] entryResultFRefModel = {IIndex.REFERENCE};
-
-
- IEntryResult[] funRefresults = ind.getEntries(IIndex.FUNCTION,IIndex.ANY, IIndex.REFERENCE);
- assertTrue("Entry exists",funRefresults != null); //$NON-NLS-1$
-
- if (funRefresults.length != entryResultFNameModel.length)
- fail("Entry Result length different from model for funcRef"); //$NON-NLS-1$
-
- for (int i=0;i<funRefresults.length; i++)
- {
- assertEquals(entryResultFNameModel[i],funRefresults[i].getName());
- assertEquals(entryResultFMetaModel[0],funRefresults[i].getMetaKind());
- assertEquals(entryResultFRefModel[0],funRefresults[i].getRefKind());
- }
-
- String [] namespaceRefResultModel = {"EntryResult: word=namespaceRef/A, refs={ 1 }, offsets={ [ 2228, 2241, 2257, 2273, 2292, 2313, 2334] }",
- "EntryResult: word=namespaceRef/B/A, refs={ 1 }, offsets={ [ 2231, 2244, 2260, 2276, 2295, 2337] }"}; //$NON-NLS-1$ //$NON-NLS-2$
-
-
- String[] entryResultNNameModel = {"A", "B/A"};
- int[] entryResultNMetaModel = {IIndex.NAMESPACE};
- int[] entryResultNRefModel = {IIndex.REFERENCE};
-
- IEntryResult[] namespacerefresults = ind.getEntries(IIndex.NAMESPACE, IIndex.ANY, IIndex.REFERENCE);
- assertTrue("Entry exists",namespacerefresults!=null); //$NON-NLS-1$
-
- if (namespacerefresults.length != entryResultNNameModel.length)
- fail("Entry Result length different from model for namespaceRef"); //$NON-NLS-1$
-
- for (int i=0;i<namespacerefresults.length; i++)
- {
- assertEquals(entryResultNNameModel[i],namespacerefresults[i].getName());
- assertEquals(entryResultNMetaModel[0],namespacerefresults[i].getMetaKind());
- assertEquals(entryResultNRefModel[0],namespacerefresults[i].getRefKind());
- }
-
- String[] entryResultFDNameModel = {"y/C/B/A"};
- int[] entryResultFDMetaModel = {IIndex.FIELD};
- int[] entryResultFDRefModel = {IIndex.REFERENCE};
-
- IEntryResult[] fieldrefresults = ind.getEntries(IIndex.FIELD, IIndex.ANY, IIndex.REFERENCE);
- assertTrue("Entry exists",fieldrefresults!=null); //$NON-NLS-1$
-
- if (fieldrefresults.length != entryResultFDNameModel.length)
- fail("Entry Result length different from model for fieldRef"); //$NON-NLS-1$
-
- for (int i=0;i<fieldrefresults.length; i++)
- {
- assertEquals(entryResultFDNameModel[i],fieldrefresults[i].getName());
- assertEquals(entryResultFDMetaModel[0],fieldrefresults[i].getMetaKind());
- assertEquals(entryResultFDRefModel[0],fieldrefresults[i].getRefKind());
- }
-
- String[] entryResultMNameModel = {"bar/C/B/A"};
- int[] entryResultMMetaModel = {IIndex.METHOD};
- int[] entryResultMRefModel = {IIndex.REFERENCE};
-
- IEntryResult[] methodrefresults = ind.getEntries(IIndex.METHOD, IIndex.ANY, IIndex.REFERENCE);
- assertTrue("Entry exists", methodrefresults != null); //$NON-NLS-1$
-
- if (methodrefresults.length != entryResultMNameModel.length)
- fail("Entry Result length different from model for methodRef");//$NON-NLS-1$
-
- for (int i=0;i<methodrefresults.length; i++)
- {
- assertEquals(entryResultMNameModel[i],methodrefresults[i].getName());
- assertEquals(entryResultMMetaModel[0],methodrefresults[i].getMetaKind());
- assertEquals(entryResultMRefModel[0],methodrefresults[i].getRefKind());
- }
- }
-
- public void testExactDeclarations() throws Exception
- {
- importFile("a.h","resources/dependency/a.h");//$NON-NLS-1$ //$NON-NLS-2$
-
- //Make sure project got added to index
- IPath testProjectPath = testProject.getFullPath();
- IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
-
- importFile("DepTest3.h","resources/dependency/DepTest3.h");//$NON-NLS-1$ //$NON-NLS-2$
- importFile("DepTest3.cpp","resources/dependency/DepTest3.cpp");//$NON-NLS-1$ //$NON-NLS-2$
-
- IEntryResult[] eResult = ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DEFINITION);
- IQueryResult[] qResult = ind.getPrefix(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DEFINITION);
-
- assertTrue("Expected 2 files indexed", qResult.length == 2); //$NON-NLS-1$
- assertTrue("Checking DepTest3.h location", qResult[0].getPath().equals("/IndexerTestProject/DepTest3.h")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Checking a.h location", qResult[1].getPath().equals("/IndexerTestProject/a.h")); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertTrue("Expect 2 class declaration entries", eResult.length == 2); //$NON-NLS-1$
-
- int[] DepTest3FileRefs = {2};
-
- int[] fileRefs = eResult[0].getFileReferences();
-
- assertTrue("Check DepTest3 File Refs number", fileRefs.length == 1); //$NON-NLS-1$
-
- for (int i=0; i<fileRefs.length; i++){
- assertTrue("Verify DepTest3 File Ref",fileRefs[i] == DepTest3FileRefs[i]); //$NON-NLS-1$
- }
-
- int[] aFileRefs = {3};
-
- fileRefs = eResult[1].getFileReferences();
-
- assertTrue("Check a.h File Refs number", fileRefs.length == 1); //$NON-NLS-1$
-
- for (int i=0; i<fileRefs.length; i++){
- assertTrue("Verify a.h File Ref",fileRefs[i] == aFileRefs[i]); //$NON-NLS-1$
- }
-
- }
-
- public void testMD5() throws Exception
- {
- importFile("extramail.cpp","resources/indexer/extramail.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- //importFile("mail.cpp","resources/indexer/mail.cpp");
-
- MessageDigest md = MessageDigest.getInstance("MD5"); //$NON-NLS-1$
- //MessageDigest md = MessageDigest.getInstance("SHA");
- String fileName = testProject.getFile("extramail.cpp").getLocation().toOSString(); //$NON-NLS-1$
- //String fileName = testProject.getFile("mail.cpp").getLocation().toOSString();
-
- long startTime = System.currentTimeMillis();
-
- FileInputStream stream = new FileInputStream(fileName);
- FileChannel channel = stream.getChannel();
-
- ByteBuffer byteBuffer = ByteBuffer.allocate((int)channel.size());
- channel.read(byteBuffer);
- byteBuffer.rewind();
-
- md.update(byteBuffer.array());
- byte[] messageDigest = md.digest();
-
- //System.out.println("Elapsed Time: " + (System.currentTimeMillis() - startTime) + " ms");
-
-
- }
-
- public void testMacros() throws Exception
- {
- //Add a new file to the project
- importFile("extramail.cpp","resources/indexer/extramail.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //Make sure project got added to index
- IPath testProjectPath = testProject.getFullPath();
- IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
-
- IEntryResult[] macroresults = ind.getEntries(IIndex.MACRO, IIndex.ANY, IIndex.DECLARATION);
- assertTrue("Entry exists", macroresults != null); //$NON-NLS-1$
-
- String[] entryResultNameModel = {"CASE", "MAX", "PRINT"};
- int[] entryResultMetaModel = {IIndex.MACRO};
- int[] entryResultRefModel = {IIndex.DECLARATION};
-
- if (macroresults.length != entryResultNameModel.length)
- fail("Entry Result length different from model for macros"); //$NON-NLS-1$
-
- for (int i=0;i<macroresults.length; i++)
- {
- assertEquals(entryResultNameModel[i],macroresults[i].getName());
- assertEquals(entryResultMetaModel[0],macroresults[i].getMetaKind());
- assertEquals(entryResultRefModel[0],macroresults[i].getRefKind());
- }
- }
-
- public void testIndexShutdown() throws Exception{
- //Add a new file to the project
- importFile("reftest.cpp","resources/indexer/reftest.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //Make sure project got added to index
- IPath testProjectPath = testProject.getFullPath();
- IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
-
- //Create an empty index file
- String badIndexFile = CCorePlugin.getDefault().getStateLocation().append("badIndex.index").toOSString(); //$NON-NLS-1$
- FileWriter writer = null;
- try {
- writer = new FileWriter(badIndexFile);
- writer.flush();
- writer.close();
- }
- catch (IOException e){}
-
- File indexesDirectory = new File(CCorePlugin.getDefault().getStateLocation().toOSString());
-
- //This should get rid of the empty index file from the metadata and
- //remove the index from the indexes (since its .index file is missing)
- indexManager.shutdown();
-
- File[] indexesFiles = indexesDirectory.listFiles();
- if (indexesFiles != null) {
- for (int i = 0, indexesFilesLength = indexesFiles.length; i < indexesFilesLength; i++) {
- if(indexesFiles[i].getName().equals("badIndex.index")){ //$NON-NLS-1$
- fail("Shutdown did not delete .index file"); //$NON-NLS-1$
- }
- }
- }
- }
-
- public void testForwardDeclarations() throws Exception{
- //Add a new file to the project
- importFile("reftest.cpp","resources/indexer/reftest.cpp"); //$NON-NLS-1$ //$NON-NLS-2$
-
- //Make sure project got added to index
- IPath testProjectPath = testProject.getFullPath();
- IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
- assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
- IEntryResult[] fwdDclResults = ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION, "ForwardA/A" ); //$NON-NLS-1$
- assertTrue("Entry exists",fwdDclResults != null); //$NON-NLS-1$
-
- String [] fwdDclModel = {"EntryResult: word=typeDecl/G/ForwardA/A, refs={ 1 }, offsets={ [ 225] }"}; //$NON-NLS-1$
- String[] entryResultNameModel = {"ForwardA/A"};
- int[] entryResultMetaModel = {IIndex.TYPE};
- int[] entryResultTypeModel = {IIndex.TYPE_CLASS};
- int[] entryResultRefModel = {IIndex.DECLARATION};
-
- if (fwdDclResults.length != fwdDclModel.length)
- fail("Entry Result length different from model for forward declarations"); //$NON-NLS-1$
-
- for (int i=0;i<fwdDclResults.length; i++)
- {
- assertEquals(entryResultNameModel[i],fwdDclResults[i].getName());
- assertEquals(entryResultMetaModel[i],fwdDclResults[i].getMetaKind());
- assertEquals(entryResultTypeModel[i],fwdDclResults[i].getKind());
- assertEquals(entryResultRefModel[i],fwdDclResults[i].getRefKind());
- }
-
- IEntryResult[] fwdDclRefResults = ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.REFERENCE, "ForwardA/A"); //$NON-NLS-1$
- assertTrue("Entry exists", fwdDclRefResults!= null); //$NON-NLS-1$
-
- String [] fwdDclRefModel = {"EntryResult: word=typeRef/G/ForwardA/A, refs={ 1 }, offsets={ [ 237] }"}; //$NON-NLS-1$
- String[] entryResultName2Model = {"ForwardA/A"};
- int[] entryResultMeta2Model = {IIndex.TYPE};
- int[] entryResultType2Model = {IIndex.TYPE_CLASS};
- int[] entryResultRef2Model = {IIndex.REFERENCE};
-
- if (fwdDclRefResults.length != fwdDclRefModel.length)
- fail("Entry Result length different from model for forward declarations refs"); //$NON-NLS-1$
-
- for (int i=0;i<fwdDclRefResults.length; i++)
- {
- assertEquals(entryResultName2Model[i],fwdDclRefResults[i].getName());
- assertEquals(entryResultMeta2Model[i],fwdDclRefResults[i].getMetaKind());
- assertEquals(entryResultType2Model[i],fwdDclRefResults[i].getKind());
- assertEquals(entryResultRef2Model[i],fwdDclRefResults[i].getRefKind());
- }
- }
-
-public void indexChanged(IndexChangeEvent event) {
- IIndexDelta delta = event.getDelta();
- if (delta.getDeltaType() == IIndexDelta.MERGE_DELTA){
- fileIndexed = true;
- }
-}
-
-}
diff --git a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DependencyTests.java b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DependencyTests.java
deleted file mode 100644
index 072867ead2..0000000000
--- a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/DependencyTests.java
+++ /dev/null
@@ -1,790 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Sep 25, 2003
- */
-package org.eclipse.cdt.core.indexer.tests;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Set;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorOperation;
-import org.eclipse.cdt.core.index.IIndexChangeListener;
-import org.eclipse.cdt.core.index.IIndexDelta;
-import org.eclipse.cdt.core.index.IndexChangeEvent;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.search.BasicSearchResultCollector;
-import org.eclipse.cdt.core.search.ICSearchConstants;
-import org.eclipse.cdt.core.search.ICSearchPattern;
-import org.eclipse.cdt.core.search.ICSearchResultCollector;
-import org.eclipse.cdt.core.search.ICSearchScope;
-import org.eclipse.cdt.core.search.IMatch;
-import org.eclipse.cdt.core.search.SearchEngine;
-import org.eclipse.cdt.core.testplugin.CProjectHelper;
-import org.eclipse.cdt.core.testplugin.CTestPlugin;
-import org.eclipse.cdt.core.tests.FailingTest;
-import org.eclipse.cdt.internal.core.browser.cache.TypeCacheManager;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexerRunner;
-import org.eclipse.cdt.internal.core.search.PathCollector;
-import org.eclipse.cdt.internal.core.search.PatternSearchJob;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
-import org.eclipse.cdt.internal.core.search.processing.IIndexJob;
-import org.eclipse.cdt.internal.core.sourcedependency.DependencyQueryJob;
-import org.eclipse.cdt.internal.core.sourcedependency.UpdateDependency;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-
- /**
- * @author bgheorgh
- */
- public class DependencyTests extends TestCase implements IIndexChangeListener {
- IFile file;
- IProject testProject;
- NullProgressMonitor monitor;
- IndexManager indexManager;
- IWorkspace workspace;
- BasicSearchResultCollector resultCollector;
- SearchEngine searchEngine;
- ICSearchScope scope;
- DOMSourceIndexer sourceIndexer;
- boolean fileIndexed;
- public static final int TIMEOUT = 50;
-
- public static Test suite() {
- TestSuite suite = new TestSuite(DependencyTests.class.getName());
-
- suite.addTest(new DependencyTests("testDependencyTree"));
- //suite.addTest(new DependencyTests("testDepTable"));
- suite.addTest(new DependencyTests("testDepSourceChangeTree"));
- suite.addTest(new DependencyTests("testDepHeaderChangeTree"));
- suite.addTest(new DependencyTests("testDepHeaderChangeReindex"));
- suite.addTest(new DependencyTests("testDepSourceChangeTable"));
- suite.addTest(new DependencyTests("testDepHeaderChangeTable"));
- suite.addTest(new DependencyTests("testUpdateDependancyNPE"));
- return suite;
- }
- /**
- * @param name
- */
- public DependencyTests(String name) {
- super(name);
- // TODO Auto-generated constructor stub
- }
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- //Create temp project
- testProject = createProject("DepTestProject");
- IPath pathLoc = CCorePlugin.getDefault().getStateLocation();
-
- File indexFile = new File(pathLoc.append("281274758.index").toOSString());
- if (indexFile.exists())
- indexFile.delete();
-
- if (testProject==null)
- fail("Unable to create project");
-
- resetIndexer(DOMSourceIndexer.ID);
- //The DOM Source Indexer checks to see if a file has any scanner info
- //set prior to indexing it in order to increase efficiency. We need to let it know
- //that it is running in test mode in order to allow for this scanner info test to be skipped
- DOMSourceIndexerRunner.setSkipScannerInfoTest(true);
-
- TypeCacheManager typeCacheManager = TypeCacheManager.getInstance();
- typeCacheManager.setProcessTypeCacheEvents(false);
-
- workspace = ResourcesPlugin.getWorkspace();
-
- scope = SearchEngine.createWorkspaceScope();
- monitor = new NullProgressMonitor();
- resultCollector = new BasicSearchResultCollector();
-
- searchEngine = new SearchEngine();
-
- indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- sourceIndexer = (DOMSourceIndexer) indexManager.getIndexerForProject(testProject);
- sourceIndexer.addIndexChangeListener(this);
- }
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() {
- try {
- super.tearDown();
- } catch (Exception e1) {
- }
-
- sourceIndexer.shutdown();
-
- //Delete project
- if (testProject.exists()){
- try {
- System.gc();
- System.runFinalization();
- testProject.delete(true,monitor);
- } catch (CoreException e) {
- fail(getMessage(e.getStatus()));
- }
- }
- }
-
- private String getMessage(IStatus status) {
- StringBuffer message = new StringBuffer("[");
- message.append(status.getMessage());
- if (status.isMultiStatus()) {
- IStatus children[] = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- message.append(getMessage(children[i]));
- }
- }
- message.append("]");
- return message.toString();
- }
-
- public void testDependencyTree() throws Exception{
- //Add a file to the project
- importFile("c.h","resources/dependency/c.h");
- importFile("a.h","resources/dependency/a.h");
- importFile("Inc1.h","resources/dependency/Inc1.h");
- importFile("DepTest.h","resources/dependency/DepTest.h");
- importFile("d.h","resources/dependency/d.h");
- importFile("DepTest2.h","resources/dependency/DepTest2.h");
- IFile depTest = importFile("DepTest.cpp","resources/dependency/DepTest.cpp");
- IFile depTest2 = importFile("DepTest2.cpp","resources/dependency/DepTest2.cpp");
-
-
- String[] depTestModel = {File.separator + "DepTestProject" + File.separator + "d.h", File.separator + "DepTestProject" + File.separator + "Inc1.h", File.separator + "DepTestProject" + File.separator + "c.h", File.separator + "DepTestProject" + File.separator + "a.h", File.separator + "DepTestProject" + File.separator + "DepTest.h"};
- String[] depTest2Model = {File.separator + "DepTestProject" + File.separator + "d.h", File.separator + "DepTestProject" + File.separator + "DepTest2.h"};
-
- ArrayList includes = new ArrayList();
- indexManager.performConcurrentJob(new DependencyQueryJob(testProject,depTest,sourceIndexer,includes),ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,null,null);
-
- String[] depTestModelLocal = convertToLocalPath(depTestModel);
- String[] depTestIncludes = new String[includes.size()];
- Iterator includesIterator = includes.iterator();
- int i=0;
- while(includesIterator.hasNext()){
- depTestIncludes[i] = (String) includesIterator.next();
- i++;
- }
-
- if (depTestModelLocal.length != depTestIncludes.length)
- fail("Number of included files differsfrom model");
-
- Arrays.sort(depTestModelLocal);
- Arrays.sort(depTestIncludes);
-
- for (i=0;i<depTestIncludes.length; i++)
- {
- assertEquals(depTestModelLocal[i],depTestIncludes[i]);
- }
-
- ArrayList includes2 = new ArrayList();
- indexManager.performConcurrentJob(new DependencyQueryJob(testProject,depTest2,sourceIndexer,includes2),ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,null,null);
-
- String[] depTest2ModelLocal = convertToLocalPath(depTest2Model);
- String[] depTest2Includes = new String[includes2.size()];
- Iterator includes2Iterator = includes2.iterator();
- i=0;
- while(includes2Iterator.hasNext()){
- depTest2Includes[i] = (String) includes2Iterator.next();
- i++;
- }
-
- if (depTest2ModelLocal.length != depTest2Includes.length)
- fail("Number of included files differsfrom model");
-
- Arrays.sort(depTest2ModelLocal);
- Arrays.sort(depTest2Includes);
-
- for (i=0;i<depTest2Includes.length; i++)
- {
- assertEquals(depTest2ModelLocal[i],depTest2Includes[i]);
- }
- }
-
- public void testDepTable() throws Exception{
- //Add a file to the project
-
- IFile depTest2C = importFile("DepTest2.cpp","resources/dependency/DepTest2.cpp");
- IFile depTestC = importFile("DepTest.cpp","resources/dependency/DepTest.cpp");
- IFile cH = importFile("c.h","resources/dependency/c.h");
- IFile aH = importFile("a.h","resources/dependency/a.h");
- IFile Inc1H = importFile("Inc1.h","resources/dependency/Inc1.h");
- IFile dH = importFile("d.h","resources/dependency/d.h");
- IFile depTestH = importFile("DepTest.h","resources/dependency/DepTest.h");
- IFile depTest2H = importFile("DepTest2.h","resources/dependency/DepTest2.h");
-
- testProject.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(true));
-
- PathCollector pathCollector = new PathCollector();
- getTableRefs(dH, pathCollector);
-
- String[] dHModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest2.cpp", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp"};
- String[] iPath = pathCollector.getPaths();
-
- if (dHModel.length != iPath.length)
- fail("Number of included files differsfrom model");
-
- Arrays.sort(dHModel);
- Arrays.sort(iPath);
-
- for (int i=0;i<iPath.length; i++)
- {
- assertEquals(iPath[i],dHModel[i]);
- }
-
- pathCollector = new PathCollector();
- getTableRefs(Inc1H, pathCollector);
-
- String[] Inc1HModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp"};
- iPath = pathCollector.getPaths();
-
- if (Inc1HModel.length != iPath.length)
- fail("Number of included files differsfrom model");
-
- Arrays.sort(Inc1HModel);
- Arrays.sort(iPath);
-
- for (int i=0;i<iPath.length; i++)
- {
- assertEquals(iPath[i],Inc1HModel[i]);
- }
- }
-
- public void testDepSourceChangeTable() throws Exception{
-
- //Add a file to the project
- IFile cH = importFile("c.h","resources/dependency/c.h");
- IFile aH = importFile("a.h","resources/dependency/a.h");
- IFile Inc1H = importFile("Inc1.h","resources/dependency/Inc1.h");
- IFile dH = importFile("d.h","resources/dependency/d.h");
- IFile depTestH = importFile("DepTest.h","resources/dependency/DepTest.h");
- IFile depTestC = importFile("DepTest.cpp","resources/dependency/DepTest.cpp");
-
- testProject.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(true));
-
- String[] beforeModel = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp"};
-
- PathCollector pathCollector = new PathCollector();
- getTableRefs(depTestH, pathCollector);
-
- String[] iPath = pathCollector.getPaths();
-
- compareArrays(iPath,beforeModel);
-
- pathCollector = new PathCollector();
- getTableRefs(dH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- compareArrays(iPath,beforeModel);
-
- pathCollector = new PathCollector();
- getTableRefs(Inc1H, pathCollector);
-
- iPath = pathCollector.getPaths();
- String[] inc1Model = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp"};
- compareArrays(iPath,inc1Model);
-
- pathCollector = new PathCollector();
- getTableRefs(aH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- compareArrays(iPath,inc1Model);
-
- pathCollector = new PathCollector();
- getTableRefs(cH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- String[] cHModel = {Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest.cpp"};
- compareArrays(iPath,cHModel);
-
- editCode(depTestC,"#include \"DepTest.h\"","//#include \"DepTest.h\"");
-
-
- pathCollector = new PathCollector();
- getTableRefs(depTestH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- if (iPath.length != 0)
- fail("Number of included files differs from model");
-
-
- pathCollector = new PathCollector();
- getTableRefs(dH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- compareArrays(iPath,beforeModel);
-
- pathCollector = new PathCollector();
- getTableRefs(Inc1H, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- if (iPath.length != 0)
- fail("Number of included files differs from model");
-
- pathCollector = new PathCollector();
- getTableRefs(aH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- if (iPath.length != 0)
- fail("Number of included files differs from model");
-
-
- pathCollector = new PathCollector();
- getTableRefs(cH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- if (iPath.length != 0)
- fail("Number of included files differs from model");
-
- }
-
- public void testDepSourceChangeTree() throws Exception{
-// Add a file to the project
- IFile cH = importFile("c.h","resources/dependency/c.h");
- IFile aH = importFile("a.h","resources/dependency/a.h");
- IFile Inc1H = importFile("Inc1.h","resources/dependency/Inc1.h");
- IFile depTestH = importFile("DepTest.h","resources/dependency/DepTest.h");
- IFile dH = importFile("d.h","resources/dependency/d.h");
- IFile depTest2H = importFile("DepTest2.h","resources/dependency/DepTest2.h");
- IFile depTestC = importFile("DepTest.cpp","resources/dependency/DepTest.cpp");
- IFile depTest2C = importFile("DepTest2.cpp","resources/dependency/DepTest2.cpp");
-
- testProject.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(true));
-
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
-
- String[] preDepTestModel = {File.separator + "DepTestProject" + File.separator + "DepTest.h", File.separator + "DepTestProject" + File.separator + "Inc1.h", File.separator + "DepTestProject" + File.separator + "a.h", File.separator + "DepTestProject" + File.separator + "c.h", File.separator + "DepTestProject" + File.separator + "d.h"};
-
- ArrayList includes = new ArrayList();
- indexManager.performConcurrentJob(new DependencyQueryJob(testProject,depTestC,sourceIndexer,includes),ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,null, null);
-
- String[] preDepTestModelLocal = convertToLocalPath(preDepTestModel);
- String[] preDepTestIncludes = new String[includes.size()];
-
- Iterator includesIterator = includes.iterator();
- int i=0;
- while(includesIterator.hasNext()){
- preDepTestIncludes[i] = (String) includesIterator.next();
- i++;
- }
-
- if (preDepTestModelLocal.length != preDepTestIncludes.length)
- fail("Number of included files differs from model");
-
- Arrays.sort(preDepTestModelLocal);
- Arrays.sort(preDepTestIncludes);
-
- for (i=0;i<preDepTestIncludes.length; i++){
- assertEquals(preDepTestModelLocal[i],preDepTestIncludes[i]);
- }
-
- editCode(depTestC,"#include \"DepTest.h\"","//#include \"DepTest.h\"");
- String[] postDepTestModel = {File.separator + "DepTestProject" + File.separator + "d.h"};
-
- ArrayList includes2 = new ArrayList();
-
- testProject.refreshLocal(IResource.DEPTH_INFINITE,null);
-
- indexManager.performConcurrentJob(new DependencyQueryJob(testProject,depTestC,sourceIndexer,includes2),ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,null, null);
-
-
- String[] postDepTestModelLocal = convertToLocalPath(postDepTestModel);
- String[] postDepTestIncludes = new String[includes2.size()];
-
- Iterator includesIterator2 = includes2.iterator();
-
- int j=0;
- while(includesIterator2.hasNext()){
- postDepTestIncludes[j] = (String) includesIterator2.next();
- j++;
- }
-
- if (postDepTestModelLocal.length != postDepTestIncludes.length)
- fail("Number of included files differs from model");
-
- Arrays.sort(postDepTestModelLocal);
- Arrays.sort(postDepTestIncludes);
-
- for (i=0;i<postDepTestIncludes.length; i++){
- assertEquals(postDepTestModelLocal[i],postDepTestIncludes[i]);
- }
-
- }
-
- public void testDepHeaderChangeTree() throws Exception{
- // Add a file to the project
- IFile cH = importFile("c.h","resources/dependency/c.h");
- IFile aH = importFile("a.h","resources/dependency/a.h");
- IFile depTest3H = importFile("DepTest3.h","resources/dependency/DepTest3.h");
- IFile depTest3C = importFile("DepTest3.cpp","resources/dependency/DepTest3.cpp");
-
- testProject.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(true));
-
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
-
- String[] preDepTestModel = {File.separator + "DepTestProject" + File.separator + "DepTest3.h", File.separator + "DepTestProject" + File.separator + "a.h", File.separator + "DepTestProject" + File.separator + "c.h"};
-
- ArrayList includes = new ArrayList();
- indexManager.performConcurrentJob(new DependencyQueryJob(testProject,depTest3C,sourceIndexer,includes),ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,null, null);
-
- String[] preDepTestModelLocal = convertToLocalPath(preDepTestModel);
- String[] preDepTestIncludes = new String[includes.size()];
-
- Iterator includesIterator = includes.iterator();
- int i=0;
- while(includesIterator.hasNext()){
- preDepTestIncludes[i] = (String) includesIterator.next();
- i++;
- }
-
- if (preDepTestModelLocal.length != preDepTestIncludes.length)
- fail("Number of included files differs from model");
-
- Arrays.sort(preDepTestModelLocal);
- Arrays.sort(preDepTestIncludes);
-
- for (i=0;i<preDepTestIncludes.length; i++){
- assertEquals(preDepTestModelLocal[i],preDepTestIncludes[i]);
- }
-
- editCode(aH,"#include \"c.h\"","//#include \"c.h\"");
- String[] postDepTestModel = {File.separator + "DepTestProject" + File.separator + "DepTest3.h", File.separator + "DepTestProject" + File.separator + "a.h"};
-
- ArrayList includes2 = new ArrayList();
-
- testProject.refreshLocal(IResource.DEPTH_INFINITE,null);
-
- indexManager.performConcurrentJob(new DependencyQueryJob(testProject,depTest3C,sourceIndexer,includes2),ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,null, null);
-
-
- String[] postDepTestModelLocal = convertToLocalPath(postDepTestModel);
- String[] postDepTestIncludes = new String[includes2.size()];
-
- Iterator includesIterator2 = includes2.iterator();
-
- int j=0;
- while(includesIterator2.hasNext()){
- postDepTestIncludes[j] = (String) includesIterator2.next();
- j++;
- }
-
- assertEquals(postDepTestModelLocal.length, postDepTestIncludes.length);
-
- Arrays.sort(postDepTestModelLocal);
- Arrays.sort(postDepTestIncludes);
-
- for (i=0;i<postDepTestIncludes.length; i++){
- assertEquals(postDepTestModelLocal[i],postDepTestIncludes[i]);
- }
-
- }
-
- public void testDepHeaderChangeTable() throws Exception{
-
- // Add a file to the project
- IFile cH = importFile("c.h","resources/dependency/c.h");
- IFile aH = importFile("a.h","resources/dependency/a.h");
- IFile depTest3H = importFile("DepTest3.h","resources/dependency/DepTest3.h");
- IFile depTest3C = importFile("DepTest3.cpp","resources/dependency/DepTest3.cpp");
-
- testProject.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(true));
-
-
- String[] beforeModel = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest3.cpp"};
- String[] cHModel = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest3.cpp"};
- String[] aHModel = {Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest3.cpp"};
- PathCollector pathCollector = new PathCollector();
- getTableRefs(depTest3H, pathCollector);
-
- String[] iPath = pathCollector.getPaths();
-
- compareArrays(iPath,beforeModel);
-
- pathCollector = new PathCollector();
- getTableRefs(cH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- compareArrays(iPath,cHModel);
-
- pathCollector = new PathCollector();
- getTableRefs(aH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- compareArrays(iPath,aHModel);
-
-
- editCode(aH,"#include \"c.h\"","//#include \"c.h\"");
-
- pathCollector = new PathCollector();
- getTableRefs(depTest3H, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- compareArrays(iPath,beforeModel);
-
- pathCollector = new PathCollector();
- getTableRefs(cH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- if (iPath.length != 0)
- fail("Number of included files differs from model");
-
- pathCollector = new PathCollector();
- getTableRefs(aH, pathCollector);
-
- iPath = pathCollector.getPaths();
-
- compareArrays(iPath,aHModel);
-
- }
-
- public void testUpdateDependancyNPE() {
- IResource nonExistantResource = ResourcesPlugin.getWorkspace().getRoot().getProject("non-existant-project-aha");
-
- assertFalse(nonExistantResource.exists());
- assertNull(nonExistantResource.getLocation());
-
- IIndexJob job = new UpdateDependency(nonExistantResource, sourceIndexer);
- assertFalse(job.execute(new NullProgressMonitor()));
- }
-
-
- public void testDepHeaderChangeReindex() throws Exception{
- // Add a file to the project
- IFile cH = importFile("c.h","resources/dependency/c.h");
- IFile aH = importFile("a.h","resources/dependency/a.h");
- IFile depTest3H = importFile("DepTest3.h","resources/dependency/DepTest3.h");
- IFile depTest3C = importFile("DepTest3.cpp","resources/dependency/DepTest3.cpp");
-
- testProject.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(true));
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "Z", ICSearchConstants.TYPE, ICSearchConstants.DEFINITIONS, true );
-
- search(workspace,pattern,scope,resultCollector);
-
- Set resultSet = resultCollector.getSearchResults();
- if (resultSet.size() != 1)
- fail("Expected 1 match");
-
- Iterator iter = resultSet.iterator();
- IMatch match = (IMatch) iter.next();
- if (!(match.getName().equals("Z")) &&
- (match.getElementType() != 64 ))
- fail("Wrong search result");
-
- editCode(depTest3H,"#include \"a.h\"","//#include \"a.h\"");
-
- search(workspace,pattern,scope,resultCollector);
-
- resultSet = resultCollector.getSearchResults();
-
- if (resultSet.size() != 1)
- fail("Expected no matches");
- }
-
-
- private String[] convertToLocalPath(String[] model) {
- IPath defaultPath = Platform.getLocation();
- String pathString = defaultPath.toOSString();
- char endChar = pathString.charAt(pathString.length() - 1);
- if (endChar == '/' ||
- endChar == '\\')
- {
- pathString = pathString.substring(0, pathString.length() - 1);
- }
- String[] tempLocalArray = new String[model.length];
- for (int i=0;i<model.length;i++){
- StringBuffer buffer = new StringBuffer();
- buffer.append(pathString);
- buffer.append(model[i]);
- tempLocalArray[i]=buffer.toString();
- }
- return tempLocalArray;
- }
-
- private void getTableRefs(IFile tempFile, PathCollector pathCollector) throws InterruptedException{
-
- ICSearchScope scope = SearchEngine.createWorkspaceScope();
- CSearchPattern pattern = CSearchPattern.createPattern(tempFile.getLocation().toOSString(),ICSearchConstants.INCLUDE, ICSearchConstants.REFERENCES,ICSearchConstants.EXACT_MATCH,true);
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- indexManager.performConcurrentJob(
- new PatternSearchJob(
- (CSearchPattern) pattern,
- scope,
- pathCollector,
- indexManager
- ),
- ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
- null, null );
- }
-
- private void editCode(IFile tempFile, String beforeString, String afterString) throws IOException, CoreException, InterruptedException{
- FileReader fileReader = null;
- try {
- fileReader = new FileReader(tempFile.getLocation().toOSString());
- } catch (FileNotFoundException e) {
- fail(e.getMessage());
- }
-
- BufferedReader buff = new BufferedReader(fileReader);
- String tempString;
- File tempUtilFile= new File(tempFile.getLocation().toOSString() + "TempFile");
- FileWriter writer = new FileWriter(tempUtilFile);
-
- try {
- while ((tempString = buff.readLine())!= null ) {
- if (tempString.equals(beforeString)){
- writer.write(afterString + "\n" );
- writer.flush();
- }
- else{
- writer.write(tempString + "\n" );
- writer.flush();
- }
-
- }
- } catch (IOException e1) {
- fail(e1.getMessage());
- }
- writer.close();
- buff.close();
-
- FileInputStream buff2 = new FileInputStream(tempUtilFile);
- tempFile.setContents(buff2,true,false,null);
- tempFile.refreshLocal(IResource.DEPTH_INFINITE, null);
- //buff2.close();
-
-
- }
-
- private void compareArrays(String[] first, String[] second){
-
- if (first.length != second.length)
- fail("Number of included files differs from model");
-
- Arrays.sort(first);
- Arrays.sort(second);
-
- for (int i=0;i<first.length; i++)
- {
- assertEquals(first[i],second[i]);
- }
- }
-
- protected void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector) {
- try {
- searchEngine.search( workspace, pattern, scope, collector, false );
- } catch (InterruptedException e) {
- }
- }
-
- /*
- * Utils
- */
- private IProject createProject(String projectName) throws CoreException
- {
- ICProject cproject = CProjectHelper.createCCProject(projectName, "bin");
- return cproject.getProject();
-
- }
-
- private IFile importFile(String fileName, String resourceLocation)throws Exception {
- resetIndexState();
- //Obtain file handle
- file = testProject.getProject().getFile(fileName);
- //Create file input stream
- monitor = new NullProgressMonitor();
- if (!file.exists()) {
- file.create(new FileInputStream(
- CTestPlugin.getDefault().getFileInPlugin(new Path(resourceLocation))),
- false, monitor);
- }
- waitForIndex(10); // only wait 20 seconds max.
- return file;
- }
-
- public void resetIndexState() {
- fileIndexed = false;
- }
-
- public void waitForIndex(int maxSec) throws Exception {
- int delay = 0;
- while (fileIndexed != true && delay < (maxSec * 1000))
- {
- Thread.sleep(TIMEOUT);
- delay += TIMEOUT;
- }
- }
- public void indexChanged(IndexChangeEvent event) {
- IIndexDelta delta = event.getDelta();
- if (delta.getDeltaType() == IIndexDelta.MERGE_DELTA){
- fileIndexed = true;
- }
- }
-
- public void resetIndexer(final String indexerId){
- if ( testProject != null) {
- ICDescriptorOperation op = new ICDescriptorOperation() {
-
- public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
- descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
- descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,indexerId);
- }
- };
- try {
- CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(testProject, op, new NullProgressMonitor());
- CCorePlugin.getDefault().getCoreModel().getIndexManager().indexerChangeNotification(testProject);
- } catch (CoreException e) {}
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexerOffsetTests.java b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexerOffsetTests.java
deleted file mode 100644
index 7b35d380f5..0000000000
--- a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexerOffsetTests.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.indexer.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
-import org.eclipse.cdt.internal.core.index.cindexstorage.WordEntry;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.GammaCompressedIndexBlock;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexBlock;
-
-/**
- * @author Bogdan Gheorghe
- */
-public class IndexerOffsetTests extends TestCase {
-
- public static void main(String[] args) {
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(IndexerOffsetTests.class.getName());
-
- suite.addTest(new IndexerOffsetTests("testOffsetsResizing")); //$NON-NLS-1$
-
- return suite;
-
- }
-
- /**
- * Constructor for IndexerOffsetTests.
- * @param name
- */
- public IndexerOffsetTests(String name) {
- super(name);
- }
-
- public void testOffsetsResizing() throws Exception{
- WordEntry word = new WordEntry("typeDecl/C/Test".toCharArray());
- word.addRef(2);
- word.addOffset(235,5,2,IIndex.OFFSET);
- word.addOffset(512,3,2,IIndex.OFFSET);
- word.addOffset(512,3,2,IIndex.OFFSET);
- word.addOffset(512,3,2,IIndex.OFFSET);
- word.addModifiers(18,2);
- word.addRef(5);
- word.addOffset(43,6,5,IIndex.OFFSET);
- word.addOffset(2,3,5,IIndex.LINE);
- word.addOffset(89,8,5,IIndex.OFFSET);
- word.addOffset(63,2,5,IIndex.LINE);
- word.addOffset(124,7,5,IIndex.OFFSET);
- word.addModifiers(4,5);
- word.addRef(9);
- word.addOffset(433,5,9,IIndex.OFFSET);
- word.addOffset(234,3,9,IIndex.OFFSET);
- word.addModifiers(1,9);
- word.addRef(11);
- word.addOffset(4233,2,11,IIndex.OFFSET);
- word.addOffset(2314,7,11,IIndex.OFFSET);
- word.addModifiers(8,11);
- word.addRef(17);
- word.addOffset(2,7,17,IIndex.OFFSET);
- word.addOffset(52,8,17,IIndex.OFFSET);
- word.addModifiers(32,17);
-
- int[] test =word.getOffsets(1);
-
- int[] modifierTest=word.getModifiers();
-
- WordEntry word2 = new WordEntry("typeDecl/C/Test".toCharArray());
- word2.addRef(4);
- word2.addOffset(13,4,4, IIndex.OFFSET);
- word2.addOffset(17,3,4, IIndex.OFFSET);
- word2.addOffset(20,6,4,IIndex.OFFSET);
- word2.addModifiers(64,4);
- word2.addRef(7);
- word2.addOffset(21,2,7, IIndex.OFFSET);
- word2.addOffset(24,3,7, IIndex.OFFSET);
- word2.addOffset(28,7,7,IIndex.OFFSET);
- word2.addModifiers(128,7);
-
- word.addWordInfo(word2.getRefs(), word2.getOffsets(), word2.getOffsetLengths(), word2.getOffsetCount(),word2.getModifiers());
-
- word.mapRefs(new int[]{-1, 1, 17, 3, 4, 11, 6, 7, 8, 24, 10, 5, 12, 13, 14, 15, 16, 2});
-
- IndexBlock block= new GammaCompressedIndexBlock(ICIndexStorageConstants.BLOCK_SIZE);
- block.addEntry(word);
- block.flush();
-
- WordEntry entry= new WordEntry();
- block.nextEntry(entry);
- }
-}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java
index 05062b7b96..6d10f3d5ad 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java
@@ -70,7 +70,6 @@ import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.FileManager;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
import org.eclipse.cdt.internal.core.parser.Parser;
import org.eclipse.cdt.internal.core.parser.ParserException;
import org.eclipse.core.resources.IFile;
@@ -105,7 +104,6 @@ public class FileBasePluginTest extends TestCase {
cPrj = CProjectHelper.createCCProject("ParserTestProject", "bin"); //$NON-NLS-1$ //$NON-NLS-2$
project = cPrj.getProject();
- project.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(false));
// ugly
if (className == null || !className.equals(aClassName)) {
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2FileBasePluginTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2FileBasePluginTest.java
index 69032b9380..0c3a7d4ec6 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2FileBasePluginTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2FileBasePluginTest.java
@@ -23,7 +23,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.FileManager;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -56,7 +55,6 @@ public class AST2FileBasePluginTest extends TestCase {
cPrj = CProjectHelper.createCCProject("AST2BasedProjectMofo", "bin"); //$NON-NLS-1$ //$NON-NLS-2$
project = cPrj.getProject();
- project.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(false));
// ugly
if (className == null || !className.equals(aClassName)) {
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMFileBasePluginTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMFileBasePluginTest.java
index e0ba3ffc89..44338ed203 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMFileBasePluginTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMFileBasePluginTest.java
@@ -23,7 +23,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.FileManager;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -56,7 +55,6 @@ public class DOMFileBasePluginTest extends TestCase {
cPrj = CProjectHelper.createCCProject("ParserTestProject", "bin"); //$NON-NLS-1$ //$NON-NLS-2$
project = cPrj.getProject();
- project.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(false));
// ugly
if (className == null || !className.equals(aClassName)) {
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseBaseTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseBaseTest.java
index 4d437b2f30..d8d37306b0 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseBaseTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseBaseTest.java
@@ -10,10 +10,12 @@
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2;
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.dom.DOMSearchUtil;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.core.search.DOMSearchUtil;
-import org.eclipse.cdt.core.search.ICSearchConstants;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.core.resources.IFile;
/**
@@ -30,30 +32,15 @@ public class DOMSelectionParseBaseTest extends DOMFileBasePluginTest {
return parse( code, offset1, offset2, true );
}
- /**
- * @param code
- * @param offset1
- * @param offset2
- * @param b
- * @return
- */
protected IASTNode parse(String code, int offset1, int offset2, boolean expectedToPass) throws Exception {
IFile file = importFile("temp.cpp", code); //$NON-NLS-1$
- IASTName[] names = DOMSearchUtil.getSelectedNamesFrom(file, offset1, offset2 - offset1);
-
- if (!expectedToPass) return null;
-
- if (names.length == 0) {
- assertFalse(true);
- } else {
- return names[0];
- }
-
- return null;
+ return parse(file, offset1, offset2, expectedToPass);
}
protected IASTNode parse(IFile file, int offset1, int offset2, boolean expectedToPass) throws Exception {
- IASTName[] names = DOMSearchUtil.getSelectedNamesFrom(file, offset1, offset2 - offset1);
+ ITranslationUnit tu = (ITranslationUnit)CCorePlugin.getDefault().getCoreModel().create(file);
+ IASTTranslationUnit ast = tu.getLanguage().getASTTranslationUnit(tu, 0);
+ IASTName[] names = tu.getLanguage().getSelectedNames(ast, offset1, offset2 - offset1);
if (!expectedToPass) return null;
@@ -67,10 +54,10 @@ public class DOMSelectionParseBaseTest extends DOMFileBasePluginTest {
}
protected IASTName[] getDeclarationOffTU(IASTName name) {
- return DOMSearchUtil.getNamesFromDOM(name, ICSearchConstants.DECLARATIONS);
+ return DOMSearchUtil.getNamesFromDOM(name, DOMSearchUtil.DECLARATIONS);
}
protected IASTName[] getReferencesOffTU(IASTName name) {
- return DOMSearchUtil.getNamesFromDOM(name, ICSearchConstants.REFERENCES);
+ return DOMSearchUtil.getNamesFromDOM(name, DOMSearchUtil.REFERENCES);
}
}
diff --git a/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/BaseTestFramework.java b/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/BaseTestFramework.java
index 1c12bed10d..bb30809b40 100644
--- a/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/BaseTestFramework.java
+++ b/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/BaseTestFramework.java
@@ -20,8 +20,6 @@ import java.io.InputStream;
import junit.framework.TestCase;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorOperation;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.FileManager;
@@ -31,7 +29,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
/**
@@ -75,20 +72,7 @@ abstract public class BaseTestFramework extends TestCase {
}
public void disableIndexing(){
- if ( project != null) {
- ICDescriptorOperation op = new ICDescriptorOperation() {
-
- public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
- descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
- descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,CCorePlugin.NULL_INDEXER_UNIQUE_ID);
- }
- };
- try {
- CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(project, op, new NullProgressMonitor());
- CCorePlugin.getDefault().getCoreModel().getIndexManager().indexerChangeNotification(project);
- indexDisabled=true;
- } catch (CoreException e) {}
- }
+ // TODO turn off PDOM indexing?
}
public BaseTestFramework()
diff --git a/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/RegressionTestSuite.java b/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/RegressionTestSuite.java
index 7b44d48072..21d30e8c1b 100644
--- a/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/RegressionTestSuite.java
+++ b/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/RegressionTestSuite.java
@@ -40,10 +40,8 @@ public class RegressionTestSuite extends TestSuite {
public static Test suite() {
final RegressionTestSuite suite = new RegressionTestSuite();
- suite.addTest( SearchRegressionTests.suite( false ) );
suite.addTest( SelectionRegressionTest.suite( false ) );
- suite.addTest( new SearchRegressionTests("cleanupProject") ); //$NON-NLS-1$
return suite;
}
}
diff --git a/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/SearchRegressionTests.java b/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/SearchRegressionTests.java
deleted file mode 100644
index ae962b8fa6..0000000000
--- a/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/SearchRegressionTests.java
+++ /dev/null
@@ -1,1633 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-/*
- * Created on Oct 4, 2004
- */
-package org.eclipse.cdt.core.tests;
-
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.Set;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorOperation;
-import org.eclipse.cdt.core.index.ICDTIndexer;
-import org.eclipse.cdt.core.index.IIndexChangeListener;
-import org.eclipse.cdt.core.index.IIndexDelta;
-import org.eclipse.cdt.core.index.IndexChangeEvent;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.search.BasicSearchMatch;
-import org.eclipse.cdt.core.search.BasicSearchResultCollector;
-import org.eclipse.cdt.core.search.ICSearchConstants;
-import org.eclipse.cdt.core.search.ICSearchPattern;
-import org.eclipse.cdt.core.search.ICSearchScope;
-import org.eclipse.cdt.core.search.IMatch;
-import org.eclipse.cdt.core.search.IOffsetLocatable;
-import org.eclipse.cdt.core.search.SearchEngine;
-import org.eclipse.cdt.core.testplugin.CProjectHelper;
-import org.eclipse.cdt.internal.core.browser.cache.TypeCacheManager;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexerRunner;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-/**
- * @author aniefer
- */
-public class SearchRegressionTests extends BaseTestFramework implements ICSearchConstants, IIndexChangeListener{
- static protected ICSearchScope scope;
- static protected SearchEngine searchEngine;
- static protected BasicSearchResultCollector resultCollector;
- static private boolean indexChanged = false;
- {
- scope = SearchEngine.createWorkspaceScope();
- resultCollector = new BasicSearchResultCollector();
- searchEngine = new SearchEngine();
- }
- public SearchRegressionTests()
- {
- super();
- }
- /**
- * @param name
- */
- public SearchRegressionTests(String name)
- {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
-
- try{
- if (project == null){
- cproject = CProjectHelper.createCCProject("RegressionTestProject", "bin"); //$NON-NLS-1$ //$NON-NLS-2$
- project = cproject.getProject();
- }
- } catch ( CoreException e ) { //boo
- }
-
- resetIndexer(CCorePlugin.DEFAULT_INDEXER_UNIQ_ID);
- //The DOM Source Indexer checks to see if a file has any scanner info
- //set prior to indexing it in order to increase efficiency. We need to let it know
- //that it is running in test mode in order to allow for this scanner info test to be skipped
- DOMSourceIndexerRunner.setSkipScannerInfoTest(true);
-
-
- TypeCacheManager typeCacheManager = TypeCacheManager.getInstance();
- typeCacheManager.setProcessTypeCacheEvents(false);
-
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- indexDisabled=false;
-
- ICDTIndexer indexer = CCorePlugin.getDefault().getCoreModel().getIndexManager().getIndexerForProject(project);
- if (indexer instanceof DOMSourceIndexer){
- ((DOMSourceIndexer)indexer).addIndexChangeListener( this );
- }
-
- }
-
- protected void tearDown() throws Exception {
- if( project == null || !project.exists() )
- return;
-
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- //sourceIndexer.removeIndexChangeListener( this );
- try{
- project.setSessionProperty( DOMSourceIndexer.activationKey, new Boolean( false ) );
- project.delete(true,true,new NullProgressMonitor());
- project = null;
- } catch ( CoreException e ) { //boo
- }
- super.tearDown();
- }
-
- protected Set search( ICSearchPattern pattern ) {
- try {
- resultCollector.aboutToStart();
- searchEngine.search( workspace, pattern, scope, resultCollector, false );
- } catch (InterruptedException e) {
- //boo
- }
-
- return resultCollector.getSearchResults();
- }
- protected Set search( ICSearchPattern pattern, ICElement[] list ) {
- //leave default scope as workspace
- try {
- ICSearchScope searchScope = SearchEngine.createCSearchScope(list);
- searchEngine.search( workspace, pattern, searchScope, resultCollector, false );
- } catch (InterruptedException e) {
- //boo
- }
-
- return resultCollector.getSearchResults();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.index.IIndexChangeListener#indexChanged(org.eclipse.cdt.core.index.IndexChangeEvent)
- */
- public void indexChanged( IndexChangeEvent event ) {
- if( event.getDelta().getDeltaType() == IIndexDelta.MERGE_DELTA ){
- indexChanged = true;
- }
- }
-
- protected IFile importFile(String fileName, String contents ) throws Exception{
- indexChanged = false;
- IFile file = super.importFile( fileName, contents );
-
- if (!indexDisabled){
- while( !indexChanged ){
- Thread.sleep( 100 );
- }
- }
- return file;
- }
-
- public void assertMatch( Set matches, IFile file, int offset ) throws Exception {
- Iterator i = matches.iterator();
- while( i.hasNext() ){
- IMatch match = (IMatch) i.next();
- if( ((IOffsetLocatable)match.getLocatable()).getNameStartOffset() == offset && match.getLocation().equals( file.getLocation() ) )
- return; //match
- }
- fail( "Match at offset " + offset + " in \"" + file.getLocation() + "\" not found." ); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
- }
-
- public void resetIndexer(final String indexerId){
- if ( project != null) {
- ICDescriptorOperation op = new ICDescriptorOperation() {
-
- public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
- descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
- descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,indexerId);
- }
- };
- try {
- CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(project, op, new NullProgressMonitor());
- CCorePlugin.getDefault().getCoreModel().getIndexManager().indexerChangeNotification(project);
- } catch (CoreException e) {}
- }
- }
-
- public static Test suite(){
- return suite( true );
- }
-
- public static Test suite( boolean cleanup ) {
- TestSuite suite = new TestSuite("SearchRegressionTests"); //$NON-NLS-1$
-
- suite.addTest( new SearchRegressionTests("testClassDeclarationReference") ); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testClassStructDeclaration") ); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testClassStructReference") ); //$NON-NLS-1$
-
- suite.addTest(new SearchRegressionTests("testNamespaceDeclaration")); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testNamespaceDefinition")); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testNamespaceReference")); //$NON-NLS-1$
-
- suite.addTest( new SearchRegressionTests("testMethodDeclaration")); //$NON-NLS-1$
- suite.addTest(new SearchRegressionTests("testMethodDefinition")); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testMethodReference") ); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testMethodReferenceOperator") ); //$NON-NLS-1$
- suite.addTest( new FailingTest( new SearchRegressionTests("testMethodReferenceImplicitOperator"), 80117 ) ); //defect80117 //$NON-NLS-1$
- suite.addTest(new SearchRegressionTests("testMethodReferenceInitializer")); //defect76169 //$NON-NLS-1$
- //fails because inline def refers to a member not declared yet
- suite.addTest(new SearchRegressionTests("testMethodReferenceInline")); //defect79425//$NON-NLS-1$
- //method call with constructor call not found
- suite.addTest( new SearchRegressionTests("testMethodReferenceWithCctor") ); //defect79789//$NON-NLS-1$
- //constructor call in function argument not found
- suite.addTest( new SearchRegressionTests("testConstructorReferenceArg")); //defect79785 //$NON-NLS-1$
- //constructor call by itself not found
- suite.addTest(new SearchRegressionTests("testConstructorReferenceAlone")); //defect79792 //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testDestructorReference") ); //defect79792 //$NON-NLS-1$
-
- suite.addTest(new SearchRegressionTests("testFunctionDeclaration")); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testFunctionDefinition")); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testFunctionReference") ); //$NON-NLS-1$
-
- suite.addTest( new SearchRegressionTests("testFieldDeclaration") ); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testBitFieldDeclaration") ); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testFieldDefinition")); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testFieldReference") ); //$NON-NLS-1$
- suite.addTest( new FailingTest( new SearchRegressionTests("testNestedFieldReference"), 76203 ) ); //defect76203//$NON-NLS-1$
-
- suite.addTest( new SearchRegressionTests("testVarDeclaration") ); //$NON-NLS-1$
- ///Fixup for DOM Indexer
- suite.addTest( new FailingTest(new SearchRegressionTests("testVarDefinition"))); //$NON-NLS-1$
- ///Fixup for DOM Indexer
- suite.addTest( new FailingTest(new SearchRegressionTests("testVarReference"))); //$NON-NLS-1$
- ///Fixup for DOM Indexer
- suite.addTest( new FailingTest(new SearchRegressionTests("testVarDeclarationArgument"))); //defect75901 //$NON-NLS-1$
- //var in initializer list of constructor not found
- suite.addTest( new FailingTest( new SearchRegressionTests("testVarReferenceInitializer"), 72735 ) ); //defect72735 //$NON-NLS-1$
- //definition of a var in an argument list is not found
- suite.addTest( new SearchRegressionTests("testVarDefinitionArgument") ); //defect75901 //$NON-NLS-1$
-
- suite.addTest( new FailingTest(new SearchRegressionTests("testUnionDeclaration"))); //$NON-NLS-1$
- suite.addTest( new FailingTest(new SearchRegressionTests("testUnionReference"))); //$NON-NLS-1$
-
- suite.addTest( new FailingTest(new SearchRegressionTests("testEnumerationDeclaration"))); //$NON-NLS-1$
- suite.addTest(new SearchRegressionTests("testEnumerationReference")); //$NON-NLS-1$
- //search doesn't distinguish between global and local symbols
- suite.addTest( new FailingTest( new SearchRegressionTests("testEnumerationReferenceGlobal"), 79811 ) ); //defect79811 //$NON-NLS-1$
-
- suite.addTest( new FailingTest(new SearchRegressionTests("testEnumeratorDeclaration"))); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testEnumeratorReference") ); //$NON-NLS-1$
- suite.addTest( new FailingTest( new SearchRegressionTests("testEnumeratorDeclarationCase"), 79717 ) ); //defect79717 //$NON-NLS-1$
-
- suite.addTest( new SearchRegressionTests("testTypedefDeclaration") ); //$NON-NLS-1$
- suite.addTest( new SearchRegressionTests("testMacroDeclaration") ); //$NON-NLS-1$
-
- suite.addTest( new SearchRegressionTests("testMethodFieldReferenceInExpressions") ); //$NON-NLS-1$
-
- if( cleanup )
- suite.addTest( new SearchRegressionTests( "cleanupProject" ) ); //$NON-NLS-1$
-
- return suite;
- }
-
- public void testClassDeclarationReference() throws Exception {
- Writer writer = new StringWriter();
- writer.write(" class A { \n" ); //$NON-NLS-1$
- writer.write(" int foo(); \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" int A::foo() { \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
-
- String code = writer.toString();
- IFile f = importFile( "ClassDeclarationReference.cpp", code ); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A", CLASS, ALL_OCCURRENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern, list );
-
- assertEquals( 2, matches.size() );
- assertMatch( matches, f, code.indexOf( "A {" ) ); //$NON-NLS-1$
- assertMatch( matches, f, code.indexOf( "A::" ) ); //$NON-NLS-1$
- }
-// test 85b class struct declaration
- public void testClassStructDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write(" namespace N1 { \n" ); //$NON-NLS-1$
- writer.write(" struct linkedlist1{//decl \n" ); //$NON-NLS-1$
- writer.write(" int field1_t; \n" ); //$NON-NLS-1$
- writer.write(" struct linkedlist1 *field2; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" class linkedlist2{//decl \n" ); //$NON-NLS-1$
- writer.write(" int field3; \n" ); //$NON-NLS-1$
- writer.write(" class linkedlist2 *field4; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" namespace N2 { \n" ); //$NON-NLS-1$
- writer.write(" class C { \n" ); //$NON-NLS-1$
- writer.write(" struct linkedlist1 field5; \n" ); //$NON-NLS-1$
- writer.write(" linkedlist2 *field6; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" class linkedlist2 var1; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile gh = importFile( "ClassStructDeclaration.h", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "N1::*", CLASS_STRUCT, DEFINITIONS, true ); //$NON-NLS-1$
- Set matches = search( pattern );
-
- assertEquals( 2, matches.size() );
- assertMatch( matches, gh, code.indexOf( "linkedlist1{//decl" ) ); //$NON-NLS-1$
- assertMatch( matches, gh, code.indexOf( "linkedlist2{//decl" ) ); //$NON-NLS-1$
-
- }
- // test 90
- public void testClassStructReference() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class Mammal { \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" Mammal(bool b){} \n" ); //$NON-NLS-1$
- writer.write(" static litter=12; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("class Bear : Mammal/*ref1*/{ \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" Bear(int s,int t): Mammal(true) { \n" ); //$NON-NLS-1$
- writer.write(" biotics.littersPerYear=t; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" struct { \n" ); //$NON-NLS-1$
- writer.write(" int littersPerYear; \n" ); //$NON-NLS-1$
- writer.write(" } biotics; \n" ); //$NON-NLS-1$
- writer.write(" class BearPaws{}; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("struct bioticPotential { \n" ); //$NON-NLS-1$
- writer.write(" int litterSize; \n" ); //$NON-NLS-1$
- writer.write(" int matureYears; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("struct bioticPotential/*ref2*/ bp; \n" ); //$NON-NLS-1$
- writer.write("int main(int argc, char **argv) { \n" ); //$NON-NLS-1$
- writer.write(" bioticPotential/*ref3*/ brownbear_bt = {1, 3}; \n" ); //$NON-NLS-1$
- writer.write(" Bear/*ref4*/ *grizzly = new Bear(4,3); \n" ); //$NON-NLS-1$
- writer.write(" brownbear_bt.litterSize = Mammal::litter;/*ref5*/ \n" ); //$NON-NLS-1$
- writer.write(" Bear::BearPaws p;//ref6,ref7 \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile b = importFile( "ClassStructReference.cpp", code ); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", CLASS_STRUCT, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern,list );
-
- assertMatch( matches, b, code.indexOf( "Mammal/*ref1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "bioticPotential/*ref2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "bioticPotential/*ref3*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "Bear/*ref4*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "Mammal::litter;/*ref5*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "Bear::BearPaws p;//ref6" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "BearPaws p;//ref6,ref7" ) ); //$NON-NLS-1$
- assertEquals( 7, matches.size() );
-
- }
- //test 88
- public void testNamespaceDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write("namespace N {//defn,decl \n" ); //$NON-NLS-1$
- writer.write(" int a; \n" ); //$NON-NLS-1$
- writer.write(" namespace M {//defn,decl \n" ); //$NON-NLS-1$
- writer.write(" struct linkedlist { \n" ); //$NON-NLS-1$
- writer.write(" int item; \n" ); //$NON-NLS-1$
- writer.write(" struct linkedlist *next; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile gh = importFile( "NamespaceDeclaration.h", code ); //$NON-NLS-1$
-
- writer = new StringWriter();
- writer.write("#include \"NamespaceDeclaration.h\" \n" ); //$NON-NLS-1$
- writer.write("using namespace N::M; \n" ); //$NON-NLS-1$
- writer.write("linkedlist serial_numbers; \n" ); //$NON-NLS-1$
- writer.write("namespace R {//defn,decl \n" ); //$NON-NLS-1$
- writer.write(" class C { \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" char c(); \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("using namespace R; \n" ); //$NON-NLS-1$
- writer.write("char C::c(){ \n" ); //$NON-NLS-1$
- writer.write("return 'a'; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code2 = writer.toString();
- IFile g = importFile( "NamespaceDeclaration.cpp", code2 ); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", NAMESPACE, DEFINITIONS, true ); //$NON-NLS-1$
- Set matches = search( pattern,list );
-
- assertEquals( 3, matches.size() );
- assertMatch( matches, gh, code.indexOf( "N" ) ); //$NON-NLS-1$
- assertMatch( matches, gh, code.indexOf( "M" ) ); //$NON-NLS-1$
- assertMatch( matches, g, code2.indexOf( "R {//defn,decl" ) ); //$NON-NLS-1$
-
- }
-
- // test SE47
- public void testNamespaceDefinition() throws Exception {
- Writer writer = new StringWriter();
- writer.write("namespace N/*def1*/ { \n" ); //$NON-NLS-1$
- writer.write(" int a; \n" ); //$NON-NLS-1$
- writer.write(" namespace M/*def2*/ { \n" ); //$NON-NLS-1$
- writer.write(" struct linkedlist {}; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("namespace N/*def3*/{int i;} \n" ); //$NON-NLS-1$
- String header = writer.toString();
- IFile h = importFile( "NamespaceDefinition.h", header ); //$NON-NLS-1$
-
- writer = new StringWriter();
- writer.write("#include \"NamespaceDefinition.h\"\n" ); //$NON-NLS-1$
- writer.write("using namespace N::M; \n" ); //$NON-NLS-1$
- writer.write("linkedlist serial_numbers; \n" ); //$NON-NLS-1$
- writer.write("namespace R/*def4*/ { \n" ); //$NON-NLS-1$
- writer.write(" class C {}; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("using namespace R; \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "NamespaceDefinition.cpp", source ); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", NAMESPACE, DEFINITIONS, true ); //$NON-NLS-1$
- Set matches = search( pattern,list );
-
- assertEquals( 4, matches.size() );
- assertMatch( matches, h, header.indexOf( "N/*def1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, h, header.indexOf( "M" ) ); //$NON-NLS-1$
- assertMatch( matches, h, header.indexOf( "N/*def3*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "R/*def4*/" ) ); //$NON-NLS-1$
-
- }
- //test 74 namespace references
- public void testNamespaceReference() throws Exception {
- Writer writer = new StringWriter();
- writer.write("namespace N1 {\n" ); //$NON-NLS-1$
- writer.write(" class C1 {};\n" ); //$NON-NLS-1$
- writer.write(" namespace N2 {\n" ); //$NON-NLS-1$
- writer.write(" class C2{};\n" ); //$NON-NLS-1$
- writer.write(" namespace N3 {\n" ); //$NON-NLS-1$
- writer.write(" class C3{};\n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- /*IFile nh = */importFile( "NamespaceReference.h", code ); //$NON-NLS-1$
-
- writer = new StringWriter();
- writer.write("#include \"NamespaceReference.h\" \n" ); //$NON-NLS-1$
- writer.write("N1::N2::C2 *c = new N1::N2::C2(); \n" ); //$NON-NLS-1$
- writer.write("using namespace N1::N2; \n" ); //$NON-NLS-1$
- writer.write("N3::C3 *d = new N3::C3(); \n" ); //$NON-NLS-1$
- String code2 = writer.toString();
- IFile n = importFile( "NamespaceReference.cpp", code2 ); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", NAMESPACE, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern,list );
-
- assertEquals( 8, matches.size() );
- assertMatch( matches, n, code2.indexOf( "N1::N2::C2 *c" ) ); //$NON-NLS-1$
- assertMatch( matches, n, code2.indexOf( "N2::C2 *c" ) ); //$NON-NLS-1$
- assertMatch( matches, n, code2.indexOf( "N1::N2::C2();" ) ); //$NON-NLS-1$
- assertMatch( matches, n, code2.indexOf( "N2::C2();" ) ); //$NON-NLS-1$
- assertMatch( matches, n, code2.indexOf( "N1::N2;" ) ); //$NON-NLS-1$
- assertMatch( matches, n, code2.indexOf( "N2;" ) ); //$NON-NLS-1$
- assertMatch( matches, n, code2.indexOf( "N3::C3 *d" ) ); //$NON-NLS-1$
- assertMatch( matches, n, code2.indexOf( "N3::C3();" ) ); //$NON-NLS-1$
-
- }
- //test SE100a
- public void testMethodDeclaration() throws Exception {
-
- Writer writer = new StringWriter();
- writer.write("class M { \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" int m; \n" ); //$NON-NLS-1$
- writer.write(" M/*dec1*/(); \n" ); //$NON-NLS-1$
- writer.write(" explicit M/*dec2*/(int i){} \n" ); //$NON-NLS-1$
- writer.write(" virtual ~M/*dec3*/(){} \n" ); //$NON-NLS-1$
- writer.write(" void m1/*dec4*/(); \n" ); //$NON-NLS-1$
- writer.write(" static int m2/*dec5*/(){return 1;} \n" ); //$NON-NLS-1$
- writer.write(" M& operator <</*dec7*/ (const M &rhs); \n" ); //$NON-NLS-1$
- writer.write(" M& operator==/*dec8*/ (const M &rhs); \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("namespace N{ \n" ); //$NON-NLS-1$
- writer.write("class C{ \n" ); //$NON-NLS-1$
- writer.write(" inline int m3/*dec6*/(int i){return 2;} \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("int f1(M m){} \n" ); //$NON-NLS-1$
- writer.write("void foo(){ \n" ); //$NON-NLS-1$
- writer.write(" f1(M(3)); \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("M::M() { \n" ); //$NON-NLS-1$
- writer.write(" fz(); \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("void M::m1() { \n" ); //$NON-NLS-1$
- writer.write(" fz(); \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile gh = importFile( "MethodDeclaration.cpp", code ); //$NON-NLS-1$
- //vp1 constructor, explicit cctor, destructor
- ICSearchPattern pattern=SearchEngine.createSearchPattern("*M", METHOD, DECLARATIONS, true); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- Set matches = search(pattern,list);
- assertEquals( 1, matches.size());
- assertMatch( matches, gh, code.indexOf( "M/*dec1*/" ) ); //$NON-NLS-1$
-
- //vp2 method, static, inline
- pattern=SearchEngine.createSearchPattern("m*", METHOD, DECLARATIONS, true); //$NON-NLS-1$
- matches = search(pattern,list);
- assertEquals( 1, matches.size());
- assertMatch( matches, gh, code.indexOf( "m1/*dec4*/" ) ); //$NON-NLS-1$
-
- //vp3 namespace scope, fully qualified search
- pattern=SearchEngine.createSearchPattern("N::C::m3", METHOD, DEFINITIONS, true); //$NON-NLS-1$
- matches = search(pattern,list);
- assertEquals( 1, matches.size());
- assertMatch( matches, gh, code.indexOf( "m3/*dec6*/" ) ); //$NON-NLS-1$
- //vp4 operator with and without space in name
- pattern=SearchEngine.createSearchPattern("operator ??", METHOD, DECLARATIONS, true); //$NON-NLS-1$
- matches = search(pattern,list);
- assertEquals( 2, matches.size());
- assertMatch( matches, gh, code.indexOf( "operator <</*dec7*/" ) ); //$NON-NLS-1$
- assertMatch( matches, gh, code.indexOf( "operator==/*dec8*/" ) ); //$NON-NLS-1$
- }
- // test SE100b
- public void testMethodDefinition() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class N { \n" ); //$NON-NLS-1$
- writer.write(" N& operator ||(const N &rhs){return *this;}\n" ); //$NON-NLS-1$
- writer.write(" N& operator|(const N &rhs); \n" ); //$NON-NLS-1$
- writer.write(" int m; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String header = writer.toString();
- importFile( "MethodDefinition.h", header ); //$NON-NLS-1$
-
- writer = new StringWriter();
- writer.write("#include \"MethodDefinition.h\" \n" ); //$NON-NLS-1$
- writer.write("N& N::operator|/*def1*/(const N &rhs){} \n" ); //$NON-NLS-1$
- writer.write("class M { \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" int m; \n" ); //$NON-NLS-1$
- writer.write(" M/*def2*/(){} \n" ); //$NON-NLS-1$
- writer.write(" explicit M(int i); \n" ); //$NON-NLS-1$
- writer.write(" virtual ~M/*def3*/(){} \n" ); //$NON-NLS-1$
- writer.write(" void m1(); \n" ); //$NON-NLS-1$
- writer.write(" static int m2/*def4*/(){return 1;} \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("namespace NN{ \n" ); //$NON-NLS-1$
- writer.write("class C{ \n" ); //$NON-NLS-1$
- writer.write(" inline int m3/*def5*/(int i){return 2;} \n" ); //$NON-NLS-1$
- writer.write(" void foo() const; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write(" \n" ); //$NON-NLS-1$
- writer.write("void NN::C::foo/*def6*/() const{} \n" ); //$NON-NLS-1$
- writer.write("M::M/*def7*/(int i) { \n" ); //$NON-NLS-1$
- writer.write(" m=i; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("void M::m1/*def8*/() {} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile cpp = importFile( "MethodDefinition.cpp", code ); //$NON-NLS-1$
- //vp1 operator, constructor, destructor, inline, static, const, explicit constructor
- ICElement[] list = new ICElement[1];//{cproject.findElement(new Path("MethodDefinition.cpp"))}; //$NON-NLS-1$
- list[0] = cproject;
- ICSearchPattern pattern=SearchEngine.createSearchPattern("*", METHOD, DEFINITIONS, true); //$NON-NLS-1$
- Set matches = search(pattern, list);
- assertMatch( matches, cpp, code.indexOf( "operator|/*def1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "M/*def2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "~M/*def3*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "m2/*def4*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "m3/*def5*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "foo/*def6*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "M/*def7*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "m1/*def8*/" ) ); //$NON-NLS-1$
- assertEquals( 9, matches.size());
- //vp2 operator with space in search pattern
- pattern=SearchEngine.createSearchPattern("operator |*", METHOD, DEFINITIONS, true); //$NON-NLS-1$
- matches = search(pattern, list);
- assertEquals( 2, matches.size());
- assertMatch( matches, cpp, code.indexOf( "operator|/*def1*/" ) ); //$NON-NLS-1$
- }
- // test SE50, SE100c
- public void testMethodReference() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class K{ \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" K(); \n" ); //$NON-NLS-1$
- writer.write(" virtual ~K(); \n" ); //$NON-NLS-1$
- writer.write(" static int fx(); \n" ); //$NON-NLS-1$
- writer.write(" inline void fz(){} \n" ); //$NON-NLS-1$
- writer.write(" void fy(){fz/*ref*/()} \n" ); //$NON-NLS-1$
- writer.write(" int kk; \n" ); //$NON-NLS-1$
- writer.write(" explicit K(int i){} \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- importFile( "MethodReference.h", code ); //$NON-NLS-1$
-
- writer = new StringWriter();
- writer.write("#include \"MethodReference.h\"\n" ); //$NON-NLS-1$
- writer.write("K::K(){} \n" ); //$NON-NLS-1$
- writer.write("K::~K(){} \n" ); //$NON-NLS-1$
- writer.write("int K::fx(){return 12;} \n" ); //$NON-NLS-1$
- writer.write("void fw(){} \n" ); //$NON-NLS-1$
- writer.write("void foo(){ \n" ); //$NON-NLS-1$
- writer.write(" int i = K::fx/*ref1*/(); \n" ); //$NON-NLS-1$
- writer.write(" (new K/*ref4*/())->fy/*ref2*/(); \n" ); //$NON-NLS-1$
- writer.write(" fw(); \n" ); //$NON-NLS-1$
- writer.write(" K k; \n" ); //$NON-NLS-1$
- writer.write(" k.fy/*ref3*/(); \n" ); //$NON-NLS-1$
- writer.write(" k.~K/*ref5*/(); \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code2 = writer.toString();
- IFile k = importFile( "MethodReference.cpp", code2 ); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.findElement(new Path("MethodReference.cpp")); //$NON-NLS-1$
- //vp1 ::, ->, . , inline references
- ICSearchPattern pattern=SearchEngine.createSearchPattern("f*", METHOD, REFERENCES, true); //$NON-NLS-1$
- Set matches = search( pattern,list);
- //assertEquals( 3, matches.size());
- assertMatch( matches, k, code2.lastIndexOf( "fx/*ref1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, k, code2.indexOf( "fy/*ref2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, k, code2.lastIndexOf( "fy/*ref3*/" ) ); //$NON-NLS-1$
- //vp2 constructor
- pattern=SearchEngine.createSearchPattern("*K", METHOD, REFERENCES, true); //$NON-NLS-1$
- matches = search( pattern);
- assertEquals( 2, matches.size());
- assertMatch( matches, k, code2.indexOf( "K/*ref4*/" ) ); //$NON-NLS-1$
- assertMatch( matches, k, code2.indexOf( "~K/*ref5*/" ) ); //$NON-NLS-1$
- }
- // test SE50, SE100c
- public void testMethodReferenceOperator() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class K{ \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" K(); \n" ); //$NON-NLS-1$
- writer.write(" K& operator == (const K &rhs){} \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("void foo(){ \n" ); //$NON-NLS-1$
- writer.write(" K k; \n" ); //$NON-NLS-1$
- writer.write(" K m=k; \n" ); //$NON-NLS-1$
- writer.write(" if (m.operator==/*ref1*/(k)){} \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "MethodReferenceOperator.cpp", source ); //$NON-NLS-1$
- //vp1 explicit operator== call
- ICSearchPattern pattern=SearchEngine.createSearchPattern("operator ==", METHOD, REFERENCES, true); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 1, matches.size());
- assertMatch( matches, cpp, source.indexOf( "operator==/*ref1*/" ) ); //$NON-NLS-1$
- }
- public void testMethodReferenceImplicitOperator() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class K{ \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" K(); \n" ); //$NON-NLS-1$
- writer.write(" K& operator == (const K &rhs){} \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("void foo(){ \n" ); //$NON-NLS-1$
- writer.write(" K k; \n" ); //$NON-NLS-1$
- writer.write(" K m=k; \n" ); //$NON-NLS-1$
- writer.write(" if (m==/*ref*/k){} \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "MethodReferenceImplicitOperator.cpp", source ); //$NON-NLS-1$
- //vp1 implicit operator== call (A==B)
- ICSearchPattern pattern=SearchEngine.createSearchPattern("operator ==", METHOD, REFERENCES, true); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 1, matches.size());
- assertMatch( matches, cpp, source.indexOf( "==/*ref*/" ) ); //$NON-NLS-1$
- }
-
- //76169
- public void testMethodReferenceInitializer() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class Mammal { \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" Mammal(int t): num(t){} \n" ); //$NON-NLS-1$
- writer.write(" private: \n" ); //$NON-NLS-1$
- writer.write(" int num; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("class Bear : Mammal{ \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" Bear(int t): Mammal(t) {} \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile g = importFile( "MethodReferenceInitializer.cpp", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "Mammal", METHOD, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern );
-
- assertEquals( 1, matches.size() );
- assertMatch( matches, g, code.indexOf( "Mammal(t)" ) ); //$NON-NLS-1$
-
- }
- public void testMethodReferenceInline() throws Exception {
-
- Writer writer = new StringWriter();
- writer.write("class A{ \n" ); //$NON-NLS-1$
- writer.write(" friend class M; \n" ); //$NON-NLS-1$
- writer.write(" void aa(); \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("class M { \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" M(); \n" ); //$NON-NLS-1$
- writer.write(" void zz(){a->aa();}//ref \n" ); //$NON-NLS-1$
- writer.write(" A *a; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile gh = importFile( "MethodReferenceInline.cpp", code ); //$NON-NLS-1$
- //ref inside inline defn
- ICSearchPattern pattern=SearchEngine.createSearchPattern("aa", METHOD, REFERENCES, true); //$NON-NLS-1$
- Set matches = search(pattern);
- assertEquals( 1, matches.size());
- assertMatch( matches, gh, code.indexOf( "aa();}//ref" ) ); //$NON-NLS-1$
- }
- public void testMethodReferenceWithCctor() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class C{ \n" ); //$NON-NLS-1$
- writer.write(" void cc(){} \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("void g(){ \n" ); //$NON-NLS-1$
- writer.write(" C().cc/*ref*/();\n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "MethodReferenceWithCctor.cpp", source ); //$NON-NLS-1$
- //vp1 constructor by itself
- ICSearchPattern pattern=SearchEngine.createSearchPattern("cc", METHOD, REFERENCES, true); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 1, matches.size());
- assertMatch( matches, cpp, source.indexOf( "cc/*ref*/" ) ); //$NON-NLS-1$
-
- }
- public void testConstructorReferenceArg() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class C{ \n" ); //$NON-NLS-1$
- writer.write(" C(); \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("void f(C c){} \n" ); //$NON-NLS-1$
- writer.write("void g(){ \n" ); //$NON-NLS-1$
- writer.write(" f(C/*ref*/());; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "ConstructorReferenceArg.cpp", source ); //$NON-NLS-1$
- //vp1 constructor, destructor
- ICSearchPattern pattern=SearchEngine.createSearchPattern("C", METHOD, REFERENCES, true); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 1, matches.size());
- assertMatch( matches, cpp, source.indexOf( "C/*ref*/" ) ); //$NON-NLS-1$
-
- }
- public void testConstructorReferenceAlone() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class C{ \n" ); //$NON-NLS-1$
- writer.write(" C(){} \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("void g(){ \n" ); //$NON-NLS-1$
- writer.write(" C/*ref*/(); \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "ConstructorReferenceAlone.cpp", source ); //$NON-NLS-1$
- //vp1 constructor by itself
- ICSearchPattern pattern=SearchEngine.createSearchPattern("C", METHOD, REFERENCES, true); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 1, matches.size());
- assertMatch( matches, cpp, source.indexOf( "C/*ref*/" ) ); //$NON-NLS-1$
-
- }
- public void testDestructorReference() throws Exception {
-
- Writer writer = new StringWriter();
- writer.write("class A{ \n" ); //$NON-NLS-1$
- writer.write(" friend class M; \n" ); //$NON-NLS-1$
- writer.write(" ~A(); \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("class M { \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" M(); \n" ); //$NON-NLS-1$
- writer.write(" ~M(); \n" ); //$NON-NLS-1$
- writer.write(" A *a; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("M::~M(){a->~A();}//ref \n" ); //$NON-NLS-1$
- writer.write("void f() { \n" ); //$NON-NLS-1$
- writer.write(" M m; \n" ); //$NON-NLS-1$
- writer.write(" m.~M();//ref \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "DestructorReference.cpp", source ); //$NON-NLS-1$
- //vp1 arrow ref
- ICSearchPattern pattern=SearchEngine.createSearchPattern("~A", METHOD, REFERENCES, true); //$NON-NLS-1$
- Set matches = search(pattern);
- assertEquals( 1, matches.size());
- assertMatch( matches, cpp, source.indexOf( "~A();}//ref" ) ); //$NON-NLS-1$
- //vp2 dot ref
- pattern=SearchEngine.createSearchPattern("~M", METHOD, REFERENCES, true); //$NON-NLS-1$
- matches = search(pattern);
- assertEquals( 1, matches.size());
- assertMatch( matches, cpp, source.indexOf( "~M();//ref" ) ); //$NON-NLS-1$
- }
- public void testFunctionDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write("namespace N{ \n" ); //$NON-NLS-1$
- writer.write("int f1/*decl*/(){return 0;} \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("static int f2/*decl*/(); \n" ); //$NON-NLS-1$
- writer.write("extern int f3/*decl*/(); \n" ); //$NON-NLS-1$
- writer.write("inline void f4/*decl*/(int *a, int *b){int t=*b; *b=*a; *a=t;} \n" ); //$NON-NLS-1$
- String header = writer.toString();
- IFile h = importFile( "FunctionDeclaration.h", header ); //$NON-NLS-1$
-
- writer = new StringWriter();
- writer.write("#include \"FunctionDeclaration.h\"\n" ); //$NON-NLS-1$
- writer.write("void f5()/*decl*/{ \n" ); //$NON-NLS-1$
- writer.write(" int i = N::f1(); \n" ); //$NON-NLS-1$
- writer.write(" int j = f3(); \n" ); //$NON-NLS-1$
- writer.write(" f4(&i, &j); \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "FunctionDeclaration.cpp", source ); //$NON-NLS-1$
- ICSearchPattern pattern=SearchEngine.createSearchPattern("f*", FUNCTION, DECLARATIONS, true); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- Set matches = search( pattern,list );
- //assertMatch( matches, h, header.indexOf( "f1" ) ); //$NON-NLS-1$
- assertMatch( matches, h, header.indexOf( "f2" ) ); //$NON-NLS-1$
- assertMatch( matches, h, header.indexOf( "f3" ) ); //$NON-NLS-1$
- //assertMatch( matches, h, header.indexOf( "f4" ) ); //$NON-NLS-1$
- //assertMatch( matches, cpp, source.indexOf( "f5" ) ); //$NON-NLS-1$
- assertEquals( 2, matches.size());
-
- }
- public void testFunctionDefinition() throws Exception {
- Writer writer = new StringWriter();
- writer.write("namespace N{ \n" ); //$NON-NLS-1$
- writer.write("int f1/*def*/(){return 0;} \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("static int f2(); \n" ); //$NON-NLS-1$
- writer.write("extern int f3/*decl*/(); \n" ); //$NON-NLS-1$
- writer.write("inline void f4/*def*/(int *a, int *b){int t=*b; *b=*a; *a=t;} \n" ); //$NON-NLS-1$
- String header = writer.toString();
- IFile h = importFile( "FunctionDefinition.h", header ); //$NON-NLS-1$
-
- writer = new StringWriter();
- writer.write("#include \"FunctionDefinition.h\"\n" ); //$NON-NLS-1$
- writer.write("int f2/*def*/(){return 2;} \n" ); //$NON-NLS-1$
- writer.write("void f5/*def*/(){ \n" ); //$NON-NLS-1$
- writer.write(" int i = N::f1(); \n" ); //$NON-NLS-1$
- writer.write(" int j = f3(); \n" ); //$NON-NLS-1$
- writer.write(" f4(&i, &j); \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "FunctionDefinition.cpp", source ); //$NON-NLS-1$
- ICSearchPattern pattern=SearchEngine.createSearchPattern("f*", FUNCTION, DEFINITIONS, true); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- Set matches = search( pattern,list );
- Iterator i = matches.iterator();
- while (i.hasNext()){
- BasicSearchMatch match =(BasicSearchMatch) i.next();
- int x=0;
- }
-
- assertMatch( matches, h, header.indexOf( "f1" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "f2" ) ); //$NON-NLS-1$
- assertMatch( matches, h, header.indexOf( "f4" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "f5" ) ); //$NON-NLS-1$
- assertEquals( 4, matches.size());
-
- }
- //SE50 working set
- public void testFunctionReference() throws Exception {
- Writer writer = new StringWriter();
- writer.write("namespace N{ \n" ); //$NON-NLS-1$
- writer.write("int fz(){return 0;} \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String header = writer.toString();
- importFile( "FunctionReference.h", header ); //$NON-NLS-1$
-
- writer = new StringWriter();
- writer.write("#include \"FunctionReference.h\" \n" ); //$NON-NLS-1$
- writer.write("int fw(){return 0;} \n" ); //$NON-NLS-1$
- writer.write("void fg(int i){} \n" ); //$NON-NLS-1$
- writer.write("void f(){ \n" ); //$NON-NLS-1$
- writer.write(" int i = N::fz/*ref1*/(); \n" ); //$NON-NLS-1$
- writer.write(" fg/*ref2*/(fw/*ref3*/()); \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("using N::fz/*ref4*/; \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile k = importFile( "FunctionReference.cpp", source ); //$NON-NLS-1$
- ICElement[] list = {cproject.findElement(new Path("FunctionReference.cpp"))}; //$NON-NLS-1$
- ICSearchPattern pattern=SearchEngine.createSearchPattern("f*", FUNCTION, REFERENCES, true); //$NON-NLS-1$
-
- Set matches = search( pattern,list);
- assertMatch( matches, k, source.indexOf( "fz/*ref1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, k, source.lastIndexOf( "fg/*ref2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, k, source.indexOf( "fw/*ref3*/" ) ); //$NON-NLS-1$
- assertMatch( matches, k, source.lastIndexOf( "fz/*ref4*/" ) ); //$NON-NLS-1$
- assertEquals( 4, matches.size());
-
- }
- // test SE53 // SE60c
- public void testFieldDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write(" namespace N2 { \n" ); //$NON-NLS-1$
- writer.write(" struct linkedlist1{ \n" ); //$NON-NLS-1$
- writer.write(" long field1_t; \n" ); //$NON-NLS-1$
- writer.write(" struct linkedlist1 *field2; \n" ); //$NON-NLS-1$
- writer.write(" static int sfield; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" class linkedlist2{ \n" ); //$NON-NLS-1$
- writer.write(" unsigned char field3; \n" ); //$NON-NLS-1$
- writer.write(" class linkedlist2 *field4; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" class C { \n" ); //$NON-NLS-1$
- writer.write(" struct {} field5; \n" ); //$NON-NLS-1$
- writer.write(" class C1 { \n" ); //$NON-NLS-1$
- writer.write(" N2::linkedlist2 *field6; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile gh = importFile( "FieldDeclaration.h", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern("*", FIELD, DEFINITIONS, true); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- Set matches = search( pattern,list);
- assertMatch( matches, gh, code.indexOf( "field1" ) ); //$NON-NLS-1$
- assertMatch( matches, gh, code.indexOf( "field2" ) ); //$NON-NLS-1$
- assertMatch( matches, gh, code.indexOf( "field3" ) ); //$NON-NLS-1$
- assertMatch( matches, gh, code.indexOf( "field4" ) ); //$NON-NLS-1$
- assertMatch( matches, gh, code.indexOf( "field5" ) ); //$NON-NLS-1$
- assertMatch( matches, gh, code.indexOf( "field6" ) ); //$NON-NLS-1$
- assertEquals( 6, matches.size());
-
- }
- public void testBitFieldDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write("struct Date { \n" ); //$NON-NLS-1$
- writer.write(" unsigned nWeekDay : 3; // 0..7 (3 bits) \n" ); //$NON-NLS-1$
- writer.write(" unsigned nMonthDay : 6; // 0..31 (6 bits) \n" ); //$NON-NLS-1$
- writer.write(" unsigned : 0; // Force alignment to next boundary.\n" ); //$NON-NLS-1$
- writer.write(" unsigned nMonth : 5; // 0..12 (5 bits) \n" ); //$NON-NLS-1$
- writer.write(" unsigned nYear : 8; // 0..100 (8 bits) \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile cpp = importFile( "BitFieldDeclaration.cpp", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern("n*", FIELD, DEFINITIONS, true); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- Set matches = search( pattern,list);
- //currently anon bitfields are not found (80166)
- assertEquals( 4, matches.size());
- assertMatch( matches, cpp, code.indexOf( "nWeekDay" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "nMonthDay" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "nMonth" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "nYear" ) ); //$NON-NLS-1$
- }
-
- // test SE63b var field defn
- public void testFieldDefinition() throws Exception {
-
- Writer writer = new StringWriter();
- writer.write(" enum ZooLocs {ZOOANIMAL, BEAR, PANDA};\n" ); //$NON-NLS-1$
- writer.write(" namespace zoo { \n" ); //$NON-NLS-1$
- writer.write(" class ZooAnimal{ \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" ZooAnimal(char *s = \"ZooAnimal\"); \n" ); //$NON-NLS-1$
- writer.write(" protected: \n" ); //$NON-NLS-1$
- writer.write(" char *name/*def*/; \n" ); //$NON-NLS-1$
- writer.write(" ZooAnimal *next/*def*/; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" class Mammal{ \n" ); //$NON-NLS-1$
- writer.write(" protected: \n" ); //$NON-NLS-1$
- writer.write(" bool isCarnivore/*def*/; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" class Bear : public ZooAnimal, Mammal{\n" ); //$NON-NLS-1$
- writer.write(" public: static int number; \n" ); //$NON-NLS-1$
- writer.write(" protected: \n" ); //$NON-NLS-1$
- writer.write(" ZooLocs zooArea/*def*/; \n" ); //$NON-NLS-1$
- writer.write(" class Beez{ \n" ); //$NON-NLS-1$
- writer.write(" const double dutch/*def*/; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" int zoo::Bear::number/*def*/=3; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile z = importFile( "FieldDefinition.cpp", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern("*", FIELD, DEFINITIONS, true); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- Set matches = search( pattern,list);
- assertEquals( 6, matches.size());
- assertMatch( matches, z, code.indexOf( "name/*def*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "next/*def*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "isCarnivore/*def*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "zooArea/*def*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "dutch/*def*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "number/*def*/" ) ); //$NON-NLS-1$
-}
- public void testFieldReference() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class Mammal {//decl \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" Mammal(bool b): isCarnivore/*ref*/(b){} \n" ); //$NON-NLS-1$
- writer.write(" private: \n" ); //$NON-NLS-1$
- writer.write(" bool isCarnivore; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("class Bear : Mammal{ \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" Bear(int s,int t): Mammal(true) { \n" ); //$NON-NLS-1$
- writer.write(" biotics.matureYears=s;//ref \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" struct { \n" ); //$NON-NLS-1$
- writer.write(" int matureYears; \n" ); //$NON-NLS-1$
- writer.write(" } biotics; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("struct bioticPotential { \n" ); //$NON-NLS-1$
- writer.write(" int litterSize; \n" ); //$NON-NLS-1$
- writer.write(" int matureYears; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("int main(int argc, char **argv) { \n" ); //$NON-NLS-1$
- writer.write(" bioticPotential brownbear_bt = {1, 3}; \n" ); //$NON-NLS-1$
- writer.write(" Bear *grizzly = new Bear(4,3); \n" ); //$NON-NLS-1$
- writer.write(" brownbear_bt.matureYears = grizzly->biotics.matureYears;//ref\n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile b = importFile( "FieldReference.cpp", code ); //$NON-NLS-1$
- //vp1 class field ref in constructor initializer list
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "isCarnivore", FIELD, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, b, code.indexOf( "isCarnivore/*ref*/" ) ); //$NON-NLS-1$
- //vp2 struct field ref in method to anon struct, ref in function on rhs
- pattern = SearchEngine.createSearchPattern( "biotics", FIELD, REFERENCES, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 2, matches.size() );
- assertMatch( matches, b, code.indexOf( "biotics.matureYears=s;" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "biotics.matureYears;//ref" ) ); //$NON-NLS-1$
-
- }
- //76203
- public void testNestedFieldReference() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class Bear { \n" ); //$NON-NLS-1$
- writer.write("public: \n" ); //$NON-NLS-1$
- writer.write(" Bear(int s,int t) { \n" ); //$NON-NLS-1$
- writer.write(" biotics.matureYears=s;//ref \n" ); //$NON-NLS-1$
- writer.write(" biotics.littersPerYear=t; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" struct { \n" ); //$NON-NLS-1$
- writer.write(" int matureYears; \n" ); //$NON-NLS-1$
- writer.write(" int littersPerYear; \n" ); //$NON-NLS-1$
- writer.write(" } biotics; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("struct bioticPotential { \n" ); //$NON-NLS-1$
- writer.write(" int litterSize; \n" ); //$NON-NLS-1$
- writer.write(" int matureYears; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("int main(int argc, char **argv) { \n" ); //$NON-NLS-1$
- writer.write(" bioticPotential brownbear_bt = {1, 3}; \n" ); //$NON-NLS-1$
- writer.write(" Bear *grizzly = new Bear(4,3); \n" ); //$NON-NLS-1$
- writer.write(" brownbear_bt.matureYears = grizzly->biotics.matureYears;//ref\n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile b = importFile( "NestedFieldReference.cpp", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "matureYears", FIELD, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 3, matches.size() );
- assertMatch( matches, b, code.indexOf( "matureYears = grizzly" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "matureYears;//ref" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "matureYears=s;//ref,ref" ) ); //$NON-NLS-1$ /
-
- }
- public void testVarDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write(" namespace N2 { \n" ); //$NON-NLS-1$
- writer.write(" class linkedlist2{ \n" ); //$NON-NLS-1$
- writer.write(" int field3; \n" ); //$NON-NLS-1$
- writer.write(" class linkedlist2 *field4; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" class linkedlist2 var1; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write("extern bool var2; \n" ); //$NON-NLS-1$
- writer.write("unsigned int var3(1024); \n" ); //$NON-NLS-1$
- writer.write("unsigned long long var4=123456, \n" ); //$NON-NLS-1$
- writer.write(" var5=1234567; \n" ); //$NON-NLS-1$
- writer.write("void f(){ \n" ); //$NON-NLS-1$
- writer.write(" volatile unsigned long var6; \n" ); //$NON-NLS-1$
- writer.write(" for (register int var7=0; var7<10000; var7++){} \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile gh = importFile( "VarDeclaration.h", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern=SearchEngine.createSearchPattern("*", VAR, DECLARATIONS, true); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- Set matches = search( pattern,list);
- assertEquals( 1, matches.size());
- assertMatch( matches, gh, code.indexOf( "var2" ) ); //$NON-NLS-1$
- }
- // SE63a var field defn
- public void testVarDefinition() throws Exception {
-
- Writer writer = new StringWriter();
- writer.write("namespace zoo { \n" ); //$NON-NLS-1$
- writer.write(" int var1/*def*/; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("extern int var; \n" ); //$NON-NLS-1$
- writer.write("extern char var2/*def*/=3; \n" ); //$NON-NLS-1$
- writer.write("int& var3/*def*/=zoo::var1; \n" ); //$NON-NLS-1$
- writer.write("long long var4/*def*/; \n" ); //$NON-NLS-1$
- writer.write("void f(){ \n" ); //$NON-NLS-1$
- writer.write(" short var5/*def*/=0xabcd; \n" ); //$NON-NLS-1$
- writer.write(" const float var6/*def*/=1.5;\n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("class A{ \n" ); //$NON-NLS-1$
- writer.write(" void f(){ \n" ); //$NON-NLS-1$
- writer.write(" long double** var7/*def*/; \n" ); //$NON-NLS-1$
- writer.write(" float var8/*def*/=1.5; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile cpp = importFile( "VarDefinition.cpp", code ); //$NON-NLS-1$
- ICSearchPattern pattern = SearchEngine.createSearchPattern("*", VAR, DEFINITIONS, true); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- Set matches = search( pattern,list);
- assertEquals( 8, matches.size());
- assertMatch( matches, cpp, code.indexOf( "var1" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "var2" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "var3" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "var4" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "var5" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "var6" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "var7" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, code.indexOf( "var8" ) ); //$NON-NLS-1$
- }
- // test SE60b
- public void testVarReference() throws Exception {
- Writer writer = new StringWriter();
- writer.write("char * strcpy( char *, const char * ); \n" ); //$NON-NLS-1$
- writer.write("namespace zoo { \n" ); //$NON-NLS-1$
- writer.write(" int sci=1; \n" ); //$NON-NLS-1$
- writer.write(" class ZooAnimal{ \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" ZooAnimal(char *s = \"ZooAnimal\"){} \n" ); //$NON-NLS-1$
- writer.write(" protected: \n" ); //$NON-NLS-1$
- writer.write(" char *name; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" class Bear : public ZooAnimal{ \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" Bear(char *sci = \"Ursidae\" ); \n" ); //$NON-NLS-1$
- writer.write(" protected: \n" ); //$NON-NLS-1$
- writer.write(" char *sciName; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" Bear::Bear(char *sci) { \n" ); //$NON-NLS-1$
- writer.write(" strcpy (sciName, sci/*ref1*/); \n" ); //$NON-NLS-1$
- writer.write(" int j=zoo::sci/*ref2*/; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write("void f() { \n" ); //$NON-NLS-1$
- writer.write(" int sci; \n" ); //$NON-NLS-1$
- writer.write(" sci/*ref3*/++; \n" ); //$NON-NLS-1$
- writer.write(" --sci/*ref4*/; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile z = importFile( "VarReference.cpp", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern=SearchEngine.createSearchPattern("sci", VAR, REFERENCES, true); //$NON-NLS-1$
- Set matches = search(pattern);
- assertEquals( 4, matches.size());
- assertMatch( matches, z, code.indexOf( "sci/*ref1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "sci/*ref2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "sci/*ref3*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "sci/*ref4*/" ) ); //$NON-NLS-1$
-
- }
- // 75901 // test SE60f1 var all
- public void testVarDeclarationArgument() throws Exception {
- Writer writer = new StringWriter();
- writer.write("namespace zoo { \n" ); //$NON-NLS-1$
- writer.write(" class Bear { \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" Bear( char *s/*decl1*/ = \"Bear\" );\n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" Bear::Bear(char *s/*decl2*/) \n" ); //$NON-NLS-1$
- writer.write(" : ZooAnimal(s) { \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile z = importFile( "VarDeclarationArgument.cpp", code ); //$NON-NLS-1$
- ICSearchPattern pattern=SearchEngine.createSearchPattern("s", VAR, DECLARATIONS, true); //$NON-NLS-1$
- Set matches = search(pattern);
- assertMatch( matches, z, code.indexOf( "s/*decl1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "s/*decl2*/" ) ); //$NON-NLS-1$
- assertEquals( 2, matches.size());
-
- }
- // 72735 test SE60f2 var all
- public void testVarReferenceInitializer() throws Exception{
- Writer writer = new StringWriter();
- writer.write("enum ZooLocs {ZOOANIMAL, BEAR, PANDA}; \n" ); //$NON-NLS-1$
- writer.write("namespace zoo { \n" ); //$NON-NLS-1$
- writer.write(" class ZooAnimal{ \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" ZooAnimal(char *s = \"ZooAnimal\"); \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" class Bear : public ZooAnimal{ \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" Bear( char *s = \"Bear\", ZooLocs loc = \"BEAR\" ); \n" ); //$NON-NLS-1$
- writer.write(" protected: \n" ); //$NON-NLS-1$
- writer.write(" ZooLocs zooArea; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" Bear::Bear(char *s, ZooLocs loc) \n" ); //$NON-NLS-1$
- writer.write(" : ZooAnimal(s), zooArea (loc/*ref*/) {} \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile z = importFile( "VarReferenceInitializer.cpp", code ); //$NON-NLS-1$
- ICSearchPattern pattern=SearchEngine.createSearchPattern("loc", VAR, REFERENCES, true); //$NON-NLS-1$
- Set matches = search(pattern);
- assertEquals( 1, matches.size());
- assertMatch( matches, z, code.indexOf( "loc/*ref*/" ) ); //$NON-NLS-1$
-
- }
- // 75901 // test SE60f1 var all
- public void testVarDefinitionArgument() throws Exception {
- Writer writer = new StringWriter();
- writer.write(" class C { \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" C( char *s/*def1*/ = \"Bear\" );\n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
- writer.write(" C::C(char *s/*def2*/){} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile z = importFile( "VarDeclarationArgument.cpp", code ); //$NON-NLS-1$
- ICSearchPattern pattern=SearchEngine.createSearchPattern("s", VAR, DEFINITIONS, true); //$NON-NLS-1$
- Set matches = search(pattern);
- //Changed to 0 as we no longer encode parameter strings as individual references
- assertEquals( 0, matches.size());
-
- }
-
- // test 85a union declaration
- public void testUnionDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write("enum Tokentype {ID, ICONST}; \n" ); //$NON-NLS-1$
- writer.write("class Token { \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" Tokentype tok; \n" ); //$NON-NLS-1$
- writer.write(" union { //anon field \n" ); //$NON-NLS-1$
- writer.write(" char *sval; \n" ); //$NON-NLS-1$
- writer.write(" int ival; \n" ); //$NON-NLS-1$
- writer.write(" double dval; \n" ); //$NON-NLS-1$
- writer.write(" } val1; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("static union { //anon static \n" ); //$NON-NLS-1$
- writer.write(" char *sval; \n" ); //$NON-NLS-1$
- writer.write(" int ival; \n" ); //$NON-NLS-1$
- writer.write(" double dval; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("union TokenValue { \n" ); //$NON-NLS-1$
- writer.write("TokenValue (int ix) {ival = ix;} \n" ); //$NON-NLS-1$
- writer.write("TokenValue (char *s) {sval = s;} \n" ); //$NON-NLS-1$
- writer.write("TokenValue () {} \n" ); //$NON-NLS-1$
- writer.write(" char *sval; \n" ); //$NON-NLS-1$
- writer.write(" int ival; \n" ); //$NON-NLS-1$
- writer.write(" double dval; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("TokenValue val2; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile uh = importFile( "UnionDeclaration.h", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", UNION, DEFINITIONS, true ); //$NON-NLS-1$
- ICElement[] list = new ICElement[1];
- list[0]=cproject.getCProject();
- Set matches = search( pattern,list );
-
- assertEquals( 3, matches.size() );
- assertMatch( matches, uh, code.indexOf( "union { //anon field" ) ); //$NON-NLS-1$
- assertMatch( matches, uh, code.indexOf( "union { //anon static" ) ); //$NON-NLS-1$
- assertMatch( matches, uh, code.indexOf( "TokenValue" ) ); //$NON-NLS-1$
-
- }
- public void testUnionReference() throws Exception {
- Writer writer = new StringWriter();
- writer = new StringWriter();
- writer.write("enum Tokentype {ID, ICONST}; \n" ); //$NON-NLS-1$
- writer.write("class Token { \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" Tokentype tok; \n" ); //$NON-NLS-1$
- writer.write("union TokenValue { \n" ); //$NON-NLS-1$
- writer.write("TokenValue (int ix) {ival = ix;} \n" ); //$NON-NLS-1$
- writer.write("TokenValue (char *s) {sval = s;} \n" ); //$NON-NLS-1$
- writer.write("TokenValue () {} \n" ); //$NON-NLS-1$
- writer.write(" char *sval; \n" ); //$NON-NLS-1$
- writer.write(" int ival; \n" ); //$NON-NLS-1$
- writer.write(" double dval; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("TokenValue val2; \n" ); //$NON-NLS-1$
- String header = writer.toString();
- importFile( "UnionReference.h", header ); //$NON-NLS-1$
- writer = new StringWriter();
- writer.write("#include \"UnionReference.h\" \n" ); //$NON-NLS-1$
- writer.write("union Uu{int i; double d;}; \n" ); //$NON-NLS-1$
- writer.write("void f(TokenValue/*ref1*/ t){}; \n" ); //$NON-NLS-1$
- writer.write("void g(){ \n" ); //$NON-NLS-1$
- writer.write(" f(TokenValue/*ref2*/(3)); \n" ); //$NON-NLS-1$
- writer.write(" char *p=\"hello\"; \n" ); //$NON-NLS-1$
- writer.write(" f(p); \n" ); //$NON-NLS-1$
- writer.write(" TokenValue/*ref3*/ t=(TokenValue/*ref4*/) p;\n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("Uu/*ref5*/ t; \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "UnionReference.cpp", source ); //$NON-NLS-1$
- ICElement[] list = {cproject.findElement(new Path("UnionReference.cpp"))}; //$NON-NLS-1$
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", UNION, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern, list );
-
- assertEquals( 5, matches.size() );
- assertMatch( matches, cpp, source.indexOf( "TokenValue/*ref1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "TokenValue/*ref2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "TokenValue/*ref3*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "TokenValue/*ref4*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "Uu/*ref5*/" ) ); //$NON-NLS-1$
-
- }
- // test SE44
- public void testEnumerationDeclaration() throws Exception {
- Writer writer = new StringWriter();
- //next line commented because it affects testEnumeratorDeclarationCase
- //writer.write("enum EE/*def1*/ {A0, A1}; \n" ); //$NON-NLS-1$
- writer.write("class B { \n" ); //$NON-NLS-1$
- writer.write(" enum EE/*def2*/ {B0, B1}; \n" ); //$NON-NLS-1$
- writer.write(" B(){ \n" ); //$NON-NLS-1$
- writer.write(" enum EE/*def3*/ {M0, M1}; \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" void foo(); \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String header = writer.toString();
- IFile h = importFile( "EnumerationDeclaration.h", header ); //$NON-NLS-1$
- writer = new StringWriter();
- writer.write("#include \"EnumerationDeclaration.h\" \n" ); //$NON-NLS-1$
- writer.write("void B::foo() { \n" ); //$NON-NLS-1$
- writer.write(" enum EE/*def4*/ {F0, F1}; \n" ); //$NON-NLS-1$
- writer.write(" enum EE ee; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("void boo() { \n" ); //$NON-NLS-1$
- writer.write(" enum EE/*def5*/ {G0, G1}; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "EnumerationDeclaration.cpp", source ); //$NON-NLS-1$
- //vp1 global,class,constructor; working set
- ICElement[] list = {cproject.findElement(new Path("EnumerationDeclaration.h"))}; //$NON-NLS-1$
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "EE", ENUM, DECLARATIONS, true ); //$NON-NLS-1$
- Set matches = search( pattern, list );
- assertEquals( 2, matches.size() );
- //if including first line in snippet, then include this vp and change 2 to 3 results
- //assertMatch( matches, h, header.indexOf( "EE/*def1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, h, header.indexOf( "EE/*def2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, h, header.indexOf( "EE/*def3*/" ) ); //$NON-NLS-1$
- //vp2 method,function; working set
- list[0] = cproject.findElement(new Path("EnumerationDeclaration.cpp")); //$NON-NLS-1$
- matches = search( pattern, list );
- assertEquals( 2, matches.size() );
- assertMatch( matches, cpp, source.indexOf( "EE/*def4*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "EE/*def5*/" ) ); //$NON-NLS-1$
- }
- public void testEnumerationReference() throws Exception {
- Writer writer = new StringWriter();
- //next line commented because it affects testEnumeratorDeclarationCase
- //writer.write("enum EE {A0, A1}; \n" ); //$NON-NLS-1$
- writer.write("class B { \n" ); //$NON-NLS-1$
- writer.write(" enum EE {B0, B1}; \n" ); //$NON-NLS-1$
- writer.write(" B(){ \n" ); //$NON-NLS-1$
- writer.write(" } \n" ); //$NON-NLS-1$
- writer.write(" EE/*ref8*/ bee; \n" ); //$NON-NLS-1$
- writer.write(" void foo(); \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("B::EE/*ref2*/ eieio; \n" ); //$NON-NLS-1$
- String header = writer.toString();
- IFile h = importFile( "EnumerationReference.h", header ); //$NON-NLS-1$
- writer = new StringWriter();
- writer.write("#include \"EnumerationReference.h\" \n" ); //$NON-NLS-1$
- writer.write("void B::foo() { \n" ); //$NON-NLS-1$
- writer.write(" enum EE {F0, F1}; \n" ); //$NON-NLS-1$
- writer.write(" enum EE/*ref3*/ ib4e; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("void boo(B::EE/*ref4*/ e) { \n" ); //$NON-NLS-1$
- writer.write(" enum EE {G0, G1}; \n" ); //$NON-NLS-1$
- //if including first line in snippet, then include the next line too
- //writer.write(" ::EE/*ref5*/ f; \n" ); //$NON-NLS-1$
- writer.write(" EE/*ref6*/ i=(EE/*ref7*/)2; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "EnumerationReference.cpp", source ); //$NON-NLS-1$
- //vp1 global and class reference; working set
- ICElement[] list = {cproject.findElement(new Path("EnumerationReference.h"))}; //$NON-NLS-1$
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "EE", ENUM, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern, list );
- assertEquals( 2, matches.size() );
- assertMatch( matches, h, header.indexOf( "EE/*ref2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, h, header.indexOf( "EE/*ref8*/" ) ); //$NON-NLS-1$
- //vp2 reference in method,function,cast; working set
- list[0] = cproject.findElement(new Path("EnumerationReference.cpp")); //$NON-NLS-1$
- matches = search( pattern, list );
- assertEquals( 4, matches.size() );
- //if including first line in snippet, then include this vp and change 4 to 5 results
- //assertMatch( matches, cpp, source.indexOf( "EE/*ref5*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "EE/*ref3*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "EE/*ref4*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "EE/*ref6*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "EE/*ref7*/" ) ); //$NON-NLS-1$
- //vp3 class-qualified reference in a function argument and class declaration; workspace
- pattern = SearchEngine.createSearchPattern( "B::EE", ENUM, REFERENCES, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 3, matches.size() );
- assertMatch( matches, h, header.indexOf( "EE/*ref2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, h, header.indexOf( "EE/*ref8*/" ) ); //$NON-NLS-1$
- assertMatch( matches, cpp, source.indexOf( "EE/*ref4*/" ) ); //$NON-NLS-1$
-
- }
- public void testEnumerationReferenceGlobal() throws Exception {
- Writer writer = new StringWriter();
- writer.write("enum E{E0}; \n" ); //$NON-NLS-1$
- writer.write("void f() { \n" ); //$NON-NLS-1$
- writer.write(" enum E{E1}; \n" ); //$NON-NLS-1$
- writer.write(" E e; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("E/*ref*/ f; \n" ); //$NON-NLS-1$
- String source = writer.toString();
- IFile cpp = importFile( "EnumerationReferenceGlobal.cpp", source ); //$NON-NLS-1$
- //vp1 global and class reference; working set
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "::E", ENUM, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, cpp, source.indexOf( "E/*ref*/" ) ); //$NON-NLS-1$
- }
- public void testEnumeratorDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write("enum ZooLocs {ZOOANIMAL, BEAR/*decl1*/}; \n" ); //$NON-NLS-1$
- writer.write("class Bear { \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" enum BType{BEAR/*decl2*/, PANDA/*decl3*/}; \n" ); //$NON-NLS-1$
- writer.write(" Bear(ZooLocs loc = ::BEAR ); \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile z = importFile( "EnumeratorDeclaration.cpp", code ); //$NON-NLS-1$
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "BEAR", ENUMTOR, DECLARATIONS, true ); //$NON-NLS-1$
- //vp1 enumtor in global and class scopes
- Set matches = search( pattern );
- assertEquals( 2, matches.size() );
- assertMatch( matches, z, code.indexOf( "BEAR/*decl1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "BEAR/*decl2*/" ) ); //$NON-NLS-1$
- //vp2 global enumtor with fully qualified search pattern
- pattern = SearchEngine.createSearchPattern( "::BEAR", ENUMTOR, DECLARATIONS, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, z, code.indexOf( "BEAR/*decl1*/" ) ); //$NON-NLS-1$
- //vp3 class enumtor with fully qualified search pattern
- pattern = SearchEngine.createSearchPattern( "Bear::PANDA", ENUMTOR, DECLARATIONS, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, z, code.indexOf( "PANDA" ) ); //$NON-NLS-1$
-
- }
- public void testEnumeratorReference() throws Exception {
- Writer writer = new StringWriter();
- writer.write("enum ZooLocs {ZOOANIMAL, BEAR}; \n" ); //$NON-NLS-1$
- writer.write("class Bear{ \n" ); //$NON-NLS-1$
- writer.write(" public: \n" ); //$NON-NLS-1$
- writer.write(" enum BType {BEAR=2, PANDA}; \n" ); //$NON-NLS-1$
- writer.write(" Bear(ZooLocs loc = ::BEAR/*ref1*/ );\n" ); //$NON-NLS-1$
- writer.write(" protected: \n" ); //$NON-NLS-1$
- writer.write(" ZooLocs zooArea; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- writer.write("Bear::Bear(ZooLocs loc){ \n" ); //$NON-NLS-1$
- writer.write(" zooArea=::BEAR/*ref2*/; \n" ); //$NON-NLS-1$
- writer.write(" BEAR/*ref3*/; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- writer.write("void f(){ \n" ); //$NON-NLS-1$
- writer.write(" Bear::PANDA/*ref5*/; \n" ); //$NON-NLS-1$
- writer.write("} \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile z = importFile( "EnumeratorReference.cpp", code ); //$NON-NLS-1$
- //vp1 fully qualified, partially qualified and unqualified reference
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "BEAR", ENUMTOR, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 3, matches.size() );
- assertMatch( matches, z, code.indexOf( "BEAR/*ref1*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "BEAR/*ref2*/" ) ); //$NON-NLS-1$
- assertMatch( matches, z, code.indexOf( "BEAR/*ref3*/" ) ); //$NON-NLS-1$
- pattern = SearchEngine.createSearchPattern( "Bear::PANDA", ENUMTOR, REFERENCES, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, z, code.indexOf( "PANDA/*ref5*/" ) ); //$NON-NLS-1$
- }
- public void testEnumeratorDeclarationCase() throws Exception {
- Writer writer = new StringWriter();
- writer.write("enum A {B}; \n" ); //$NON-NLS-1$
- writer.write("class C { \n" ); //$NON-NLS-1$
- writer.write(" enum D {B0}; \n" ); //$NON-NLS-1$
- writer.write("}; \n" ); //$NON-NLS-1$
- String code = writer.toString();
- IFile z = importFile( "EnumeratorDeclarationCase.cpp", code ); //$NON-NLS-1$
- //vp1 case sensitive qualified search on inside enumtor prefixed by outside enumtor
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "C::B0", ENUMTOR, DECLARATIONS, true ); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, z, code.indexOf( "B0" ) ); //$NON-NLS-1$
- //vp1 case insensitive qualified search on inside enumtor prefixed by outside enumtor
- pattern = SearchEngine.createSearchPattern( "C::B0", ENUMTOR, DECLARATIONS, false ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, z, code.indexOf( "B0" ) ); //$NON-NLS-1$
- }
- //typedef is not currently shown in the Search dialog
- //but are found when you select all types.
- public void testTypedefDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write(" class A { \n" ); //$NON-NLS-1$
- writer.write(" typedef struct alpha {} beta/*decl*/; \n" ); //$NON-NLS-1$
- writer.write(" }; \n" ); //$NON-NLS-1$
-
- String code = writer.toString();
- IFile f = importFile( "TypedefDeclaration.cpp", code ); //$NON-NLS-1$
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "beta", TYPEDEF, DECLARATIONS, true ); //$NON-NLS-1$
- Set matches = search( pattern );
-
- assertEquals( 1, matches.size() );
- assertMatch( matches, f, code.indexOf( "beta/*decl*/" ) ); //$NON-NLS-1$
- }
- public void testMacroDeclaration() throws Exception {
- Writer writer = new StringWriter();
- writer.write("#define paster/*decl1*/( n ) printf( \"token\" #n \" = %d\", token##n ) \n" ); //$NON-NLS-1$
- writer.write("#define token9/*decl2*/ 3 \n" ); //$NON-NLS-1$
- writer.write("#define HELLO/*decl3*/ \n" ); //$NON-NLS-1$
- writer.write("#ifdef HELLO \n" ); //$NON-NLS-1$
- writer.write(" #define HI/*decl4*/ \n" ); //$NON-NLS-1$
- writer.write("#endif \n" ); //$NON-NLS-1$
- writer.write("#ifdef GOODBYE \n" ); //$NON-NLS-1$
- writer.write(" #define BYE/*decl5*/ \n" ); //$NON-NLS-1$
- writer.write("#endif \n" ); //$NON-NLS-1$
- String header = writer.toString();
- IFile h = importFile( "MacroDeclaration.cpp", header ); //$NON-NLS-1$
- //vp1 identifier as a function with arguements
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "paster", MACRO, DECLARATIONS, true ); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, h, header.indexOf( "paster/*decl1*/" ) ); //$NON-NLS-1$
- //vp2 identifier with token-string
- pattern = SearchEngine.createSearchPattern( "token9", MACRO, DECLARATIONS, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, h, header.indexOf( "token9/*decl2*/" ) ); //$NON-NLS-1$
- //vp3 identifer without token-string
- pattern = SearchEngine.createSearchPattern( "HELLO", MACRO, DECLARATIONS, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, h, header.indexOf( "HELLO/*decl3*/" ) ); //$NON-NLS-1$
- //vp4-identifier inside defined ifdef
- pattern = SearchEngine.createSearchPattern( "HI", MACRO, DECLARATIONS, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 1, matches.size() );
- assertMatch( matches, h, header.indexOf( "HI/*decl4*" ) ); //$NON-NLS-1$
- //vp5-identifier inside undefined ifdef
- pattern = SearchEngine.createSearchPattern( "BYE", MACRO, DECLARATIONS, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 0, matches.size() );
- }
- public void testMethodFieldReferenceInExpressions() throws Exception {
- Writer writer = new StringWriter();
- writer.write("class M { \n" );//$NON-NLS-1$
- writer.write(" public: \n" );//$NON-NLS-1$
- writer.write(" int mm(){return 0;} \n" );//$NON-NLS-1$
- writer.write(" float fm; \n" );//$NON-NLS-1$
- writer.write("}; \n" );//$NON-NLS-1$
- writer.write("class N{ \n" );//$NON-NLS-1$
- writer.write("public: \n" );//$NON-NLS-1$
- writer.write(" double mn(){return 3.2;} \n" );//$NON-NLS-1$
- writer.write(" static const int fn= 12; \n" );//$NON-NLS-1$
- writer.write("}; \n" );//$NON-NLS-1$
- writer.write("void foo() { \n" );//$NON-NLS-1$
- writer.write(" M m; \n" );//$NON-NLS-1$
- writer.write(" N *n; \n" );//$NON-NLS-1$
- writer.write(" double i= ((double)m.mm/*11*/()+n->fn/*21*/-m.fm/*22*/ \n" );//$NON-NLS-1$
- writer.write(" /n->mn/*12*/())*(m.fm/*23*/*n->mn/*13*/()) \n" );//$NON-NLS-1$
- writer.write(" &&m.mm/*14*/()||(int)n->fn/*24*/ \n" );//$NON-NLS-1$
- writer.write(" &(int)n->mn/*15*/()|(int)m.fm/*25*/ \n" );//$NON-NLS-1$
- writer.write(" <<(int)n->fn/*26*/>>m.mm/*16*/(); \n" );//$NON-NLS-1$
- writer.write("} \n" );//$NON-NLS-1$
- String code = writer.toString();
- IFile b = importFile( "MethodFieldReferenceInExpressions.cpp", code ); //$NON-NLS-1$
- //vp1 methods
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "m*", METHOD, REFERENCES, true ); //$NON-NLS-1$
- Set matches = search( pattern );
- assertEquals( 6, matches.size() );
- assertMatch( matches, b, code.indexOf( "mm/*11*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "mn/*12*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "mn/*13*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "mm/*14*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "mn/*15*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "mm/*16*/" ) ); //$NON-NLS-1$
- //vp2 fields
- pattern = SearchEngine.createSearchPattern( "f*", FIELD, REFERENCES, true ); //$NON-NLS-1$
- matches = search( pattern );
- assertEquals( 6, matches.size() );
- assertMatch( matches, b, code.indexOf( "fn/*21*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "fm/*22*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "fm/*23*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "fn/*24*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "fm/*22*/" ) ); //$NON-NLS-1$
- assertMatch( matches, b, code.indexOf( "fn/*26*/" ) ); //$NON-NLS-1$
- }
-}
diff --git a/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/SelectionRegressionTest.java b/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/SelectionRegressionTest.java
index dce4b3d4e5..796cfbf8c2 100644
--- a/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/SelectionRegressionTest.java
+++ b/core/org.eclipse.cdt.core.tests/regression/org/eclipse/cdt/core/tests/SelectionRegressionTest.java
@@ -32,8 +32,6 @@ import org.eclipse.cdt.core.parser.ast.IASTNode;
import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
import org.eclipse.cdt.core.parser.tests.CompleteParseBaseTest.FullParseCallback;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
-import org.eclipse.cdt.internal.core.browser.cache.TypeCacheManager;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -103,8 +101,6 @@ public class SelectionRegressionTest extends BaseTestFramework {
}
} catch ( CoreException e ) { //boo
}
- TypeCacheManager typeCacheManager = TypeCacheManager.getInstance();
- typeCacheManager.setProcessTypeCacheEvents(false);
}
protected void tearDown() throws Exception {
@@ -112,7 +108,6 @@ public class SelectionRegressionTest extends BaseTestFramework {
return;
try{
- project.setSessionProperty( DOMSourceIndexer.activationKey, new Boolean( false ) );
project.delete(true,true,new NullProgressMonitor());
project = null;
} catch ( CoreException e ) { //boo
diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/BaseSearchTest.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/BaseSearchTest.java
deleted file mode 100644
index 8f1961adad..0000000000
--- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/BaseSearchTest.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corp. - Rational Software - initial implementation
- *******************************************************************************/
-/*
- * Created on Jul 22, 2003
- */
-package org.eclipse.cdt.core.search.tests;
-
-import java.io.FileInputStream;
-
-import junit.framework.TestCase;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorOperation;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.search.BasicSearchResultCollector;
-import org.eclipse.cdt.core.search.ICSearchConstants;
-import org.eclipse.cdt.core.search.ICSearchPattern;
-import org.eclipse.cdt.core.search.ICSearchResultCollector;
-import org.eclipse.cdt.core.search.ICSearchScope;
-import org.eclipse.cdt.core.search.SearchEngine;
-import org.eclipse.cdt.core.testplugin.CProjectHelper;
-import org.eclipse.cdt.core.testplugin.CTestPlugin;
-import org.eclipse.cdt.core.testplugin.FileManager;
-import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexerRunner;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class BaseSearchTest extends TestCase implements ICSearchConstants {
-
- static protected ICSearchScope scope;
- static protected IFile file;
- static protected IProject testProject;
- static protected NullProgressMonitor monitor;
- static protected IWorkspace workspace;
- static protected BasicSearchResultCollector resultCollector;
- static protected SearchEngine searchEngine;
- static protected FileManager fileManager;
- static final String sourceIndexerID = "org.eclipse.cdt.core.originalsourceindexer"; //$NON-NLS-1$
- static protected DOMSourceIndexer sourceIndexer;
- {
-
- //(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
- monitor = new NullProgressMonitor();
-
- workspace = ResourcesPlugin.getWorkspace();
- CCorePlugin.getDefault().getPluginPreferences().setValue(CCorePlugin.PREF_INDEXER, CCorePlugin.DEFAULT_INDEXER_UNIQ_ID);
-
- try {
- //Create temp project
- testProject = createProject("SearchTestProject");
- resetIndexer(DOMSourceIndexer.ID);
-
- testProject.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(true));
-
- //Set the id of the source indexer extension point as a session property to allow
- //index manager to instantiate it
- //testProject.setSessionProperty(IndexManager.indexerIDKey, sourceIndexerID);
- sourceIndexer = (DOMSourceIndexer) CCorePlugin.getDefault().getCoreModel().getIndexManager().getIndexerForProject(testProject);
- } catch (CoreException e) {}
-
- resetIndexer(CCorePlugin.DEFAULT_INDEXER_UNIQ_ID);
- //The DOM Source Indexer checks to see if a file has any scanner info
- //set prior to indexing it in order to increase efficiency. We need to let it know
- //that it is running in test mode in order to allow for this scanner info test to be skipped
- DOMSourceIndexerRunner.setSkipScannerInfoTest(true);
-
-
- if (testProject == null)
- fail("Unable to create project");
-
- //Create file manager
- fileManager = new FileManager();
-
- try {
- //Add a file to the project
- //importFile("mail.cpp", "resources/indexer/mail.cpp");
- importFile("classDecl.cpp", "resources/search/classDecl.cpp");
- importFile("include.h", "resources/search/include.h");
- } catch (Exception e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
-
- scope = SearchEngine.createWorkspaceScope();
-
- resultCollector = new BasicSearchResultCollector();
-
- searchEngine = new SearchEngine();
- }
-
-
-
- public BaseSearchTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
-
- }
-
- protected void tearDown() {
- }
-
- private IProject createProject(String projectName) throws CoreException {
- ICProject cPrj = CProjectHelper.createCCProject(projectName, "bin");
- return cPrj.getProject();
- }
-
- private void importFile(String fileName, String resourceLocation) throws Exception{
- //Obtain file handle
- file = testProject.getProject().getFile(fileName);
- //Create file input stream
-
- if (!file.exists()){
- file.create(new FileInputStream(
- CTestPlugin.getDefault().getFileInPlugin(new Path(resourceLocation))),
- false,monitor);
- fileManager.addFile(file);
- }
-
- }
-
- protected char[] getSearchPattern(int meta_kind, int kind, int ref, String name) {
- return Index.encodeEntry(meta_kind, kind, ref, name);
- }
-
- public void assertEquals(char [] first, char [] second) {
- assertEquals( new String(first), new String(second));
- }
-
- protected void search(IWorkspace workspace, ICSearchPattern pattern, ICSearchScope scope, ICSearchResultCollector collector) {
- try {
- searchEngine.search( workspace, pattern, scope, collector, false );
- } catch (InterruptedException e) {
-
- }
- }
-
- public void resetIndexer(final String indexerId){
- if ( testProject != null) {
- ICDescriptorOperation op = new ICDescriptorOperation() {
-
- public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
- descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
- descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,indexerId);
- }
- };
- try {
- CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(testProject, op, new NullProgressMonitor());
- CCorePlugin.getDefault().getCoreModel().getIndexManager().indexerChangeNotification(testProject);
- } catch (CoreException e) {}
- }
- }
-
-}
diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java
deleted file mode 100644
index 5fadaf0736..0000000000
--- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corp. - Rational Software - initial implementation
- *******************************************************************************/
-/*
- * Created on Jul 3, 2003
- */
-package org.eclipse.cdt.core.search.tests;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.cdt.core.search.ICSearchConstants;
-import org.eclipse.cdt.core.search.ICSearchPattern;
-import org.eclipse.cdt.core.search.IMatch;
-import org.eclipse.cdt.core.search.IOffsetLocatable;
-import org.eclipse.cdt.core.search.OrPattern;
-import org.eclipse.cdt.core.search.SearchEngine;
-import org.eclipse.cdt.internal.core.CharOperation;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.search.matching.ClassDeclarationPattern;
-
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSearchConstants {
-
- public ClassDeclarationPatternTests(String name) {
- super(name);
- }
-
- public void testMatchSimpleDeclaration(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A", TYPE, DEFINITIONS, false );
-
- assertTrue( pattern instanceof ClassDeclarationPattern );
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- //Changed to 2 since we also return Derived as a Typdecl
- assertEquals( 2, matches.size() );
- }
-
- public void testMatchNamespaceNestedDeclaration(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "NS::B", TYPE, DEFINITIONS, true );
-
- assertTrue( pattern instanceof ClassDeclarationPattern );
-
- ClassDeclarationPattern clsPattern = (ClassDeclarationPattern)pattern;
-
- assertTrue( CharOperation.equals( new char[] { 'B' }, clsPattern.getName() ) );
- assertTrue( clsPattern.getContainingTypes().length == 1 );
- assertTrue( CharOperation.equals( new char[] { 'N', 'S' }, clsPattern.getContainingTypes()[0] ) );
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( 1, matches.size() );
- }
-
- public void testBug39652() {
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B", TYPE, DEFINITIONS, true );
-
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
-
- /* Test should find 1 match */
- assertTrue( matches != null );
- assertTrue( matches.size() == 1 );
-
- pattern = SearchEngine.createSearchPattern( "NS::NS2::a", TYPE, DEFINITIONS, true );
- search( workspace, pattern, scope, resultCollector );
-
- matches = resultCollector.getSearchResults();
- assertTrue( matches != null );
-
- pattern = SearchEngine.createSearchPattern( "NS::B::AA", TYPE, DEFINITIONS, true ); //TODO was NS::B::A, changed for bug 41445
- search( workspace, pattern, scope, resultCollector );
-
- matches = resultCollector.getSearchResults();
- assertTrue( matches != null );
- }
-
- public void testMatchStruct(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "AA", STRUCT, DEFINITIONS, true ); //TODO was A, changed for bug 41445
-
- assertTrue( pattern instanceof ClassDeclarationPattern );
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "NS::B::AA", TYPE, DEFINITIONS, true ); //TODO was 2, changed for bug 41445
- search( workspace, pattern, scope, resultCollector );
-
- Set matches2 = resultCollector.getSearchResults();
- assertTrue( matches2 != null );
- assertEquals( matches2.size(), 1 );
-
- Iterator iter = matches.iterator();
- Iterator iter2 = matches2.iterator();
-
- IMatch match = (IMatch)iter.next();
- IMatch match2 = (IMatch)iter2.next();
-
- //assertTrue( match.path.equals( match2.path ) );
- assertEquals( ((IOffsetLocatable) match.getLocatable()).getNameStartOffset(), ((IOffsetLocatable) match2.getLocatable()).getNameStartOffset() );
- assertEquals( ((IOffsetLocatable) match.getLocatable()).getNameEndOffset() , ((IOffsetLocatable) match2.getLocatable()).getNameEndOffset() );
- }
-
- public void testWildcardQualification() {
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "::*::A", TYPE, DEFINITIONS, true );
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 0 );
-
- pattern = SearchEngine.createSearchPattern( "NS::*::A", TYPE, DEFINITIONS, false );
- search( workspace, pattern, scope, resultCollector );
-
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 ); //TODO was 1, changed for bug 41445
- }
-
- public void testElaboratedType(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "struct AA", TYPE, DEFINITIONS, true ); //TODO was 2, changed for bug 41445
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "union u", TYPE, DEFINITIONS, true );
- search( workspace, pattern, scope, resultCollector );
-
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 2 );
-
- pattern = SearchEngine.createSearchPattern( "union ::*::u", TYPE, DEFINITIONS, true );
- search( workspace, pattern, scope, resultCollector );
-
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- }
-
- public void testClassIndexPrefix(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "struct A::B::*::c", TYPE, DECLARATIONS, true );
- assertTrue( pattern instanceof ClassDeclarationPattern );
-
- ClassDeclarationPattern clsPattern = (ClassDeclarationPattern)pattern;
- assertEquals( getSearchPattern(IIndex.TYPE, IIndex.TYPE_STRUCT, IIndex.DECLARATION, "c/"), clsPattern.indexEntryPrefix());
-
- clsPattern = (ClassDeclarationPattern) SearchEngine.createSearchPattern( "class ::*::A::B::c", TYPE, DECLARATIONS, true );
- assertEquals( getSearchPattern(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION, "c/B/A/"), clsPattern.indexEntryPrefix());
-
- clsPattern = (ClassDeclarationPattern) SearchEngine.createSearchPattern( "enum ::RT*::c", TYPE, REFERENCES, true );
- assertEquals( getSearchPattern(IIndex.TYPE, IIndex.TYPE_ENUM, IIndex.REFERENCE,"c/RT"), clsPattern.indexEntryPrefix());
-
- clsPattern = (ClassDeclarationPattern) SearchEngine.createSearchPattern( "union A::B::c", TYPE, REFERENCES, false );
- assertEquals( getSearchPattern(IIndex.TYPE, IIndex.TYPE_UNION, IIndex.REFERENCE, ""), clsPattern.indexEntryPrefix());
- }
-
- public void testGloballyQualifiedItem(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "::A", TYPE, DEFINITIONS, true );
- assertTrue( pattern instanceof ClassDeclarationPattern );
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "::u", TYPE, DEFINITIONS, true );
- assertTrue( pattern instanceof ClassDeclarationPattern );
-
- search( workspace, pattern, scope, resultCollector );
-
- matches = resultCollector.getSearchResults();
-
- assertEquals( matches.size(), 1);
- }
-
- public void testClassReferences(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "::A", TYPE, REFERENCES, true );
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( 6, matches.size());
- }
-
- public void testClassReferenceInFieldType(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "::NS::B::AA", TYPE, REFERENCES, true ); //TODO was A, changed for bug 41445
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- }
-
- public void testTypeReferenceVisibleByUsingDirective(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "::NS::NS2::a", STRUCT, REFERENCES, true );
-
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- }
-
- public void testEnumerationReferenceVisibleByInheritance(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "::NS::B::e", ENUM, REFERENCES, true );
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- }
-
- public void testHeadersVisitedTwice(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "Hea*", CLASS, DEFINITIONS, true );
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
-
- //1 for Heal, 1 for Head
- assertEquals( matches.size(), 2 );
- }
-
- public void testAllOccurences(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A", TYPE, ALL_OCCURRENCES, true );
- assertTrue( pattern instanceof OrPattern );
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
-
- assertEquals(8, matches.size() );
- }
-
- public void testReferencesInFunction(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "AClassForFoo", CLASS, REFERENCES, true );
-
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 3 );
-
- Iterator iter = matches.iterator();
-
- while( iter.hasNext() ){
- IMatch match = (IMatch) iter.next();
- assertTrue( match.getName().equals("AClassForFoo") );
- }
- }
-
- public void testbug42902_TypeDefs(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern("NS_B", TYPEDEF, ALL_OCCURRENCES, true );
-
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
-
- assertEquals( matches.size(), 2 );
- }
-
-/* public void testBug54169(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "e", TYPE, DECLARATIONS, true );
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
-
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "NS_B", TYPE, DECLARATIONS, true );
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
-
- assertEquals( matches.size(), 1 );
- }*/
-}
-
diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java
deleted file mode 100644
index a2c683d866..0000000000
--- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corp. - Rational Software - initial implementation
- *******************************************************************************/
-/*
- * Created on Jul 23, 2003
- */
-package org.eclipse.cdt.core.search.tests;
-
-import java.util.Set;
-
-import org.eclipse.cdt.core.search.ICSearchPattern;
-import org.eclipse.cdt.core.search.IMatch;
-import org.eclipse.cdt.core.search.IOffsetLocatable;
-import org.eclipse.cdt.core.search.SearchEngine;
-import org.eclipse.cdt.internal.core.CharOperation;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.search.matching.MethodDeclarationPattern;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class FunctionMethodPatternTests extends BaseSearchTest {
-
- /**
- * @param name
- */
- public FunctionMethodPatternTests(String name) {
- super(name);
- // TODO Auto-generated constructor stub
- }
-
- public void testFunctionIndexPrefix(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "c()", FUNCTION, DECLARATIONS, true ); //$NON-NLS-1$
-
- MethodDeclarationPattern functionPattern = (MethodDeclarationPattern)pattern;
- assertEquals( getSearchPattern(IIndex.FUNCTION, IIndex.ANY, IIndex.DECLARATION, "c"), functionPattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- functionPattern = (MethodDeclarationPattern) SearchEngine.createSearchPattern( "rt*()", FUNCTION, DECLARATIONS, true ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.FUNCTION, IIndex.ANY, IIndex.DECLARATION, "rt"), functionPattern.indexEntryPrefix()); //$NON-NLS-1$
-
- functionPattern = (MethodDeclarationPattern) SearchEngine.createSearchPattern( "Ac", FUNCTION, REFERENCES, false ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.FUNCTION, IIndex.ANY, IIndex.REFERENCE, ""), functionPattern.indexEntryPrefix()); //$NON-NLS-1$
- }
-
- public void testMethodIndexPrefix(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B::c", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- assertTrue( pattern instanceof MethodDeclarationPattern );
-
- MethodDeclarationPattern methodPattern = (MethodDeclarationPattern)pattern;
- assertEquals( getSearchPattern(IIndex.METHOD, IIndex.ANY, IIndex.DECLARATION, "c/B/A"), methodPattern.indexEntryPrefix()); //$NON-NLS-1$
-
- methodPattern = (MethodDeclarationPattern) SearchEngine.createSearchPattern( "::*::A::B::c", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.METHOD, IIndex.ANY, IIndex.DECLARATION, "c/B/A/"), methodPattern.indexEntryPrefix()); //$NON-NLS-1$
-
- methodPattern = (MethodDeclarationPattern) SearchEngine.createSearchPattern( "::RT*::c", METHOD, REFERENCES, true ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.METHOD, IIndex.ANY, IIndex.REFERENCE, "c/RT"), methodPattern.indexEntryPrefix()); //$NON-NLS-1$
-
- methodPattern = (MethodDeclarationPattern) SearchEngine.createSearchPattern( "A::B::c", METHOD, REFERENCES, false ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.METHOD, IIndex.ANY, IIndex.REFERENCE, ""), methodPattern.indexEntryPrefix()); //$NON-NLS-1$
- }
-
- public void testMethodDeclaration() {
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B::f", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
-
- assertEquals( matches.size(), 4 );
- }
-
- public void testMethodDeclarationWithParams() {
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B::f( A )", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
-
- assertEquals( 1, matches.size());
- }
-
- public void testMethodDeclarationParameterMatching(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "f( A & )", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
- assertEquals( 1,matches.size() );
-
- pattern = SearchEngine.createSearchPattern( "f( A * )", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( 1, matches.size());
-
- pattern = SearchEngine.createSearchPattern( "f( int &, const char [], A** )", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( 1, matches.size() );
- }
-
- public void testMethodWithNoParameters(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "turn( )", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
- assertEquals( 2, matches.size());
-
- pattern = SearchEngine.createSearchPattern( "turn(void)", METHOD, DECLARATIONS_DEFINITIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( 2, matches.size());
-
- pattern = SearchEngine.createSearchPattern( "turnAgain()", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( 1, matches.size());
-
- }
-
- public void testOperators_bug43063_bug42979(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "operator \\*", METHOD, DECLARATIONS_DEFINITIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- IMatch match1 = (IMatch) matches.iterator().next();
-
- pattern = SearchEngine.createSearchPattern( "operator \\*", METHOD, DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- IMatch match2 = (IMatch) matches.iterator().next();
-
- assertTrue( ((IOffsetLocatable)match1.getLocatable()).getNameStartOffset() == ((IOffsetLocatable)match2.getLocatable()).getNameStartOffset() );
-
- pattern = SearchEngine.createSearchPattern( "operator \\*=", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- match1 = (IMatch) matches.iterator().next();
-
- pattern = SearchEngine.createSearchPattern( "operator \\*=", METHOD, DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- match2 = (IMatch) matches.iterator().next();
-
- assertTrue( ((IOffsetLocatable)match1.getLocatable()).getNameStartOffset() != ((IOffsetLocatable)match2.getLocatable()).getNameStartOffset() );
-
- pattern = SearchEngine.createSearchPattern( "operator *", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 5 );
-
- pattern = SearchEngine.createSearchPattern( "operator *", METHOD, DECLARATIONS_DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 8 ); //2 in classDecl.cpp
-
- pattern = SearchEngine.createSearchPattern( "operator ->\\*", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- assertTrue( pattern instanceof MethodDeclarationPattern );
- MethodDeclarationPattern methodPattern = (MethodDeclarationPattern) pattern;
- char [] string = new char[] {'o','p','e','r','a','t','o','r',' ','-','>','\\','*'};
- assertTrue( CharOperation.equals( string, methodPattern.getSimpleName() ) );
- }
-
- public void testBug43498(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "operator ?elete", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
-
- assertTrue( pattern instanceof MethodDeclarationPattern );
- MethodDeclarationPattern methodPattern = (MethodDeclarationPattern) pattern;
-
- char [] string = new char[] {'o','p','e','r','a','t','o','r',' ','?','e','l','e','t','e'};
- assertTrue( CharOperation.equals( string, methodPattern.getSimpleName() ) );
-
- pattern = SearchEngine.createSearchPattern( "operator delete", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- assertTrue( pattern instanceof MethodDeclarationPattern );
- methodPattern = (MethodDeclarationPattern) pattern;
- string = new char[] {'o','p','e','r','a','t','o','r',' ','d','e','l','e','t','e'};
- assertTrue( CharOperation.equals( string, methodPattern.getSimpleName() ) );
-
- pattern = SearchEngine.createSearchPattern( "word?word", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- assertTrue( pattern instanceof MethodDeclarationPattern );
- methodPattern = (MethodDeclarationPattern) pattern;
-
- string = new char[] {'w','o','r','d','?','w','o','r','d'};
- assertTrue( CharOperation.equals( string, methodPattern.getSimpleName() ) );
-
- pattern = SearchEngine.createSearchPattern( "operato? delete", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- assertTrue( pattern instanceof MethodDeclarationPattern );
- methodPattern = (MethodDeclarationPattern) pattern;
- string = new char[] {'o','p','e','r','a','t','o','?',' ','d','e','l','e','t','e'};
- assertTrue( CharOperation.equals( string, methodPattern.getSimpleName() ) );
- }
-
- public void testBug43062(){
- MethodDeclarationPattern pattern = (MethodDeclarationPattern) SearchEngine.createSearchPattern( "operator const short &", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- char [] string = new char [] { 'o','p','e','r','a','t','o','r',' ','c','o','n','s','t',' ','s','h','o','r','t',' ','&' };
- assertTrue( CharOperation.equals( string, pattern.getSimpleName() ) );
-
- pattern = (MethodDeclarationPattern) SearchEngine.createSearchPattern( "operator short", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- string = new char [] { 'o','p','e','r','a','t','o','r',' ','s','h','o','r','t' };
- assertTrue( CharOperation.equals( string, pattern.getSimpleName() ) );
-
- pattern = (MethodDeclarationPattern) SearchEngine.createSearchPattern( "operator short int", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
- string = new char [] { 'o','p','e','r','a','t','o','r',' ','s','h','o','r','t',' ','i','n','t' };
- assertTrue( CharOperation.equals( string, pattern.getSimpleName() ) );
- }
-
- public void testConstructorDestructor(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A", METHOD, DECLARATIONS_DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "~A", METHOD, DECLARATIONS_DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
-
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- }
-
- public void testLookupForDefinition(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "turn", METHOD, DECLARATIONS_DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 3 );
-
- pattern = SearchEngine.createSearchPattern( "Direction::turn", METHOD, DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 0 );
- }
-
- public void testBug63478(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B::f(*)", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
-
- assertEquals( matches.size(), 4 );
- }
-}
diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java
deleted file mode 100644
index 0c6ea282bb..0000000000
--- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corp. - Rational Software - initial implementation
- *******************************************************************************/
-/*
- * Created on Jul 23, 2003
- */
-package org.eclipse.cdt.core.search.tests;
-
-
-import java.util.Set;
-
-import org.eclipse.cdt.core.search.BasicSearchMatch;
-import org.eclipse.cdt.core.search.ICSearchPattern;
-import org.eclipse.cdt.core.search.IMatch;
-import org.eclipse.cdt.core.search.SearchEngine;
-import org.eclipse.cdt.core.testplugin.CTestPlugin;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.search.matching.FieldDeclarationPattern;
-import org.eclipse.cdt.internal.core.search.matching.MatchLocator;
-import org.eclipse.cdt.internal.core.search.matching.NamespaceDeclarationPattern;
-import org.eclipse.core.runtime.Path;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class OtherPatternTests extends BaseSearchTest {
-
- /**
- * @param name
- */
- public OtherPatternTests(String name) {
- super(name);
- // TODO Auto-generated constructor stub
- }
-
- public void testNamespaceIndexPrefix(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B::c", NAMESPACE, DEFINITIONS, true ); //$NON-NLS-1$
- assertTrue( pattern instanceof NamespaceDeclarationPattern );
-
- NamespaceDeclarationPattern nsPattern = (NamespaceDeclarationPattern)pattern;
- assertEquals( getSearchPattern(IIndex.NAMESPACE, IIndex.ANY, IIndex.DEFINITION, "c/B/A"), nsPattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- nsPattern = (NamespaceDeclarationPattern) SearchEngine.createSearchPattern( "::*::A::B::c", NAMESPACE, DEFINITIONS, true ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.NAMESPACE, IIndex.ANY, IIndex.DEFINITION, "c/B/A/"), nsPattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- nsPattern = (NamespaceDeclarationPattern) SearchEngine.createSearchPattern( "::RT*::c", NAMESPACE, REFERENCES, true ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.NAMESPACE, IIndex.ANY, IIndex.REFERENCE, "c/RT"), nsPattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- nsPattern = (NamespaceDeclarationPattern) SearchEngine.createSearchPattern( "A::B::c", NAMESPACE, REFERENCES, false ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.NAMESPACE, IIndex.ANY, IIndex.REFERENCE, ""), nsPattern.indexEntryPrefix() ); //$NON-NLS-1$
- }
-
- public void testVariableIndexPrefix(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "c", VAR, DECLARATIONS, true ); //$NON-NLS-1$
- assertTrue( pattern instanceof FieldDeclarationPattern );
-
- FieldDeclarationPattern variablePattern = (FieldDeclarationPattern)pattern;
- assertEquals( getSearchPattern(IIndex.VAR, IIndex.ANY, IIndex.DECLARATION, "c"), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- variablePattern = (FieldDeclarationPattern) SearchEngine.createSearchPattern( "rt*", VAR, DECLARATIONS, true ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.VAR, IIndex.ANY, IIndex.DECLARATION, "rt"), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- variablePattern = (FieldDeclarationPattern) SearchEngine.createSearchPattern( "Ac", VAR, REFERENCES, false ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.VAR, IIndex.ANY, IIndex.REFERENCE, ""), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- variablePattern = (FieldDeclarationPattern) SearchEngine.createSearchPattern( "A?c", VAR, REFERENCES, true ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.VAR, IIndex.ANY, IIndex.REFERENCE, "A"), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
- }
-
- public void testFieldIndexPrefix(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B::c", FIELD, DECLARATIONS, true ); //$NON-NLS-1$
- assertTrue( pattern instanceof FieldDeclarationPattern );
-
- FieldDeclarationPattern fieldPattern = (FieldDeclarationPattern)pattern;
- assertEquals( getSearchPattern(IIndex.FIELD, IIndex.ANY, IIndex.DECLARATION, "c/B/A"), fieldPattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- fieldPattern = (FieldDeclarationPattern) SearchEngine.createSearchPattern( "::*::A::B::c", FIELD, DECLARATIONS, true ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.FIELD, IIndex.ANY, IIndex.DECLARATION, "c/B/A/"), fieldPattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- fieldPattern = (FieldDeclarationPattern) SearchEngine.createSearchPattern( "::RT*::c", FIELD, REFERENCES, true ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.FIELD, IIndex.ANY, IIndex.REFERENCE, "c/RT"), fieldPattern.indexEntryPrefix() ); //$NON-NLS-1$
-
- fieldPattern = (FieldDeclarationPattern) SearchEngine.createSearchPattern( "A::B::c", FIELD, REFERENCES, false ); //$NON-NLS-1$
- assertEquals( getSearchPattern(IIndex.FIELD, IIndex.ANY, IIndex.REFERENCE, ""), fieldPattern.indexEntryPrefix() ); //$NON-NLS-1$
- }
-
- public void testNamespaceDeclaration(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "NS*", NAMESPACE, DEFINITIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
-
- assertEquals( matches.size(), 3 );
- }
-
- public void testNamespaceReferenceInUsingDirective() {
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "::NS::NS2", NAMESPACE, REFERENCES, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
-
- assertEquals( matches.size(), 1 );
- }
-
- public void testNamespaceReferenceInClassBaseClause(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "::NS", NAMESPACE, REFERENCES, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 2 );
- }
-
- public void testFieldDeclaration(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "a*Struct", FIELD, DEFINITIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- }
-
- public void testVariableDeclaration(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "b?", VAR, DEFINITIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 2 );
-
- IMatch match = (IMatch) matches.iterator().next();
- assertTrue( match.getParentName().equals( "" ) ); //$NON-NLS-1$
- }
-
- /*public void testParameterDeclaration(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "index", VAR, DECLARATIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( 5, matches.size());
- }
-
- public void testOrPattern(){
- OrPattern orPattern = new OrPattern();
- orPattern.addPattern( SearchEngine.createSearchPattern( "::NS::B::e", ENUM, REFERENCES, true ) ); //$NON-NLS-1$
- orPattern.addPattern( SearchEngine.createSearchPattern( "Hea*", CLASS, DECLARATIONS, true ) ); //$NON-NLS-1$
-
- search( workspace, orPattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
-
- assertEquals( matches.size(), 3 );
-
- orPattern = new OrPattern();
- orPattern.addPattern( SearchEngine.createSearchPattern( "b?", VAR, DECLARATIONS, true ) ); //$NON-NLS-1$
- orPattern.addPattern( SearchEngine.createSearchPattern( "a*Struct", FIELD, DECLARATIONS, true ) ); //$NON-NLS-1$
- orPattern.addPattern( SearchEngine.createSearchPattern( "::NS::NS2", NAMESPACE, REFERENCES, true ) ); //$NON-NLS-1$
- orPattern.addPattern( SearchEngine.createSearchPattern( "A::B::f( A )", METHOD, DECLARATIONS, true ) ); //$NON-NLS-1$
-
- search( workspace, orPattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( 5, matches.size() );
- }*/
-
- public void testMacroPattern(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "FOO", MACRO, DECLARATIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- IMatch match = (IMatch) matches.iterator().next();
- assertTrue( match.getName().equals( "FOO" ) ); //$NON-NLS-1$
- assertTrue( match.getParentName().equals( "" )); //$NON-NLS-1$
-
- pattern = SearchEngine.createSearchPattern( "FOO", MACRO, ALL_OCCURRENCES, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- }
-
- public void testDerived(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "A", DERIVED, DECLARATIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- IMatch match = (IMatch) matches.iterator().next();
- assertTrue( match.getName().equals( "A" ) ); //$NON-NLS-1$
- }
-
- public void testEnumerators(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "One", ENUMTOR, DEFINITIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- IMatch match = (IMatch) matches.iterator().next();
- assertTrue( match.getName().equals( "One" ) ); //$NON-NLS-1$
-
- pattern = SearchEngine.createSearchPattern( "NS::B::Two", ENUMTOR, DEFINITIONS, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- match = (IMatch) matches.iterator().next();
- assertTrue( match.getName().equals( "Two" ) ); //$NON-NLS-1$
- }
-
- public void testEnumeratorReferences(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "One", ENUMTOR, REFERENCES, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- IMatch match = (IMatch) matches.iterator().next();
- assertTrue( match.getName().equals( "One" ) ); //$NON-NLS-1$
- }
-
- /*public void testParameterReferences(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "index", VAR, REFERENCES, true ); //$NON-NLS-1$
-
- search( workspace, pattern, scope, resultCollector );
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 3 );
- }*/
-
-
- /*public void testBug43129(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "externalInt", VAR, DECLARATIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "externalIntWithInitializer", VAR, DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "externCInt", VAR, DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "externCIntWithInitializer", VAR, DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "forwardFunction", FUNCTION, ALL_OCCURRENCES, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 2 );
-
- pattern = SearchEngine.createSearchPattern( "normalFunction", FUNCTION, DECLARATIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "normalFunction", FUNCTION, DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "forwardMethod", METHOD, ALL_OCCURRENCES, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 2 );
-
- pattern = SearchEngine.createSearchPattern( "staticField", FIELD, ALL_OCCURRENCES, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 2 );
- }*/
-
- public void testNoResourceSearching() throws Exception {
- String path = CTestPlugin.getDefault().getFileInPlugin(new Path("resources/search/include.h")).getAbsolutePath(); //$NON-NLS-1$
-
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "Head", CLASS, REFERENCES, true ); //$NON-NLS-1$
-
- resultCollector.aboutToStart();
-
- MatchLocator matchLocator = new MatchLocator( pattern, resultCollector, scope);
- matchLocator.setProgressMonitor(monitor);
-
- try {
- matchLocator.locateMatches( new String [] { path }, workspace, null );
- } catch (InterruptedException e1) { //boo
- }
-
- resultCollector.done();
-
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 4 );
- }
-
- public void testBug42911_43988(){
- BasicSearchMatch match1 = new BasicSearchMatch();
- BasicSearchMatch match2 = new BasicSearchMatch();
-
- assertTrue( match1.equals( match2 ) );
- assertTrue( match2.equals( match1 ) );
-
- match1.setName( "IWasSaying" ); //$NON-NLS-1$
- match1.setParentName( "boo" ); //$NON-NLS-1$
- match1.setReturnType( "urns" ); //$NON-NLS-1$
-
- assertFalse( match1.equals( match2 ) );
- assertFalse( match2.equals( match1 ) );
-
- match2.setName( "IWasSaying" ); //$NON-NLS-1$
- match2.setParentName( "boo" ); //$NON-NLS-1$
- match2.setReturnType( "urns" ); //$NON-NLS-1$
-
- assertTrue( match1.equals( match2 ) );
- }
-
- public void testBug68235(){
- ICSearchPattern pattern = SearchEngine.createSearchPattern( "bug68235::xTag", STRUCT, DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- Set matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "bug68235::yTag", STRUCT, DEFINITIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "bug68235::xType", TYPEDEF, DECLARATIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "bug68235::yType", TYPEDEF, DECLARATIONS, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "bug68235::xType", TYPEDEF, REFERENCES, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
-
- pattern = SearchEngine.createSearchPattern( "bug68235::yType", TYPEDEF, REFERENCES, true ); //$NON-NLS-1$
- search( workspace, pattern, scope, resultCollector );
- matches = resultCollector.getSearchResults();
- assertEquals( matches.size(), 1 );
- }
-}
diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ParseTestOnSearchFiles.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ParseTestOnSearchFiles.java
deleted file mode 100644
index 8a5a1004e9..0000000000
--- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ParseTestOnSearchFiles.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.search.tests;
-
-import java.io.File;
-
-import junit.framework.TestCase;
-
-import org.eclipse.cdt.core.parser.IParser;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.NullLogService;
-import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ScannerInfo;
-import org.eclipse.cdt.core.testplugin.CTestPlugin;
-import org.eclipse.core.runtime.Path;
-
-/**
- * @author jcamelon
- *
- */
-public class ParseTestOnSearchFiles extends TestCase
-{
- private String name;
- private String fullPathName;
- /**
- *
- */
- public ParseTestOnSearchFiles()
- {
- super();
- }
- /**
- * @param name
- */
- public ParseTestOnSearchFiles(String name)
- {
- super(name);
- }
-
- protected void setUp() throws Exception {
- name = "resources/search/classDecl.cpp";
- File f = CTestPlugin.getDefault().getFileInPlugin(new Path(name));
- fullPathName = f.getAbsolutePath();
- }
-
- public void testParseOfAndrewsFile() throws Exception
- {
- ISourceElementRequestor requestor = new NullSourceElementRequestor();
- IScanner scanner = ParserFactory.createScanner( fullPathName, new ScannerInfo(), ParserMode.COMPLETE_PARSE, ParserLanguage.CPP, requestor, new NullLogService(), null );
- IParser parser = ParserFactory.createParser( scanner, requestor, ParserMode.COMPLETE_PARSE, ParserLanguage.CPP, null );
- assertTrue( parser.parse() );
- }
-
-}
diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/SearchTestSuite.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/SearchTestSuite.java
deleted file mode 100644
index fb7ee6e131..0000000000
--- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/SearchTestSuite.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corp. - Rational Software - initial implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.search.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class SearchTestSuite extends TestCase {
- public static Test suite() {
- TestSuite suite= new TestSuite(SearchTestSuite.class.getName());
-
- suite.addTestSuite(ClassDeclarationPatternTests.class);
- suite.addTestSuite(FunctionMethodPatternTests.class);
- suite.addTestSuite(OtherPatternTests.class);
- suite.addTestSuite(ParseTestOnSearchFiles.class);
- return suite;
- }
-}
diff --git a/core/org.eclipse.cdt.core/.classpath b/core/org.eclipse.cdt.core/.classpath
index 9d6202a599..570015a64b 100644
--- a/core/org.eclipse.cdt.core/.classpath
+++ b/core/org.eclipse.cdt.core/.classpath
@@ -1,13 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="index"/>
<classpathentry kind="src" path="model"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="utils"/>
- <classpathentry kind="src" path="search"/>
- <classpathentry kind="src" path="dependency"/>
<classpathentry kind="src" path="parser"/>
- <classpathentry kind="src" path="browser"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index 6c346388e1..3bb728792f 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -7,8 +7,6 @@ Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.core,
- org.eclipse.cdt.core.browser,
- org.eclipse.cdt.core.browser.typehierarchy,
org.eclipse.cdt.core.dom,
org.eclipse.cdt.core.dom.ast,
org.eclipse.cdt.core.dom.ast.c,
@@ -17,29 +15,19 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.core.dom.ast.gnu.c,
org.eclipse.cdt.core.dom.ast.gnu.cpp,
org.eclipse.cdt.core.formatter,
- org.eclipse.cdt.core.index,
org.eclipse.cdt.core.model,
+ org.eclipse.cdt.core.model.util,
org.eclipse.cdt.core.parser,
org.eclipse.cdt.core.parser.ast,
org.eclipse.cdt.core.parser.ast.gcc,
org.eclipse.cdt.core.parser.extension,
org.eclipse.cdt.core.parser.util,
org.eclipse.cdt.core.resources,
- org.eclipse.cdt.core.search,
org.eclipse.cdt.internal.core,
- org.eclipse.cdt.internal.core.browser.cache,
- org.eclipse.cdt.internal.core.browser.util,
org.eclipse.cdt.internal.core.dom,
org.eclipse.cdt.internal.core.dom.parser,
org.eclipse.cdt.internal.core.dom.parser.c,
org.eclipse.cdt.internal.core.dom.parser.cpp,
- org.eclipse.cdt.internal.core.index,
- org.eclipse.cdt.internal.core.index.cindexstorage,
- org.eclipse.cdt.internal.core.index.cindexstorage.io,
- org.eclipse.cdt.internal.core.index.ctagsindexer,
- org.eclipse.cdt.internal.core.index.domsourceindexer,
- org.eclipse.cdt.internal.core.index.impl,
- org.eclipse.cdt.internal.core.index.nullindexer,
org.eclipse.cdt.internal.core.model,
org.eclipse.cdt.internal.core.parser,
org.eclipse.cdt.internal.core.parser.ast,
@@ -57,11 +45,6 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.internal.core.pdom.dom,
org.eclipse.cdt.internal.core.pdom.dom.c,
org.eclipse.cdt.internal.core.pdom.dom.cpp,
- org.eclipse.cdt.internal.core.search,
- org.eclipse.cdt.internal.core.search.indexing,
- org.eclipse.cdt.internal.core.search.matching,
- org.eclipse.cdt.internal.core.search.processing,
- org.eclipse.cdt.internal.core.sourcedependency,
org.eclipse.cdt.internal.core.util,
org.eclipse.cdt.internal.errorparsers,
org.eclipse.cdt.internal.formatter,
diff --git a/core/org.eclipse.cdt.core/browser/ChangeLog-browser b/core/org.eclipse.cdt.core/browser/ChangeLog-browser
deleted file mode 100644
index 076461df5d..0000000000
--- a/core/org.eclipse.cdt.core/browser/ChangeLog-browser
+++ /dev/null
@@ -1,108 +0,0 @@
-2005-03-29 Chris Wiebe
- small change for potential reduction in memory usage
- * browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java
-
-2005-03-29 Chris Wiebe
- temporary fix for type parser timeout
- * browser/org/eclipse/cdt/core/browser/cache/TypeParser.java
-
-2005-03-13 Bogdan Gheorghe
- Updated references to IndexManager to reflect new multi-indexer framework.
- * browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependencies.java
- * browser/org/eclipse/cdt/internal/core/browser/cache/IndexerJob.java
- * browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob.java
- * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java
- * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java
-
- Added temporary flag to TypeCacheManager to prevent deadlocks during JUnit runs, pending
- changes to Index Storage framework.
- * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheManager.java
-
-2005-01-06 Chris Wiebe
- added parser timeout to TypeParser
- * browser/org/eclipse/cdt/internal/core/browser/cache/TypeParser.java
-
-2004-11-08 Chris Wiebe
-
- fix for 68883
- * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheManager.java
-
-2004-09-15 Chris Wiebe
-
- add getTypes and getAllTypes methods
- * browser/org/eclipse/cdt/core/browser/TypeUtil.java
-
-2004-09-02 Chris Wiebe
-
- add method to get global namespace
- * browser/org/eclipse/cdt/internal/core/browser/AllTypesCache.java
-
-2004-09-01 Chris Wiebe
-
- avoid unnecessary deltas
- * browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheManager.java
-
-2004-08-31 Chris Wiebe
-
- Fix for 68883
- * browser/org/eclipse/cdt/core/browser/AllTypesCache.java
- * browser/org/eclipse/cdt/core/browser/ITypeCacheChangedListener.java
- * browser/org/eclipse/cdt/core/browser/ITypeInfo.java
- * browser/org/eclipse/cdt/core/browser/TypeInfo.java
- * browser/org/eclipse/cdt/core/browser/TypeUtil.java
- * browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchy.java
- * browser/org/eclipse/cdt/core/browser/cache/ITypeCache.java
- * browser/org/eclipse/cdt/core/browser/cache/TypeCache.java
- * browser/org/eclipse/cdt/core/browser/cache/TypeCacheManager.java
-
-2004-08-26 Chris Wiebe
-
- make QualifiedTypeName immutable class
- get rid of unnecessary memory allocations
- * browser/org/eclipse/cdt/core/browser/IQualifiedTypeName.java
- * browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java
- * browser/org/eclipse/cdt/core/browser/TypeInfo.java
- * browser/org/eclipse/cdt/internal/core/browser/TypeCache.java
-
-2004-07-16 Chris Wiebe
-
- Fixing numerous warnings.
-
-2004-07-06 Chris Wiebe
-
- This patch prevents some NPEs from happening in the class browser. I
- suggest this should be applied to both HEAD and CDT_2_0 branch.
-
- * browser/org/eclipse/cdt/core/browser/TypeInfo.java
-
-2004-06-22 Alain Magloire
- Part of PR 68246.
- Close the inputstream to release resource handle
- when we done with it, we can not rely on the GC to do it for us.
-
- * browser/org/eclipse/cdt/internal/core/browser/cache/TypeParser.java
-
-2004-06-21 Chris Wiebe
-
- - fix for bug #66108 (C++ browser cannot show members of class)
- - TypeParser now uses resource to get scanner info
-
-2004-06-17 Alain Magloire
-
- Changes from Chris Wiebe to deal
- with the memory consumption.
-
-2004-05-12 Chris Wiebe
- Heavy refactoring of type cache to address scalability
- concerns.
-
-2004-05-06 Chris Wiebe
- Creating a new Job to handle the changes, instead
- of reusing the same job.
-
-2004-04-20 Chris Wiebe
- refactored TypeCacheDeltaListener into standalone class
- added option in Work In Progress prefs page to disable background cache
-
-2004-04-06 Chris Wiebe
- initial placement of non-ui code into org.eclipse.cdt.core.browser \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java
deleted file mode 100644
index 1481da5ae0..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/AllTypesCache.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy;
-import org.eclipse.cdt.core.browser.typehierarchy.TypeHierarchyBuilder;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ElementChangedEvent;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.IElementChangedListener;
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.cdt.core.model.IWorkingCopyProvider;
-import org.eclipse.cdt.internal.core.browser.cache.ITypeCache;
-import org.eclipse.cdt.internal.core.browser.cache.TypeCacheManager;
-import org.eclipse.cdt.internal.core.browser.util.ArrayUtil;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * Manages a search cache for types in the workspace. Instead of returning
- * objects of type <code>ICElement</code> the methods of this class returns a
- * list of the lightweight objects <code>TypeInfo</code>.
- * <P>
- * AllTypesCache runs asynchronously using a background job to rebuild the cache
- * as needed. If the cache becomes dirty again while the background job is
- * running, the job is restarted.
- * <P>
- * If <code>getTypes</code> is called in response to a user action, a progress
- * dialog is shown. If called before the background job has finished, getTypes
- * waits for the completion of the background job.
- */
-public class AllTypesCache {
-
- private static final int INITIAL_DELAY = 5000;
- private static IWorkingCopyProvider fgWorkingCopyProvider;
- private static TypeHierarchyBuilder fgTypeHierarchyBuilder;
- private static IElementChangedListener fgElementChangedListener;
- private static IPropertyChangeListener fgPropertyChangeListener;
- static boolean fgEnableIndexing = true;
-
- /** Preference key for enabling background cache */
- public final static String ENABLE_BACKGROUND_TYPE_CACHE = "enableBackgroundTypeCache"; //$NON-NLS-1$
-
- /**
- * Initializes the AllTypesCache service.
- *
- * @param provider A working copy provider.
- */
- public static void initialize(IWorkingCopyProvider workingCopyProvider) {
- fgWorkingCopyProvider = workingCopyProvider;
- TypeCacheManager.getInstance().setWorkingCopyProvider(fgWorkingCopyProvider);
- fgTypeHierarchyBuilder = new TypeHierarchyBuilder();
-
- // load prefs
-// Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
-// if (prefs.contains(ENABLE_BACKGROUND_TYPE_CACHE)) {
-// fgEnableIndexing = prefs.getBoolean(ENABLE_BACKGROUND_TYPE_CACHE);
-// } else {
-// prefs.setDefault(ENABLE_BACKGROUND_TYPE_CACHE, false);
-// prefs.setValue(ENABLE_BACKGROUND_TYPE_CACHE, false);
-// CCorePlugin.getDefault().savePluginPreferences();
-// fgEnableIndexing = true;
-// }
- fgEnableIndexing = false;
-
- // start jobs in background after INITIAL_DELAY
- TypeCacheManager.getInstance().reconcile(fgEnableIndexing, Job.BUILD, INITIAL_DELAY);
-
- // add delta listener
- fgElementChangedListener = new IElementChangedListener() {
- public void elementChanged(ElementChangedEvent event) {
- TypeCacheManager.getInstance().processElementChanged(event, fgEnableIndexing);
- }
- };
- CoreModel.getDefault().addElementChangedListener(fgElementChangedListener);
-
-// // add property change listener
-// fgPropertyChangeListener = new IPropertyChangeListener() {
-// public void propertyChange(PropertyChangeEvent event) {
-// String property = event.getProperty();
-// if (property.equals(ENABLE_BACKGROUND_TYPE_CACHE)) {
-// String value = (String) event.getNewValue();
-// fgEnableIndexing = Boolean.valueOf(value).booleanValue();
-// if (!fgEnableIndexing) {
-// TypeCacheManager.getInstance().cancelJobs();
-// } else {
-// TypeCacheManager.getInstance().reconcile(fgEnableIndexing, Job.BUILD, 0);
-// }
-// }
-// }
-// };
-// prefs.addPropertyChangeListener(fgPropertyChangeListener);
- }
-
- /**
- * Terminates the service provided by AllTypesCache.
- */
- public static void terminate() {
- // remove delta listener
- if (fgElementChangedListener != null)
- CoreModel.getDefault().removeElementChangedListener(fgElementChangedListener);
-
- // remove property change listener
- if (fgPropertyChangeListener != null)
- CCorePlugin.getDefault().getPluginPreferences().removePropertyChangeListener(fgPropertyChangeListener);
-
- // terminate all running jobs
- if (TypeCacheManager.getInstance() != null) {
- TypeCacheManager.getInstance().cancelJobs();
- }
- }
-
- /**
- * Returns all types in the workspace.
- */
- public static ITypeInfo[] getAllTypes() {
- final Collection fAllTypes = new ArrayList();
- TypeSearchScope workspaceScope = new TypeSearchScope(true);
- IProject[] projects = workspaceScope.getEnclosingProjects();
- ITypeInfoVisitor visitor = new ITypeInfoVisitor() {
- public boolean visit(ITypeInfo info) {
- fAllTypes.add(info);
- return true;
- }
- public boolean shouldContinue() { return true; }
- };
- for (int i = 0; i < projects.length; ++i) {
- TypeCacheManager.getInstance().getCache(projects[i]).accept(visitor);
- }
- return (ITypeInfo[]) fAllTypes.toArray(new ITypeInfo[fAllTypes.size()]);
- }
-
- /**
- * Returns all types in the given scope.
- *
- * @param scope The search scope
- * @param kinds Array containing CElement types: C_NAMESPACE, C_CLASS,
- * C_UNION, C_ENUMERATION, C_TYPEDEF
- */
- public static ITypeInfo[] getTypes(ITypeSearchScope scope, int[] kinds) {
- final Collection fTypesFound = new ArrayList();
- final ITypeSearchScope fScope = scope;
- final int[] fKinds = kinds;
- IProject[] projects = scope.getEnclosingProjects();
- ITypeInfoVisitor visitor = new ITypeInfoVisitor() {
- public boolean visit(ITypeInfo info) {
- if (ArrayUtil.contains(fKinds, info.getCElementType())
- && (fScope != null && info.isEnclosed(fScope))) {
- fTypesFound.add(info);
- }
- return true;
- }
- public boolean shouldContinue() { return true; }
- };
- for (int i = 0; i < projects.length; ++i) {
- TypeCacheManager.getInstance().getCache(projects[i]).accept(visitor);
- }
- return (ITypeInfo[]) fTypesFound.toArray(new ITypeInfo[fTypesFound.size()]);
- }
-
- /**
- * Returns all types matching name in the given scope.
- *
- * @param scope The search scope
- * @param qualifiedName The qualified type name
- * @param kinds Array containing CElement types: C_NAMESPACE, C_CLASS,
- * C_UNION, C_ENUMERATION, C_TYPEDEF
- * @param matchEnclosed <code>true</code> if enclosed types count as matches (foo::bar == bar)
- */
- public static ITypeInfo[] getTypes(ITypeSearchScope scope, IQualifiedTypeName qualifiedName, int[] kinds, boolean matchEnclosed) {
- final Collection fTypesFound = new ArrayList();
- final ITypeSearchScope fScope = scope;
- final int[] fKinds = kinds;
- final IQualifiedTypeName fQualifiedName = qualifiedName;
- final boolean fMatchEnclosed = matchEnclosed;
- IProject[] projects = scope.getEnclosingProjects();
- ITypeInfoVisitor visitor = new ITypeInfoVisitor() {
- public boolean visit(ITypeInfo info) {
- if (ArrayUtil.contains(fKinds, info.getCElementType())
- && (fScope != null && info.isEnclosed(fScope))) {
- IQualifiedTypeName currName = info.getQualifiedTypeName();
- if (fMatchEnclosed && currName.segmentCount() > fQualifiedName.segmentCount()
- && currName.lastSegment().equals(fQualifiedName.lastSegment())) {
- currName = currName.removeFirstSegments(currName.segmentCount() - fQualifiedName.segmentCount());
- }
- if (currName.equals(fQualifiedName)) {
- fTypesFound.add(info);
- }
- }
- return true;
- }
- public boolean shouldContinue() { return true; }
- };
- for (int i = 0; i < projects.length; ++i) {
- TypeCacheManager.getInstance().getCache(projects[i]).accept(visitor);
- }
- return (ITypeInfo[]) fTypesFound.toArray(new ITypeInfo[fTypesFound.size()]);
- }
-
- /**
- * Returns all namespaces in the given scope.
- *
- * @param scope The search scope
- * @param includeGlobalNamespace <code>true</code> if the global (default) namespace should be returned
- */
- public static ITypeInfo[] getNamespaces(ITypeSearchScope scope, boolean includeGlobalNamespace) {
- final Collection fTypesFound = new ArrayList();
- final ITypeSearchScope fScope = scope;
- IProject[] projects = scope.getEnclosingProjects();
- ITypeInfoVisitor visitor = new ITypeInfoVisitor() {
- public boolean visit(ITypeInfo info) {
- if (info.getCElementType() == ICElement.C_NAMESPACE
- && (fScope != null && info.isEnclosed(fScope))) {
- fTypesFound.add(info);
- }
- return true;
- }
- public boolean shouldContinue() { return true; }
- };
- for (int i = 0; i < projects.length; ++i) {
- ITypeCache cache = TypeCacheManager.getInstance().getCache(projects[i]);
- cache.accept(visitor);
- if (includeGlobalNamespace) {
- fTypesFound.add(cache.getGlobalNamespace());
- }
- }
- return (ITypeInfo[]) fTypesFound.toArray(new ITypeInfo[fTypesFound.size()]);
- }
-
- /**
- * Returns the global (default) namespace for the given project.
- *
- * @param project the project
- */
- public static ITypeInfo getGlobalNamespace(IProject project) {
- ITypeCache cache = TypeCacheManager.getInstance().getCache(project);
- return cache.getGlobalNamespace();
- }
-
- /**
- * Returns true if the type cache is up to date.
- */
- public static boolean isCacheUpToDate(ITypeSearchScope scope) {
- forceDeltaComplete();
-
- IProject[] projects = scope.getEnclosingProjects();
- for (int i = 0; i < projects.length; ++i) {
- IProject project = projects[i];
- if (project.exists() && project.isOpen()) {
- if (!TypeCacheManager.getInstance().getCache(project).isUpToDate())
- return false;
- }
- }
- return true;
- }
-
- private static void forceDeltaComplete() {
- if (fgWorkingCopyProvider != null) {
- IWorkingCopy[] workingCopies = fgWorkingCopyProvider.getWorkingCopies();
- for (int i = 0; i < workingCopies.length; ++i) {
- IWorkingCopy wc = workingCopies[i];
- try {
- synchronized (wc) {
- wc.reconcile();
- }
- } catch (CModelException ex) {
- }
- }
- }
- }
-
- /**
- * Updates the type cache.
- *
- * @param monitor the progress monitor
- */
- public static void updateCache(ITypeSearchScope scope, IProgressMonitor monitor) {
- TypeCacheManager.getInstance().updateCache(scope, monitor);
- }
-
- /**
- * Resolves a type location.
- *
- * @param info the type to search for
- * @param monitor the progress monitor
- */
- public static ITypeReference resolveTypeLocation(ITypeInfo info, IProgressMonitor monitor) {
- return TypeCacheManager.getInstance().resolveTypeLocation(info, monitor, fgEnableIndexing);
- }
-
- /** Returns first type in the cache which matches the given
- * type and name. If no type is found, <code>null</code>
- * is returned.
- *
- * @param project the enclosing project
- * @param type the ICElement type
- * @param qualifiedName the qualified type name to match
- * @return the matching type
- */
- public static ITypeInfo getType(IProject project, int type, IQualifiedTypeName qualifiedName) {
- ITypeCache cache = TypeCacheManager.getInstance().getCache(project);
- return cache.getType(type, qualifiedName);
- }
-
- /**
- * Returns all types matching name in the given project.
- *
- * @param project the enclosing project
- * @param qualifiedName The qualified type name
- * @param matchEnclosed <code>true</code> if enclosed types count as matches (foo::bar == bar)
- * @param ignoreCase <code>true</code> if case-insensitive
- * @return Array of types
- */
- public static ITypeInfo[] getTypes(IProject project, IQualifiedTypeName qualifiedName, boolean matchEnclosed, boolean ignoreCase) {
- ITypeCache cache = TypeCacheManager.getInstance().getCache(project);
- return cache.getTypes(qualifiedName, matchEnclosed, ignoreCase);
- }
-
- /**
- * Creates and returns a type hierarchy for this type containing
- * this type and all of its supertypes and subtypes in the workspace.
- *
- * @param info the given type
- * @param monitor the given progress monitor
- * @return a type hierarchy for the given type
- */
- public static ITypeHierarchy createTypeHierarchy(ICElement type, IProgressMonitor monitor) throws CModelException {
- ITypeInfo info = TypeCacheManager.getInstance().getTypeForElement(type, true, true, fgEnableIndexing, monitor);
- if (info != null)
- return fgTypeHierarchyBuilder.createTypeHierarchy(info, fgEnableIndexing, monitor);
- return null;
- }
-
- public static void addTypeCacheChangedListener(ITypeCacheChangedListener listener) {
- TypeCacheManager.getInstance().addTypeCacheChangedListener(listener);
- }
-
- public static void removeTypeCacheChangedListener(ITypeCacheChangedListener listener) {
- TypeCacheManager.getInstance().removeTypeCacheChangedListener(listener);
- }
-
- public static ITypeInfo getTypeForElement(ICElement element, boolean forceUpdate, boolean forceResolve, IProgressMonitor monitor) {
- return TypeCacheManager.getInstance().getTypeForElement(element, forceUpdate, forceResolve, fgEnableIndexing, monitor);
- }
-
- public static ICElement getElementForType(ITypeInfo type, boolean forceUpdate, boolean forceResolve, IProgressMonitor monitor) {
- return TypeCacheManager.getInstance().getElementForType(type, forceUpdate, forceResolve, fgEnableIndexing, monitor);
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeCacheChangedListener.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeCacheChangedListener.java
deleted file mode 100644
index a7e7bce5d1..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeCacheChangedListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-import org.eclipse.core.resources.IProject;
-
-
-/**
- * A listener which gets notified when the type cache changes.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- */
-public interface ITypeCacheChangedListener {
-
- /**
- * Notifies that the type cache for the given project has changed in some way
- * and should be refreshed at some point to make it consistent with the current
- * state of the C model.
- *
- * @param project the given project
- */
- void typeCacheChanged(IProject project);
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java
deleted file mode 100644
index b985dbf27f..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfo.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.internal.core.browser.cache.ITypeCache;
-import org.eclipse.core.resources.IProject;
-
-/**
- * Type information.
- */
-public interface ITypeInfo extends Comparable {
-
- public static final int KNOWN_TYPES[] = {
- ICElement.C_NAMESPACE,
- ICElement.C_CLASS,
- ICElement.C_STRUCT,
- ICElement.C_UNION,
- ICElement.C_ENUMERATION,
- ICElement.C_TYPEDEF
- };
-
- /**
- * Gets the CElement type.
- * @return ICElement.C_NAMESPACE, C_CLASS, C_STRUCT, C_UNION, C_ENUMERATION, or C_TYPEDEF,
- * or zero if unknown type.
- */
- public int getCElementType();
-
- /**
- * Sets the CElement type.
- */
- public void setCElementType(int type);
-
- /**
- * Gets the type name.
- */
- public String getName();
-
- /**
- * Gets the qualified type name.
- */
- public IQualifiedTypeName getQualifiedTypeName();
-
- /**
- * Returns true if the type exists.
- */
- public boolean exists();
-
- /**
- * Returns true if the element type is unknown.
- */
- public boolean isUndefinedType();
-
- /**
- * Returns true if this type is enclosed by other types,
- * i.e. declared an inside another namespace or class.
- */
- public boolean isEnclosedType();
-
- /** Gets the enclosing type, i.e. the outer class or namespace which contains this type.
- * @return the enclosing type, or <code>null</code> if not found.
- */
- public ITypeInfo getEnclosingType();
-
- /** Gets the enclosing namespace for this type.
- * @return the enclosing namespace, or <code>null</code> if none exists.
- */
- public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace);
-
- /** Gets the first enclosing type which matches one of the given kinds.
- * @param kinds Array containing CElement types: C_NAMESPACE, C_CLASS, C_STRUCT
- * @return the enclosing type, or <code>null</code> if not found.
- */
- public ITypeInfo getEnclosingType(int[] kinds);
-
- /** Gets the root namespace, i.e. the outermost namespace
- * which contains this type.
- * @param includeGlobalNamespace <code>true</code> if the global (default) namespace should be returned
- * @return the namespace, or <code>null</code> if not found.
- */
- public ITypeInfo getRootNamespace(boolean includeGlobalNamespace);
-
- /**
- * Returns true if this type is capable of enclosing other types,
- * i.e. it is a namespace, class, or struct.
- */
- public boolean isEnclosingType();
-
- /**
- * Returns true if this type encloses other types, i.e. contains
- * inner classes or namespaces.
- */
- public boolean hasEnclosedTypes();
-
- /**
- * Returns true if this type encloses the given type.
- */
- public boolean encloses(ITypeInfo info);
-
- /**
- * Returns true if this type is enclosed by the given type.
- */
- public boolean isEnclosed(ITypeInfo info);
-
- /** Gets the enclosed types, i.e. inner classes or classes inside this namespace.
- * @return array of inner types, or empty array if not found.
- */
- public ITypeInfo[] getEnclosedTypes();
-
- /** Gets the enclosed types, i.e. inner classes or classes inside this namespace.
- * @param kinds Array containing CElement types: C_NAMESPACE, C_CLASS, C_STRUCT,
- * C_UNION, C_ENUMERATION, C_TYPEDEF
- * @return array of inner types, or empty array if not found.
- */
- public ITypeInfo[] getEnclosedTypes(int kinds[]);
-
- /**
- * Gets the enclosing project.
- */
- public IProject getEnclosingProject();
-
- /**
- * Returns true if type is enclosed in the given scope.
- */
- public boolean isEnclosed(ITypeSearchScope scope);
-
- /**
- * Adds a source reference.
- */
- public void addReference(ITypeReference location);
-
- /** Gets the originating locations where this type was declared.
- * @return all known source references, or an empty
- * array if none found.
- */
- public ITypeReference[] getReferences();
-
- /** Gets the real location where type was declared.
- * @return the parsed source reference (with offset and length),
- * or <code>null</code> if not found.
- */
- public ITypeReference getResolvedReference();
-
- /**
- * Returns true if the type can be substituted.
- */
- public boolean canSubstituteFor(ITypeInfo info);
-
- public ITypeCache getCache();
- public void setCache(ITypeCache typeCache);
-
- /**
- * Returns true if other types extend this type.
- */
- public boolean hasSubTypes();
-
- /** Gets all types which extend this type.
- * @return array of types, or <code>null</code> if none found.
- */
- public ITypeInfo[] getSubTypes();
-
- /**
- * Returns true if this type has base classes.
- */
- public boolean hasSuperTypes();
-
- /** Gets the base classes.
- * @return array of types, or <code>null</code> if none found.
- */
- public ITypeInfo[] getSuperTypes();
-
- /**
- * Gets the base class access visibility (PRIVATE, PROTECTED, PUBLIC)
- */
- public ASTAccessVisibility getSuperTypeAccess(ITypeInfo subType);
-
- /**
- * Adds a derived class reference, i.e. this type is used as
- * a base class at the given location.
- */
- public void addDerivedReference(ITypeReference location);
-
- /** Gets the originating locations where this type was
- * used as a base class.
- * @return all known source references, or an empty
- * array if none found.
- */
- public ITypeReference[] getDerivedReferences();
-
- /**
- * Returns true if the type is a class or struct.
- */
- public boolean isClass();
-
- /**
- * Returns true if type is referenced in the given scope.
- */
- public boolean isReferenced(ITypeSearchScope scope);
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfoVisitor.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfoVisitor.java
deleted file mode 100644
index 38dcbe93ab..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeInfoVisitor.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-public interface ITypeInfoVisitor {
-
- public boolean visit(ITypeInfo info);
-
- public boolean shouldContinue();
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeReference.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeReference.java
deleted file mode 100644
index 90d29c4283..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeReference.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-public interface ITypeReference {
-
- /**
- * Returns the full, absolute path of this reference
- * relative to the workspace, or null if no path can be
- * determined.
- */
- public IPath getPath();
-
- /**
- * Returns the absolute path in the local file system
- * to this reference, or null if no path can be
- * determined.
- */
- public IPath getLocation();
-
- /**
- * Returns the resource.
- */
- public IResource getResource();
-
- /**
- * Returns the working copy.
- */
- public IWorkingCopy getWorkingCopy();
-
- /**
- * Returns the project.
- */
- public IProject getProject();
-
- /**
- * Returns the offset.
- */
- public int getOffset();
-
- /**
- * Returns the length.
- */
- public int getLength();
-
- /**
- * Returns the CElements located at the stored offset and length,
- * or <code>null</code> if not found.
- */
- public ICElement[] getCElements();
-
- /**
- * Returns a translation unit for this location.
- */
- public ITranslationUnit getTranslationUnit();
-
- /** Gets the path for this location, relative to one of
- * the given project's include paths.
- *
- * @param project the project to use as a reference.
- * @return The path to this location, relative to the longest
- * matching include path in the given project.
- */
- public IPath getRelativeIncludePath(IProject project);
-
- /** Gets the path for this location, relative to the
- * given path.
- *
- * @param relativeToPath the path to use as a reference.
- * @return The path to this location, relative to the
- * given path.
- */
- public IPath getRelativePath(IPath relativeToPath);
-
- boolean isLineNumber();
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java
deleted file mode 100644
index 269d3c9a8f..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/ITypeSearchScope.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-import java.util.Collection;
-
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-
-public interface ITypeSearchScope {
-
- public boolean isPathScope();
- public boolean isProjectScope();
- public boolean isWorkspaceScope();
- public boolean isEmpty();
-
- public boolean encloses(ITypeSearchScope scope);
- public boolean encloses(IProject project);
- public boolean encloses(IPath path);
- public boolean encloses(String path);
- public boolean encloses(ICElement element);
- public boolean encloses(IWorkingCopy workingCopy);
-
- public void add(IWorkingCopy workingCopy);
- public void add(IPath path, boolean addSubfolders, IProject enclosingProject);
- public void add(IProject project);
- public void add(ICElement elem);
- public void add(ITypeSearchScope scope);
- public void addWorkspace();
- public void clear();
- public IProject[] getEnclosingProjects();
-
- public Collection pathSet();
- public Collection containerSet();
- public Collection projectSet();
- public Collection enclosingProjectSet();
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java
deleted file mode 100644
index 9a10b78da9..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeInfo.java
+++ /dev/null
@@ -1,330 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.internal.core.browser.cache.ITypeCache;
-import org.eclipse.cdt.internal.core.browser.util.ArrayUtil;
-import org.eclipse.core.resources.IProject;
-
-public class TypeInfo implements ITypeInfo
-{
- protected ITypeCache fTypeCache;
- protected int fElementType;
- protected IQualifiedTypeName fQualifiedName;
- protected ITypeReference[] fSourceRefs = null;
- protected int fSourceRefsCount = 0;
- protected ITypeReference[] fDerivedSourceRefs = null;
- protected int fDerivedSourceRefsCount = 0;
-
- protected final static int INITIAL_REFS_SIZE = 1;
- protected final static int REFS_GROW_BY = 2;
- protected final static ITypeInfo[] EMPTY_TYPES = new ITypeInfo[0];
-
- public TypeInfo(int elementType, IQualifiedTypeName typeName) {
- fElementType = elementType;
- fQualifiedName = typeName;
- }
-
- public void addReference(ITypeReference location) {
- if (fSourceRefs == null) {
- fSourceRefs = new ITypeReference[INITIAL_REFS_SIZE];
- fSourceRefsCount = 0;
- } else if (fSourceRefsCount == fSourceRefs.length) {
- ITypeReference[] refs = new ITypeReference[fSourceRefs.length + REFS_GROW_BY];
- System.arraycopy(fSourceRefs, 0, refs, 0, fSourceRefsCount);
- fSourceRefs = refs;
- }
- fSourceRefs[fSourceRefsCount] = location;
- ++fSourceRefsCount;
- }
-
- public ITypeReference[] getReferences() {
- if (fSourceRefs != null) {
- ITypeReference[] refs = new ITypeReference[fSourceRefsCount];
- System.arraycopy(fSourceRefs, 0, refs, 0, fSourceRefsCount);
- return refs;
- }
- return null;
- }
-
- public ITypeReference getResolvedReference() {
- for (int i = 0; i < fSourceRefsCount; ++i) {
- ITypeReference location = fSourceRefs[i];
- if (location.isLineNumber() )
- return location;
- if( location.getLength() != 0) {
- return location;
- }
- }
- return null;
- }
-
- public boolean isReferenced() {
- return (fSourceRefs != null || fDerivedSourceRefs != null);
- }
-
- public boolean isReferenced(ITypeSearchScope scope) {
- if (scope == null || scope.isWorkspaceScope())
- return true;
-
- // check if path is in scope
- for (int i = 0; i < fSourceRefsCount; ++i) {
- ITypeReference location = fSourceRefs[i];
- if (scope.encloses(location.getPath()))
- return true;
- }
- for (int i = 0; i < fDerivedSourceRefsCount; ++i) {
- ITypeReference location = fDerivedSourceRefs[i];
- if (scope.encloses(location.getPath()))
- return true;
- }
-
- return false;
- }
-
- public boolean isUndefinedType() {
- return fElementType == 0;
- }
-
- public boolean canSubstituteFor(ITypeInfo info) {
- return isExactMatch(info);
- }
-
- protected boolean isExactMatch(ITypeInfo info) {
- if (hashCode() != info.hashCode())
- return false;
- if (fElementType == info.getCElementType()
- && fQualifiedName.equals(info.getQualifiedTypeName())) {
- IProject project1 = getEnclosingProject();
- IProject project2 = info.getEnclosingProject();
- if (project1 == null && project2 == null)
- return true;
- if (project1 == null || project2 == null)
- return false;
- return project1.equals(project2);
- }
- return false;
- }
-
- public boolean exists() {
- return fTypeCache != null;
- }
-
- public int getCElementType() {
- return fElementType;
- }
-
- public void setCElementType(int type) {
- fElementType = type;
- }
-
- public IQualifiedTypeName getQualifiedTypeName() {
- return fQualifiedName;
- }
-
- public String getName() {
- return fQualifiedName.getName();
- }
-
- public boolean isEnclosedType() {
- return (fQualifiedName.isQualified());
- }
-
- public ITypeInfo getEnclosingType(int kinds[]) {
- if (fTypeCache != null) {
- return fTypeCache.getEnclosingType(this, kinds);
- }
- return null;
- }
-
- public ITypeInfo getEnclosingType() {
- return getEnclosingType(KNOWN_TYPES);
- }
-
- public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) {
- if (fTypeCache != null) {
- return fTypeCache.getEnclosingNamespace(this, includeGlobalNamespace);
- }
- return null;
- }
-
- public ITypeInfo getRootNamespace(boolean includeGlobalNamespace) {
- if (fTypeCache != null) {
- return fTypeCache.getRootNamespace(this, includeGlobalNamespace);
- }
- return null;
- }
-
- public boolean isEnclosingType() {
- return (fElementType == ICElement.C_NAMESPACE
- || fElementType == ICElement.C_CLASS
- || fElementType == ICElement.C_STRUCT);
- }
-
- public boolean encloses(ITypeInfo info) {
- if (isEnclosingType() && fTypeCache == info.getCache()) {
- return fQualifiedName.isPrefixOf(info.getQualifiedTypeName());
- }
- return false;
- }
-
- public boolean isEnclosed(ITypeInfo info) {
- return info.encloses(this);
- }
-
- public boolean hasEnclosedTypes() {
- if (isEnclosingType() && fTypeCache != null) {
- return fTypeCache.hasEnclosedTypes(this);
- }
- return false;
- }
-
- public ITypeInfo[] getEnclosedTypes() {
- return getEnclosedTypes(KNOWN_TYPES);
- }
-
- public ITypeInfo[] getEnclosedTypes(int kinds[]) {
- if (fTypeCache != null) {
- return fTypeCache.getEnclosedTypes(this, kinds);
- }
- return EMPTY_TYPES;
- }
-
- public IProject getEnclosingProject() {
- if (fTypeCache != null) {
- return fTypeCache.getProject();
- }
- return null;
- }
-
- public String toString() {
- return fQualifiedName.toString();
- }
-
- public boolean isEnclosed(ITypeSearchScope scope) {
- if (scope == null || scope.isWorkspaceScope())
- return true;
-
- // check if path is in scope
- for (int i = 0; i < fSourceRefsCount; ++i) {
- ITypeReference location = fSourceRefs[i];
- if (scope.encloses(location.getPath()))
- return true;
- }
-
- return false;
- }
-
- public int hashCode() {
- int hashCode = fQualifiedName.hashCode() + fElementType;
- IProject project = getEnclosingProject();
- if (project != null)
- hashCode += project.hashCode();
- return hashCode;
- }
-
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof TypeInfo)) {
- return false;
- }
- return isExactMatch((TypeInfo)obj);
- }
-
- public int compareTo(Object obj) {
- if (obj == this) {
- return 0;
- }
- if( !(obj instanceof TypeInfo)) {
- throw new ClassCastException();
- }
- TypeInfo info= (TypeInfo)obj;
- if (fElementType != info.fElementType)
- return (fElementType < info.fElementType) ? -1 : 1;
- return fQualifiedName.compareTo(info.getQualifiedTypeName());
- }
-
- public static boolean isValidType(int type) {
- return ArrayUtil.contains(KNOWN_TYPES, type);
- }
-
- public ITypeCache getCache() {
- return fTypeCache;
- }
-
- public void setCache(ITypeCache typeCache) {
- fTypeCache = typeCache;
- }
-
- public void addDerivedReference(ITypeReference location) {
- if (fDerivedSourceRefs == null) {
- fDerivedSourceRefs = new ITypeReference[INITIAL_REFS_SIZE];
- fDerivedSourceRefsCount = 0;
- } else if (fDerivedSourceRefsCount == fDerivedSourceRefs.length) {
- ITypeReference[] refs = new ITypeReference[fDerivedSourceRefs.length + REFS_GROW_BY];
- System.arraycopy(fDerivedSourceRefs, 0, refs, 0, fDerivedSourceRefsCount);
- fDerivedSourceRefs = refs;
- }
- fDerivedSourceRefs[fDerivedSourceRefsCount] = location;
- ++fDerivedSourceRefsCount;
- }
-
- public ITypeReference[] getDerivedReferences() {
- if (fDerivedSourceRefs != null) {
- ITypeReference[] refs = new ITypeReference[fDerivedSourceRefsCount];
- System.arraycopy(fDerivedSourceRefs, 0, refs, 0, fDerivedSourceRefsCount);
- return refs;
- }
- return null;
- }
-
- public boolean hasSubTypes() {
- return (fDerivedSourceRefs != null);
- }
-
- public ITypeInfo[] getSubTypes() {
- if (fTypeCache != null) {
- return fTypeCache.getSubtypes(this);
- }
- return null;
- }
-
- public boolean hasSuperTypes() {
- if (fTypeCache != null) {
- return (fTypeCache.getSupertypes(this) != null);
- }
- return false;
-// return true; //TODO can't know this until we parse
- }
-
- public ITypeInfo[] getSuperTypes() {
- if (fTypeCache != null) {
- return fTypeCache.getSupertypes(this);
- }
- return null;
- }
-
- public ASTAccessVisibility getSuperTypeAccess(ITypeInfo superType) {
- if (fTypeCache != null) {
- return fTypeCache.getSupertypeAccess(this, superType);
- }
- return null;
- }
-
- public boolean isClass() {
- return (fElementType == ICElement.C_CLASS
- || fElementType == ICElement.C_STRUCT);
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeReference.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeReference.java
deleted file mode 100644
index cb91663e81..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeReference.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.cdt.utils.PathUtil;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-
-public class TypeReference implements ITypeReference {
- private IPath fPath;
- private IProject fProject;
- private IResource fResource;
- private IWorkingCopy fWorkingCopy;
- private int fOffset;
- private int fLength;
- public boolean offsetIsLineNumber = false;
-
- public TypeReference(IPath path, IProject project, int offset, int length) {
- fPath = path;
- fProject = project;
- fWorkingCopy = null;
- fResource = null;
- fOffset = offset;
- fLength = length;
- }
-
- public TypeReference(IResource resource, IProject project, int offset, int length) {
- fPath = null;
- fProject = project;
- fWorkingCopy = null;
- fResource = resource;
- fOffset = offset;
- fLength = length;
- }
-
- public TypeReference(IWorkingCopy workingCopy, IProject project, int offset, int length) {
- fPath = null;
- fProject = project;
- fWorkingCopy = workingCopy;
- fResource = null;
- fOffset = offset;
- fLength = length;
- }
-
- public TypeReference(IPath path, IProject project) {
- this(path, project, 0, 0);
- }
-
- public TypeReference(IResource resource, IProject project) {
- this(resource, project, 0, 0);
- }
-
- public TypeReference(IWorkingCopy workingCopy, IProject project) {
- this(workingCopy, project, 0, 0);
- }
-
- public IPath getPath() {
- if (fWorkingCopy != null) {
- return fWorkingCopy.getPath();
- } else if (fResource != null) {
- return fResource.getFullPath();
- } else {
- return fPath;
- }
- }
-
- public IPath getLocation() {
- if (fWorkingCopy != null) {
- IResource resource = fWorkingCopy.getUnderlyingResource();
- if (resource != null) {
- return resource.getLocation();
- }
- return null;
- } else if (fResource != null) {
- return fResource.getLocation();
- } else if (fPath != null) {
- return fPath;
- } else if (fProject != null) {
- return fProject.getLocation();
- } else {
- return null;
- }
- }
-
- public IResource getResource() {
- return fResource;
- }
-
- public IWorkingCopy getWorkingCopy() {
- return fWorkingCopy;
- }
-
- public IProject getProject() {
- if (fProject != null) {
- return fProject;
- }
- if (fWorkingCopy != null) {
- ICProject cProject = fWorkingCopy.getCProject();
- if (cProject != null) {
- return cProject.getProject();
- }
- return null;
- } else if (fResource != null) {
- return fResource.getProject();
- } else {
- return null;
- }
- }
-
- public ITranslationUnit getTranslationUnit() {
- ITranslationUnit unit = null;
- if (fWorkingCopy != null) {
- unit = fWorkingCopy.getTranslationUnit();
- } else if (fResource != null) {
- ICElement elem = CoreModel.getDefault().create(fResource);
- if (elem instanceof ITranslationUnit)
- unit = (ITranslationUnit) elem;
- } else {
- IPath path = getLocation();
- ICElement elem = CoreModel.getDefault().create(path);
- if (elem instanceof ITranslationUnit)
- unit = (ITranslationUnit) elem;
- }
-
- if (unit == null) {
- IProject project = getProject();
- if (project != null) {
- ICProject cProject = findCProject(project);
- if (cProject != null) {
- IPath path = getLocation();
- ICElement elem = CoreModel.getDefault().createTranslationUnitFrom(cProject, path);
- if (elem instanceof ITranslationUnit)
- unit = (ITranslationUnit) elem;
- }
- }
- }
- return unit;
- }
-
- private ICProject findCProject(IProject project) {
- try {
- ICProject[] cProjects = CoreModel.getDefault().getCModel().getCProjects();
- if (cProjects != null) {
- for (int i = 0; i < cProjects.length; ++i) {
- ICProject cProject = cProjects[i];
- if (project.equals(cProjects[i].getProject()))
- return cProject;
- }
- }
- } catch (CModelException e) {
- }
- return null;
- }
-
- public ICElement[] getCElements() {
- ITranslationUnit unit = getTranslationUnit();
- if (unit != null) {
- try {
- if( offsetIsLineNumber )
- {
- ICElement [] result = new ICElement[1];
- result[0] = unit.getElementAtLine(fOffset);
- return result;
- }
- return unit.getElementsAtOffset(fOffset);
- } catch (CModelException e) {
- }
- }
- return null;
- }
-
- public int getOffset() {
- return fOffset;
- }
-
- public int getLength() {
- return fLength;
- }
-
- public IPath getRelativeIncludePath(IProject project) {
- IPath path = getLocation();
- if (path != null) {
- IPath relativePath = PathUtil.makeRelativePathToProjectIncludes(path, project);
- if (relativePath != null)
- return relativePath;
- }
- return path;
- }
-
- public IPath getRelativePath(IPath relativeToPath) {
- IPath path = getPath();
- if (path != null) {
- IPath relativePath = PathUtil.makeRelativePath(path, relativeToPath);
- if (relativePath != null)
- return relativePath;
- }
- return path;
- }
-
- public String toString() {
- IPath path = getLocation();
- if (path != null) {
- if (fLength == 0 && fOffset == 0) {
- return path.toString();
- }
- return path.toString() + ":" + fOffset + "-" + (fOffset + fLength); //$NON-NLS-1$//$NON-NLS-2$
- }
- return ""; //$NON-NLS-1$
- }
-
- public int hashCode() {
- return toString().hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof ITypeReference)) {
- return false;
- }
- ITypeReference ref = (ITypeReference)obj;
- return toString().equals(ref.toString());
- }
-
- public boolean isLineNumber() {
- return offsetIsLineNumber;
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java
deleted file mode 100644
index c29ea790f9..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/TypeSearchScope.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.cdt.core.parser.IScannerInfo;
-import org.eclipse.cdt.core.parser.IScannerInfoProvider;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-public class TypeSearchScope implements ITypeSearchScope {
-
- private Set fPathSet = new HashSet();
- private Set fContainerSet = new HashSet();
- private Set fProjectSet = new HashSet();
- private Set fEnclosingProjectSet = new HashSet();
- private boolean fWorkspaceScope = false;
-
- // cached arrays
- private IProject[] fAllProjects = null;
- private IProject[] fProjects = null;
- private IPath[] fContainerPaths = null;
-
- public TypeSearchScope() {
- }
-
- public TypeSearchScope(boolean workspaceScope) {
- fWorkspaceScope = workspaceScope;
- }
-
- public TypeSearchScope(ITypeSearchScope scope) {
- add(scope);
- }
-
- public TypeSearchScope(IProject project) {
- add(project);
- }
-
- public Collection pathSet() {
- return fPathSet;
- }
- public Collection containerSet() {
- return fContainerSet;
- }
- public Collection projectSet() {
- return fProjectSet;
- }
- public Collection enclosingProjectSet() {
- return fEnclosingProjectSet;
- }
-
- public boolean encloses(ITypeSearchScope scope) {
- if (isWorkspaceScope())
- return true;
-
- if (!scope.pathSet().isEmpty()) {
- // check if this scope encloses the other scope's paths
- for (Iterator i = scope.pathSet().iterator(); i.hasNext(); ) {
- IPath path = (IPath) i.next();
- if (!encloses(path))
- return false;
- }
- }
-
- if (!scope.containerSet().isEmpty()) {
- // check if this scope encloses the other scope's containers
- for (Iterator i = scope.containerSet().iterator(); i.hasNext(); ) {
- IPath path = (IPath) i.next();
- if (!encloses(path))
- return false;
- }
- }
-
- if (!scope.projectSet().isEmpty()) {
- // check if this scope encloses the other scope's projects
- for (Iterator i = scope.projectSet().iterator(); i.hasNext(); ) {
- IProject project = (IProject) i.next();
- if (!encloses(project))
- return false;
- }
- }
-
- return true;
- }
-
- public boolean encloses(IProject project) {
- if (isWorkspaceScope())
- return true;
-
- // check projects that were explicity added to scope
- if (fProjectSet.contains(project))
- return true;
-
- return false;
- }
-
- public boolean encloses(IPath path) {
- if (isWorkspaceScope())
- return true;
-
- // check files that were explicity added to scope
- if (fPathSet.contains(path))
- return true;
-
- // check containers that were explicity added to scope
- // including subdirs
- if (fContainerSet.contains(path))
- return true;
- if (fContainerPaths == null) {
- fContainerPaths = (IPath[]) fContainerSet.toArray(new IPath[fContainerSet.size()]);
-// java.util.Arrays.sort(fContainerPaths);
- }
- for (int i = 0; i < fContainerPaths.length; ++i) {
- if (fContainerPaths[i].isPrefixOf(path)) {
- return true;
- }
- }
-
- // check projects that were explicity added to scope
- if (fProjectSet.contains(path))
- return true;
-
- // check projects that were explicity added to scope
- if (fProjects == null) {
- fProjects = (IProject[]) fProjectSet.toArray(new IProject[fProjectSet.size()]);
- }
- // check if one of the projects contains path
- for (int i = 0; i < fProjects.length; ++i) {
- if (projectContainsPath(fProjects[i], path, false)) {
- return true;
- }
- }
-
- return false;
- }
-
- public boolean encloses(String path) {
- return encloses(new Path(path));
- }
-
- public boolean encloses(ICElement element) {
- return encloses(element.getPath());
- }
-
- public boolean encloses(IWorkingCopy workingCopy) {
- return encloses(workingCopy.getOriginalElement().getPath());
- }
-
- public IProject[] getEnclosingProjects() {
- if (isWorkspaceScope()) {
- return getAllProjects();
- }
- return (IProject[]) fEnclosingProjectSet.toArray(new IProject[fEnclosingProjectSet.size()]);
- }
-
- private static boolean projectContainsPath(IProject project, IPath path, boolean checkIncludePaths) {
- IPath projectPath = project.getFullPath();
- if (projectPath.isPrefixOf(path)) {
-// ISourceRoot[] sourceRoots = null;
-// try {
-// sourceRoots = cProject.getSourceRoots();
-// } catch (CModelException ex) {
-// }
-// if (sourceRoots != null) {
-// for (int j = 0; j < sourceRoots.length; ++j) {
-// ISourceRoot root = sourceRoots[j];
-// if (root.isOnSourceEntry(path))
-// return true;
-// }
-// }
- return true;
- }
-
- if (checkIncludePaths) {
- //TODO this appears to be very slow -- cache this?
- IPath[] includePaths = getIncludePaths(project);
- if (includePaths != null) {
- for (int i = 0; i < includePaths.length; ++i) {
- IPath include = includePaths[i];
- if (include.isPrefixOf(path) || include.equals(path))
- return true;
- }
- }
- }
-
- return false;
- }
-
- private static IPath[] getIncludePaths(IProject project) {
- IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project);
- if (provider != null) {
- IScannerInfo info = provider.getScannerInformation(project);
- if (info != null) {
- String[] includes = info.getIncludePaths();
- if (includes != null && includes.length > 0) {
- IPath[] includePaths = new IPath[includes.length];
- for (int i = 0; i < includes.length; ++i) {
- includePaths[i] = new Path(includes[i]);
- }
-// java.util.Arrays.sort(includePaths);
- return includePaths;
- }
- }
- }
- return null;
- }
-
- private static IProject[] getAllProjects() {
- IProject[] projects = getCProjects();
- if (projects == null)
- projects = new IProject[0];
- return projects;
- }
-
- private static IProject[] getCProjects() {
- IProject[] allProjects = CCorePlugin.getWorkspace().getRoot().getProjects();
- if (allProjects != null) {
- IProject[] cProjects = new IProject[allProjects.length];
- int count = 0;
- for (int i = 0; i < allProjects.length; ++i) {
- IProject project = allProjects[i];
- if (isCProject(project)) {
- cProjects[count++] = project;
- }
- }
- if (count > 0) {
- if (count == allProjects.length) {
- return cProjects;
- }
- IProject[] newProjects = new IProject[count];
- System.arraycopy(cProjects, 0, newProjects, 0, count);
- return newProjects;
- }
- }
- return null;
- }
-
- private static boolean isCProject(IProject project) {
- IProjectDescription projDesc = null;
- try {
- projDesc = project.getDescription();
- if (projDesc == null)
- return false;
- } catch (CoreException e) {
- return false;
- }
- String[] natures = projDesc.getNatureIds();
- if (natures != null) {
- for (int i = 0; i < natures.length; ++i) {
- if (natures[i].equals(CProjectNature.C_NATURE_ID)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public boolean isPathScope() {
- return !fPathSet.isEmpty();
- }
-
- public boolean isProjectScope() {
- return !fProjectSet.isEmpty();
- }
-
- public boolean isWorkspaceScope() {
- return fWorkspaceScope;
- }
-
- public boolean isEmpty() {
- return (!isWorkspaceScope() && fPathSet.isEmpty() && fContainerSet.isEmpty() && fProjectSet.isEmpty());
- }
-
- public void add(IWorkingCopy workingCopy) {
- IPath path = workingCopy.getOriginalElement().getPath();
- IProject enclosingProject = null;
- ICProject cProject = workingCopy.getCProject();
- if (cProject != null)
- enclosingProject = cProject.getProject();
- fPathSet.add(path);
- if (enclosingProject != null)
- addEnclosingProject(enclosingProject);
- }
-
- public void add(IPath path, boolean addSubfolders, IProject enclosingProject) {
- if (addSubfolders) {
- fContainerSet.add(path);
- fContainerPaths = null;
- } else {
- fPathSet.add(path);
- }
- if (enclosingProject != null) {
- addEnclosingProject(enclosingProject);
- } else {
- // check all projects in workspace
- if (fAllProjects == null) {
- fAllProjects = getAllProjects();
- }
- // check if one of the projects contains path
- for (int i = 0; i < fAllProjects.length; ++i) {
- if (projectContainsPath(fAllProjects[i], path, false)) {
- addEnclosingProject(fAllProjects[i]);
- break;
- }
- }
- }
- }
-
- public void add(IProject project) {
- fProjectSet.add(project);
- fProjects = null;
- fAllProjects = null;
- addEnclosingProject(project);
- }
-
- private void addEnclosingProject(IProject project) {
- fEnclosingProjectSet.add(project);
- }
-
- public void addWorkspace() {
- fWorkspaceScope = true;
- fProjects = null;
- fAllProjects = null;
- }
-
- public void add(ICElement elem) {
- if (elem == null)
- return;
-
- switch (elem.getElementType()) {
- case ICElement.C_MODEL: {
- addWorkspace();
- break;
- }
-
- case ICElement.C_PROJECT: {
- IProject project = ((ICProject)elem).getProject();
- add(project);
- break;
- }
-
- case ICElement.C_CCONTAINER: {
- IProject project = null;
- ICProject cProject = elem.getCProject();
- if (cProject != null)
- project = cProject.getProject();
- add(elem.getPath(), true, project);
- break;
- }
-
- case ICElement.C_UNIT: {
- IProject project = null;
- ICProject cProject = elem.getCProject();
- if (cProject != null)
- project = cProject.getProject();
- add(elem.getPath(), false, project);
- break;
- }
-
- case ICElement.C_INCLUDE:
- case ICElement.C_NAMESPACE:
- case ICElement.C_TEMPLATE_CLASS:
- case ICElement.C_CLASS:
- case ICElement.C_STRUCT:
- case ICElement.C_UNION:
- case ICElement.C_ENUMERATION:
- case ICElement.C_TYPEDEF: {
- IProject project = null;
- ICProject cProject = elem.getCProject();
- if (cProject != null)
- project = cProject.getProject();
- add(elem.getPath(), false, project);
- break;
- }
- }
- }
-
- public void add(ITypeSearchScope scope) {
- fPathSet.addAll(scope.pathSet());
- fContainerSet.addAll(scope.containerSet());
- fProjectSet.addAll(scope.projectSet());
- fEnclosingProjectSet.addAll(scope.enclosingProjectSet());
- fProjects = null;
- fAllProjects = null;
- fContainerPaths = null;
- fWorkspaceScope |= scope.isWorkspaceScope();
- }
-
- public void clear() {
- fPathSet.clear();
- fContainerSet.clear();
- fProjectSet.clear();
- fEnclosingProjectSet.clear();
- fWorkspaceScope = false;
- fProjects = null;
- fAllProjects = null;
- fContainerPaths = null;
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/UnknownTypeInfo.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/UnknownTypeInfo.java
deleted file mode 100644
index c31921f596..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/UnknownTypeInfo.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser;
-
-import org.eclipse.core.runtime.IPath;
-
-public class UnknownTypeInfo extends TypeInfo {
-
- public UnknownTypeInfo(String name, IPath path) {
- this(new QualifiedTypeName(name));
- if (path != null) {
- addReference(new TypeReference(path, null));
- }
- }
-
- public UnknownTypeInfo(IQualifiedTypeName typeName) {
- super(0, typeName);
- }
-
- public boolean isUndefinedType() {
- return true;
- }
-
- public boolean canSubstituteFor(ITypeInfo info) {
- if (fTypeCache == info.getCache()) {
- int compareType = info.getCElementType();
- if (fElementType == 0 || compareType == 0 || fElementType == compareType) {
- return fQualifiedName.equals(info.getQualifiedTypeName());
- }
- }
- return false;
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ChangeCollector.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ChangeCollector.java
deleted file mode 100644
index 71f9fe0f77..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ChangeCollector.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser.typehierarchy;
-
-import java.util.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.browser.TypeUtil;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICElementDelta;
-import org.eclipse.cdt.core.model.IMember;
-import org.eclipse.cdt.core.model.IParent;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.internal.core.model.CElement;
-
-/*
- * Collects changes (reported through fine-grained deltas) that can affect a type hierarchy.
- */
-public class ChangeCollector {
-
- /*
- * A table from ICElements to TypeDeltas
- */
- HashMap changes = new HashMap();
-
- TypeHierarchy hierarchy;
-
- public ChangeCollector(TypeHierarchy hierarchy) {
- this.hierarchy = hierarchy;
- }
-
- /*
- * Adds the children of the given delta to the list of changes.
- */
- private void addAffectedChildren(ICElementDelta delta) throws CModelException {
-// ICElementDelta[] children = delta.getAffectedChildren();
-// for (int i = 0, length = children.length; i < length; i++) {
-// ICElementDelta child = children[i];
-// ICElement childElement = child.getElement();
-// switch (childElement.getElementType()) {
-// case ICElement.IMPORT_CONTAINER:
-// addChange((IImportContainer)childElement, child);
-// break;
-// case ICElement.IMPORT_DECLARATION:
-// addChange((IImportDeclaration)childElement, child);
-// break;
-// case ICElement.TYPE:
-// addChange((ICElement)childElement, child);
-// break;
-// case ICElement.INITIALIZER:
-// case ICElement.FIELD:
-// case ICElement.METHOD:
-// addChange((IMember)childElement, child);
-// break;
-// }
-// }
- }
-
- /*
- * Adds the given delta on a compilation unit to the list of changes.
- */
- public void addChange(ITranslationUnit cu, ICElementDelta newDelta) throws CModelException {
-// int newKind = newDelta.getKind();
-// switch (newKind) {
-// case ICElementDelta.ADDED:
-// ArrayList allTypes = new ArrayList();
-// getAllTypesFromElement(cu, allTypes);
-// for (int i = 0, length = allTypes.size(); i < length; i++) {
-// ICElement type = (ICElement)allTypes.get(i);
-// addTypeAddition(type, (SimpleDelta)this.changes.get(type));
-// }
-// break;
-// case ICElementDelta.REMOVED:
-// allTypes = new ArrayList();
-// getAllTypesFromHierarchy((JavaElement)cu, allTypes);
-// for (int i = 0, length = allTypes.size(); i < length; i++) {
-// ICElement type = (ICElement)allTypes.get(i);
-// addTypeRemoval(type, (SimpleDelta)this.changes.get(type));
-// }
-// break;
-// case ICElementDelta.CHANGED:
-// addAffectedChildren(newDelta);
-// break;
-// }
- }
-
-/* private void addChange(IImportContainer importContainer, ICElementDelta newDelta) throws CModelException {
- int newKind = newDelta.getKind();
- if (newKind == ICElementDelta.CHANGED) {
- addAffectedChildren(newDelta);
- return;
- }
- SimpleDelta existingDelta = (SimpleDelta)this.changes.get(importContainer);
- if (existingDelta != null) {
- switch (newKind) {
- case ICElementDelta.ADDED:
- if (existingDelta.getKind() == ICElementDelta.REMOVED) {
- // REMOVED then ADDED
- this.changes.remove(importContainer);
- }
- break;
- case ICElementDelta.REMOVED:
- if (existingDelta.getKind() == ICElementDelta.ADDED) {
- // ADDED then REMOVED
- this.changes.remove(importContainer);
- }
- break;
- // CHANGED handled above
- }
- } else {
- SimpleDelta delta = new SimpleDelta();
- switch (newKind) {
- case ICElementDelta.ADDED:
- delta.added();
- break;
- case ICElementDelta.REMOVED:
- delta.removed();
- break;
- }
- this.changes.put(importContainer, delta);
- }
- }
-
- private void addChange(IImportDeclaration importDecl, ICElementDelta newDelta) {
- SimpleDelta existingDelta = (SimpleDelta)this.changes.get(importDecl);
- int newKind = newDelta.getKind();
- if (existingDelta != null) {
- switch (newKind) {
- case ICElementDelta.ADDED:
- if (existingDelta.getKind() == ICElementDelta.REMOVED) {
- // REMOVED then ADDED
- this.changes.remove(importDecl);
- }
- break;
- case ICElementDelta.REMOVED:
- if (existingDelta.getKind() == ICElementDelta.ADDED) {
- // ADDED then REMOVED
- this.changes.remove(importDecl);
- }
- break;
- // CHANGED cannot happen for import declaration
- }
- } else {
- SimpleDelta delta = new SimpleDelta();
- switch (newKind) {
- case ICElementDelta.ADDED:
- delta.added();
- break;
- case ICElementDelta.REMOVED:
- delta.removed();
- break;
- }
- this.changes.put(importDecl, delta);
- }
- }
-*/
-
- /*
- * Adds a change for the given member (a method, a field or an initializer) and the types it defines.
- */
- private void addChange(IMember member, ICElementDelta newDelta) throws CModelException {
-// int newKind = newDelta.getKind();
-// switch (newKind) {
-// case ICElementDelta.ADDED:
-// ArrayList allTypes = new ArrayList();
-// getAllTypesFromElement(member, allTypes);
-// for (int i = 0, length = allTypes.size(); i < length; i++) {
-// ICElement innerType = (ICElement)allTypes.get(i);
-// addTypeAddition(innerType, (SimpleDelta)this.changes.get(innerType));
-// }
-// break;
-// case ICElementDelta.REMOVED:
-// allTypes = new ArrayList();
-// getAllTypesFromHierarchy((JavaElement)member, allTypes);
-// for (int i = 0, length = allTypes.size(); i < length; i++) {
-// ICElement type = (ICElement)allTypes.get(i);
-// addTypeRemoval(type, (SimpleDelta)this.changes.get(type));
-// }
-// break;
-// case ICElementDelta.CHANGED:
-// addAffectedChildren(newDelta);
-// break;
-// }
- }
-
- /*
- * Adds a change for the given type and the types it defines.
- */
- private void addChange(ICElement type, ICElementDelta newDelta) throws CModelException {
-// int newKind = newDelta.getKind();
-// SimpleDelta existingDelta = (SimpleDelta)this.changes.get(type);
-// switch (newKind) {
-// case ICElementDelta.ADDED:
-// addTypeAddition(type, existingDelta);
-// ArrayList allTypes = new ArrayList();
-// getAllTypesFromElement(type, allTypes);
-// for (int i = 0, length = allTypes.size(); i < length; i++) {
-// ICElement innerType = (ICElement)allTypes.get(i);
-// addTypeAddition(innerType, (SimpleDelta)this.changes.get(innerType));
-// }
-// break;
-// case ICElementDelta.REMOVED:
-// addTypeRemoval(type, existingDelta);
-// allTypes = new ArrayList();
-// getAllTypesFromHierarchy((JavaElement)type, allTypes);
-// for (int i = 0, length = allTypes.size(); i < length; i++) {
-// ICElement innerType = (ICElement)allTypes.get(i);
-// addTypeRemoval(innerType, (SimpleDelta)this.changes.get(innerType));
-// }
-// break;
-// case ICElementDelta.CHANGED:
-// addTypeChange(type, newDelta.getFlags(), existingDelta);
-// addAffectedChildren(newDelta);
-// break;
-// }
- }
-
-/* private void addTypeAddition(ICElement type, SimpleDelta existingDelta) throws CModelException {
- if (existingDelta != null) {
- switch (existingDelta.getKind()) {
- case ICElementDelta.REMOVED:
- // REMOVED then ADDED
- boolean hasChange = false;
- if (hasSuperTypeChange(type)) {
- existingDelta.superTypes();
- hasChange = true;
- }
- if (hasVisibilityChange(type)) {
- existingDelta.modifiers();
- hasChange = true;
- }
- if (!hasChange) {
- this.changes.remove(type);
- }
- break;
- // CHANGED then ADDED
- // or ADDED then ADDED: should not happen
- }
- } else {
- // check whether the type addition affects the hierarchy
- String typeName = type.getElementName();
- if (this.hierarchy.hasSupertype(typeName)
- || this.hierarchy.subtypesIncludeSupertypeOf(type)
- || this.hierarchy.missingTypes.contains(typeName)) {
- SimpleDelta delta = new SimpleDelta();
- delta.added();
- this.changes.put(type, delta);
- }
- }
- }
-*/
-/* private void addTypeChange(ICElement type, int newFlags, SimpleDelta existingDelta) throws CModelException {
- if (existingDelta != null) {
- switch (existingDelta.getKind()) {
- case ICElementDelta.CHANGED:
- // CHANGED then CHANGED
- int existingFlags = existingDelta.getFlags();
- boolean hasChange = false;
- if ((existingFlags & ICElementDelta.F_SUPER_TYPES) != 0
- && hasSuperTypeChange(type)) {
- existingDelta.superTypes();
- hasChange = true;
- }
- if ((existingFlags & ICElementDelta.F_MODIFIERS) != 0
- && hasVisibilityChange(type)) {
- existingDelta.modifiers();
- hasChange = true;
- }
- if (!hasChange) {
- // super types and visibility are back to the ones in the existing hierarchy
- this.changes.remove(type);
- }
- break;
- // ADDED then CHANGED: leave it as ADDED
- // REMOVED then CHANGED: should not happen
- }
- } else {
- // check whether the type change affects the hierarchy
- SimpleDelta typeDelta = null;
- if ((newFlags & ICElementDelta.F_SUPER_TYPES) != 0
- && this.hierarchy.includesTypeOrSupertype(type)) {
- typeDelta = new SimpleDelta();
- typeDelta.superTypes();
- }
- if ((newFlags & ICElementDelta.F_MODIFIERS) != 0
- && this.hierarchy.hasSupertype(type.getElementName())) {
- if (typeDelta == null) {
- typeDelta = new SimpleDelta();
- }
- typeDelta.modifiers();
- }
- if (typeDelta != null) {
- this.changes.put(type, typeDelta);
- }
- }
- }
-*/
-/* private void addTypeRemoval(ICElement type, SimpleDelta existingDelta) {
- if (existingDelta != null) {
- switch (existingDelta.getKind()) {
- case ICElementDelta.ADDED:
- // ADDED then REMOVED
- this.changes.remove(type);
- break;
- case ICElementDelta.CHANGED:
- // CHANGED then REMOVED
- existingDelta.removed();
- break;
- // REMOVED then REMOVED: should not happen
- }
- } else {
- // check whether the type removal affects the hierarchy
- if (this.hierarchy.contains(type)) {
- SimpleDelta typeDelta = new SimpleDelta();
- typeDelta.removed();
- this.changes.put(type, typeDelta);
- }
- }
- }
-*/
- /*
- * Returns all types defined in the given element excluding the given element.
- */
- private void getAllTypesFromElement(ICElement element, ArrayList allTypes) throws CModelException {
- switch (element.getElementType()) {
- case ICElement.C_UNIT:
- ICElement[] types = TypeUtil.getTypes((ITranslationUnit)element);
- for (int i = 0, length = types.length; i < length; i++) {
- ICElement type = types[i];
- allTypes.add(type);
- getAllTypesFromElement(type, allTypes);
- }
- break;
- case ICElement.C_CLASS:
- case ICElement.C_STRUCT:
-// types = ((ICElement)element).getTypes();
- types = TypeUtil.getTypes(element);
- for (int i = 0, length = types.length; i < length; i++) {
- ICElement type = types[i];
- allTypes.add(type);
- getAllTypesFromElement(type, allTypes);
- }
- break;
-// case ICElement.INITIALIZER:
-// case ICElement.FIELD:
- case ICElement.C_METHOD:
- if (element instanceof IParent) {
- ICElement[] children = ((IParent)element).getChildren();
- for (int i = 0, length = children.length; i < length; i++) {
- ICElement type = (ICElement)children[i];
- allTypes.add(type);
- getAllTypesFromElement(type, allTypes);
- }
- }
- break;
- }
- }
-
- /*
- * Returns all types in the existing hierarchy that have the given element as a parent.
- */
- private void getAllTypesFromHierarchy(CElement element, ArrayList allTypes) {
- switch (element.getElementType()) {
- case ICElement.C_UNIT:
- ArrayList types = (ArrayList)this.hierarchy.files.get(element);
- if (types != null) {
- allTypes.addAll(types);
- }
- break;
- case ICElement.C_CLASS:
- case ICElement.C_STRUCT:
-// case ICElement.INITIALIZER:
-// case ICElement.FIELD:
- case ICElement.C_METHOD:
- types = (ArrayList)this.hierarchy.files.get(((IMember)element).getTranslationUnit());
- if (types != null) {
- for (int i = 0, length = types.size(); i < length; i++) {
- ICElement type = (ICElement)types.get(i);
- if (element.isAncestorOf(type)) {
- allTypes.add(type);
- }
- }
- }
- break;
- }
- }
-
- private boolean hasSuperTypeChange(ICElement type) throws CModelException {
-// // check super class
-// ICElement superclass = this.hierarchy.getSuperclass(type);
-// String existingSuperclassName = superclass == null ? null : superclass.getElementName();
-// String newSuperclassName = type.getSuperclassName();
-// if (existingSuperclassName != null && !existingSuperclassName.equals(newSuperclassName)) {
-// return true;
-// }
-//
-// // check super interfaces
-// ICElement[] existingSuperInterfaces = this.hierarchy.getSuperInterfaces(type);
-// String[] newSuperInterfaces = type.getSuperInterfaceNames();
-// if (existingSuperInterfaces.length != newSuperInterfaces.length) {
-// return true;
-// }
-// for (int i = 0, length = newSuperInterfaces.length; i < length; i++) {
-// String superInterfaceName = newSuperInterfaces[i];
-// if (!superInterfaceName.equals(newSuperInterfaces[i])) {
-// return true;
-// }
-// }
-
- return false;
- }
-
- private boolean hasVisibilityChange(ICElement type) throws CModelException {
-// int existingFlags = this.hierarchy.getCachedFlags(type);
-// int newFlags = type.getFlags();
-// return existingFlags != newFlags;
- return false;
- }
-
- /*
- * Whether the hierarchy needs refresh according to the changes collected so far.
- */
- public boolean needsRefresh() {
- return changes.size() != 0;
- }
-
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- Iterator iterator = this.changes.entrySet().iterator();
- while (iterator.hasNext()) {
- Map.Entry entry = (Map.Entry)iterator.next();
- buffer.append(((CElement)entry.getKey()).toDebugString());
- buffer.append(entry.getValue());
- if (iterator.hasNext()) {
- buffer.append('\n');
- }
- }
- return buffer.toString();
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ITypeHierarchy.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ITypeHierarchy.java
deleted file mode 100644
index befed906b6..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ITypeHierarchy.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser.typehierarchy;
-
-import java.io.OutputStream;
-
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * A type hierarchy provides navigations between a type and its resolved
- * supertypes and subtypes for a specific type or for all types within a region.
- * Supertypes may extend outside of the type hierarchy's region in which it was
- * created such that the root of the hierarchy is always included. For example, if a type
- * hierarchy is created for a <code>java.io.File</code>, and the region the hierarchy was
- * created in is the package fragment <code>java.io</code>, the supertype
- * <code>java.lang.Object</code> will still be included.
- * <p>
- * A type hierarchy is static and can become stale. Although consistent when
- * created, it does not automatically track changes in the model.
- * As changes in the model potentially invalidate the hierarchy, change notifications
- * are sent to registered <code>ICElementHierarchyChangedListener</code>s. Listeners should
- * use the <code>exists</code> method to determine if the hierarchy has become completely
- * invalid (for example, when the type or project the hierarchy was created on
- * has been removed). To refresh a hierarchy, use the <code>refresh</code> method.
- * </p>
- * <p>
- * The type hierarchy may contain cycles due to malformed supertype declarations.
- * Most type hierarchy queries are oblivious to cycles; the <code>getAll* </code>
- * methods are implemented such that they are unaffected by cycles.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface ITypeHierarchy {
-/**
- * Adds the given listener for changes to this type hierarchy. Listeners are
- * notified when this type hierarchy changes and needs to be refreshed.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener
- */
-void addTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener);
-/**
- * Returns whether the given type is part of this hierarchy.
- *
- * @param type the given type
- * @return true if the given type is part of this hierarchy, false otherwise
- */
-boolean contains(ICElement type);
-/**
- * Returns whether the type and project this hierarchy was created on exist.
- * @return true if the type and project this hierarchy was created on exist, false otherwise
- */
-boolean exists();
-
-/**
- * Returns all resolved subtypes (direct and indirect) of the
- * given type, in no particular order, limited to the
- * types in this type hierarchy's graph. An empty array
- * is returned if there are no resolved subtypes for the
- * given type.
- *
- * @param type the given type
- * @return all resolved subtypes (direct and indirect) of the given type
- */
-ICElement[] getAllSubtypes(ICElement type);
-/**
- * Returns all resolved superclasses of the
- * given class, in bottom-up order. An empty array
- * is returned if there are no resolved superclasses for the
- * given class.
- *
- * <p>NOTE: once a type hierarchy has been created, it is more efficient to
- * query the hierarchy for superclasses than to query a class recursively up
- * the superclass chain. Querying an element performs a dynamic resolution,
- * whereas the hierarchy returns a pre-computed result.
- *
- * @param type the given type
- * @return all resolved superclasses of the given class, in bottom-up order, an empty
- * array if none.
- */
-ICElement[] getAllSupertypes(ICElement type);
-
-/**
- * Returns all classes in the graph which have no resolved superclass,
- * in no particular order.
- *
- * @return all classes in the graph which have no resolved superclass
- */
-ICElement[] getRootClasses();
-
-/**
- * Returns the direct resolved subtypes of the given type,
- * in no particular order, limited to the types in this
- * type hierarchy's graph.
- * If the type is a class, this returns the resolved subclasses.
- * If the type is an interface, this returns both the classes which implement
- * the interface and the interfaces which extend it.
- *
- * @param type the given type
- * @return the direct resolved subtypes of the given type limited to the types in this
- * type hierarchy's graph
- */
-ICElement[] getSubtypes(ICElement type);
-
-/**
- * Returns the resolved supertypes of the given type,
- * in no particular order, limited to the types in this
- * type hierarchy's graph.
- * For classes, this returns its superclass and the interfaces that the class implements.
- * For interfaces, this returns the interfaces that the interface extends. As a consequence
- * <code>java.lang.Object</code> is NOT considered to be a supertype of any interface
- * type.
- *
- * @param type the given type
- * @return the resolved supertypes of the given type limited to the types in this
- * type hierarchy's graph
- */
-ICElement[] getSupertypes(ICElement type);
-/**
- * Returns the type this hierarchy was computed for.
- * Returns <code>null</code> if this hierarchy was computed for a region.
- *
- * @return the type this hierarchy was computed for
- */
-ICElement getType();
-/**
- * Re-computes the type hierarchy reporting progress.
- *
- * @param monitor the given progress monitor
- * @exception JavaModelException if unable to refresh the hierarchy
- */
-void refresh(IProgressMonitor monitor) throws CModelException;
-/**
- * Removes the given listener from this type hierarchy.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener the listener
- */
-void removeTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener);
-/**
- * Stores the type hierarchy in an output stream. This stored hierarchy can be load by
- * ICElement#loadTypeHierachy(IJavaProject, InputStream, IProgressMonitor).
- * Listeners of this hierarchy are not stored.
- *
- * Only hierarchies created by the following methods can be store:
- * <ul>
- * <li>ICElement#newSupertypeHierarchy(IProgressMonitor)</li>
- * <li>ICElement#newTypeHierarchy(IJavaProject, IProgressMonitor)</li>
- * <li>ICElement#newTypeHierarchy(IProgressMonitor)</li>
- * </u>
- *
- * @param outputStream output stream where the hierarchy will be stored
- * @param monitor the given progress monitor
- * @exception JavaModelException if unable to store the hierarchy in the ouput stream
- * @see ICElement#loadTypeHierachy(java.io.InputStream, IProgressMonitor)
- * @since 2.1
- */
-void store(OutputStream outputStream, IProgressMonitor monitor) throws CModelException;
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ITypeHierarchyChangedListener.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ITypeHierarchyChangedListener.java
deleted file mode 100644
index cc985600ab..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/ITypeHierarchyChangedListener.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser.typehierarchy;
-
-/**
- * A listener which gets notified when a particular type hierarchy object
- * changes.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- */
-public interface ITypeHierarchyChangedListener {
- /**
- * Notifies that the given type hierarchy has changed in some way and should
- * be refreshed at some point to make it consistent with the current state of
- * the Java model.
- *
- * @param typeHierarchy the given type hierarchy
- */
- void typeHierarchyChanged(ITypeHierarchy typeHierarchy);
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchy.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchy.java
deleted file mode 100644
index 5288ff7e64..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchy.java
+++ /dev/null
@@ -1,582 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser.typehierarchy;
-
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.core.ICLogConstants;
-import org.eclipse.cdt.core.browser.AllTypesCache;
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ElementChangedEvent;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICElementDelta;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.IElementChangedListener;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.search.ICSearchScope;
-import org.eclipse.cdt.internal.core.model.Util;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.Platform;
-
-public class TypeHierarchy implements ITypeHierarchy, IElementChangedListener {
-
- public static boolean DEBUG = false;
-
- private static final class TypeEntry {
- ITypeInfo type;
- ASTAccessVisibility access;
- TypeEntry(ITypeInfo type, ASTAccessVisibility access) {
- this.type = type;
- this.access = access;
- }
- }
- private static final int INITIAL_SUPER_TYPES = 1;
- private static final int INITIAL_SUB_TYPES = 1;
- private static final ITypeInfo[] NO_TYPES = new ITypeInfo[0];
- private ArrayList fRootTypes = new ArrayList();
- private Map fTypeToSuperTypes = new HashMap();
- private Map fTypeToSubTypes = new HashMap();
-
- private ITypeInfo fFocusType;
-
- /**
- * The progress monitor to report work completed too.
- */
- protected IProgressMonitor fProgressMonitor = null;
- /**
- * Change listeners - null if no one is listening.
- */
- protected ArrayList fChangeListeners = null;
-
- /*
- * A map from Openables to ArrayLists of ITypes
- */
- public Map files = null;
-
- /**
- * Whether this hierarchy should contains subtypes.
- */
- protected boolean fComputeSubtypes;
-
- /**
- * The scope this hierarchy should restrain itsef in.
- */
- ICSearchScope fScope;
-
- /*
- * Whether this hierarchy needs refresh
- */
- public boolean fNeedsRefresh = true;
-// /*
-// * Collects changes to types
-// */
-// protected ChangeCollector fChangeCollector;
-
-
-
- /**
- * Creates a TypeHierarchy on the given type.
- */
- public TypeHierarchy(ITypeInfo type) {
- fFocusType = type;
- }
-
- /**
- * Adds the type to the collection of root classes
- * if the classes is not already present in the collection.
- */
- public void addRootType(ITypeInfo type) {
- if (!fRootTypes.contains(type)) {
- fRootTypes.add(type);
- }
- }
-
- /**
- * Adds the given supertype to the type.
- */
- public void addSuperType(ITypeInfo type, ITypeInfo superType, ASTAccessVisibility access) {
- Collection superEntries = (Collection) fTypeToSuperTypes.get(type);
- if (superEntries == null) {
- superEntries = new ArrayList(INITIAL_SUPER_TYPES);
- fTypeToSuperTypes.put(type, superEntries);
- }
- Collection subTypes = (Collection) fTypeToSubTypes.get(superType);
- if (subTypes == null) {
- subTypes = new ArrayList(INITIAL_SUB_TYPES);
- fTypeToSubTypes.put(superType, subTypes);
- }
- if (!subTypes.contains(type)) {
- subTypes.add(type);
- }
- for (Iterator i = superEntries.iterator(); i.hasNext(); ) {
- TypeEntry entry = (TypeEntry)i.next();
- if (entry.type.equals(superType)) {
- // update the access
- entry.access = access;
- return; // don't add if already exists
- }
- }
- TypeEntry typeEntry = new TypeEntry(superType, access);
- superEntries.add(typeEntry);
- }
-
- /**
- * Adds the given subtype to the type.
- */
- protected void addSubType(ITypeInfo type, ITypeInfo subType) {
- Collection subTypes = (Collection) fTypeToSubTypes.get(type);
- if (subTypes == null) {
- subTypes = new ArrayList(INITIAL_SUB_TYPES);
- fTypeToSubTypes.put(type, subTypes);
- }
- if (!subTypes.contains(subType)) {
- subTypes.add(subType);
- }
-
- Collection superEntries = (Collection) fTypeToSuperTypes.get(subType);
- if (superEntries == null) {
- superEntries = new ArrayList(INITIAL_SUPER_TYPES);
- fTypeToSuperTypes.put(subType, superEntries);
- }
- for (Iterator i = superEntries.iterator(); i.hasNext(); ) {
- TypeEntry entry = (TypeEntry)i.next();
- if (entry.type.equals(type))
- return; // don't add if already exists
- }
- // default to private access
- TypeEntry typeEntry = new TypeEntry(type, ASTAccessVisibility.PRIVATE);
- superEntries.add(typeEntry);
- }
-
- /**
- * Returns true if type already has the given supertype.
- */
- public boolean hasSuperType(ITypeInfo type, ITypeInfo superType) {
- Collection entries = (Collection) fTypeToSuperTypes.get(type);
- if (entries != null) {
- for (Iterator i = entries.iterator(); i.hasNext(); ) {
- TypeEntry entry = (TypeEntry)i.next();
- if (entry.type.equals(superType))
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns an array of supertypes for the given type - will never return null.
- */
- public ITypeInfo[] getSuperTypes(ITypeInfo type) {
- Collection entries = (Collection) fTypeToSuperTypes.get(type);
- if (entries != null) {
- ArrayList superTypes = new ArrayList(INITIAL_SUPER_TYPES);
- for (Iterator i = entries.iterator(); i.hasNext(); ) {
- TypeEntry entry = (TypeEntry)i.next();
- superTypes.add(entry.type);
- }
- return (ITypeInfo[])superTypes.toArray(new ITypeInfo[superTypes.size()]);
- }
- return NO_TYPES;
- }
-
- /**
- * Returns an array of subtypes for the given type - will never return null.
- */
- public ITypeInfo[] getSubTypes(ITypeInfo type) {
- Collection subTypes = (Collection) fTypeToSubTypes.get(type);
- if (subTypes != null) {
- return (ITypeInfo[])subTypes.toArray(new ITypeInfo[subTypes.size()]);
- }
- return NO_TYPES;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#addTypeHierarchyChangedListener(org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchyChangedListener)
- */
- public void addTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener) {
- ArrayList listeners = fChangeListeners;
- if (listeners == null) {
- fChangeListeners = listeners = new ArrayList();
- }
-
- // register with JavaCore to get Java element delta on first listener added
- if (listeners.size() == 0) {
- CoreModel.getDefault().addElementChangedListener(this);
- }
-
- // add listener only if it is not already present
- if (listeners.indexOf(listener) == -1) {
- listeners.add(listener);
- }
- }
-
-
- /**
- * @see ITypeHierarchy
- */
- public synchronized void removeTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener) {
- ArrayList listeners = fChangeListeners;
- if (listeners == null) {
- return;
- }
- listeners.remove(listener);
-
- // deregister from JavaCore on last listener removed
- if (listeners.isEmpty()) {
- CoreModel.getDefault().removeElementChangedListener(this);
- }
- }
-
- /**
- * Determines if the change effects this hierarchy, and fires
- * change notification if required.
- */
- public void elementChanged(ElementChangedEvent event) {
- // type hierarchy change has already been fired
- if (fNeedsRefresh) return;
-
- if (isAffected(event.getDelta())) {
- fNeedsRefresh = true;
- fireChange();
- }
- }
-
- /**
- * Returns true if the given delta could change this type hierarchy
- */
- public synchronized boolean isAffected(ICElementDelta delta) {
-// ICElement element= delta.getElement();
-// switch (element.getElementType()) {
-// case ICElement.C_MODEL:
-// return isAffectedByCModel(delta, element);
-// case ICElement.C_PROJECT:
-// return isAffectedByCProject(delta, element);
-// case ICElement.C_UNIT:
-// return isAffectedByOpenable(delta, element);
-// }
-// return false;
- return true;
- }
-
- /**
- * Notifies listeners that this hierarchy has changed and needs
- * refreshing. Note that listeners can be removed as we iterate
- * through the list.
- */
- public void fireChange() {
- ArrayList listeners = fChangeListeners;
- if (listeners == null) {
- return;
- }
- if (DEBUG) {
- System.out.println("FIRING hierarchy change ["+Thread.currentThread()+"]"); //$NON-NLS-1$ //$NON-NLS-2$
- if (fFocusType != null) {
- System.out.println(" for hierarchy focused on " + fFocusType.toString()); //$NON-NLS-1$
- }
- }
- // clone so that a listener cannot have a side-effect on this list when being notified
- listeners = (ArrayList)listeners.clone();
- for (int i= 0; i < listeners.size(); i++) {
- final ITypeHierarchyChangedListener listener= (ITypeHierarchyChangedListener)listeners.get(i);
- Platform.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
- Util.log(exception, "Exception occurred in listener of Type hierarchy change notification", ICLogConstants.CDT); //$NON-NLS-1$
- }
- public void run() throws Exception {
- listener.typeHierarchyChanged(TypeHierarchy.this);
- }
- });
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#contains(org.eclipse.cdt.core.model.ICElement)
- */
- public boolean contains(ICElement type) {
- // classes
- ITypeInfo info = AllTypesCache.getTypeForElement(type, true, true, null);
-
- if (info == null)
- return false;
-
- if (fTypeToSuperTypes.get(info) != null) {
- return true;
- }
-
- // root classes
- if (fRootTypes.contains(type)) return true;
-
- return false;
- }
-
- /**
- * @see ITypeHierarchy
- */
- public boolean exists() {
- if (!fNeedsRefresh) return true;
-
- return (fFocusType == null || fFocusType.exists()) && cProject().exists();
- }
-
- /**
- * Returns the C project this hierarchy was created in.
- */
- public ICProject cProject() {
- IProject project = fFocusType.getCache().getProject();
- return findCProject(project);
- }
- private ICProject findCProject(IProject project) {
- try {
- ICProject[] cProjects = CoreModel.getDefault().getCModel().getCProjects();
- if (cProjects != null) {
- for (int i = 0; i < cProjects.length; ++i) {
- ICProject cProject = cProjects[i];
- if (project.equals(cProjects[i].getProject()))
- return cProject;
- }
- }
- } catch (CModelException e) {
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#getAllClasses()
- */
- public ICElement[] getAllClasses() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#getRootClasses()
- */
- public ICElement[] getRootClasses() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#getSubtypes(org.eclipse.cdt.core.model.ICElement)
- */
- public ICElement[] getSubtypes(ICElement type) {
- List list = new ArrayList();
- ITypeInfo info = AllTypesCache.getTypeForElement(type, true, true, null);
- Collection entries = (Collection) fTypeToSubTypes.get(info);
- if (entries != null) {
- for (Iterator i = entries.iterator(); i.hasNext(); ) {
- ITypeInfo subType = (ITypeInfo)i.next();
- ICElement elem = AllTypesCache.getElementForType(subType, true, true, null);
- if (elem != null) {
- list.add(elem);
- }
- }
- }
- return (ICElement[])list.toArray(new ICElement[list.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#getAllSuperclasses(org.eclipse.cdt.core.model.ICElement)
- */
- public ICElement[] getAllSubtypes(ICElement type) {
- List list = new ArrayList();
- ITypeInfo info = AllTypesCache.getTypeForElement(type, true, true, null);
- addSubs(info, list);
- //convert list to ICElements
- ICElement[] elems = new ICElement[list.size()];
- int count = 0;
- for (Iterator i = list.iterator(); i.hasNext(); ) {
- ITypeInfo subType = (ITypeInfo) i.next();
- elems[count++] = AllTypesCache.getElementForType(subType, true, true, null);
- }
- return elems;
- }
-
- private void addSubs(ITypeInfo type, List list) {
- Collection entries = (Collection) fTypeToSubTypes.get(type);
- if (entries != null) {
- for (Iterator i = entries.iterator(); i.hasNext(); ) {
- ITypeInfo subType = (ITypeInfo)i.next();
- if (!list.contains(subType)) {
- list.add(subType);
- }
- addSubs(subType, list);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#getSupertypes(org.eclipse.cdt.core.model.ICElement)
- */
- public ICElement[] getSupertypes(ICElement type) {
- List list = new ArrayList();
- ITypeInfo info = AllTypesCache.getTypeForElement(type, true, true, null);
- Collection entries = (Collection) fTypeToSuperTypes.get(info);
- if (entries != null) {
- for (Iterator i = entries.iterator(); i.hasNext(); ) {
- TypeEntry entry = (TypeEntry)i.next();
- ITypeInfo superType = entry.type;
- ICElement elem = AllTypesCache.getElementForType(superType, true, true, null);
- if (elem != null) {
- list.add(elem);
- }
- }
- }
- return (ICElement[])list.toArray(new ICElement[list.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#getAllSuperclasses(org.eclipse.cdt.core.model.ICElement)
- */
- public ICElement[] getAllSupertypes(ICElement type) {
- List list = new ArrayList();
- ITypeInfo info = AllTypesCache.getTypeForElement(type, true, true, null);
- addSupers(info, list);
- //convert list to ICElements
- ICElement[] elems = new ICElement[list.size()];
- int count = 0;
- for (Iterator i = list.iterator(); i.hasNext(); ) {
- ITypeInfo superType = (ITypeInfo) i.next();
- elems[count++] = AllTypesCache.getElementForType(superType, true, true, null);
- }
- return elems;
- }
-
- private void addSupers(ITypeInfo type, List list) {
- Collection entries = (Collection) fTypeToSuperTypes.get(type);
- if (entries != null) {
- for (Iterator i = entries.iterator(); i.hasNext(); ) {
- TypeEntry entry = (TypeEntry)i.next();
- ITypeInfo superType = entry.type;
- if (!list.contains(superType)) {
- list.add(superType);
- }
- addSupers(superType, list);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#getType()
- */
- public ICElement getType() {
- if (fFocusType != null)
- return AllTypesCache.getElementForType(fFocusType, true, true, null);
- return null;
- }
-
- /**
- * @see ITypeHierarchy
- * TODO (jerome) should use a PerThreadObject to build the hierarchy instead of synchronizing
- * (see also isAffected(IJavaElementDelta))
- */
- public synchronized void refresh(IProgressMonitor monitor) throws CModelException {
- try {
- fProgressMonitor = monitor;
- if (monitor != null) {
- if (fFocusType != null) {
- monitor.beginTask(TypeHierarchyMessages.getFormattedString("hierarchy.creatingOnType", fFocusType.getQualifiedTypeName().getFullyQualifiedName()), 100); //$NON-NLS-1$
- } else {
- monitor.beginTask(TypeHierarchyMessages.getString("hierarchy.creating"), 100); //$NON-NLS-1$
- }
- }
- long start = -1;
- if (DEBUG) {
- start = System.currentTimeMillis();
- if (fComputeSubtypes) {
- System.out.println("CREATING TYPE HIERARCHY [" + Thread.currentThread() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- System.out.println("CREATING SUPER TYPE HIERARCHY [" + Thread.currentThread() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (fFocusType != null) {
- System.out.println(" on type " + fFocusType.toString()); //$NON-NLS-1$
- }
- }
-
- compute();
-// initializeRegions();
- fNeedsRefresh = false;
-// fChangeCollector = null;
-
- if (DEBUG) {
- if (fComputeSubtypes) {
- System.out.println("CREATED TYPE HIERARCHY in " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- System.out.println("CREATED SUPER TYPE HIERARCHY in " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- System.out.println(this.toString());
- }
- } finally {
- if (monitor != null) {
- monitor.done();
- }
- fProgressMonitor = null;
- }
- }
-
- /**
- * Compute this type hierarchy.
- */
- protected void compute() {
- if (fFocusType != null) {
-// HierarchyBuilder builder =
-// new IndexBasedHierarchyBuilder(
-// this,
-// this.scope);
-// builder.build(this.computeSubtypes);
-
-// initialize(1);
-// buildSupertypes();
-
- } // else a RegionBasedTypeHierarchy should be used
- }
-
- /**
- * Initializes this hierarchy's internal tables with the given size.
- */
- /* protected void initialize(int size) {
- if (size < 10) {
- size = 10;
- }
- int smallSize = (size / 2);
- this.classToSuperclass = new HashMap(size);
- this.interfaces = new ArrayList(smallSize);
- this.missingTypes = new ArrayList(smallSize);
- this.rootClasses = new TypeVector();
- this.typeToSubtypes = new HashMap(smallSize);
- this.typeToSuperInterfaces = new HashMap(smallSize);
- this.typeFlags = new HashMap(smallSize);
-
- this.projectRegion = new Region();
- this.packageRegion = new Region();
- this.files = new HashMap(5);
- }
-*/
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.typehierarchy.ITypeHierarchy#store(java.io.OutputStream, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void store(OutputStream outputStream, IProgressMonitor monitor) throws CModelException {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyBuilder.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyBuilder.java
deleted file mode 100644
index cded12e974..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyBuilder.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser.typehierarchy;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.ICModelStatusConstants;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.internal.core.browser.cache.TypeCacheManager;
-import org.eclipse.cdt.internal.core.model.CModelStatus;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-
-public class TypeHierarchyBuilder {
-
- public TypeHierarchyBuilder() {
- }
-
- public ITypeHierarchy createTypeHierarchy(ITypeInfo info, boolean enableIndexing, IProgressMonitor monitor) throws CModelException {
- TypeHierarchy typeHierarchy = new TypeHierarchy(info);
- Set processedTypes = new HashSet();
- addSuperClasses(typeHierarchy, info, processedTypes, enableIndexing, monitor);
-
- typeHierarchy.addRootType(info);
- processedTypes.clear();
- addSubClasses(typeHierarchy, info, processedTypes, enableIndexing, monitor);
-
- return typeHierarchy;
- }
-
- private void addSuperClasses(TypeHierarchy typeHierarchy, ITypeInfo type, Set processedTypes, boolean enableIndexing, IProgressMonitor monitor) throws CModelException {
- if (type.hasSuperTypes()) {
- ITypeInfo[] superTypes = TypeCacheManager.getInstance().locateSuperTypesAndWait(type, enableIndexing, Job.SHORT, monitor);
- if (superTypes == null)
- throw new CModelException(new CModelStatus(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST));
-
- for (int i = 0; i < superTypes.length; ++i) {
- ITypeInfo superType = superTypes[i];
-
- // recursively process sub sub classes
- if (!processedTypes.contains(superType)) {
- processedTypes.add(superType);
- addSuperClasses(typeHierarchy, superType, processedTypes, enableIndexing, monitor);
- }
-
- ASTAccessVisibility access = type.getSuperTypeAccess(superType);
-
- typeHierarchy.addSuperType(type, superType, access);
- }
- } else {
- typeHierarchy.addRootType(type);
- }
- }
-
- private void addSubClasses(TypeHierarchy typeHierarchy, ITypeInfo type, Set processedTypes, boolean enableIndexing, IProgressMonitor monitor) throws CModelException {
- if (type.hasSubTypes()) {
- ITypeInfo[] subTypes = TypeCacheManager.getInstance().locateSubTypesAndWait(type, enableIndexing, Job.SHORT, monitor);
- if (subTypes == null)
- throw new CModelException(new CModelStatus(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST));
-
- for (int i = 0; i < subTypes.length; ++i) {
- ITypeInfo subType = subTypes[i];
-
- // recursively process sub sub classes
- if (!processedTypes.contains(subType)) {
- processedTypes.add(subType);
- addSubClasses(typeHierarchy, subType, processedTypes, enableIndexing, monitor);
- }
-
- typeHierarchy.addSubType(type, subType);
- }
- }
- }
-
-/*
- private IStructure findCElementForType(ITypeInfo info, boolean enableIndexing, IProgressMonitor monitor) throws CModelException {
- if (!info.exists())
- throw new CModelException(new CModelStatus(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST));
-
- if (!info.isClass())
- throw new CModelException(new CModelStatus(ICModelStatusConstants.INVALID_ELEMENT_TYPES));
-
- // first we need to resolve the type location
- ITypeReference location = TypeCacheManager.getInstance().locateTypeAndWait(info, enableIndexing, Job.SHORT, monitor);
- if (location == null)
- throw new CModelException(new CModelStatus(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST));
-
- ICElement cElem = location.getCElement();
- if (cElem == null)
- throw new CModelException(new CModelStatus(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST));
-
- if (!(cElem instanceof IStructure))
- throw new CModelException(new CModelStatus(ICModelStatusConstants.INVALID_ELEMENT_TYPES));
-
- IStructure cClass = (IStructure)cElem;
-
- // check if type exists in cache
- ITypeInfo type = TypeCacheManager.getInstance().getTypeForElement(cElem);
- if (type == null || !type.equals(info))
- throw new CModelException(new CModelStatus(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST));
-
- return cClass;
- }
-
- private ITypeInfo findTypeInCache(ITypeCache cache, String name) {
- IQualifiedTypeName qualName = new QualifiedTypeName(name);
- ITypeInfo[] superTypes = cache.getTypes(qualName);
- for (int i = 0; i < superTypes.length; ++i) {
- ITypeInfo superType = superTypes[i];
- if (superType.isClass()) {
- return superType;
- }
- }
- return null;
- }
-*/
-
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyMessages.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyMessages.java
deleted file mode 100644
index 467841057c..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyMessages.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.core.browser.typehierarchy;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class TypeHierarchyMessages {
-
- private static final String RESOURCE_BUNDLE= TypeHierarchyMessages.class.getName();
-
- private static ResourceBundle fgResourceBundle;
- static {
- try {
- fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
- } catch (MissingResourceException x) {
- fgResourceBundle = null;
- }
- }
-
- private TypeHierarchyMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- } catch (NullPointerException e) {
- return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- public static String getFormattedString(String key, String arg) {
- return getFormattedString(key, new String[] { arg });
- }
-
- public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getString(key), args);
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyMessages.properties b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyMessages.properties
deleted file mode 100644
index 760292b333..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/core/browser/typehierarchy/TypeHierarchyMessages.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 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
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# QNX Software Systems - Initial API and implementation
-###############################################################################
-
-### hierarchy
-hierarchy.nullProject = Project argument cannot be null
-hierarchy.nullRegion = Region cannot be null
-hierarchy.nullFocusType = Type focus cannot be null
-hierarchy.creating = Creating type hierarchy...
-hierarchy.creatingOnType = Creating type hierarchy on {0}...
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/BasicJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/BasicJob.java
deleted file mode 100644
index 7bf631918b..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/BasicJob.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import org.eclipse.cdt.internal.core.browser.util.DelegatedProgressMonitor;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-public abstract class BasicJob extends Job {
-
- private Object fFamily;
- private DelegatedProgressMonitor fProgressMonitor= new DelegatedProgressMonitor();
- private Object fRunLock = new Object();
- private boolean fIsRunning = false;
- private static boolean VERBOSE = false;
-
- public BasicJob(String name, Object family) {
- super(name);
- fFamily = family;
- setPriority(BUILD);
- setSystem(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(IProgressMonitor)
- */
- protected abstract IStatus runWithDelegatedProgress(IProgressMonitor monitor) throws InterruptedException;
-
- /* (non-Javadoc)
- * @see org.eclipse.core.internal.jobs.InternalJob#belongsTo(java.lang.Object)
- */
- public boolean belongsTo(Object family) {
- if (fFamily != null) {
- return fFamily.equals(family);
- }
- return false;
- }
-
- public boolean isRunning() {
- synchronized(fRunLock) {
- return fIsRunning;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(IProgressMonitor)
- */
- public IStatus run(IProgressMonitor monitor) {
- synchronized(fRunLock) {
- fIsRunning = true;
- }
-
- fProgressMonitor.init();
- fProgressMonitor.addDelegate(monitor);
-
- IStatus result = Status.CANCEL_STATUS;
- try {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- result = runWithDelegatedProgress(fProgressMonitor);
-
- if (monitor.isCanceled())
- throw new InterruptedException();
- } catch(InterruptedException ex) {
- return Status.CANCEL_STATUS;
- } catch (OperationCanceledException ex) {
- return Status.CANCEL_STATUS;
- } finally {
- fProgressMonitor.done();
- fProgressMonitor.removeAllDelegates();
- fProgressMonitor.init();
-
- synchronized(fRunLock) {
- fIsRunning = false;
- }
- }
- return result;
- }
-
- /**
- * Forwards progress info to the progress monitor and
- * blocks until the job is finished.
- *
- * @param monitor the progress monitor.
- * @throws InterruptedException
- *
- * @see Job#join
- */
- public void join(IProgressMonitor monitor) throws InterruptedException {
- if (monitor != null) {
- fProgressMonitor.addDelegate(monitor);
- }
- super.join();
- }
-
- /**
- * Outputs message to console.
- */
- protected static void trace(String msg) {
- if (VERBOSE) {
- System.out.println("(" + Thread.currentThread() + ") " + msg); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/ITypeCache.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/ITypeCache.java
deleted file mode 100644
index d4e73fbdae..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/ITypeCache.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import org.eclipse.cdt.core.browser.IQualifiedTypeName;
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.browser.ITypeInfoVisitor;
-import org.eclipse.cdt.core.browser.ITypeReference;
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-public interface ITypeCache extends ISchedulingRule {
-
- /** Returns whether cache contains any types.
- *
- * @return <code>true</code> if cache is empty
- */
- public boolean isEmpty();
-
- /** Returns whether cache is complete.
- *
- * @return <code>true</code> if cache is up to date.
- */
- public boolean isUpToDate();
-
- /** Inserts type into cache.
- *
- * @param info
- */
- public void insert(ITypeInfo info);
-
- /** Adds subtype to type.
- *
- * @param type
- * @param subtype
- */
- public void addSubtype(ITypeInfo type, ITypeInfo subtype);
-
- /** Adds supertype to type.
- *
- * @param type the type
- * @param supertype the supertype
- * @param the access visibility (PUBLIC, PROTECTED, PRIVATE)
- * @param isVirtual <code>true</code> if virtual base class
- */
- public void addSupertype(ITypeInfo type, ITypeInfo supertype, ASTAccessVisibility access, boolean isVirtual);
-
- /** Removes type from cache.
- *
- * @param info
- */
- public void remove(ITypeInfo info);
-
- /** Removes all types in the given scope.
- *
- * @param scope
- */
- public void flush(ITypeSearchScope scope);
-
- /** Removes all types referenced by the given path.
- *
- * @param path
- */
- public void flush(IPath path);
-
- /** Removes all types from the cache.
- */
- public void flushAll();
-
- /** Returns all paths in the cache which are enclosed by
- * the given scope. If no paths are found, an empty
- * array is returned.
- *
- * @param scope the scope to search, or <code>null</code> to
- * search the entire cache.
- * @return A collection of paths in the given scope.
- */
- public IPath[] getPaths(ITypeSearchScope scope);
-
- /** Returns all types in the cache which are enclosed by
- * the given scope. If no types are found, an empty array
- * is returned.
- *
- * @param scope the scope to search, or <code>null</code> to
- * search the entire cache.
- * @return Array of types in the given scope
- */
- public ITypeInfo[] getTypes(ITypeSearchScope scope);
-
- /** Returns all types in the cache which match the given
- * name. If no types are found, an empty array is returned.
- *
- * @param qualifiedName the qualified type name to match
- * @param matchEnclosed <code>true</code> if enclosed types count as matches (foo::bar == bar)
- * @param ignoreCase <code>true</code> if case-insensitive
- * @return Array of types
- */
- public ITypeInfo[] getTypes(IQualifiedTypeName qualifiedName, boolean matchEnclosed, boolean ignoreCase);
-
- /** Returns first type in the cache which matches the given
- * type and name. If no type is found, <code>null</code>
- * is returned.
- *
- * @param type the ICElement type
- * @param qualifiedName the qualified type name to match
- * @return the matching type
- */
- public ITypeInfo getType(int type, IQualifiedTypeName qualifiedName);
-
- /** Gets the first enclosing type which matches one of the given kinds.
- *
- * @param info the given type
- * @param kinds Array containing CElement types: C_NAMESPACE, C_CLASS, C_STRUCT
- *
- * @return the enclosing type, or <code>null</code> if not found.
- */
- public ITypeInfo getEnclosingType(ITypeInfo info, int[] kinds);
-
- /** Returns the enclosing namespace for the given type, or
- * <code>null</code> if none exists.
- *
- * @param type the ICElement type
- * @param includeGlobalNamespace <code>true</code> if the global (default) namespace should be returned
- * @return the enclosing namespace, or <code>null</code> if not found.
- */
- public ITypeInfo getEnclosingNamespace(ITypeInfo info, boolean includeGlobalNamespace);
-
- /** Gets the root namespace of which encloses the given type.
- *
- * @param info the given type
- * @param includeGlobalNamespace <code>true</code> if the global (default) namespace should be returned
- * @return the enclosing namespace, or <code>null</code> if not found.
- */
- public ITypeInfo getRootNamespace(ITypeInfo info, boolean includeGlobalNamespace);
-
- /** Returns whether any types are enclosed by the given type.
- *
- * @param info the given type
- * @return <code>true</code> if the given type encloses other types.
- */
- public boolean hasEnclosedTypes(ITypeInfo info);
-
- /** Gets the types which are enclosed by the given type.
- *
- * @param info the given type
- * @param kinds Array containing CElement types: C_NAMESPACE, C_CLASS,
- * C_UNION, C_ENUMERATION, C_TYPEDEF
- * @return the enclosed types, or an empty array if not found.
- */
- public ITypeInfo[] getEnclosedTypes(ITypeInfo info, int kinds[]);
-
- /** Returns all types in the cache are supertypes of the given type.
- *
- * @param info the given type
- * @return Array of supertypes, or <code>null</code> if none found.
- */
- public ITypeInfo[] getSupertypes(ITypeInfo info);
-
- /** Returns the supertype access visiblity.
- *
- * @param type the given type
- * @param supertype the supertype
- * @return the visibility (PRIVATE, PROTECTED, PUBLIC) or <code>null</code> if none found.
- */
- public ASTAccessVisibility getSupertypeAccess(ITypeInfo type, ITypeInfo superType);
-
-
- /** Returns all types in the cache which extend the given type.
- *
- * @param info the given type
- * @return Array of subtypes, or <code>null</code> if none found.
- */
- public ITypeInfo[] getSubtypes(ITypeInfo info);
-
- /** Returns the project associated with this cache.
- *
- * @return the project
- */
- public IProject getProject();
-
- /** Accepts a visitor and iterates over all types in the cache.
- *
- * @param visitor
- */
- public void accept(ITypeInfoVisitor visitor);
-
- public void addDelta(TypeCacheDelta delta);
- public void reconcile(boolean enableIndexing, int priority, int delay);
- public void reconcileAndWait(boolean enableIndexing, int priority, IProgressMonitor monitor);
- public void cancelJobs();
-
- public void locateType(ITypeInfo info, int priority, int delay);
- public ITypeReference locateTypeAndWait(ITypeInfo info, int priority, IProgressMonitor monitor);
-
- public void locateSupertypes(ITypeInfo info, int priority, int delay);
- public ITypeInfo[] locateSupertypesAndWait(ITypeInfo info, int priority, IProgressMonitor monitor);
-
- public void locateSubtypes(ITypeInfo info, int priority, int delay);
- public ITypeInfo[] locateSubtypesAndWait(ITypeInfo info, int priority, IProgressMonitor monitor);
-
- public ITypeInfo getGlobalNamespace();
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob.java
deleted file mode 100644
index 3e87fdf7d5..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.io.IOException;
-
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.internal.core.index.IEntryResult;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
-import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.cdt.utils.PathUtil;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class IndexerDependenciesJob extends IndexerJob {
-
- private ITypeCache fTypeCache;
- private ITypeSearchScope fScope;
-
- public IndexerDependenciesJob(IndexManager indexManager, ITypeCache typeCache, ITypeSearchScope scope) {
- super(indexManager, typeCache.getProject());
- fTypeCache = typeCache;
- fScope = scope;
- }
-
- protected boolean processIndex(IIndex index, IProject project, IProgressMonitor progressMonitor) throws InterruptedException {
- IndexInput input = new BlocksIndexInput(index.getIndexFile());
- try {
- input.open();
- flushDependencies(input, progressMonitor);
- return true;
- } catch (IOException e) {
- return false;
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- return false;
- }
- }
- }
-
- private void flushDependencies(IndexInput input, IProgressMonitor progressMonitor)
- throws InterruptedException, IOException {
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult[] includeEntries = input.queryEntriesPrefixedBy(Index.encodeEntry(IIndex.INCLUDE, IIndex.ANY, IIndex.REFERENCE));
- if (includeEntries != null) {
- //TODO subprogress monitor
- for (int i = 0; i < includeEntries.length; ++i) {
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult entry = includeEntries[i];
- IPath includePath = getIncludePath(entry);
-
- if (fScope != null && fScope.encloses(includePath)) {
- int[] references = entry.getFileReferences();
- if (references != null) {
- for (int j = 0; j < references.length; ++j) {
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- IndexedFileEntry file = input.getIndexedFile(references[j]);
- if (file != null && file.getPath() != null) {
- IPath path = PathUtil.getWorkspaceRelativePath(file.getPath());
- fTypeCache.flush(path);
- }
- }
- }
- }
- }
- }
- }
-
- private IPath getIncludePath(IEntryResult entry) {
- return PathUtil.getWorkspaceRelativePath(entry.getName());
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob2.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob2.java
deleted file mode 100644
index 9b5718de1d..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob2.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.io.IOException;
-
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.internal.core.index.IEntryResult;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
-import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.cdt.utils.PathUtil;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class IndexerDependenciesJob2 extends IndexerJob2 {
-
- private ITypeCache fTypeCache;
- private ITypeSearchScope fScope;
-
- public IndexerDependenciesJob2(IndexManager indexManager, ITypeCache typeCache, ITypeSearchScope scope) {
- super(indexManager, typeCache.getProject());
- fTypeCache = typeCache;
- fScope = scope;
- }
-
- protected boolean processIndex(IProgressMonitor progressMonitor) throws InterruptedException {
- IndexInput input = new BlocksIndexInput(fProjectIndex.getIndexFile());
- try {
- input.open();
- flushDependencies(input, progressMonitor);
- return true;
- } catch (IOException e) {
- return false;
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- return false;
- }
- }
- }
-
- private void flushDependencies(IndexInput input, IProgressMonitor progressMonitor)
- throws InterruptedException, IOException {
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult[] includeEntries = input.queryEntriesPrefixedBy(Index.encodeEntry(IIndex.INCLUDE, IIndex.ANY, IIndex.REFERENCE));
- if (includeEntries != null) {
- //TODO subprogress monitor
- for (int i = 0; i < includeEntries.length; ++i) {
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult entry = includeEntries[i];
- IPath includePath = getIncludePath(entry);
-
- if (fScope != null && fScope.encloses(includePath)) {
- int[] references = entry.getFileReferences();
- if (references != null) {
- for (int j = 0; j < references.length; ++j) {
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- IndexedFileEntry file = input.getIndexedFile(references[j]);
- if (file != null && file.getPath() != null) {
- IPath path = PathUtil.getWorkspaceRelativePath(file.getPath());
- fTypeCache.flush(path);
- }
- }
- }
- }
- }
- }
- }
-
- private IPath getIncludePath(IEntryResult entry) {
- return PathUtil.getWorkspaceRelativePath(entry.getName());
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerJob.java
deleted file mode 100644
index 4de9fba649..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerJob.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial implementation
- * QNX Software Systems - adapted for type cache
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.io.IOException;
-
-import org.eclipse.cdt.core.index.ICDTIndexer;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.cdt.internal.core.search.indexing.ReadWriteMonitor;
-import org.eclipse.cdt.internal.core.search.processing.IIndexJob;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-public abstract class IndexerJob implements IIndexJob {
-
- private IndexManager fIndexManager;
- private IProject fProject;
- private IIndex fProjectIndex = null;
- private DOMSourceIndexer fSourceIndexer = null;
-
- public static final String FAMILY= "BasicTypeIndexerJob"; //$NON-NLS-1$
-
- public IndexerJob(IndexManager indexManager, IProject project) {
- fIndexManager = indexManager;
- fProject = project;
- //Get the indexer assigned to this project; check to see if it's
- //a Source Indexder
- ICDTIndexer indexer = indexManager.getIndexerForProject(project);
- if (indexer instanceof DOMSourceIndexer)
- fSourceIndexer = (DOMSourceIndexer) indexer;
- }
-
- public boolean belongsTo(String family) {
- return family == FAMILY;
- }
-
- public void cancel() {
- }
-
- public boolean isReadyToRun() {
- if (fProjectIndex == null) { // only check once. As long as this job is used, it will keep the same index picture
- getIndexForProject(fProject); // will only cache answer if all indexes were available originally
- }
- return true;
- }
-
- public String toString() {
- return FAMILY;
- }
-
- protected abstract boolean processIndex(IIndex index, IProject project, IProgressMonitor progressMonitor) throws InterruptedException;
-
- public boolean execute(IProgressMonitor progressMonitor) {
- boolean success = false;
- try {
- fProjectIndex = getIndexForProject(fProject);
- if (fProjectIndex == null)
- return false;
-
- if (progressMonitor == null) {
- progressMonitor = new NullProgressMonitor();
- }
- if (progressMonitor.isCanceled())
- throw new OperationCanceledException();
-
- progressMonitor.beginTask("", 1); //$NON-NLS-1$
-
- success = prepareIndex(fProjectIndex, fProject, progressMonitor);
-
- if (progressMonitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- progressMonitor.worked(1);
-
- return success;
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- } finally {
- progressMonitor.done();
- }
- }
-
- private boolean prepareIndex(IIndex index, IProject project, IProgressMonitor progressMonitor) throws InterruptedException {
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- if (index == null)
- return COMPLETE;
-
- if (fSourceIndexer == null)
- return FAILED;
-
- ReadWriteMonitor monitor = fSourceIndexer.getMonitorFor(index);
-
- if (monitor == null)
- return COMPLETE; // index got deleted since acquired
-
- try {
- monitor.enterRead(); // ask permission to read
- /* if index has changed, commit these before querying */
- if (index.hasChanged()) {
- try {
- monitor.exitRead(); // free read lock
- monitor.enterWrite(); // ask permission to write
- fSourceIndexer.saveIndex(index);
- } catch (IOException e) {
- return FAILED;
- } finally {
- monitor.exitWriteEnterRead(); // finished writing and reacquire read permission
- }
- }
-
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- return processIndex(index, project, progressMonitor);
- } finally {
- monitor.exitRead(); // finished reading
- }
- }
-
- private IIndex getIndexForProject(IProject project) {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IPath path = project.getFullPath();
- IPath location;
- if ((!root.getProject(path.lastSegment()).exists()) // if project does not exist
- && path.segmentCount() > 1
- && ((location = root.getFile(path).getLocation()) == null
- || !new java.io.File(location.toOSString()).exists()) // and internal jar file does not exist
- && !new java.io.File(path.toOSString()).exists()) { // and external jar file does not exist
- return null;
- }
-
- // may trigger some index recreation work
- if (fSourceIndexer != null)
- return fSourceIndexer.getIndex(path, true /*reuse index file*/, false /*do not create if none*/);
-
- return null;
- }
-}
-
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerJob2.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerJob2.java
deleted file mode 100644
index 51be068de3..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerJob2.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004,2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * QNX Software Systems - adapted for type cache
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.io.IOException;
-
-import org.eclipse.cdt.core.index.ICDTIndexer;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.cdt.internal.core.search.indexing.ReadWriteMonitor;
-import org.eclipse.cdt.internal.core.search.processing.IIndexJob;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-public abstract class IndexerJob2 implements IIndexJob {
-
- protected IProject fProject;
- protected IIndex fProjectIndex = null;
- protected ICDTIndexer fSourceIndexer = null;
-
- public static final String FAMILY= "IndexerJob2"; //$NON-NLS-1$
-
- public IndexerJob2(IndexManager indexManager, IProject project) {
- fProject = project;
- fSourceIndexer = indexManager.getIndexerForProject(project);
- fProjectIndex = getIndexForProject();
- }
-
- public boolean belongsTo(String family) {
- return family == FAMILY;
- }
-
- public void cancel() {
- }
-
- public boolean isReadyToRun() {
- return true;
- }
-
- public String toString() {
- return FAMILY;
- }
-
- protected abstract boolean processIndex(IProgressMonitor progressMonitor) throws InterruptedException;
-
- public boolean execute(IProgressMonitor progressMonitor) {
- boolean success = false;
- try {
- if (fProjectIndex == null)
- return false;
-
- if (progressMonitor == null) {
- progressMonitor = new NullProgressMonitor();
- }
- if (progressMonitor.isCanceled())
- throw new OperationCanceledException();
-
- progressMonitor.beginTask("", 1); //$NON-NLS-1$
-
- success = prepareIndex(progressMonitor);
-
- if (progressMonitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- progressMonitor.worked(1);
-
- return success;
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- } finally {
- progressMonitor.done();
- }
- }
-
- private boolean prepareIndex(IProgressMonitor progressMonitor) throws InterruptedException {
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- if (fProjectIndex == null)
- return COMPLETE;
-
- if (fSourceIndexer == null)
- return FAILED;
-
- ReadWriteMonitor monitor = fSourceIndexer.getMonitorFor(fProjectIndex);
-
- if (monitor == null)
- return COMPLETE; // index got deleted since acquired
-
- try {
- monitor.enterRead(); // ask permission to read
- /* if index has changed, commit these before querying */
- if (fProjectIndex.hasChanged()) {
- try {
- monitor.exitRead(); // free read lock
- monitor.enterWrite(); // ask permission to write
- fSourceIndexer.saveIndex(fProjectIndex);
- } catch (IOException e) {
- return FAILED;
- } finally {
- monitor.exitWriteEnterRead(); // finished writing and reacquire read permission
- }
- }
-
- if (progressMonitor.isCanceled())
- throw new InterruptedException();
-
- return processIndex(progressMonitor);
- } finally {
- monitor.exitRead(); // finished reading
- }
- }
-
- private IIndex getIndexForProject() {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IPath path = fProject.getFullPath();
- IPath location;
- if ((!root.getProject(path.lastSegment()).exists()) // if project does not exist
- && path.segmentCount() > 1
- && ((location = root.getFile(path).getLocation()) == null
- || !new java.io.File(location.toOSString()).exists()) // and internal jar file does not exist
- && !new java.io.File(path.toOSString()).exists()) { // and external jar file does not exist
- return null;
- }
-
- // may trigger some index recreation work
- if (fSourceIndexer != null)
- return fSourceIndexer.getIndex(path, true /*reuse index file*/, false /*do not create if none*/);
-
- return null;
- }
-
- protected int index2ICElement( int kind )
- {
- switch(kind) {
- case IIndex.TYPE_CLASS:
- return ICElement.C_CLASS;
- case IIndex.TYPE_STRUCT:
- return ICElement.C_STRUCT;
- case IIndex.TYPE_ENUM:
- return ICElement.C_ENUMERATION;
- case IIndex.TYPE_UNION:
- return ICElement.C_UNION;
- case IIndex.TYPE_TYPEDEF:
- return ICElement.C_TYPEDEF;
- default:
- return 0;
- }
- }
-}
-
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob.java
deleted file mode 100644
index d550952261..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.io.IOException;
-
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.core.browser.QualifiedTypeName;
-import org.eclipse.cdt.core.browser.TypeInfo;
-import org.eclipse.cdt.core.browser.TypeReference;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.internal.core.index.IEntryResult;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
-import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.cdt.utils.PathUtil;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class IndexerTypesJob extends IndexerJob {
-
- private ITypeCache fTypeCache;
-
- public IndexerTypesJob(IndexManager indexManager, ITypeCache typeCache, ITypeSearchScope scope) {
- super(indexManager, typeCache.getProject());
- fTypeCache = typeCache;
- }
-
- protected boolean processIndex(IIndex index, IProject project, IProgressMonitor progressMonitor) throws InterruptedException {
- IndexInput input = new BlocksIndexInput(index.getIndexFile());
- try {
- input.open();
- updateNamespaces(input, project, progressMonitor);
- updateTypes(input, project, progressMonitor);
- return true;
- } catch (IOException e) {
- return false;
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- return false;
- }
- }
- }
-
- private void updateNamespaces(IndexInput input, IProject project, IProgressMonitor monitor)
- throws InterruptedException, IOException {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult[] namespaceEntries = input.queryEntriesPrefixedBy(Index.encodeEntry(IIndex.NAMESPACE, IIndex.ANY, IIndex.DECLARATION));
- if (namespaceEntries != null) {
- //TODO subprogress monitor
- for (int i = 0; i < namespaceEntries.length; ++i) {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult entry = namespaceEntries[i];
- String name = entry.getName();
- if (name.length() != 0) {
- String[] enclosingNames = entry.getEnclosingNames();
- addType(input, project, entry, ICElement.C_NAMESPACE, name, enclosingNames, monitor);
- }
- }
- }
- }
-
- private void updateTypes(IndexInput input, IProject project, IProgressMonitor monitor)
- throws InterruptedException, IOException {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult[] typeEntries = input.queryEntriesPrefixedBy(Index.encodeEntry(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION));
- if (typeEntries != null) {
- //TODO subprogress monitor
- for (int i = 0; i < typeEntries.length; ++i) {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult entry = typeEntries[i];
-
- String name = entry.getName();
- switch (entry.getKind() ) {
- case IIndex.TYPE_CLASS :
- case IIndex.TYPE_STRUCT :
- case IIndex.TYPE_TYPEDEF :
- case IIndex.TYPE_ENUM :
- case IIndex.TYPE_UNION :
- if (name.length() != 0) { // skip anonymous structs
- addType(input, project, entry, entry.getKind(), name, entry.getEnclosingNames(), monitor);
- }
- break;
- case IIndex.TYPE_DERIVED :
- if (name.length() != 0) { // skip anonymous structs
- addSuperTypeReference(input, project, entry, name, entry.getEnclosingNames(), monitor);
- }
- break;
- default:
- break;
- }
- }
- }
- }
-
- private void addType(IndexInput input, IProject project, IEntryResult entry, int type, String name, String[] enclosingNames, IProgressMonitor monitor)
- throws InterruptedException, IOException {
- QualifiedTypeName qualifiedName = new QualifiedTypeName(name, enclosingNames);
- ITypeInfo info = fTypeCache.getType(type, qualifiedName);
- if (info == null || info.isUndefinedType()) {
- int[] references = entry.getFileReferences();
- if (references != null && references.length > 0) {
- // add new type to cache
- if (info != null) {
- info.setCElementType(type);
- } else {
- info = new TypeInfo(type, qualifiedName);
- fTypeCache.insert(info);
- }
-
-// for (int i = 0; i < references.length; ++i) {
-// if (monitor.isCanceled())
-// throw new InterruptedException();
-//
-// IndexedFile file = input.getIndexedFile(references[i]);
-// if (file != null && file.getPath() != null) {
-// IPath path = PathUtil.getWorkspaceRelativePath(file.getPath());
-// info.addReference(new TypeReference(path, project));
-// }
-// }
- // just grab the first reference
- IndexedFileEntry file = input.getIndexedFile(references[0]);
- if (file != null && file.getPath() != null) {
- IPath path = PathUtil.getWorkspaceRelativePath(file.getPath());
- info.addReference(new TypeReference(path, project));
- }
- }
- }
- }
-
- private void addSuperTypeReference(IndexInput input, IProject project, IEntryResult entry, String name, String[] enclosingNames, IProgressMonitor monitor) throws InterruptedException, IOException {
- QualifiedTypeName qualifiedName = new QualifiedTypeName(name, enclosingNames);
- ITypeInfo info = fTypeCache.getType(ICElement.C_CLASS, qualifiedName);
- if (info == null)
- info = fTypeCache.getType(ICElement.C_STRUCT, qualifiedName);
- if (info == null) {
- // add dummy type to cache
- info = new TypeInfo(0, qualifiedName);
- fTypeCache.insert(info);
- }
- int[] references = entry.getFileReferences();
- if (references != null && references.length > 0) {
- for (int i = 0; i < references.length; ++i) {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- IndexedFileEntry file = input.getIndexedFile(references[i]);
- if (file != null && file.getPath() != null) {
- IPath path = PathUtil.getWorkspaceRelativePath(file.getPath());
- info.addDerivedReference(new TypeReference(path, project));
-//
-// // get absolute path
-// IPath path = new Path(file.getPath());
-// IPath projectPath = project.getFullPath();
-// if (projectPath.isPrefixOf(path)) {
-// path = project.getLocation().append(path.removeFirstSegments(projectPath.segmentCount()));
-// }
-// info.addDerivedReference(new TypeReference(path, project));
- }
- }
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob2.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob2.java
deleted file mode 100644
index daecedab08..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob2.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.io.IOException;
-
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.core.browser.QualifiedTypeName;
-import org.eclipse.cdt.core.browser.TypeInfo;
-import org.eclipse.cdt.core.browser.TypeReference;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.internal.core.index.IEntryResult;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.index.IQueryResult;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput;
-import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.cdt.utils.PathUtil;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class IndexerTypesJob2 extends IndexerJob2 {
-
- private ITypeCache fTypeCache;
-
- public IndexerTypesJob2(IndexManager indexManager, ITypeCache typeCache, ITypeSearchScope scope) {
- super(indexManager, typeCache.getProject());
- fTypeCache = typeCache;
- }
-
- protected boolean processIndex(IProgressMonitor progressMonitor) throws InterruptedException {
- IndexInput input = null;
- try {
- input = new BlocksIndexInput( fProjectIndex.getIndexFile() );
- input.open();
- updateNamespaces(input, progressMonitor);
- updateTypes(input, progressMonitor);
- return true;
- } catch (IOException e) {
- return false;
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- // do nothing
- }
- }
- }
- }
-
- private void updateNamespaces(IndexInput input, IProgressMonitor monitor)
- throws InterruptedException, IOException {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult[] namespaceEntries = fProjectIndex.getEntries( IIndex.NAMESPACE, IIndex.ANY, IIndex.DEFINITION );
- IQueryResult[] namespacePaths = fProjectIndex.getPrefix(IIndex.NAMESPACE, IIndex.ANY, IIndex.DEFINITION );
-// input.queryEntriesPrefixedBy(Index.encodeEntry(IIndex.NAMESPACE, IIndex.ANY, IIndex.DECLARATION));
- if (namespaceEntries != null) {
- //TODO subprogress monitor
- for (int i = 0; i < namespaceEntries.length; ++i) {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult entry = namespaceEntries[i];
- String name = entry.getName();
- if (name.length() != 0) {
- String[] enclosingNames = entry.getEnclosingNames();
- addType(input, entry, namespacePaths[i].getPath(), ICElement.C_NAMESPACE, name, enclosingNames, monitor);
- }
- }
- }
- }
-
- private void updateTypes(IndexInput input, IProgressMonitor monitor)
- throws InterruptedException, IOException {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- for( int counter = 0; counter < 2; ++counter )
- {
- IEntryResult[] typeEntries = fProjectIndex.getEntries( IIndex.TYPE, IIndex.ANY, ( counter == 0 ) ? IIndex.DECLARATION : IIndex.DEFINITION );
-
- if (typeEntries != null) {
- //TODO subprogress monitor
- for (int i = 0; i < typeEntries.length; ++i) {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult entry = typeEntries[i];
-
- String name = entry.extractSimpleName();
- switch (entry.getKind() ) {
- case IIndex.TYPE_CLASS :
- case IIndex.TYPE_STRUCT :
- case IIndex.TYPE_TYPEDEF :
- case IIndex.TYPE_ENUM :
- case IIndex.TYPE_UNION :
- if (counter != 0 && name.length() != 0) { // skip anonymous structs
- addType(input, entry, null, index2ICElement( entry.getKind() ), name, entry.getEnclosingNames(), monitor);
- }
- break;
- default:
- break;
- }
- }
- }
- }
-
- IEntryResult[] typeEntries = fProjectIndex.getEntries( IIndex.TYPE, IIndex.TYPE_DERIVED, IIndex.ANY );
- if (typeEntries != null){
- for( int j = 0; j < typeEntries.length; ++j )
- {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- IEntryResult entry = typeEntries[j];
- String name = entry.extractSimpleName();
- switch( entry.getKind() )
- {
- case IIndex.TYPE_DERIVED :
- if (name.length() != 0) { // skip anonymous structs
- addSuperTypeReference(input, entry, name, entry.getEnclosingNames(), monitor);
- }
- break;
- default:
- break;
- }
- }
- }
- }
-
- private void addType(IndexInput input, IEntryResult entry, String pth, int type, String name, String[] enclosingNames, IProgressMonitor monitor)
- throws InterruptedException, IOException {
- QualifiedTypeName qualifiedName = new QualifiedTypeName(name, enclosingNames);
- ITypeInfo info = fTypeCache.getType(type, qualifiedName);
- if (info == null || info.isUndefinedType()) {
- int[] references = entry.getFileReferences();
- if (references != null && references.length > 0) {
- // add new type to cache
- if (info != null) {
- info.setCElementType(type);
- } else {
- info = new TypeInfo(type, qualifiedName);
- fTypeCache.insert(info);
- }
-
-// for (int i = 0; i < references.length; ++i) {
-// if (monitor.isCanceled())
-// throw new InterruptedException();
-//
-// IndexedFile file = input.getIndexedFile(references[i]);
-// if (file != null && file.getPath() != null) {
-// IPath path = PathUtil.getWorkspaceRelativePath(file.getPath());
-// info.addReference(new TypeReference(path, project));
-// }
-// }
- if (pth == null) {
- pth = input.getIndexedFile( references[0] ).getPath();
- }
-
- final IPath workspaceRelativePath = PathUtil.getWorkspaceRelativePath(pth);
- int offset = entry.getOffsets()[0][0];
-// int offsetType = Integer.valueOf(String.valueOf(offsets[i][j]).substring(0,1)).intValue();
- int offsetType = offset;
- int m = 1;
- while (offsetType >= 10) {
- offsetType = offsetType / 10;
- m *= 10;
- }
- int value = offset - ( offsetType * m );
-// int value = Integer.valueOf(String.valueOf(offset).substring(1)).intValue();
-
- TypeReference typeReference = null;
- if (offsetType==IIndex.LINE){
- typeReference = new TypeReference(workspaceRelativePath, fProject, value, 0 );
- typeReference.offsetIsLineNumber = true;
- }else if (offsetType==IIndex.OFFSET){
- typeReference = new TypeReference(workspaceRelativePath, fProject, value, entry.getOffsetLengths()[0][0] );
- }
- if( typeReference != null )
- info.addReference(typeReference);
- }
- }
- }
-
- private void addSuperTypeReference(IndexInput input, IEntryResult entry, String name, String[] enclosingNames, IProgressMonitor monitor) throws InterruptedException, IOException {
- QualifiedTypeName qualifiedName = new QualifiedTypeName(name, enclosingNames);
- ITypeInfo info = fTypeCache.getType(ICElement.C_CLASS, qualifiedName);
- if (info == null)
- info = fTypeCache.getType(ICElement.C_STRUCT, qualifiedName);
- if (info == null) {
- // add dummy type to cache
- info = new TypeInfo(0, qualifiedName);
- fTypeCache.insert(info);
- }
- int[] references = entry.getFileReferences();
- if (references != null && references.length > 0) {
- for (int i = 0; i < references.length; ++i) {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- String pth = input.getIndexedFile( references[i] ).getPath();
- IPath path = PathUtil.getWorkspaceRelativePath(pth);
-
- info.addDerivedReference(new TypeReference(path, fProject));
-//
-// // get absolute path
-// IPath path = new Path(file.getPath());
-// IPath projectPath = project.getFullPath();
-// if (projectPath.isPrefixOf(path)) {
-// path = project.getLocation().append(path.removeFirstSegments(projectPath.segmentCount()));
-// }
-// info.addDerivedReference(new TypeReference(path, project));
-
- }
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/SubTypeLocatorJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/SubTypeLocatorJob.java
deleted file mode 100644
index 7909c033a9..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/SubTypeLocatorJob.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.model.IWorkingCopyProvider;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-public class SubTypeLocatorJob extends BasicJob {
-
- public static final Object FAMILY = new Object();
- private ITypeInfo fLocateType;
- private ITypeCache fTypeCache;
- private IWorkingCopyProvider fWorkingCopyProvider;
-
- public SubTypeLocatorJob(ITypeInfo info, ITypeCache typeCache, IWorkingCopyProvider workingCopyProvider) {
- super(TypeCacheMessages.getString("SubTypeLocatorJob.jobName"), FAMILY); //$NON-NLS-1$
- fLocateType = info;
- fTypeCache = typeCache;
- fWorkingCopyProvider= workingCopyProvider;
- }
-
- public ITypeInfo getType() {
- return fLocateType;
- }
-
- protected IStatus runWithDelegatedProgress(IProgressMonitor monitor) throws InterruptedException {
- boolean success = false;
- long startTime = System.currentTimeMillis();
- trace("SubTypeLocatorJob: started"); //$NON-NLS-1$
-
- try {
- monitor.beginTask(TypeCacheMessages.getString("SubTypeLocatorJob.taskName"), 100); //$NON-NLS-1$
-
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- TypeParser parser = new TypeParser(fTypeCache, fWorkingCopyProvider);
- success = parser.findSubTypes(fLocateType, new SubProgressMonitor(monitor, 100));
-
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- } finally {
- long executionTime = System.currentTimeMillis() - startTime;
- if (success)
- trace("SubTypeLocatorJob: completed ("+ executionTime + " ms)"); //$NON-NLS-1$ //$NON-NLS-2$
- else
- trace("SubTypeLocatorJob: aborted ("+ executionTime + " ms)"); //$NON-NLS-1$ //$NON-NLS-2$
-
- monitor.done();
- }
-
- return Status.OK_STATUS;
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java
deleted file mode 100644
index 592f7d99d3..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCache.java
+++ /dev/null
@@ -1,895 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.cdt.core.browser.IQualifiedTypeName;
-import org.eclipse.cdt.core.browser.ITypeCacheChangedListener;
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.browser.ITypeInfoVisitor;
-import org.eclipse.cdt.core.browser.ITypeReference;
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.core.browser.QualifiedTypeName;
-import org.eclipse.cdt.core.browser.TypeInfo;
-import org.eclipse.cdt.core.browser.TypeSearchScope;
-import org.eclipse.cdt.core.index.ICDTIndexer;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.IWorkingCopyProvider;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.internal.core.browser.util.ArrayUtil;
-import org.eclipse.cdt.internal.core.model.CModelManager;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-
-public class TypeCache implements ITypeCache {
-
- private static final int INITIAL_TYPE_COUNT = 100;
- private final Map fTypeKeyMap = new HashMap(INITIAL_TYPE_COUNT);
- final IProject fProject;
- private final IWorkingCopyProvider fWorkingCopyProvider;
- final Collection fDeltas = new ArrayList();
- final ITypeInfo fGlobalNamespace;
- private final Map fTypeToSubTypes = new HashMap();
- private final Map fTypeToSuperTypes = new HashMap();
- ITypeCacheChangedListener fChangeListener = null;
-
- private static final class SuperTypeEntry {
- ITypeInfo superType;
- ASTAccessVisibility access;
- boolean isVirtual;
- SuperTypeEntry(ITypeInfo superType, ASTAccessVisibility access, boolean isVirtual) {
- this.superType = superType;
- this.access = access;
- this.isVirtual = isVirtual;
- }
- }
-
- private SuperTypeEntry findSuperTypeEntry(Collection entryCollection, ITypeInfo superType) {
- for (Iterator i = entryCollection.iterator(); i.hasNext(); ) {
- SuperTypeEntry e = (SuperTypeEntry) i.next();
- if (e.superType.equals(superType)) {
- return e;
- }
- }
- return null;
- }
-
- private static final int[] ENCLOSING_TYPES = {ICElement.C_NAMESPACE, ICElement.C_CLASS, ICElement.C_STRUCT, 0};
-
- private IJobChangeListener fJobChangeListener = new IJobChangeListener() {
- public void aboutToRun(IJobChangeEvent event) {
- }
-
- public void awake(IJobChangeEvent event) {
- }
-
- public void done(IJobChangeEvent event) {
- Job job = event.getJob();
- if (job instanceof TypeCacherJob) {
- TypeCacherJob deltaJob = (TypeCacherJob)job;
- IStatus status = event.getResult();
- if (status != null) {
- boolean jobFinished = (status.equals(Status.OK_STATUS)
- && !deltaJob.isIndexerBusy());
- // remove the completed deltas
- synchronized(fDeltas) {
- for (Iterator i = fDeltas.iterator(); i.hasNext(); ) {
- TypeCacheDelta delta = (TypeCacheDelta) i.next();
- if (delta.getJob() != null && delta.getJob().equals(deltaJob)) {
- if (jobFinished) {
- i.remove();
- } else {
- delta.assignToJob(null);
- }
- }
- }
- }
- }
- // TODO finer-grained change deltas
- if (fChangeListener != null)
- fChangeListener.typeCacheChanged(fProject);
- }
- }
-
- public void running(IJobChangeEvent event) {
- }
-
- public void scheduled(IJobChangeEvent event) {
- }
-
- public void sleeping(IJobChangeEvent event) {
- }
- };
-
- private static class GlobalNamespace implements IQualifiedTypeName {
-
- private static final String GLOBAL_NAMESPACE = TypeCacheMessages.getString("TypeCache.globalNamespace"); //$NON-NLS-1$
- private static final String[] segments = new String[] { GLOBAL_NAMESPACE };
-
- public GlobalNamespace() {
- }
-
- public String getName() {
- return GLOBAL_NAMESPACE;
- }
-
- public String[] getEnclosingNames() {
- return null;
- }
-
- public String getFullyQualifiedName() {
- return GLOBAL_NAMESPACE;
- }
-
- public IQualifiedTypeName getEnclosingTypeName() {
- return null;
- }
-
- public boolean isEmpty() {
- return false;
- }
-
- public boolean isGlobal() {
- return true;
- }
-
- public boolean isQualified() {
- return false;
- }
-
- public boolean isValidSegment(String segment) {
- return false;
- }
-
- public int segmentCount() {
- return 1;
- }
-
- public String[] segments() {
- return segments;
- }
-
- public String segment(int index) {
- if (index > 0)
- return null;
- return GLOBAL_NAMESPACE;
- }
-
- public String lastSegment() {
- return GLOBAL_NAMESPACE;
- }
-
- public int matchingFirstSegments(IQualifiedTypeName typeName) {
- return 1;
- }
-
- public boolean isPrefixOf(IQualifiedTypeName typeName) {
- return true;
- }
-
- public IQualifiedTypeName append(String[] names) {
- return new QualifiedTypeName(names);
- }
-
- public IQualifiedTypeName append(IQualifiedTypeName typeName) {
- return new QualifiedTypeName(typeName);
- }
-
- public IQualifiedTypeName append(String qualifiedName) {
- return new QualifiedTypeName(qualifiedName);
- }
-
- public IQualifiedTypeName removeFirstSegments(int count) {
- return this;
- }
-
- public IQualifiedTypeName removeLastSegments(int count) {
- return this;
- }
-
- public boolean isLowLevel() {
- return false;
- }
-
- public boolean isValid() {
- return true;
- }
-
- public int hashCode() {
- return GLOBAL_NAMESPACE.hashCode();
- }
-
- public String toString() {
- return getFullyQualifiedName();
- }
-
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof IQualifiedTypeName)) {
- return false;
- }
- return equals((IQualifiedTypeName)obj);
- }
-
- public int compareTo(Object obj) {
- if (obj == this) {
- return 0;
- }
- if (!(obj instanceof IQualifiedTypeName)) {
- throw new ClassCastException();
- }
- return compareTo((IQualifiedTypeName)obj);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.IQualifiedTypeName#equals(org.eclipse.cdt.core.browser.IQualifiedTypeName)
- */
- public boolean equals(IQualifiedTypeName typeName) {
- return (typeName instanceof GlobalNamespace);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.IQualifiedTypeName#equalsIgnoreCase(org.eclipse.cdt.core.browser.IQualifiedTypeName)
- */
- public boolean equalsIgnoreCase(IQualifiedTypeName typeName) {
- return (typeName instanceof GlobalNamespace);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.IQualifiedTypeName#compareTo(org.eclipse.cdt.core.browser.IQualifiedTypeName)
- */
- public int compareTo(IQualifiedTypeName typeName) {
- return getFullyQualifiedName().compareTo(typeName.getFullyQualifiedName());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.IQualifiedTypeName#compareToIgnoreCase(org.eclipse.cdt.core.browser.IQualifiedTypeName)
- */
- public int compareToIgnoreCase(IQualifiedTypeName typeName) {
- return getFullyQualifiedName().compareToIgnoreCase(typeName.getFullyQualifiedName());
- }
- }
-
- private static class HashKey {
- private IQualifiedTypeName name;
- private int type;
- public HashKey(IQualifiedTypeName name, int type) {
- this.name = name;
- this.type = type;
- }
- public int hashCode() {
- return (this.name.hashCode() + this.type);
- }
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof HashKey)) {
- return false;
- }
- HashKey otherKey = (HashKey)obj;
- return (this.type == otherKey.type && this.name.equals(otherKey.name));
- }
- }
-
- public TypeCache(IProject project, IWorkingCopyProvider workingCopyProvider) {
- fProject = project;
- fWorkingCopyProvider = workingCopyProvider;
- fDeltas.add(new TypeCacheDelta(fProject));
- fGlobalNamespace = new TypeInfo(ICElement.C_NAMESPACE, new GlobalNamespace());
- fGlobalNamespace.setCache(this);
- }
-
- public TypeCache(IProject project, IWorkingCopyProvider workingCopyProvider, ITypeCacheChangedListener listener) {
- this(project, workingCopyProvider);
- fChangeListener = listener;
- }
-
- public boolean contains(ISchedulingRule rule) {
- if (this == rule)
- return true;
- if (rule instanceof ITypeCache) {
- ITypeCache typeCache = (ITypeCache) rule;
- if (fProject.equals(typeCache.getProject()))
- return true;
- }
- return false;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- if (rule instanceof ITypeCache) {
- ITypeCache typeCache = (ITypeCache) rule;
- if (fProject.equals(typeCache.getProject()))
- return true;
- }
- return false;
- }
-
- public IProject getProject() {
- return fProject;
- }
-
- public synchronized boolean isEmpty() {
- return fTypeKeyMap.isEmpty();
- }
-
- public synchronized void insert(ITypeInfo newType) {
- // check if enclosing types are already in cache
- IQualifiedTypeName enclosingName = newType.getQualifiedTypeName().getEnclosingTypeName();
- if (enclosingName != null) {
- while (!enclosingName.isEmpty()) {
- // try namespace, class, struct, then undefined
- ITypeInfo enclosingType = null;
- for (int i = 0; enclosingType == null && i < ENCLOSING_TYPES.length; ++i) {
- enclosingType = (ITypeInfo) fTypeKeyMap.get(new HashKey(enclosingName, ENCLOSING_TYPES[i]));
- }
- if (enclosingType == null) {
- // create a dummy type to take this place (type 0 == unknown)
- ITypeInfo dummyType = new TypeInfo(0, enclosingName);
- dummyType.setCache(this);
- fTypeKeyMap.put(new HashKey(enclosingName, 0), dummyType);
- }
- enclosingName = enclosingName.removeLastSegments(1);
- }
- }
-
- fTypeKeyMap.put(new HashKey(newType.getQualifiedTypeName(), newType.getCElementType()), newType);
- newType.setCache(this);
- }
-
- public synchronized void remove(ITypeInfo info) {
- fTypeKeyMap.remove(new HashKey(info.getQualifiedTypeName(), info.getCElementType()));
- info.setCache(null);
- }
-
- public synchronized void flush(ITypeSearchScope scope) {
- if (scope.encloses(fProject)) {
- flushAll();
- } else {
- for (Iterator mapIter = fTypeKeyMap.entrySet().iterator(); mapIter.hasNext(); ) {
- Map.Entry entry = (Map.Entry) mapIter.next();
- ITypeInfo info = (ITypeInfo) entry.getValue();
- if (info.isEnclosed(scope)) {
- mapIter.remove();
- }
- }
- }
- }
-
- public synchronized void flush(IPath path) {
- ITypeSearchScope scope = new TypeSearchScope();
- scope.add(path, false, null);
- flush(scope);
- }
-
- public synchronized void flushAll() {
- // flush the entire cache
- accept(new ITypeInfoVisitor() {
- public boolean visit(ITypeInfo info) {
- info.setCache(null);
- return true;
- }
- public boolean shouldContinue() { return true; }
- });
- fTypeKeyMap.clear();
- }
-
- public synchronized void addSupertype(ITypeInfo type, ITypeInfo supertype, ASTAccessVisibility access, boolean isVirtual) {
- Collection entryCollection = (Collection) fTypeToSuperTypes.get(type);
- if (entryCollection == null) {
- entryCollection = new ArrayList();
- fTypeToSuperTypes.put(type, entryCollection);
- }
- if (findSuperTypeEntry(entryCollection, supertype) == null) {
- entryCollection.add(new SuperTypeEntry(supertype, access, isVirtual));
- supertype.setCache(this);
- }
- }
-
- public synchronized ITypeInfo[] getSupertypes(ITypeInfo type) {
- Collection entryCollection = (Collection) fTypeToSuperTypes.get(type);
- if (entryCollection != null && !entryCollection.isEmpty()) {
- ITypeInfo[] superTypes = new ITypeInfo[entryCollection.size()];
- int count = 0;
- for (Iterator i = entryCollection.iterator(); i.hasNext(); ) {
- SuperTypeEntry e = (SuperTypeEntry) i.next();
- superTypes[count++] = e.superType;
- }
- return superTypes;
- }
- return null;
- }
-
- public ASTAccessVisibility getSupertypeAccess(ITypeInfo type, ITypeInfo superType) {
- Collection entryCollection = (Collection) fTypeToSuperTypes.get(type);
- if (entryCollection != null && !entryCollection.isEmpty()) {
- SuperTypeEntry e = findSuperTypeEntry(entryCollection, superType);
- if (e != null)
- return e.access;
- }
- return null;
- }
-
- public synchronized void addSubtype(ITypeInfo type, ITypeInfo subtype) {
- Collection typeCollection = (Collection) fTypeToSubTypes.get(type);
- if (typeCollection == null) {
- typeCollection = new ArrayList();
- fTypeToSubTypes.put(type, typeCollection);
- }
- if (!typeCollection.contains(subtype)) {
- typeCollection.add(subtype);
- subtype.setCache(this);
- }
- }
-
- public synchronized ITypeInfo[] getSubtypes(ITypeInfo type) {
- Collection typeCollection = (Collection) fTypeToSubTypes.get(type);
- if (typeCollection != null && !typeCollection.isEmpty()) {
- return (ITypeInfo[]) typeCollection.toArray(new ITypeInfo[typeCollection.size()]);
- }
- return null;
- }
-
- public synchronized void accept(ITypeInfoVisitor visitor) {
- for (Iterator mapIter = fTypeKeyMap.entrySet().iterator(); mapIter.hasNext(); ) {
- Map.Entry entry = (Map.Entry) mapIter.next();
- ITypeInfo info = (ITypeInfo) entry.getValue();
- if (!visitor.shouldContinue())
- return; // stop visiting
- visitor.visit(info);
- }
- }
-
- public synchronized IPath[] getPaths(final ITypeSearchScope scope) {
- final Set pathSet = new HashSet();
- accept(new ITypeInfoVisitor() {
- public boolean visit(ITypeInfo info) {
- if (scope == null || info.isEnclosed(scope)) {
- ITypeReference[] refs = info.getReferences();
- if (refs != null) {
- for (int i = 0; i < refs.length; ++i) {
- IPath path = refs[i].getPath();
- if (scope == null || scope.encloses(path))
- pathSet.add(path);
- }
- }
- }
- return true;
- }
- public boolean shouldContinue() { return true; }
- });
- return (IPath[]) pathSet.toArray(new IPath[pathSet.size()]);
- }
-
- public synchronized ITypeInfo[] getTypes(final ITypeSearchScope scope) {
- final Collection results = new ArrayList();
- accept(new ITypeInfoVisitor() {
- public boolean visit(ITypeInfo info) {
- if (scope == null || info.isEnclosed(scope)) {
- results.add(info);
- }
- return true;
- }
- public boolean shouldContinue() { return true; }
- });
- return (ITypeInfo[]) results.toArray(new ITypeInfo[results.size()]);
- }
-
- public synchronized ITypeInfo[] getTypes(IQualifiedTypeName qualifiedName, boolean matchEnclosed, boolean ignoreCase) {
- Collection results = new ArrayList();
- if (!ignoreCase && !matchEnclosed) {
- for (int i = 0; i < ITypeInfo.KNOWN_TYPES.length; ++i) {
- ITypeInfo info = (ITypeInfo) fTypeKeyMap.get(new HashKey(qualifiedName, ITypeInfo.KNOWN_TYPES[i]));
- if (info != null) {
- results.add(info);
- }
- }
- ITypeInfo info = (ITypeInfo) fTypeKeyMap.get(new HashKey(qualifiedName, 0));
- if (info != null) {
- results.add(info);
- }
- } else {
- // TODO this should probably use a more efficient search algorithm
- for (Iterator mapIter = fTypeKeyMap.entrySet().iterator(); mapIter.hasNext(); ) {
- Map.Entry entry = (Map.Entry) mapIter.next();
- ITypeInfo info = (ITypeInfo) entry.getValue();
- IQualifiedTypeName currName = info.getQualifiedTypeName();
-
- if (ignoreCase) {
- if (matchEnclosed && currName.segmentCount() > qualifiedName.segmentCount()
- && currName.lastSegment().equalsIgnoreCase(qualifiedName.lastSegment())) {
- currName = currName.removeFirstSegments(currName.segmentCount() - qualifiedName.segmentCount());
- }
- if (currName.equalsIgnoreCase(qualifiedName)) {
- results.add(info);
- }
- } else {
- if (matchEnclosed && currName.segmentCount() > qualifiedName.segmentCount()
- && currName.lastSegment().equals(qualifiedName.lastSegment())) {
- currName = currName.removeFirstSegments(currName.segmentCount() - qualifiedName.segmentCount());
- }
- if (currName.equals(qualifiedName)) {
- results.add(info);
- }
- }
- }
- }
- return (ITypeInfo[]) results.toArray(new ITypeInfo[results.size()]);
- }
-
- public synchronized ITypeInfo getType(int type, IQualifiedTypeName qualifiedName) {
- ITypeInfo info = (ITypeInfo) fTypeKeyMap.get(new HashKey(qualifiedName, type));
- if (info == null && type != 0) {
- info = (ITypeInfo) fTypeKeyMap.get(new HashKey(qualifiedName, 0));
- }
- return info;
- }
-
- public synchronized ITypeInfo getEnclosingType(ITypeInfo info, final int[] kinds) {
- IQualifiedTypeName enclosingName = info.getQualifiedTypeName().getEnclosingTypeName();
- if (enclosingName != null) {
- // try namespace, class, struct, then undefined
- ITypeInfo enclosingType = null;
- for (int i = 0; enclosingType == null && i < ENCLOSING_TYPES.length; ++i) {
- if (ArrayUtil.contains(kinds, ENCLOSING_TYPES[i])) {
- enclosingType = (ITypeInfo) fTypeKeyMap.get(new HashKey(enclosingName, ENCLOSING_TYPES[i]));
- }
- }
- return enclosingType;
- }
- return null;
- }
-
- public synchronized ITypeInfo getEnclosingNamespace(ITypeInfo info, boolean includeGlobalNamespace) {
- IQualifiedTypeName enclosingName = info.getQualifiedTypeName().getEnclosingTypeName();
- if (enclosingName != null) {
- // look for namespace
- ITypeInfo enclosingType = (ITypeInfo) fTypeKeyMap.get(new HashKey(enclosingName, ICElement.C_NAMESPACE));
- if (enclosingType != null) {
- return enclosingType;
- }
- // try class, struct, then undefined
- final int[] kinds = {ICElement.C_CLASS, ICElement.C_STRUCT, 0};
- for (int i = 0; enclosingType == null && i < kinds.length; ++i) {
- enclosingType = (ITypeInfo) fTypeKeyMap.get(new HashKey(enclosingName, kinds[i]));
- }
- if (enclosingType != null) {
- return getEnclosingNamespace(enclosingType, includeGlobalNamespace);
- }
- }
- if (includeGlobalNamespace)
- return fGlobalNamespace;
- return null;
- }
-
- public synchronized ITypeInfo getRootNamespace(ITypeInfo info, boolean includeGlobalNamespace) {
- IQualifiedTypeName qualifiedName = info.getQualifiedTypeName();
- if (qualifiedName.isGlobal()) {
- if (info.getCElementType() == ICElement.C_NAMESPACE)
- return info;
- if (includeGlobalNamespace)
- return fGlobalNamespace;
- return null;
- }
- IQualifiedTypeName namespace = qualifiedName.removeLastSegments(qualifiedName.segmentCount()-1);
- // try namespace, then undefined
- ITypeInfo namespaceType = (ITypeInfo) fTypeKeyMap.get(new HashKey(namespace, ICElement.C_NAMESPACE));
- if (namespaceType == null)
- namespaceType = (ITypeInfo) fTypeKeyMap.get(new HashKey(namespace, 0));
- return namespaceType;
- }
-
- public synchronized boolean hasEnclosedTypes(final ITypeInfo info) {
- final IQualifiedTypeName parentName = info.getQualifiedTypeName();
- final boolean[] foundTypes = { false };
- accept(new ITypeInfoVisitor() {
- public boolean visit(ITypeInfo type) {
- if (type != info && parentName.isPrefixOf(type.getQualifiedTypeName())) {
- foundTypes[0] = true;
- }
- return true;
- }
- public boolean shouldContinue() {
- return !foundTypes[0];
- }
- });
- return foundTypes[0];
- }
-
- public synchronized ITypeInfo[] getEnclosedTypes(final ITypeInfo enclosedBy, final int kinds[]) {
- final IQualifiedTypeName parentName = enclosedBy.getQualifiedTypeName();
- final Collection results = new ArrayList();
- accept(new ITypeInfoVisitor() {
- public boolean visit(ITypeInfo type) {
- if (ArrayUtil.contains(kinds, type.getCElementType())) {
- IQualifiedTypeName enclosingName = type.getQualifiedTypeName().getEnclosingTypeName();
- if (enclosedBy == fGlobalNamespace) {
- if (enclosingName == null) {
- results.add(type);
- } else {
-// // check if enclosing parent is namespace
-// getRootNamespace(type);
- }
- } else if (parentName.equals(enclosingName)) {
- results.add(type);
- }
- }
- return true;
- }
- public boolean shouldContinue() { return true; }
- });
-
- return (ITypeInfo[]) results.toArray(new ITypeInfo[results.size()]);
- }
-
- public ITypeInfo getGlobalNamespace() {
- return fGlobalNamespace;
- }
-
- public boolean isUpToDate() {
- synchronized(fDeltas) {
- return fDeltas.isEmpty();
- }
- }
-
- public void addDelta(TypeCacheDelta delta) {
- synchronized(fDeltas) {
- fDeltas.add(delta);
- }
- }
-
- public void reconcile(boolean enableIndexing, int priority, int delay) {
- // check if anything needs to be done
- if (deltasRemaining() == 0)
- return; // nothing to do
-
- // cancel any scheduled or running jobs for this project
- IJobManager jobManager = Platform.getJobManager();
- Job[] jobs = jobManager.find(TypeCacherJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- TypeCacherJob deltaJob = (TypeCacherJob) jobs[i];
- if (deltaJob.getCache().equals(this)) {
- deltaJob.cancel();
- }
- }
-
- // check again, in case some jobs finished in the meantime
- if (deltasRemaining() == 0)
- return; // nothing to do
-
- TypeCacherJob deltaJob = null;
- IndexManager indexManager = CModelManager.getDefault().getIndexManager();
- ICDTIndexer indexer = indexManager.getIndexerForProject( fProject );
- boolean haveIndexer = (indexer != null && indexer.isIndexEnabled( fProject ));
- synchronized(fDeltas) {
- if( haveIndexer ){
- // grab all the remaining deltas
- TypeCacheDelta[] jobDeltas = (TypeCacheDelta[]) fDeltas.toArray(new TypeCacheDelta[fDeltas.size()]);
-
- // create a new job
- deltaJob = new TypeCacherJob(this, jobDeltas, enableIndexing);
- // assign deltas to job
- if (jobDeltas != null) {
- for (int i = 0; i < jobDeltas.length; ++i) {
- jobDeltas[i].assignToJob(deltaJob);
- }
- }
- } else {
- //we don't have an indexer, don't create a job to do these deltas, throw them away
- fDeltas.clear();
- }
- }
-
- if( deltaJob != null ){
- // schedule the new job
- deltaJob.addJobChangeListener(fJobChangeListener);
- deltaJob.setPriority(priority);
- deltaJob.schedule(delay);
- }
- }
-
- public void reconcileAndWait(boolean enableIndexing, int priority, IProgressMonitor monitor) {
- reconcile(enableIndexing, priority, 0);
-
- // wait for jobs to complete
- IJobManager jobManager = Platform.getJobManager();
- Job[] jobs = jobManager.find(TypeCacherJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- TypeCacherJob deltaJob = (TypeCacherJob) jobs[i];
- if (deltaJob.getCache().equals(this)) {
- try {
- deltaJob.join(monitor);
- } catch (InterruptedException e) {
- }
- }
- }
- }
-
- // returns the number of deltas either not assigned to a job,
- // or assigned to a job which is not yet running
- private int deltasRemaining() {
- // count the left-over deltas
- synchronized(fDeltas) {
- int count = 0;
- for (Iterator i = fDeltas.iterator(); i.hasNext(); ) {
- TypeCacheDelta delta = (TypeCacheDelta) i.next();
- TypeCacherJob job = delta.getJob();
- if (job == null || !job.isRunning()) {
- ++count;
- }
- }
- return count;
- }
- }
-
- public void cancelJobs() {
- IJobManager jobManager = Platform.getJobManager();
- Job[] jobs = jobManager.find(TypeCacherJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- TypeCacherJob deltaJob = (TypeCacherJob) jobs[i];
- if (deltaJob.getCache().equals(this)) {
- deltaJob.cancel();
- }
- }
- jobs = jobManager.find(TypeLocatorJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- TypeLocatorJob locatorJob = (TypeLocatorJob) jobs[i];
- if (locatorJob.getType().getEnclosingProject().equals(fProject)) {
- locatorJob.cancel();
- }
- }
- jobs = jobManager.find(SubTypeLocatorJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- SubTypeLocatorJob locatorJob = (SubTypeLocatorJob) jobs[i];
- if (locatorJob.getType().getEnclosingProject().equals(fProject)) {
- locatorJob.cancel();
- }
- }
- }
-
- public void locateType(ITypeInfo info, int priority, int delay) {
- ITypeReference location = info.getResolvedReference();
- if (location != null)
- return; // nothing to do
-
- // cancel any scheduled or running jobs for this type
- IJobManager jobManager = Platform.getJobManager();
- Job[] jobs = jobManager.find(TypeLocatorJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- TypeLocatorJob locatorJob = (TypeLocatorJob) jobs[i];
- if (locatorJob.getType().equals(info)) {
- locatorJob.cancel();
- }
- }
-
- // check again, in case some jobs finished in the meantime
- location = info.getResolvedReference();
- if (location != null)
- return; // nothing to do
-
- // create a new job
- TypeLocatorJob locatorJob = new TypeLocatorJob(info, this, fWorkingCopyProvider);
- // schedule the new job
- locatorJob.setPriority(priority);
- locatorJob.schedule(delay);
- }
-
- public ITypeReference locateTypeAndWait(ITypeInfo info, int priority, IProgressMonitor monitor) {
- locateType(info, priority, 0);
-
- // wait for jobs to complete
- IJobManager jobManager = Platform.getJobManager();
- Job[] jobs = jobManager.find(TypeLocatorJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- TypeLocatorJob locatorJob = (TypeLocatorJob) jobs[i];
- if (locatorJob.getType().equals(info)) {
- try {
- locatorJob.join(monitor);
- } catch (InterruptedException e) {
- }
- }
- }
-
- return info.getResolvedReference();
- }
-
- public void locateSupertypes(ITypeInfo info, int priority, int delay) {
- ITypeInfo[] superTypes = getSupertypes(info);
- if (superTypes != null)
- return; // nothing to do
-
- locateType(info, priority, delay);
- }
-
- public ITypeInfo[] locateSupertypesAndWait(ITypeInfo info, int priority, IProgressMonitor monitor) {
- locateSupertypes(info, priority, 0);
-
- // wait for jobs to complete
- IJobManager jobManager = Platform.getJobManager();
- Job[] jobs = jobManager.find(SubTypeLocatorJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- SubTypeLocatorJob locatorJob = (SubTypeLocatorJob) jobs[i];
- if (locatorJob.getType().equals(info)) {
- try {
- locatorJob.join(monitor);
- } catch (InterruptedException e) {
- }
- }
- }
-
- return getSupertypes(info);
- }
-
- public void locateSubtypes(ITypeInfo info, int priority, int delay) {
- ITypeInfo[] subTypes = getSubtypes(info);
- if (subTypes != null)
- return; // nothing to do
-
- // cancel any scheduled or running jobs for this type
- IJobManager jobManager = Platform.getJobManager();
- Job[] jobs = jobManager.find(SubTypeLocatorJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- SubTypeLocatorJob locatorJob = (SubTypeLocatorJob) jobs[i];
- if (locatorJob.getType().equals(info)) {
- locatorJob.cancel();
- }
- }
-
- // check again, in case some jobs finished in the meantime
- subTypes = getSubtypes(info);
- if (subTypes != null)
- return; // nothing to do
-
- // create a new job
- SubTypeLocatorJob locatorJob = new SubTypeLocatorJob(info, this, fWorkingCopyProvider);
- // schedule the new job
- locatorJob.setPriority(priority);
- locatorJob.schedule(delay);
- }
-
- public ITypeInfo[] locateSubtypesAndWait(ITypeInfo info, int priority, IProgressMonitor monitor) {
- locateSubtypes(info, priority, 0);
-
- // wait for jobs to complete
- IJobManager jobManager = Platform.getJobManager();
- Job[] jobs = jobManager.find(SubTypeLocatorJob.FAMILY);
- for (int i = 0; i < jobs.length; ++i) {
- SubTypeLocatorJob locatorJob = (SubTypeLocatorJob) jobs[i];
- if (locatorJob.getType().equals(info)) {
- try {
- locatorJob.join(monitor);
- } catch (InterruptedException e) {
- }
- }
- }
-
- return getSubtypes(info);
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheDelta.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheDelta.java
deleted file mode 100644
index 6b897bdb3e..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheDelta.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.core.browser.TypeSearchScope;
-import org.eclipse.cdt.core.model.ICElementDelta;
-import org.eclipse.core.resources.IProject;
-
-
-public class TypeCacheDelta {
- private IProject fProject = null;
- private ICElementDelta fCElementDelta = null;
- private ITypeSearchScope fScope = null;
- private TypeCacherJob fJob = null;
-
- public TypeCacheDelta(IProject project, ICElementDelta delta) {
- fProject = project;
- fCElementDelta = delta;
- }
-
- public TypeCacheDelta(IProject project, ITypeSearchScope scope) {
- fProject = project;
- fScope = scope;
- }
-
- public TypeCacheDelta(IProject project) {
- fProject = project;
- fScope = new TypeSearchScope();
- fScope.add(project);
- }
-
- public IProject getProject() {
- return fProject;
- }
-
- public ITypeSearchScope getScope() {
- return fScope;
- }
-
- public ICElementDelta getCElementDelta() {
- return fCElementDelta;
- }
-
- public void assignToJob(TypeCacherJob job) {
- fJob = job;
- }
-
- public TypeCacherJob getJob() {
- return fJob;
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheManager.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheManager.java
deleted file mode 100644
index cee4acd132..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheManager.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.browser.IQualifiedTypeName;
-import org.eclipse.cdt.core.browser.ITypeCacheChangedListener;
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.browser.ITypeReference;
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.core.browser.TypeSearchScope;
-import org.eclipse.cdt.core.browser.TypeUtil;
-import org.eclipse.cdt.core.model.ElementChangedEvent;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICElementDelta;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.model.IWorkingCopyProvider;
-import org.eclipse.cdt.internal.core.model.CModelManager;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
-
-public class TypeCacheManager implements ITypeCacheChangedListener, IndexManager.IIndexerSelectionListener {
- private static final TypeCacheManager fgInstance = new TypeCacheManager();
- private Map fCacheMap;
- private IWorkingCopyProvider fWorkingCopyProvider;
- private ArrayList fChangeListeners = new ArrayList();
-
- private static final int INITIAL_TYPE_MAP_SIZE = 50;
- //TODO make this a WeakHashMap or LRUCache
- private Map fTypeToElementMap = new HashMap(INITIAL_TYPE_MAP_SIZE);
- private Map fElementToTypeMap = new HashMap(INITIAL_TYPE_MAP_SIZE);
- private boolean processTypeCacheEvents = true;
-
- private TypeCacheManager() {
- fCacheMap = new HashMap();
- CModelManager.getDefault().getIndexManager().subscribeForIndexerChangeNotifications( this );
- }
-
- public static TypeCacheManager getInstance() {
- return fgInstance;
- }
-
- protected void finalize() throws Throwable {
- CModelManager.getDefault().getIndexManager().unSubscribeForIndexerChangeNotifications( this );
- super.finalize();
- }
-
- public void setWorkingCopyProvider(IWorkingCopyProvider workingCopyProvider) {
- fWorkingCopyProvider = workingCopyProvider;
- }
-
- public synchronized void updateProject(IProject project) {
- // TODO finer-grained flush needed, for now just flush the whole map
- fTypeToElementMap.clear();
- fElementToTypeMap.clear();
- addCacheDelta(project, null);
- }
-
- public synchronized void processElementChanged(ElementChangedEvent event, boolean enableIndexing) {
- int deltaCount = processDelta(event.getDelta());
- if (deltaCount > 0) {
- // TODO finer-grained flush needed, for now just flush the whole map
- fTypeToElementMap.clear();
- fElementToTypeMap.clear();
- reconcile(enableIndexing, Job.BUILD, 0);
- }
- }
-
- private static final int PATH_ENTRY_FLAGS = ICElementDelta.F_ADDED_PATHENTRY_SOURCE
- | ICElementDelta.F_REMOVED_PATHENTRY_SOURCE
- | ICElementDelta.F_CHANGED_PATHENTRY_INCLUDE
- | ICElementDelta.F_CHANGED_PATHENTRY_MACRO
- | ICElementDelta.F_PATHENTRY_REORDER;
-
- private int processDelta(ICElementDelta delta) {
- ICElement elem = delta.getElement();
- boolean added = (delta.getKind() == ICElementDelta.ADDED);
- boolean removed = (delta.getKind() == ICElementDelta.REMOVED);
- boolean contentChanged = ((delta.getFlags() & ICElementDelta.F_CONTENT) != 0);
- boolean pathEntryChanged = ((delta.getFlags() & PATH_ENTRY_FLAGS) != 0);
- boolean openedOrClosed = (((delta.getFlags() & ICElementDelta.F_CLOSED) != 0) || ((delta.getFlags() & ICElementDelta.F_OPENED) != 0));
- boolean hasChildren = ((delta.getFlags() & ICElementDelta.F_CHILDREN) != 0);
- int deltaCount = 0;
-
-
- switch (elem.getElementType()) {
- case ICElement.C_PROJECT:
- case ICElement.C_CCONTAINER: {
- ICProject cProject = elem.getCProject();
- IProject project = cProject.getProject();
- if (added || removed || pathEntryChanged || openedOrClosed) {
- addCacheDelta(project, delta);
- ++deltaCount;
- }
- }
- break;
-
- case ICElement.C_UNIT: {
- ICProject cProject = elem.getCProject();
- IProject project = cProject.getProject();
- ITranslationUnit unit = (ITranslationUnit) elem;
- if (unit.isWorkingCopy()) {
- deltaCount += processWorkingCopyDelta(delta);
- return deltaCount;
- }
- if (added || removed || pathEntryChanged || contentChanged) {
- addCacheDelta(project, delta);
- ++deltaCount;
- }
- }
- break;
-
- case ICElement.C_INCLUDE:
- case ICElement.C_NAMESPACE:
- case ICElement.C_TEMPLATE_CLASS:
- case ICElement.C_CLASS:
- case ICElement.C_STRUCT:
- case ICElement.C_UNION:
- case ICElement.C_ENUMERATION:
- case ICElement.C_TYPEDEF:
- {
- ICProject cProject = elem.getCProject();
- IProject project = cProject.getProject();
- if (added || removed) {
- addCacheDelta(project, delta);
- ++deltaCount;
- }
- }
- break;
- }
-
- if (hasChildren) {
- ICElementDelta[] children = delta.getAffectedChildren();
- if (children != null) {
- for (int i = 0; i < children.length; ++i) {
- deltaCount += processDelta(children[i]);
- }
- }
- }
-
- return deltaCount;
- }
-
- private void addCacheDelta(IProject project, ICElementDelta delta) {
- if (delta == null) {
- getCache(project).addDelta(new TypeCacheDelta(project));
- } else {
- getCache(project).addDelta(new TypeCacheDelta(project, delta));
- }
- }
-
- private int processWorkingCopyDelta(ICElementDelta delta) {
- // ignore workies copies for now
- return 0;
-/* ICElement elem = delta.getElement();
- boolean added = (delta.getKind() == ICElementDelta.ADDED);
- boolean removed = (delta.getKind() == ICElementDelta.REMOVED);
- boolean contentChanged = ((delta.getFlags() & ICElementDelta.F_CONTENT) != 0);
- boolean pathEntryChanged = ((delta.getFlags() & PATH_ENTRY_FLAGS) != 0);
- boolean hasChildren = ((delta.getFlags() & ICElementDelta.F_CHILDREN) != 0);
-
- switch (elem.getElementType()) {
- case ICElement.C_UNIT: {
- ICProject cProject = elem.getCProject();
- IProject project = cProject.getProject();
- if (added || removed || pathEntryChanged || contentChanged) {
- TypeCacheDelta cacheDelta = new TypeCacheDelta(project, delta);
- getCache(project).addDelta(cacheDelta);
- }
- }
- break;
-
- case ICElement.C_INCLUDE:
- case ICElement.C_NAMESPACE:
- case ICElement.C_TEMPLATE_CLASS:
- case ICElement.C_CLASS:
- case ICElement.C_STRUCT:
- case ICElement.C_UNION:
- case ICElement.C_ENUMERATION:
- case ICElement.C_TYPEDEF:
- {
- ICProject cProject = elem.getCProject();
- IProject project = cProject.getProject();
- if (added || removed) {
- TypeCacheDelta cacheDelta = new TypeCacheDelta(project, delta);
- getCache(project).addDelta(cacheDelta);
- }
- }
- break;
- }
-
- if (hasChildren) {
- ICElementDelta[] children = delta.getAffectedChildren();
- if (children != null) {
- for (int i = 0; i < children.length; ++i) {
- processWorkingCopyDelta(children[i]);
- }
- }
- }
-*/
- }
-
- public synchronized ITypeCache getCache(IProject project) {
- synchronized(fCacheMap) {
- ITypeCache cache = (ITypeCache) fCacheMap.get(project);
- if (cache == null) {
- cache = new TypeCache(project, fWorkingCopyProvider, this);
- fCacheMap.put(project, cache);
- }
- return cache;
- }
- }
-
- public synchronized void reconcile(boolean enableIndexing, int priority, int delay) {
- if (!(processTypeCacheEvents))
- return;
-
- TypeSearchScope workspaceScope = new TypeSearchScope(true);
- IProject[] projects = workspaceScope.getEnclosingProjects();
- for (int i = 0; i < projects.length; ++i) {
- ITypeCache cache = getCache(projects[i]);
- cache.reconcile(enableIndexing, priority, delay);
- }
- }
-
- public synchronized void reconcileAndWait(boolean enableIndexing, int priority, IProgressMonitor monitor) {
- if (!(processTypeCacheEvents))
- return;
-
- TypeSearchScope workspaceScope = new TypeSearchScope(true);
- IProject[] projects = workspaceScope.getEnclosingProjects();
- for (int i = 0; i < projects.length; ++i) {
- ITypeCache cache = getCache(projects[i]);
- cache.reconcileAndWait(enableIndexing, priority, monitor);
- }
- }
-
- public void cancelJobs() {
- IJobManager jobManager = Platform.getJobManager();
- jobManager.cancel(TypeCacherJob.FAMILY);
- jobManager.cancel(TypeLocatorJob.FAMILY);
- }
-
- public ITypeInfo[] locateSuperTypesAndWait(ITypeInfo info, boolean enableIndexing, int priority, IProgressMonitor monitor) {
- ITypeInfo[] superTypes = info.getSuperTypes();
- if (superTypes == null) {
- // cancel background jobs
- IProject project = info.getEnclosingProject();
- getCache(project).cancelJobs();
-
- // start the search job
- getCache(project).locateSupertypesAndWait(info, priority, monitor);
-
- superTypes = info.getSuperTypes();
-
- // resume background jobs
- reconcile(enableIndexing, Job.BUILD, 0);
- }
- return superTypes;
- }
-
- public ITypeInfo[] locateSubTypesAndWait(ITypeInfo info, boolean enableIndexing, int priority, IProgressMonitor monitor) {
- ITypeInfo[] subTypes = info.getSubTypes();
- if (subTypes == null) {
- // cancel background jobs
- IProject project = info.getEnclosingProject();
- getCache(project).cancelJobs();
-
- // start the search job
- getCache(project).locateSubtypesAndWait(info, priority, monitor);
-
- subTypes = info.getSubTypes();
-
- // resume background jobs
- reconcile(enableIndexing, Job.BUILD, 0);
- }
- return subTypes;
- }
-
- public void updateCache(ITypeSearchScope scope, IProgressMonitor monitor) {
- // schedule jobs to update cache
- IProject[] projects = scope.getEnclosingProjects();
- monitor.beginTask(TypeCacheMessages.getString("AllTypesCache.updateCache.taskName"), projects.length); //$NON-NLS-1$
- for (int i = 0; i < projects.length; ++i) {
- IProject project = projects[i];
- // wait for any running jobs to finish
- getCache(project).reconcileAndWait(true, Job.SHORT, new SubProgressMonitor(monitor, 1));
- }
- monitor.done();
- }
-
- /**
- * Resolves a type location.
- *
- * @param info the type to search for
- * @param monitor the progress monitor
- */
- public ITypeReference resolveTypeLocation(ITypeInfo info, IProgressMonitor monitor, boolean enableIndexing) {
- ITypeReference location = info.getResolvedReference();
- if (location == null) {
- // cancel background jobs
- IProject project = info.getEnclosingProject();
- ITypeCache cache = getCache(project);
- cache.cancelJobs();
-
- // start the search job
- cache.locateTypeAndWait(info, Job.SHORT, monitor);
-
- // get the newly parsed location
- location = info.getResolvedReference();
-
- // resume background jobs
- reconcile(enableIndexing, Job.BUILD, 0);
- }
- return location;
- }
-
- public void addTypeCacheChangedListener(ITypeCacheChangedListener listener) {
- // add listener only if it is not already present
- synchronized(fChangeListeners) {
- if (!fChangeListeners.contains(listener)) {
- fChangeListeners.add(listener);
- }
- }
- }
-
- public void removeTypeCacheChangedListener(ITypeCacheChangedListener listener) {
- synchronized(fChangeListeners) {
- fChangeListeners.remove(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.browser.ITypeCacheChangedListener#typeCacheChanged(org.eclipse.core.resources.IProject)
- */
- public synchronized void typeCacheChanged(final IProject project) {
- // clone so that a listener cannot have a side-effect on this list when being notified
- ArrayList listeners;
- synchronized(fChangeListeners) {
- listeners = (ArrayList) fChangeListeners.clone();
- }
- for (Iterator i = listeners.iterator(); i.hasNext(); ) {
- final ITypeCacheChangedListener listener = (ITypeCacheChangedListener) i.next();
- Platform.run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.ERROR, "Exception occurred in listener of type cache change notification", e); //$NON-NLS-1$
- CCorePlugin.log(status);
- }
- public void run() throws Exception {
- listener.typeCacheChanged(project);
- }
- });
- }
- }
-
- public ITypeInfo getTypeForElement(ICElement element, boolean forceUpdate, boolean forceResolve, boolean enableIndexing, IProgressMonitor monitor) {
- if (element.exists()) {
- ITypeInfo cachedInfo = (ITypeInfo) fElementToTypeMap.get(element);
- if (cachedInfo != null && cachedInfo.exists())
- return cachedInfo;
- }
-
- IQualifiedTypeName qualifiedName = TypeUtil.getFullyQualifiedName(element);
- if (qualifiedName != null) {
- ICProject cProject = element.getCProject();
- IProject project = cProject.getProject();
- ITypeCache cache = getCache(project);
- if (!cache.isUpToDate() && forceUpdate) {
- if (monitor == null)
- monitor = new NullProgressMonitor();
- // wait for any running jobs to finish
- cache.reconcileAndWait(true, Job.SHORT, monitor);
- }
-
- ITypeInfo info = cache.getType(element.getElementType(), qualifiedName);
- if (info != null) {
- ITypeReference ref = info.getResolvedReference();
- if (ref == null && forceResolve) {
- if (monitor == null)
- monitor = new NullProgressMonitor();
- ref = resolveTypeLocation(info, monitor, enableIndexing);
- }
-
- // cache for later use
- fElementToTypeMap.put(element, info);
- return info;
- }
- }
- return null;
- }
-
- public ICElement getElementForType(ITypeInfo type, boolean forceUpdate, boolean forceResolve, boolean enableIndexing, IProgressMonitor monitor) {
- if (type.exists()) {
- ICElement cachedElem = (ICElement) fTypeToElementMap.get(type);
- if (cachedElem != null && cachedElem.exists())
- return cachedElem;
- }
-
- IProject project = type.getEnclosingProject();
- ITypeCache cache = getCache(project);
- if (!cache.isUpToDate() && forceUpdate) {
- if (monitor == null)
- monitor = new NullProgressMonitor();
- // wait for any running jobs to finish
- cache.reconcileAndWait(true, Job.SHORT, monitor);
-
- //TODO replace type with new type from cache???
- }
-
- ITypeReference ref = type.getResolvedReference();
- if (ref == null && forceResolve) {
- ref = resolveTypeLocation(type, monitor, enableIndexing);
- }
- if (ref != null) {
- ICElement[] elems = ref.getCElements();
- if (elems != null && elems.length > 0) {
- ICElement foundElem = elems[0];
- if (elems.length > 1) {
- for (int i = 0; i < elems.length; ++i) {
- ICElement elem = elems[i];
- if (elem.getElementType() == type.getCElementType() && elem.getElementName().equals(type.getName())) {
- //TODO should check fully qualified name
- foundElem = elem;
- break;
- }
- }
- }
-
- if (foundElem != null) {
- // cache for later use
- fTypeToElementMap.put(type, foundElem);
- return foundElem;
- }
- }
- }
- return null;
- }
- public boolean getProcessTypeCacheEvents() {
- return processTypeCacheEvents;
- }
- public void setProcessTypeCacheEvents(boolean processTypeCacheEvents) {
- this.processTypeCacheEvents = processTypeCacheEvents;
- }
-
- public void indexerSelectionChanged(IProject project) {
- addCacheDelta(project, null );
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheMessages.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheMessages.java
deleted file mode 100644
index 30e20e6257..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheMessages.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class TypeCacheMessages {
-
- private static final String RESOURCE_BUNDLE= TypeCacheMessages.class.getName();
-
- private static ResourceBundle fgResourceBundle;
- static {
- try {
- fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
- } catch (MissingResourceException x) {
- fgResourceBundle = null;
- }
- }
-
- private TypeCacheMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- } catch (NullPointerException e) {
- return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- public static String getFormattedString(String key, String arg) {
- return getFormattedString(key, new String[] { arg });
- }
-
- public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getString(key), args);
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheMessages.properties b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheMessages.properties
deleted file mode 100644
index c4d26740d2..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacheMessages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 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
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# QNX Software Systems - Initial API and implementation
-###############################################################################
-
-AllTypesCache.updateCache.taskName=Updating Type Cache...
-
-TypeCacherJob.defaultJobName=Type Cache
-TypeCacherJob.jobName=Type Cache [{0}]
-TypeCacherJob.taskName=Updating Type Cache...
-
-TypeLocatorJob.jobName=Type Locator
-TypeLocatorJob.taskName=Searching for Type Declaration...
-SubTypeLocatorJob.jobName=Subtype Locator
-SubTypeLocatorJob.taskName=Searching for Subtypes...
-
-TypeCache.globalNamespace=(global)
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java
deleted file mode 100644
index 3cb779f2e1..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeCacherJob.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.core.browser.TypeSearchScope;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICElementDelta;
-import org.eclipse.cdt.core.search.ICSearchConstants;
-import org.eclipse.cdt.internal.core.index.IIndex;
-import org.eclipse.cdt.internal.core.model.CModelManager;
-import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-
-/**
- * Background job for filling the type cache.
- * @see org.eclipse.core.runtime.jobs.Job
- * @since 3.0
- */
-public class TypeCacherJob extends BasicJob {
-
- public static final Object FAMILY = new Object();
- private IndexManager fIndexManager;
- private ITypeCache fTypeCache;
- private TypeCacheDelta[] fDeltas;
- private boolean fEnableIndexing;
- private boolean fIndexerIsBusy;
-
- public TypeCacherJob(ITypeCache typeCache, TypeCacheDelta[] deltas, boolean enableIndexing) {
- super(TypeCacheMessages.getString("TypeCacherJob.defaultJobName"), FAMILY); //$NON-NLS-1$
- fTypeCache = typeCache;
- fDeltas = deltas;
- fEnableIndexing = enableIndexing;
- fIndexerIsBusy = false;
- fIndexManager = CModelManager.getDefault().getIndexManager();
- setPriority(BUILD);
- setSystem(true);
- setRule(typeCache);
- setName(TypeCacheMessages.getFormattedString("TypeCacherJob.jobName", fTypeCache.getProject().getName())); //$NON-NLS-1$
- }
-
- public ITypeCache getCache() {
- return fTypeCache;
- }
-
- public TypeCacheDelta[] getDeltas() {
- return fDeltas;
- }
-
- public boolean isIndexerBusy() {
- return fIndexerIsBusy;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(IProgressMonitor)
- */
- protected IStatus runWithDelegatedProgress(IProgressMonitor monitor) throws InterruptedException {
- boolean success = false;
- long startTime = System.currentTimeMillis();
- trace("TypeCacherJob: started"); //$NON-NLS-1$
-
- try {
- int totalWork = 100;
- monitor.beginTask(TypeCacheMessages.getString("TypeCacherJob.taskName"), totalWork); //$NON-NLS-1$
-
- // figure out what needs to be flushed
- TypeSearchScope flushScope = new TypeSearchScope();
- if (fDeltas != null) {
- for (int i = 0; i < fDeltas.length; ++i) {
- TypeCacheDelta delta = fDeltas[i];
- prepareToFlush(delta, flushScope);
- }
- }
-
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- // flush the cache
- int flushWork = 0;
- if (!flushScope.isEmpty()) {
- flushWork = totalWork / 4;
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, flushWork);
- flush(flushScope, subMonitor);
- }
-
- // update the cache
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, totalWork - flushWork);
- update(flushScope, subMonitor);
-
- if (monitor.isCanceled())
- throw new InterruptedException();
- } finally {
- long executionTime = System.currentTimeMillis() - startTime;
- if (success)
- trace("TypeCacherJob: completed ("+ executionTime + " ms)"); //$NON-NLS-1$ //$NON-NLS-2$
- else
- trace("TypeCacherJob: aborted ("+ executionTime + " ms)"); //$NON-NLS-1$ //$NON-NLS-2$
-
- monitor.done();
- }
-
- return Status.OK_STATUS;
- }
-
- private void flush(ITypeSearchScope scope, IProgressMonitor monitor) throws InterruptedException {
- // flush the cache
- boolean success = true;
- IProject project = fTypeCache.getProject();
-
- monitor.beginTask("", 100); //$NON-NLS-1$
-
- fTypeCache.flush(scope);
- if (!scope.encloses(project)) {
- if (project.exists() && project.isOpen()) {
- success = doIndexerJob(new IndexerDependenciesJob(fIndexManager, fTypeCache, scope), monitor);
- }
- }
-
- if (!success || monitor.isCanceled()) {
- throw new InterruptedException();
- }
-
- monitor.done();
- }
-
- private void update(ITypeSearchScope scope, IProgressMonitor monitor) throws InterruptedException {
- boolean success = true;
- IProject project = fTypeCache.getProject();
-
- monitor.beginTask("", 100); //$NON-NLS-1$
- if (project.exists() && project.isOpen()) {
- success = doIndexerJob(new IndexerTypesJob2(fIndexManager, fTypeCache, scope), monitor);
- }
-
- if (!success || monitor.isCanceled()) {
- throw new InterruptedException();
- }
-
- monitor.done();
- }
-
- private boolean doIndexerJob(IndexerJob job, IProgressMonitor monitor) {
- if (!fEnableIndexing) {
- return false;
- }
-
- // check if indexer is busy
- fIndexerIsBusy = false;
- try {
- fIndexManager.performConcurrentJob(new DummyIndexerJob(fIndexManager, fTypeCache.getProject()),
- ICSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH, new NullProgressMonitor(), null);
- } catch (OperationCanceledException e) {
- fIndexerIsBusy = true;
- }
-
- // do an immediate (but possibly incomplete) search
- // if fIndexerIsBusy the cache will stay dirty and we'll hit the indexer again next time
- return fIndexManager.performConcurrentJob(job,
- ICSearchConstants.FORCE_IMMEDIATE_SEARCH, monitor, null);
- }
-
- private boolean doIndexerJob(IndexerJob2 job, IProgressMonitor monitor) {
- if (!fEnableIndexing) {
- return false;
- }
-
- // check if indexer is busy
- fIndexerIsBusy = false;
- try {
- fIndexManager.performConcurrentJob(new DummyIndexerJob(fIndexManager, fTypeCache.getProject()),
- ICSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH, new NullProgressMonitor(), null);
- } catch (OperationCanceledException e) {
- fIndexerIsBusy = true;
- }
-
- // do an immediate (but possibly incomplete) search
- // if fIndexerIsBusy the cache will stay dirty and we'll hit the indexer again next time
- return fIndexManager.performConcurrentJob(job,
- ICSearchConstants.FORCE_IMMEDIATE_SEARCH, monitor, null);
- }
-
-
- private static final int PATH_ENTRY_FLAGS = ICElementDelta.F_ADDED_PATHENTRY_SOURCE
- | ICElementDelta.F_REMOVED_PATHENTRY_SOURCE
- | ICElementDelta.F_CHANGED_PATHENTRY_INCLUDE
- | ICElementDelta.F_CHANGED_PATHENTRY_MACRO
- | ICElementDelta.F_PATHENTRY_REORDER;
-
- private void prepareToFlush(TypeCacheDelta cacheDelta, ITypeSearchScope scope) {
- ITypeSearchScope deltaScope = cacheDelta.getScope();
- if (deltaScope != null)
- scope.add(deltaScope);
-
- ICElementDelta delta = cacheDelta.getCElementDelta();
- if (delta != null) {
- ICElement elem = delta.getElement();
- boolean added = (delta.getKind() == ICElementDelta.ADDED);
- boolean removed = (delta.getKind() == ICElementDelta.REMOVED);
- boolean contentChanged = ((delta.getFlags() & ICElementDelta.F_CONTENT) != 0);
- boolean pathEntryChanged = ((delta.getFlags() & PATH_ENTRY_FLAGS) != 0);
-
- switch (elem.getElementType()) {
- case ICElement.C_MODEL: {
- if (added || removed) {
- scope.add(elem);
- }
- }
- break;
-
- case ICElement.C_PROJECT: {
- if (added || removed || pathEntryChanged) {
- scope.add(elem);
- }
- }
- break;
-
- case ICElement.C_CCONTAINER: {
- if (added || removed || pathEntryChanged) {
- scope.add(elem);
- }
- }
- break;
-
- case ICElement.C_UNIT: {
- if (added || removed || pathEntryChanged || contentChanged) {
- scope.add(elem);
- }
- }
- break;
-
- case ICElement.C_INCLUDE:
- case ICElement.C_NAMESPACE:
- case ICElement.C_TEMPLATE_CLASS:
- case ICElement.C_CLASS:
- case ICElement.C_STRUCT:
- case ICElement.C_UNION:
- case ICElement.C_ENUMERATION:
- case ICElement.C_TYPEDEF:
- {
- //TODO handle working copies
- if (added || removed) {
- scope.add(elem);
- }
- }
- break;
- }
- }
- }
-
- private static final class DummyIndexerJob extends IndexerJob {
- public DummyIndexerJob(IndexManager indexManager, IProject project) {
- super(indexManager, project);
- }
- protected boolean processIndex(IIndex index, IProject project, IProgressMonitor progressMonitor) {
- return false;
- }
- }
-
-}
-
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeLocatorJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeLocatorJob.java
deleted file mode 100644
index 6e07320b32..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeLocatorJob.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.model.IWorkingCopyProvider;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-public class TypeLocatorJob extends BasicJob {
-
- public static final Object FAMILY = new Object();
- private ITypeInfo fLocateType;
- private ITypeCache fTypeCache;
- private IWorkingCopyProvider fWorkingCopyProvider;
-
- public TypeLocatorJob(ITypeInfo info, ITypeCache typeCache, IWorkingCopyProvider workingCopyProvider) {
- super(TypeCacheMessages.getString("TypeLocatorJob.jobName"), FAMILY); //$NON-NLS-1$
- fLocateType = info;
- fTypeCache = typeCache;
- fWorkingCopyProvider= workingCopyProvider;
- }
-
- public ITypeInfo getType() {
- return fLocateType;
- }
-
- protected IStatus runWithDelegatedProgress(IProgressMonitor monitor) throws InterruptedException {
- boolean success = false;
- long startTime = System.currentTimeMillis();
- trace("TypeLocatorJob: started"); //$NON-NLS-1$
-
- try {
- monitor.beginTask(TypeCacheMessages.getString("TypeLocatorJob.taskName"), 100); //$NON-NLS-1$
-
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- TypeParser parser = new TypeParser(fTypeCache, fWorkingCopyProvider);
- success = parser.findType(fLocateType, new SubProgressMonitor(monitor, 100));
-
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- } finally {
- long executionTime = System.currentTimeMillis() - startTime;
- if (success)
- trace("TypeLocatorJob: completed ("+ executionTime + " ms)"); //$NON-NLS-1$ //$NON-NLS-2$
- else
- trace("TypeLocatorJob: aborted ("+ executionTime + " ms)"); //$NON-NLS-1$ //$NON-NLS-2$
-
- monitor.done();
- }
-
- return Status.OK_STATUS;
- }
-}
diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeParser.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeParser.java
deleted file mode 100644
index dc5aa9e65c..0000000000
--- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeParser.java
+++ /dev/null
@@ -1,955 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial implementation
- * QNX Software Systems - adapted for type search
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.browser.cache;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.browser.ITypeInfo;
-import org.eclipse.cdt.core.browser.ITypeReference;
-import org.eclipse.cdt.core.browser.ITypeSearchScope;
-import org.eclipse.cdt.core.browser.QualifiedTypeName;
-import org.eclipse.cdt.core.browser.TypeInfo;
-import org.eclipse.cdt.core.browser.TypeReference;
-import org.eclipse.cdt.core.browser.TypeSearchScope;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.cdt.core.model.IWorkingCopyProvider;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.DefaultProblemHandler;
-import org.eclipse.cdt.core.parser.IParser;
-import org.eclipse.cdt.core.parser.IProblem;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.IScannerInfo;
-import org.eclipse.cdt.core.parser.IScannerInfoProvider;
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ParseError;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserFactoryError;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ParserTimeOut;
-import org.eclipse.cdt.core.parser.ParserUtil;
-import org.eclipse.cdt.core.parser.ScannerInfo;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;