From 8a70b5e1d2ed9eda5f11e0dc0ac65656f1a4388e Mon Sep 17 00:00:00 2001 From: John Camelon Date: Fri, 4 Jul 2003 17:15:44 +0000 Subject: [PATCH] Patch for Andrew Niefer. cdt.core: - Modified ICSearchConstants to use classes (SearchFor & LimitTo) instead of int for constants - Modified MatchLocator to actually invoke the parser to do the search cdt.core.tests: - Added new source Folder search - Added search/ClassDeclarationPatternTests::testMatchSimpleDeclaration - Added search/ClassDeclarationPatternTests::testMatchNamespaceNestedDeclaration - Added new resource folder search & containing file classDecl.cpp - Added new failures package ord.eclipse.cdt.core.search.failedTests - Added new failing test PatternsFailedTests::testBug39652 * Note that both the ClassDeclarationPatternTests and PatternsFailedTests must be run as Plugin Tests * cdt.ui: - Updated Search classes to reflect changes to ICSearchConstants. --- core/org.eclipse.cdt.core.tests/.classpath | 1 + core/org.eclipse.cdt.core.tests/ChangeLog | 1254 +++++++++-------- .../failedTests/PatternsFailedTests.java | 77 + .../resources/search/classDecl.cpp | 13 + .../tests/ClassDeclarationPatternTests.java | 119 ++ .../core/suite/AutomatedIntegrationSuite.java | 27 +- core/org.eclipse.cdt.core/search/ChangeLog | 5 + .../cdt/core/search/ICSearchConstants.java | 46 +- .../core/search/ICSearchResultCollector.java | 13 + .../eclipse/cdt/core/search/SearchEngine.java | 6 +- .../core/search/matching/CSearchPattern.java | 45 +- .../matching/ClassDeclarationPattern.java | 24 +- .../core/search/matching/MatchLocator.java | 146 +- .../ui/search/CSearchMessages.properties | 4 +- .../internal/ui/search/CSearchOperation.java | 39 +- .../cdt/internal/ui/search/CSearchPage.java | 127 +- .../ui/search/CSearchResultCollector.java | 39 +- 17 files changed, 1204 insertions(+), 781 deletions(-) create mode 100644 core/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/search/failedTests/PatternsFailedTests.java create mode 100644 core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp create mode 100644 core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java diff --git a/core/org.eclipse.cdt.core.tests/.classpath b/core/org.eclipse.cdt.core.tests/.classpath index 744c6f2097b..f02faaec060 100644 --- a/core/org.eclipse.cdt.core.tests/.classpath +++ b/core/org.eclipse.cdt.core.tests/.classpath @@ -21,5 +21,6 @@ + diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index b4220331c66..e0174c6a114 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -1,622 +1,632 @@ -2003-07-03 Bogdan Gheorghe - Added IndexManagerTest::testAddNewFileToIndex() - Added IndexManagerTest::testRemoveProjectFromIndex() - Added IndexManagerTest::testRemoveFileFromIndex() - -2003-07-02 Victor Mozgin - Added DOMTests::testBug39501(). - Improved filtering of expected failures/inconclusives in TortureTest. - -2003-06-30 John Camelon - Added DOMTests::testAssignmentExpression() - Added PreprocessorConditionalTest to ParserTestSuite. - -2003-06-28 John Camelon - Completed Quickparse expression representation. - Updated ExpressionEvaluation and associated tests. - -2003-06-26 John Camelon - Update IASTExpression. - Move Parser.Backtrack and Parser.EndOfFile to external interface. - -2003-06-25 John Camelon - Added DOMFailedTest::testBug39349(). - Added DOMTests::testBug39348(). - -2003-06-25 John Camelon - Create new interface and support for calculating lineNumber/offset mapping. - Updated IASTClassSpecifier for qualified name query. - Began structuring expressions and declarators in Parser for ISourceElementRequestor. - Updated other packages to use new interfaces. - Updated automatedtests/torture test to use new line number information. - -2003-06-24 John Camelon - Updates for ISourceElementRequestor - elaborated types & enumerations. - -2003-06-23 John Camelon - Factory/constructor signature updates. - -2003-06-17 Victor Mozgin - Added MacroTests.java (invocation in AllCoreTests). - Added MacroTests.c to resources. - -2003-06-17 Sean Evoy - Moved the ManagedBuildInfo extension point from the plugin file in org.eclipse.cdt.ui.tests - Added new options to sub target for include paths and preprocessor symbols - Added test for IManagedBuildPathInfo - * build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java - -2003-06-17 Brent Nicolle - Added Interface tests of IStructure.java. - -2003-06-17 Victor Mozgin - Added DeclaratorsTests.java (invocation in AllCoreTests). - Added DeclaratorsTests.cpp to org.eclipse.cdt.core.model.tests.resources. - -2003-06-16 Victor Mozgin - Added testOldKRFunctionDeclarations() to DOMTests. - Added testKRFunctionDeclarations() to TranslationUnitTests. - -2003-06-16 Vladimir Hirsl - Added /build, /parser, /failures and /suite directories to the library. - Copied resources from /model/org.eclipse.cdt.core.model.tests.resources - to /model/org/clipse/cdt/core/model/tests/resources/cmodel. - Added class AISResultPrinter to format test results. - Class AutomatedIntegrationSuite now implements IPlatformRunnable. - -2003-06-14 Victor Mozgin - Moved testBugSingleton192() from LokiFailures to DOMTests. - Added testPointersToMembers() and testPointersToMemberFunctions() to DOMTests. - Added testBug36290() and testBug36931() to DOMTests. - -2003-06-13 John Camelon - Added Class/Base infrastructure to public interfaces & requestor callback. - Moved many internal interfaces to external packages. - Organized imports. - -2003-06-13 Victor Mozgin - Renamed NullParserCallback into NullSourceElementRequester in AutomatedFramework. - -2003-06-13 John Camelon - Merged ParserSymbolTable branch back into HEAD. - -2003-06-12 John Camelon - Get rest of JUnit tests working, will merge back to HEAD branch. - -2003-06-12 John Camelon - Introduction of ASTFactory strategy, some restructuring of packages and interfaces. - -2003-06-11 Victor Mozgin - Old Java TestCase.txt and TestCase2.txt for partioning testing have been replaced with C/C++ files. - Modified AutomatedIntegrationSuite.java so it doesn't produce JUnit warning anymore. - All tests in org.eclipse.cdt.ui.tests should pass now. - -3003-06-11 Peter Graves - Update the test.xml to get the location of org.eclipse.test from a property - if set. If the property is not set, it will default to the old value. - -2003-06-11 Victor Mozgin - Added TortureTest to test CDT C++ parser with GCC testsuites. - GCC testsuites are not included. - -2003-06-10 John Camelon - Futher pursuit of the golden hammer, symbol table integration. - -2003-06-10 Brent Nicolle - Added some Interface tests of (IInclude, IMacro, IStructure). - Made sure all the Test Suites have names in the JUnit hierarchy. - -2003-06-09 John Camelon - First step in replacing IParserCallback with ISourceElementRequestor. - -2003-06-09 Victor Mozgin - Moved testBug36769() from ACEFailedTest.java to DOMTests.java. - Removed ACEFailedTest.java as it is empty now. - Added DOMTests.testBug36769B(). - -2003-06-09 Victor Mozgin - Moved testBug36932() from DOMFailedTest.java to DOMTests.java. - Added DOMTests.testBug36932B() and DOMTests.testBug36932C(). - -2003-06-09 Victor Mozgin - Moved testBug36701() from ScannerFailedTests.java to ScannerTestCase.java. - Renamed it to testBug36701A() and fixed it. - Added ScannerTestCase.testBug36701B(). - -2003-06-07 Victor Mozgin - Moved testBug36766A(), testBug36766B() & testBug36766C() from STLFailedTests.java to DOMTests.java. - Renamed them to testBug36766and36769x(), as they cover both PRs. - Added testBug36766and36769D() - test for templated destructor. - -2003-06-05 John Camelon - Moved testBug23478A() & testBug23478B() from failed tests to TranslationUnitTests.java. - Removed TranslationUnitFailedTests.java as it was empty. - -2003-05-29 Andrew Niefer - Modified tests to support eType & PtrOp changes in core - Added ParserSymbolTableTest::testTemplateParameterAsParent - Added ParserSymbolTableTest::testTemplateInstanceAsParent - Added ParserSymbolTableTest::testTemplateParameterDefaults - Added ParserSymbolTableTest::testTemplateParameterAsFunctionArgument - started ParserSymbolTableTest::incompletetestTemplateSpecialization - -2003-05-26 John Camelon - Rollback PST/Parser integration. - -2003-05-13 Andrew Niefer - Modified ParserSymbolTableTest to use new interface - -2003-05-08 Andrew Niefer - Added ParserSymbolTableTest::testMarkRollback - -2003-05-06 John Camelon - Further integration of SymbolTable into Parser, some refactoring. - -2003-05-05 John Camelon/Andrew Niefer - Added CrossReferenceTests to ParserTestSuite to test symbol-table/DOM interworking. - -2003-05-05 Andrew Niefer - Rewrote ParserSymbolTableTest to reflect structural changes to the symbol table. - -2003-05-01 Andrew Niefer - Updated FractionalAutomatedTest to use threads - Modified ScannerTestCase::testBug36287 - Added ScannerTestCase::testBug37011 - Added ScannerTestCase::testOtherPreprocessorDefines - -2003-04-28 John Camelon - Moved testBug36730() & testBug37019() from DOMFailedTests to DOMTests. - -2003-04-28 Andrew Niefer - Added DOMFailedTest::testBug37019 - Added DOMFailedTest::testBug36932 - Added ScannerFailedTest::testBug37011 - -2003-04-28 John Camelon - Added DOMTests::testOrder(). - -2003-04-28 Peter Graves - * model/org/eclipse/cdt/core/model/tests/BinaryTests: - Updated to remove a few small errors, and deal with some changes - to the core CDT - -2003-04-27 John Camelon - Added testBug36932() to DOMTests. - Moved testBugFunctor758() from LokiFailures to DOMTests. - Moved testBug36704() from DOMFailedTest to DOMTests. - Moved testBug36699() from DOMFailedTest to DOMTests. - Moved testBug36691() from DOMFailedTest to DOMTests. - -2003-04-25 Andrew Niefer - Moved ACEFailedTest::testBug36771 to DOMTests - Moved DOMFailedTest::testBug36714 to DOMTests - Updated ScannerTestCase::testBug36816 - -2003-04-25 John Camelon - Added DOMTests::testBug36852(). - Added DOMTests::testBug36764(). - Moved DOMFailedTests::testBug36702() to DOMTests(). - -2003-04-24 John Camelon - Moved fixed tests from FailedTests to DOMTests. - Added DOMTests::testBug36799(). - Cleaned up tests to reduce amount of code necessary to maintain these things. - -2003-04-24 John Camelon - Moved fixed tests from FailedTests to DOMTests. - Added LokiFailures.java to failed tests directory. - -2003-04-24 Andrew Niefer - Added AutomatedFramework.java - Added FractionalAutomatedTest (which derives from AutomatedFramework) - Refactored AutomatedTest to derive from AutomatdFramework - Added ScannerTestCase.testBug36816 - Added ScannerTestCase.testBug36255 - -2003-04-24 John Camelon - Fixed Java 1.3 compliance issue w/AutomatedTest.java - Fixed False failure in HelloWorld.java. - -2003-04-21 John Camelon - Updated DOMTests::testBug36247(). - Moved testBug36692(), testBug36703(), testBug36708(), testBug36707(), testBug36689() - and testBug36690() from DOMFailedTests to DOMTests and updated them. - -2003-04-20 John Camelon - Added DOMTests::testBug36551(). - Adjusted AutomatedTest to turn on line numbering. - Added DOMFailedTests and 11 failed test cases. - -2003-04-17 Andrew Niefer - Added ScannerTestCase::testBug36695() - Moved ScannerFailedTest::testBug36521 to ScannerTestCase::testBug36521() - Moved ScannerFailedTest::testBug36509 to ScannerTestCase::testBug36509() - Moved ScannerFailedTest::testBug36475 to ScannerTestCase::testBug36475() - Updated ScannerTestCase::testBug36047 - Updated ScannerTestCase::testBug36045 - -2003-04-17 John Camelon - Updated DOMTests::testBug36600(). - Updated LineNumberTest::testDOMLineNos(). - Added DOMTests::testBug36559(). - -2003-04-17 Andrew Niefer - Added AutomatedTest - Added resources.cFiles - Added resources.cppFiles - -2003-04-16 John Camelon - Added DOMTests::testBug36532(). - Added DOMTests::testBug36432(). - Added DOMTests::testBug36594(). - Added DOMTests::testBug36600(). - Added DOMTests::testArrayOfPointerToFunctions(). - -2003-04-15 John Camelon - Added ScannerTestCase::testBug36434(). - Added ScannerTestCase::testMultipleLines(). - Added ParserTestSuite. - Added LineNumberTest. - Updated CModelElementsTests to set the Nature of the C++ project appropriately. - -2003-04-15 Andrew Niefer - Moved ScannerFailedTest::testBug36047 to ScannerTestCase::testBug36047 - Added ScannerFailedTest::testBug36475 - -2003-04-13 John Camelon - Added DOMTests::testPointersToFunctions. - -2003-04-11 John Camelon - Added DOMTests::testBug36247(). - -2003-04-11 Andrew Niefer - Moved ScannerFailedTest::testBug36316 to ScannerTestCase::testBug36316 - Added ScannerFailedTest::testBug36047 - Added ScannerTestCase::testNestedRecursiveDefines - -2003-04-10 John Camelon - Added DOMTests::testBug36237(). - -2003-04-09 John Camelon - Removed all the old Code Model Builder source that was no longer being used (NewModelBuilder.java, etc.). - Moved all the files in parser.util directory to the dom. - Organized imports. - Added DOMTests::testTemplateDeclarationOfMethod(). - Added DOMTests::testBug36250(). - Added DOMTests::testBug36240(). - Added DOMTests::testBug36254(). - -2003-04-09 John Camelon - Updated ScannerTest::testBug36045(). - Added ScannerTest::testBug36287(). - Added DOMTests::testBug36288(). - -2003-04-06 Andrew Niefer - Added ParserSymbolTableTest::testOverloadRanking() - -2003-04-04 Alain Magloire - * src/org/eclipse/cdt/testplugin/util/VerifyDialog.java: - Remove some warnings. - -2003-04-03 John Camelon - Updated ScannerTest::testSimpleIfdef() for bug36019. - Updated ScannerTest::testNumerics() for bug36020. - Added ScannerTest::testBug36045(). - Updated DOMTests::testTemplateDeclaration() for template grammar updates. - -2003-04-01 Andrew Niefer - ParserSymbolTableTest. modifications to using declaration tests to reflect changes in the - symbol table. Also added testUserDefinedConversionSequences() - -2003-04-01 John Camelon - Added testBug35906() to DOMTests. - -2003-03-31 John Camelon - Added testStruct() to DOMTests. - Added test35892()to ScannerTest. - -2003-03-31 Andrew Niefer - In ParserSymbolTableTest, renamed testFunctionResolution_2() to testFunctionResolution_PointersAndBaseClasses(), - and modified to reflect changes in function resolution. - Added testFunctionResolution_TypedefsAndPointers(). - -2003-03-31 John Camelon - Added testWeirdStrings() and testNumerics() to ScannerTestCase. - Added testTemplateSpecialization(), testTemplateDeclaration(), testBug26467(), - testTypedef() and testTemplateInstantiation() to DOMTests. - -2003-03-28 John Camelon - Added testConstructorChain() and testASMDefinition() to DOMTests. - -2003-03-27 Alain Magloire - Changes were done in the Core Model API, the hierarchy is now - ICModel - ICProject - ICContainer - ITranslationUnit - IArchive - IBinary - We adjust the tests. - * model/org/eclipse/cdt/core/model/tests/ArchiveTests.java - * model/org/eclipse/cdt/core/model/tests/BinaryTests.java - * model/org/eclipse/cdt/core/model/tests/TranslationUniTests.java - * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java - -2003-03-26 Andrew Niefer - In ParserSymbolTableTest : - updated all tests to reflect TypeInfo changes - Added testFunctionResolution() & testFunctionResolution_2() in - -2003-03-25 John Camelon - Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(), - testUsingClauses() and testEnumSpecifier() to DOMTests. - -2003-03-23 John Camelon - Added ptrOperator() test to DOMTests. - Added testFunctionModifiers() test to DOMTests. - Added testArrays() test to DOMTests. - -2003-03-20 Alain Magloire - - Patch from Amer Hoda, tests for the CElement deltas for Translation Units. - * model/org/eclipse/cdt/core/model/tests/ElementDeltaTest.java - * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h - -2003-03-19 Alain Magloire - Patch from Amer Hoda, introducing a simple test for the core model. - * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java - * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h - -2003-03-18 John Camelon - Updated DOMTests to validate simple case of a function declaration with multiple parameters. - * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java - -2003-03-11 John Camelon - Updated DOMTests for core.internal.parser change of merging DeclarationSpecifier and DeclSpecifier - Organized imports - * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java - * parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java - -2003-03-10 John Camelon - Added macro pasting tests - -2003-03-06 Andrew Niefer - Added tests for exercising Namespaces & using directives in new parser's symbol table - -2003-03-04 Doug Schaefer - This is a pretty big patch, but it is the merge of the NewParser1 branch into the HEAD branch. lder "parser") - JUnit tests for testing various pieces (source folder "parser" in cdt.ui.tests. - -2003-01-29 Peter Graves - - Fixed the warnings when accessing static methods - * src/org/eclipse/cdt/testplugin/util/DialogCheck.java: - * src/org/eclipse/cdt/testplugin/CTestPlugin.java - * src/org/eclipse/cdt/testplugin/TestWorkbench.java - * ChangeLog: make all entries have the same formatting - -2002-12-17 Peter Graves - - * plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and - to move closer to automated running - -2002-11-27 Alain Magloire - - * model/org/eclipse/cdt/core/model/tests/CModelTests.java: - Use CoreModel.getDefault(). - -2002-10-30 Alain Magloire - - * model/org/eclipse/cdt/core/model/tests/CModelTests.java (testGetNatureID): - The fields and the methods use in this test was removed from the CoreModel class. - (testHasNature): The method use in this case was refactor in the classes - CProjectNature and CCProjectNature, fix the test. - -2002-10-18 Peter Graves - - src/org/eclipse/cdt/testplugin/CProjectHelper.jada - Cleanup of the CProjectHelper file to remove unused imports, commeted out code etc. - -======= -2003-04-21 Andrew Niefer - Added DOMFailedTests::testBug36713() - Added DOMFailedTests::testBug36714() - Added DOMFailedTests::testBug36717() - Added DOMFailedTests::testBug36730() - -2003-04-21 Andrew Niefer - Added ScannerTestCase::testBug36695() - Moved ScannerFailedTest::testBug36521 to ScannerTestCase::testBug36521() - Moved ScannerFailedTest::testBug36509 to ScannerTestCase::testBug36509() - Moved ScannerFailedTest::testBug36475 to ScannerTestCase::testBug36475() - Updated ScannerTestCase::testBug36047 - Updated ScannerTestCase::testBug36045 - -2003-04-20 John Camelon - Added DOMTests::testBug36551(). - Adjusted AutomatedTest to turn on line numbering. - Added DOMFailedTests and 11 failed test cases. - -2003-04-17 John Camelon - Updated DOMTests::testBug36600(). - Updated LineNumberTest::testDOMLineNos(). - Added DOMTests::testBug36559(). - -2003-04-17 Andrew Niefer - Added AutomatedTest - Added resources.cFiles - Added resources.cppFiles - -2003-04-16 John Camelon - Added DOMTests::testBug36532(). - Added DOMTests::testBug36432(). - Added DOMTests::testBug36594(). - Added DOMTests::testBug36600(). - Added DOMTests::testArrayOfPointerToFunctions(). - -2003-04-15 John Camelon - Added ScannerTestCase::testBug36434(). - Added ScannerTestCase::testMultipleLines(). - Added ParserTestSuite. - Added LineNumberTest. - Updated CModelElementsTests to set the Nature of the C++ project appropriately. - -2003-04-15 Andrew Niefer - Moved ScannerFailedTest::testBug36047 to ScannerTestCase::testBug36047 - Added ScannerFailedTest::testBug36475 - -2003-04-13 John Camelon - Added DOMTests::testPointersToFunctions. - -2003-04-11 John Camelon - Added DOMTests::testBug36247(). - -2003-04-11 Andrew Niefer - Moved ScannerFailedTest::testBug36316 to ScannerTestCase::testBug36316 - Added ScannerFailedTest::testBug36047 - Added ScannerTestCase::testNestedRecursiveDefines - -2003-04-10 John Camelon - Added DOMTests::testBug36237(). - -2003-04-09 John Camelon - Removed all the old Code Model Builder source that was no longer being used (NewModelBuilder.java, etc.). - Moved all the files in parser.util directory to the dom. - Organized imports. - Added DOMTests::testTemplateDeclarationOfMethod(). - Added DOMTests::testBug36250(). - Added DOMTests::testBug36240(). - Added DOMTests::testBug36254(). - -2003-04-09 John Camelon - Updated ScannerTest::testBug36045(). - Added ScannerTest::testBug36287(). - Added DOMTests::testBug36288(). - -2003-04-06 Andrew Niefer - Added ParserSymbolTableTest::testOverloadRanking() - -2003-04-04 Alain Magloire - * src/org/eclipse/cdt/testplugin/util/VerifyDialog.java: - Remove some warnings. - -2003-04-03 John Camelon - Updated ScannerTest::testSimpleIfdef() for bug36019. - Updated ScannerTest::testNumerics() for bug36020. - Added ScannerTest::testBug36045(). - Updated DOMTests::testTemplateDeclaration() for template grammar updates. - -2003-04-01 Andrew Niefer - ParserSymbolTableTest. modifications to using declaration tests to reflect changes in the - symbol table. Also added testUserDefinedConversionSequences() - -2003-04-01 John Camelon - Added testBug35906() to DOMTests. - -2003-03-31 John Camelon - Added testStruct() to DOMTests. - Added test35892()to ScannerTest. - -2003-03-31 Andrew Niefer - In ParserSymbolTableTest, renamed testFunctionResolution_2() to testFunctionResolution_PointersAndBaseClasses(), - and modified to reflect changes in function resolution. - Added testFunctionResolution_TypedefsAndPointers(). - -2003-03-31 John Camelon - Added testWeirdStrings() and testNumerics() to ScannerTestCase. - Added testTemplateSpecialization(), testTemplateDeclaration(), testBug26467(), - testTypedef() and testTemplateInstantiation() to DOMTests. - -2003-03-28 John Camelon - Added testConstructorChain() and testASMDefinition() to DOMTests. - -2003-03-27 Alain Magloire - Changes were done in the Core Model API, the hierarchy is now - ICModel - ICProject - ICContainer - ITranslationUnit - IArchive - IBinary - We adjust the tests. - * model/org/eclipse/cdt/core/model/tests/ArchiveTests.java - * model/org/eclipse/cdt/core/model/tests/BinaryTests.java - * model/org/eclipse/cdt/core/model/tests/TranslationUniTests.java - * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java - -2003-03-26 Andrew Niefer - In ParserSymbolTableTest : - updated all tests to reflect TypeInfo changes - Added testFunctionResolution() & testFunctionResolution_2() in - -2003-03-25 John Camelon - Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(), - testUsingClauses() and testEnumSpecifier() to DOMTests. - -2003-03-23 John Camelon - Added ptrOperator() test to DOMTests. - Added testFunctionModifiers() test to DOMTests. - Added testArrays() test to DOMTests. - -2003-03-20 Alain Magloire - - Patch from Amer Hoda, tests for the CElement deltas for Translation Units. - * model/org/eclipse/cdt/core/model/tests/ElementDeltaTest.java - * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h - -2003-03-19 Alain Magloire - Patch from Amer Hoda, introducing a simple test for the core model. - * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java - * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h - -2003-03-18 John Camelon - Updated DOMTests to validate simple case of a function declaration with multiple parameters. - * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java - -2003-03-11 John Camelon - Updated DOMTests for core.internal.parser change of merging DeclarationSpecifier and DeclSpecifier - Organized imports - * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java - * parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java - -2003-03-10 John Camelon - Added macro pasting tests - -2003-03-06 Andrew Niefer - Added tests for exercising Namespaces & using directives in new parser's symbol table - -2003-03-04 Doug Schaefer - This is a pretty big patch, but it is the merge of the NewParser1 branch into the HEAD branch. lder "parser") - JUnit tests for testing various pieces (source folder "parser" in cdt.ui.tests. - -2003-01-29 Peter Graves - - Fixed the warnings when accessing static methods - * src/org/eclipse/cdt/testplugin/util/DialogCheck.java: - * src/org/eclipse/cdt/testplugin/CTestPlugin.java - * src/org/eclipse/cdt/testplugin/TestWorkbench.java - * ChangeLog: make all entries have the same formatting - -2002-12-17 Peter Graves - - * plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and - to move closer to automated running - -2002-11-27 Alain Magloire - - * model/org/eclipse/cdt/core/model/tests/CModelTests.java: - Use CoreModel.getDefault(). - -2002-10-30 Alain Magloire - - * model/org/eclipse/cdt/core/model/tests/CModelTests.java (testGetNatureID): - The fields and the methods use in this test was removed from the CoreModel class. - (testHasNature): The method use in this case was refactor in the classes - CProjectNature and CCProjectNature, fix the test. - -2002-10-18 Peter Graves - - src/org/eclipse/cdt/testplugin/CProjectHelper.jada - Cleanup of the CProjectHelper file to remove unused imports, commeted out code etc. - ->>>>>>> 1.36 +2003-07-04 Andrew Niefer + Added new source Folder search + Added search/ClassDeclarationPatternTests::testMatchSimpleDeclaration + Added search/ClassDeclarationPatternTests::testMatchNamespaceNestedDeclaration + Added new resource folder search & containing file classDecl.cpp + Added new failures package ord.eclipse.cdt.core.search.failedTests + Added new failing test PatternsFailedTests::testBug39652 + + * Note that ClassDeclarationPatternTests and PatternsFailedTests both must be run as plugin tests + +2003-07-03 Bogdan Gheorghe + Added IndexManagerTest::testAddNewFileToIndex() + Added IndexManagerTest::testRemoveProjectFromIndex() + Added IndexManagerTest::testRemoveFileFromIndex() + +2003-07-02 Victor Mozgin + Added DOMTests::testBug39501(). + Improved filtering of expected failures/inconclusives in TortureTest. + +2003-06-30 John Camelon + Added DOMTests::testAssignmentExpression() + Added PreprocessorConditionalTest to ParserTestSuite. + +2003-06-28 John Camelon + Completed Quickparse expression representation. + Updated ExpressionEvaluation and associated tests. + +2003-06-26 John Camelon + Update IASTExpression. + Move Parser.Backtrack and Parser.EndOfFile to external interface. + +2003-06-25 John Camelon + Added DOMFailedTest::testBug39349(). + Added DOMTests::testBug39348(). + +2003-06-25 John Camelon + Create new interface and support for calculating lineNumber/offset mapping. + Updated IASTClassSpecifier for qualified name query. + Began structuring expressions and declarators in Parser for ISourceElementRequestor. + Updated other packages to use new interfaces. + Updated automatedtests/torture test to use new line number information. + +2003-06-24 John Camelon + Updates for ISourceElementRequestor - elaborated types & enumerations. + +2003-06-23 John Camelon + Factory/constructor signature updates. + +2003-06-17 Victor Mozgin + Added MacroTests.java (invocation in AllCoreTests). + Added MacroTests.c to resources. + +2003-06-17 Sean Evoy + Moved the ManagedBuildInfo extension point from the plugin file in org.eclipse.cdt.ui.tests + Added new options to sub target for include paths and preprocessor symbols + Added test for IManagedBuildPathInfo + * build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java + +2003-06-17 Brent Nicolle + Added Interface tests of IStructure.java. + +2003-06-17 Victor Mozgin + Added DeclaratorsTests.java (invocation in AllCoreTests). + Added DeclaratorsTests.cpp to org.eclipse.cdt.core.model.tests.resources. + +2003-06-16 Victor Mozgin + Added testOldKRFunctionDeclarations() to DOMTests. + Added testKRFunctionDeclarations() to TranslationUnitTests. + +2003-06-16 Vladimir Hirsl + Added /build, /parser, /failures and /suite directories to the library. + Copied resources from /model/org.eclipse.cdt.core.model.tests.resources + to /model/org/clipse/cdt/core/model/tests/resources/cmodel. + Added class AISResultPrinter to format test results. + Class AutomatedIntegrationSuite now implements IPlatformRunnable. + +2003-06-14 Victor Mozgin + Moved testBugSingleton192() from LokiFailures to DOMTests. + Added testPointersToMembers() and testPointersToMemberFunctions() to DOMTests. + Added testBug36290() and testBug36931() to DOMTests. + +2003-06-13 John Camelon + Added Class/Base infrastructure to public interfaces & requestor callback. + Moved many internal interfaces to external packages. + Organized imports. + +2003-06-13 Victor Mozgin + Renamed NullParserCallback into NullSourceElementRequester in AutomatedFramework. + +2003-06-13 John Camelon + Merged ParserSymbolTable branch back into HEAD. + +2003-06-12 John Camelon + Get rest of JUnit tests working, will merge back to HEAD branch. + +2003-06-12 John Camelon + Introduction of ASTFactory strategy, some restructuring of packages and interfaces. + +2003-06-11 Victor Mozgin + Old Java TestCase.txt and TestCase2.txt for partioning testing have been replaced with C/C++ files. + Modified AutomatedIntegrationSuite.java so it doesn't produce JUnit warning anymore. + All tests in org.eclipse.cdt.ui.tests should pass now. + +3003-06-11 Peter Graves + Update the test.xml to get the location of org.eclipse.test from a property + if set. If the property is not set, it will default to the old value. + +2003-06-11 Victor Mozgin + Added TortureTest to test CDT C++ parser with GCC testsuites. + GCC testsuites are not included. + +2003-06-10 John Camelon + Futher pursuit of the golden hammer, symbol table integration. + +2003-06-10 Brent Nicolle + Added some Interface tests of (IInclude, IMacro, IStructure). + Made sure all the Test Suites have names in the JUnit hierarchy. + +2003-06-09 John Camelon + First step in replacing IParserCallback with ISourceElementRequestor. + +2003-06-09 Victor Mozgin + Moved testBug36769() from ACEFailedTest.java to DOMTests.java. + Removed ACEFailedTest.java as it is empty now. + Added DOMTests.testBug36769B(). + +2003-06-09 Victor Mozgin + Moved testBug36932() from DOMFailedTest.java to DOMTests.java. + Added DOMTests.testBug36932B() and DOMTests.testBug36932C(). + +2003-06-09 Victor Mozgin + Moved testBug36701() from ScannerFailedTests.java to ScannerTestCase.java. + Renamed it to testBug36701A() and fixed it. + Added ScannerTestCase.testBug36701B(). + +2003-06-07 Victor Mozgin + Moved testBug36766A(), testBug36766B() & testBug36766C() from STLFailedTests.java to DOMTests.java. + Renamed them to testBug36766and36769x(), as they cover both PRs. + Added testBug36766and36769D() - test for templated destructor. + +2003-06-05 John Camelon + Moved testBug23478A() & testBug23478B() from failed tests to TranslationUnitTests.java. + Removed TranslationUnitFailedTests.java as it was empty. + +2003-05-29 Andrew Niefer + Modified tests to support eType & PtrOp changes in core + Added ParserSymbolTableTest::testTemplateParameterAsParent + Added ParserSymbolTableTest::testTemplateInstanceAsParent + Added ParserSymbolTableTest::testTemplateParameterDefaults + Added ParserSymbolTableTest::testTemplateParameterAsFunctionArgument + started ParserSymbolTableTest::incompletetestTemplateSpecialization + +2003-05-26 John Camelon + Rollback PST/Parser integration. + +2003-05-13 Andrew Niefer + Modified ParserSymbolTableTest to use new interface + +2003-05-08 Andrew Niefer + Added ParserSymbolTableTest::testMarkRollback + +2003-05-06 John Camelon + Further integration of SymbolTable into Parser, some refactoring. + +2003-05-05 John Camelon/Andrew Niefer + Added CrossReferenceTests to ParserTestSuite to test symbol-table/DOM interworking. + +2003-05-05 Andrew Niefer + Rewrote ParserSymbolTableTest to reflect structural changes to the symbol table. + +2003-05-01 Andrew Niefer + Updated FractionalAutomatedTest to use threads + Modified ScannerTestCase::testBug36287 + Added ScannerTestCase::testBug37011 + Added ScannerTestCase::testOtherPreprocessorDefines + +2003-04-28 John Camelon + Moved testBug36730() & testBug37019() from DOMFailedTests to DOMTests. + +2003-04-28 Andrew Niefer + Added DOMFailedTest::testBug37019 + Added DOMFailedTest::testBug36932 + Added ScannerFailedTest::testBug37011 + +2003-04-28 John Camelon + Added DOMTests::testOrder(). + +2003-04-28 Peter Graves + * model/org/eclipse/cdt/core/model/tests/BinaryTests: + Updated to remove a few small errors, and deal with some changes + to the core CDT + +2003-04-27 John Camelon + Added testBug36932() to DOMTests. + Moved testBugFunctor758() from LokiFailures to DOMTests. + Moved testBug36704() from DOMFailedTest to DOMTests. + Moved testBug36699() from DOMFailedTest to DOMTests. + Moved testBug36691() from DOMFailedTest to DOMTests. + +2003-04-25 Andrew Niefer + Moved ACEFailedTest::testBug36771 to DOMTests + Moved DOMFailedTest::testBug36714 to DOMTests + Updated ScannerTestCase::testBug36816 + +2003-04-25 John Camelon + Added DOMTests::testBug36852(). + Added DOMTests::testBug36764(). + Moved DOMFailedTests::testBug36702() to DOMTests(). + +2003-04-24 John Camelon + Moved fixed tests from FailedTests to DOMTests. + Added DOMTests::testBug36799(). + Cleaned up tests to reduce amount of code necessary to maintain these things. + +2003-04-24 John Camelon + Moved fixed tests from FailedTests to DOMTests. + Added LokiFailures.java to failed tests directory. + +2003-04-24 Andrew Niefer + Added AutomatedFramework.java + Added FractionalAutomatedTest (which derives from AutomatedFramework) + Refactored AutomatedTest to derive from AutomatdFramework + Added ScannerTestCase.testBug36816 + Added ScannerTestCase.testBug36255 + +2003-04-24 John Camelon + Fixed Java 1.3 compliance issue w/AutomatedTest.java + Fixed False failure in HelloWorld.java. + +2003-04-21 John Camelon + Updated DOMTests::testBug36247(). + Moved testBug36692(), testBug36703(), testBug36708(), testBug36707(), testBug36689() + and testBug36690() from DOMFailedTests to DOMTests and updated them. + +2003-04-20 John Camelon + Added DOMTests::testBug36551(). + Adjusted AutomatedTest to turn on line numbering. + Added DOMFailedTests and 11 failed test cases. + +2003-04-17 Andrew Niefer + Added ScannerTestCase::testBug36695() + Moved ScannerFailedTest::testBug36521 to ScannerTestCase::testBug36521() + Moved ScannerFailedTest::testBug36509 to ScannerTestCase::testBug36509() + Moved ScannerFailedTest::testBug36475 to ScannerTestCase::testBug36475() + Updated ScannerTestCase::testBug36047 + Updated ScannerTestCase::testBug36045 + +2003-04-17 John Camelon + Updated DOMTests::testBug36600(). + Updated LineNumberTest::testDOMLineNos(). + Added DOMTests::testBug36559(). + +2003-04-17 Andrew Niefer + Added AutomatedTest + Added resources.cFiles + Added resources.cppFiles + +2003-04-16 John Camelon + Added DOMTests::testBug36532(). + Added DOMTests::testBug36432(). + Added DOMTests::testBug36594(). + Added DOMTests::testBug36600(). + Added DOMTests::testArrayOfPointerToFunctions(). + +2003-04-15 John Camelon + Added ScannerTestCase::testBug36434(). + Added ScannerTestCase::testMultipleLines(). + Added ParserTestSuite. + Added LineNumberTest. + Updated CModelElementsTests to set the Nature of the C++ project appropriately. + +2003-04-15 Andrew Niefer + Moved ScannerFailedTest::testBug36047 to ScannerTestCase::testBug36047 + Added ScannerFailedTest::testBug36475 + +2003-04-13 John Camelon + Added DOMTests::testPointersToFunctions. + +2003-04-11 John Camelon + Added DOMTests::testBug36247(). + +2003-04-11 Andrew Niefer + Moved ScannerFailedTest::testBug36316 to ScannerTestCase::testBug36316 + Added ScannerFailedTest::testBug36047 + Added ScannerTestCase::testNestedRecursiveDefines + +2003-04-10 John Camelon + Added DOMTests::testBug36237(). + +2003-04-09 John Camelon + Removed all the old Code Model Builder source that was no longer being used (NewModelBuilder.java, etc.). + Moved all the files in parser.util directory to the dom. + Organized imports. + Added DOMTests::testTemplateDeclarationOfMethod(). + Added DOMTests::testBug36250(). + Added DOMTests::testBug36240(). + Added DOMTests::testBug36254(). + +2003-04-09 John Camelon + Updated ScannerTest::testBug36045(). + Added ScannerTest::testBug36287(). + Added DOMTests::testBug36288(). + +2003-04-06 Andrew Niefer + Added ParserSymbolTableTest::testOverloadRanking() + +2003-04-04 Alain Magloire + * src/org/eclipse/cdt/testplugin/util/VerifyDialog.java: + Remove some warnings. + +2003-04-03 John Camelon + Updated ScannerTest::testSimpleIfdef() for bug36019. + Updated ScannerTest::testNumerics() for bug36020. + Added ScannerTest::testBug36045(). + Updated DOMTests::testTemplateDeclaration() for template grammar updates. + +2003-04-01 Andrew Niefer + ParserSymbolTableTest. modifications to using declaration tests to reflect changes in the + symbol table. Also added testUserDefinedConversionSequences() + +2003-04-01 John Camelon + Added testBug35906() to DOMTests. + +2003-03-31 John Camelon + Added testStruct() to DOMTests. + Added test35892()to ScannerTest. + +2003-03-31 Andrew Niefer + In ParserSymbolTableTest, renamed testFunctionResolution_2() to testFunctionResolution_PointersAndBaseClasses(), + and modified to reflect changes in function resolution. + Added testFunctionResolution_TypedefsAndPointers(). + +2003-03-31 John Camelon + Added testWeirdStrings() and testNumerics() to ScannerTestCase. + Added testTemplateSpecialization(), testTemplateDeclaration(), testBug26467(), + testTypedef() and testTemplateInstantiation() to DOMTests. + +2003-03-28 John Camelon + Added testConstructorChain() and testASMDefinition() to DOMTests. + +2003-03-27 Alain Magloire + Changes were done in the Core Model API, the hierarchy is now + ICModel + ICProject + ICContainer + ITranslationUnit + IArchive + IBinary + We adjust the tests. + * model/org/eclipse/cdt/core/model/tests/ArchiveTests.java + * model/org/eclipse/cdt/core/model/tests/BinaryTests.java + * model/org/eclipse/cdt/core/model/tests/TranslationUniTests.java + * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java + +2003-03-26 Andrew Niefer + In ParserSymbolTableTest : + updated all tests to reflect TypeInfo changes + Added testFunctionResolution() & testFunctionResolution_2() in + +2003-03-25 John Camelon + Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(), + testUsingClauses() and testEnumSpecifier() to DOMTests. + +2003-03-23 John Camelon + Added ptrOperator() test to DOMTests. + Added testFunctionModifiers() test to DOMTests. + Added testArrays() test to DOMTests. + +2003-03-20 Alain Magloire + + Patch from Amer Hoda, tests for the CElement deltas for Translation Units. + * model/org/eclipse/cdt/core/model/tests/ElementDeltaTest.java + * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h + +2003-03-19 Alain Magloire + Patch from Amer Hoda, introducing a simple test for the core model. + * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java + * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h + +2003-03-18 John Camelon + Updated DOMTests to validate simple case of a function declaration with multiple parameters. + * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java + +2003-03-11 John Camelon + Updated DOMTests for core.internal.parser change of merging DeclarationSpecifier and DeclSpecifier + Organized imports + * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java + * parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java + +2003-03-10 John Camelon + Added macro pasting tests + +2003-03-06 Andrew Niefer + Added tests for exercising Namespaces & using directives in new parser's symbol table + +2003-03-04 Doug Schaefer + This is a pretty big patch, but it is the merge of the NewParser1 branch into the HEAD branch. lder "parser") + JUnit tests for testing various pieces (source folder "parser" in cdt.ui.tests. + +2003-01-29 Peter Graves + + Fixed the warnings when accessing static methods + * src/org/eclipse/cdt/testplugin/util/DialogCheck.java: + * src/org/eclipse/cdt/testplugin/CTestPlugin.java + * src/org/eclipse/cdt/testplugin/TestWorkbench.java + * ChangeLog: make all entries have the same formatting + +2002-12-17 Peter Graves + + * plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and + to move closer to automated running + +2002-11-27 Alain Magloire + + * model/org/eclipse/cdt/core/model/tests/CModelTests.java: + Use CoreModel.getDefault(). + +2002-10-30 Alain Magloire + + * model/org/eclipse/cdt/core/model/tests/CModelTests.java (testGetNatureID): + The fields and the methods use in this test was removed from the CoreModel class. + (testHasNature): The method use in this case was refactor in the classes + CProjectNature and CCProjectNature, fix the test. + +2002-10-18 Peter Graves + + src/org/eclipse/cdt/testplugin/CProjectHelper.jada + Cleanup of the CProjectHelper file to remove unused imports, commeted out code etc. + +======= +2003-04-21 Andrew Niefer + Added DOMFailedTests::testBug36713() + Added DOMFailedTests::testBug36714() + Added DOMFailedTests::testBug36717() + Added DOMFailedTests::testBug36730() + +2003-04-21 Andrew Niefer + Added ScannerTestCase::testBug36695() + Moved ScannerFailedTest::testBug36521 to ScannerTestCase::testBug36521() + Moved ScannerFailedTest::testBug36509 to ScannerTestCase::testBug36509() + Moved ScannerFailedTest::testBug36475 to ScannerTestCase::testBug36475() + Updated ScannerTestCase::testBug36047 + Updated ScannerTestCase::testBug36045 + +2003-04-20 John Camelon + Added DOMTests::testBug36551(). + Adjusted AutomatedTest to turn on line numbering. + Added DOMFailedTests and 11 failed test cases. + +2003-04-17 John Camelon + Updated DOMTests::testBug36600(). + Updated LineNumberTest::testDOMLineNos(). + Added DOMTests::testBug36559(). + +2003-04-17 Andrew Niefer + Added AutomatedTest + Added resources.cFiles + Added resources.cppFiles + +2003-04-16 John Camelon + Added DOMTests::testBug36532(). + Added DOMTests::testBug36432(). + Added DOMTests::testBug36594(). + Added DOMTests::testBug36600(). + Added DOMTests::testArrayOfPointerToFunctions(). + +2003-04-15 John Camelon + Added ScannerTestCase::testBug36434(). + Added ScannerTestCase::testMultipleLines(). + Added ParserTestSuite. + Added LineNumberTest. + Updated CModelElementsTests to set the Nature of the C++ project appropriately. + +2003-04-15 Andrew Niefer + Moved ScannerFailedTest::testBug36047 to ScannerTestCase::testBug36047 + Added ScannerFailedTest::testBug36475 + +2003-04-13 John Camelon + Added DOMTests::testPointersToFunctions. + +2003-04-11 John Camelon + Added DOMTests::testBug36247(). + +2003-04-11 Andrew Niefer + Moved ScannerFailedTest::testBug36316 to ScannerTestCase::testBug36316 + Added ScannerFailedTest::testBug36047 + Added ScannerTestCase::testNestedRecursiveDefines + +2003-04-10 John Camelon + Added DOMTests::testBug36237(). + +2003-04-09 John Camelon + Removed all the old Code Model Builder source that was no longer being used (NewModelBuilder.java, etc.). + Moved all the files in parser.util directory to the dom. + Organized imports. + Added DOMTests::testTemplateDeclarationOfMethod(). + Added DOMTests::testBug36250(). + Added DOMTests::testBug36240(). + Added DOMTests::testBug36254(). + +2003-04-09 John Camelon + Updated ScannerTest::testBug36045(). + Added ScannerTest::testBug36287(). + Added DOMTests::testBug36288(). + +2003-04-06 Andrew Niefer + Added ParserSymbolTableTest::testOverloadRanking() + +2003-04-04 Alain Magloire + * src/org/eclipse/cdt/testplugin/util/VerifyDialog.java: + Remove some warnings. + +2003-04-03 John Camelon + Updated ScannerTest::testSimpleIfdef() for bug36019. + Updated ScannerTest::testNumerics() for bug36020. + Added ScannerTest::testBug36045(). + Updated DOMTests::testTemplateDeclaration() for template grammar updates. + +2003-04-01 Andrew Niefer + ParserSymbolTableTest. modifications to using declaration tests to reflect changes in the + symbol table. Also added testUserDefinedConversionSequences() + +2003-04-01 John Camelon + Added testBug35906() to DOMTests. + +2003-03-31 John Camelon + Added testStruct() to DOMTests. + Added test35892()to ScannerTest. + +2003-03-31 Andrew Niefer + In ParserSymbolTableTest, renamed testFunctionResolution_2() to testFunctionResolution_PointersAndBaseClasses(), + and modified to reflect changes in function resolution. + Added testFunctionResolution_TypedefsAndPointers(). + +2003-03-31 John Camelon + Added testWeirdStrings() and testNumerics() to ScannerTestCase. + Added testTemplateSpecialization(), testTemplateDeclaration(), testBug26467(), + testTypedef() and testTemplateInstantiation() to DOMTests. + +2003-03-28 John Camelon + Added testConstructorChain() and testASMDefinition() to DOMTests. + +2003-03-27 Alain Magloire + Changes were done in the Core Model API, the hierarchy is now + ICModel + ICProject + ICContainer + ITranslationUnit + IArchive + IBinary + We adjust the tests. + * model/org/eclipse/cdt/core/model/tests/ArchiveTests.java + * model/org/eclipse/cdt/core/model/tests/BinaryTests.java + * model/org/eclipse/cdt/core/model/tests/TranslationUniTests.java + * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java + +2003-03-26 Andrew Niefer + In ParserSymbolTableTest : + updated all tests to reflect TypeInfo changes + Added testFunctionResolution() & testFunctionResolution_2() in + +2003-03-25 John Camelon + Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(), + testUsingClauses() and testEnumSpecifier() to DOMTests. + +2003-03-23 John Camelon + Added ptrOperator() test to DOMTests. + Added testFunctionModifiers() test to DOMTests. + Added testArrays() test to DOMTests. + +2003-03-20 Alain Magloire + + Patch from Amer Hoda, tests for the CElement deltas for Translation Units. + * model/org/eclipse/cdt/core/model/tests/ElementDeltaTest.java + * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h + +2003-03-19 Alain Magloire + Patch from Amer Hoda, introducing a simple test for the core model. + * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java + * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h + +2003-03-18 John Camelon + Updated DOMTests to validate simple case of a function declaration with multiple parameters. + * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java + +2003-03-11 John Camelon + Updated DOMTests for core.internal.parser change of merging DeclarationSpecifier and DeclSpecifier + Organized imports + * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java + * parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java + +2003-03-10 John Camelon + Added macro pasting tests + +2003-03-06 Andrew Niefer + Added tests for exercising Namespaces & using directives in new parser's symbol table + +2003-03-04 Doug Schaefer + This is a pretty big patch, but it is the merge of the NewParser1 branch into the HEAD branch. lder "parser") + JUnit tests for testing various pieces (source folder "parser" in cdt.ui.tests. + +2003-01-29 Peter Graves + + Fixed the warnings when accessing static methods + * src/org/eclipse/cdt/testplugin/util/DialogCheck.java: + * src/org/eclipse/cdt/testplugin/CTestPlugin.java + * src/org/eclipse/cdt/testplugin/TestWorkbench.java + * ChangeLog: make all entries have the same formatting + +2002-12-17 Peter Graves + + * plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and + to move closer to automated running + +2002-11-27 Alain Magloire + + * model/org/eclipse/cdt/core/model/tests/CModelTests.java: + Use CoreModel.getDefault(). + +2002-10-30 Alain Magloire + + * model/org/eclipse/cdt/core/model/tests/CModelTests.java (testGetNatureID): + The fields and the methods use in this test was removed from the CoreModel class. + (testHasNature): The method use in this case was refactor in the classes + CProjectNature and CCProjectNature, fix the test. + +2002-10-18 Peter Graves + + src/org/eclipse/cdt/testplugin/CProjectHelper.jada + Cleanup of the CProjectHelper file to remove unused imports, commeted out code etc. + +>>>>>>> 1.36 diff --git a/core/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/search/failedTests/PatternsFailedTests.java b/core/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/search/failedTests/PatternsFailedTests.java new file mode 100644 index 00000000000..be6a712d6f5 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/search/failedTests/PatternsFailedTests.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v0.5 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v05.html + * + * Contributors: + * IBM Corp. - Rational Software - initial implementation + ******************************************************************************/ +/* + * Created on Jul 4, 2003 + */ +package org.eclipse.cdt.core.search.failedTests; + +import java.util.Set; + +import org.eclipse.cdt.core.search.ICSearchConstants; +import org.eclipse.cdt.internal.core.search.matching.CSearchPattern; +import org.eclipse.cdt.internal.core.search.matching.MatchLocator; +import org.eclipse.cdt.internal.ui.search.CSearchResultCollector; +import org.eclipse.core.runtime.Path; + +import junit.framework.TestCase; + +/** + * @author aniefer + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class PatternsFailedTests extends TestCase implements ICSearchConstants { + + private MatchLocator matchLocator; + private CSearchResultCollector resultCollector; + private String cppPath; + + public PatternsFailedTests(String name) { + super(name); + } + + private void initialize( CSearchPattern pattern ){ + cppPath = org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile(); + cppPath += "resources/search/classDecl.cpp"; + + resultCollector = new CSearchResultCollector(); + matchLocator = new MatchLocator( pattern, resultCollector, null, null ); + } + + public void testBug39652() { + CSearchPattern pattern = CSearchPattern.createPattern( "A::B", TYPE, DECLARATIONS, EXACT_MATCH, true ); + + initialize( pattern ); + matchLocator.locateMatches( new String[] { cppPath }, null, null ); + Set matches = resultCollector.getMatches(); + /* Test should find 1 match */ + //assertTrue( matches != null ); + //assertTrue( matches.size() == 1 ); + + /* instead it finds none because qualifications are wrong*/ + assertTrue( matches == null ); + + pattern = CSearchPattern.createPattern( "NS::NS2::a", TYPE, DECLARATIONS, EXACT_MATCH, true ); + initialize( pattern ); + matchLocator.locateMatches( new String[] { cppPath }, null, null ); + matches = resultCollector.getMatches(); + assertTrue( matches == null ); + + pattern = CSearchPattern.createPattern( "NS::B::A", TYPE, DECLARATIONS, EXACT_MATCH, true ); + initialize( pattern ); + matchLocator.locateMatches( new String[] { cppPath }, null, null ); + matches = resultCollector.getMatches(); + assertTrue( matches == null ); + } + + +} diff --git a/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp b/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp new file mode 100644 index 00000000000..209f373fd77 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp @@ -0,0 +1,13 @@ +class A { + class B { + }; +}; + +namespace NS { + namespace NS2{ + struct a{}; + } + class B { + struct A {}; + }; +} 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 new file mode 100644 index 00000000000..3cda9a4183f --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java @@ -0,0 +1,119 @@ +/******************************************************************************* + * Copyright (c) 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v0.5 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v05.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.internal.core.search.CharOperation; +import org.eclipse.cdt.internal.core.search.matching.CSearchPattern; +import org.eclipse.cdt.internal.core.search.matching.ClassDeclarationPattern; +import org.eclipse.cdt.internal.core.search.matching.MatchLocator; +import org.eclipse.cdt.internal.ui.search.CSearchResultCollector; +import org.eclipse.core.runtime.Path; + +import junit.framework.TestCase; + +/** + * @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 TestCase implements ICSearchConstants { + + private MatchLocator matchLocator; + private CSearchResultCollector resultCollector; + private String cppPath; + + public ClassDeclarationPatternTests(String name) { + super(name); + } + + private void initialize( CSearchPattern pattern ){ + cppPath = org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile(); + cppPath += "resources/search/classDecl.cpp"; + + resultCollector = new CSearchResultCollector(); + matchLocator = new MatchLocator( pattern, resultCollector, null, null ); + } + + public void testMatchSimpleDeclaration(){ + CSearchPattern pattern = CSearchPattern.createPattern( "A", TYPE, DECLARATIONS, EXACT_MATCH, true ); + + assertTrue( pattern instanceof ClassDeclarationPattern ); + + initialize( pattern ); + + matchLocator.locateMatches( new String [] { cppPath }, null, null ); + + Set matches = resultCollector.getMatches(); + assertEquals( matches.size(), 2 ); + } + + public void testMatchNamespaceNestedDeclaration(){ + CSearchPattern pattern = CSearchPattern.createPattern( "NS::B", TYPE, DECLARATIONS, EXACT_MATCH, 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] ) ); + + initialize( pattern ); + + matchLocator.locateMatches( new String [] { cppPath }, null, null ); + + Set matches = resultCollector.getMatches(); + assertEquals( matches.size(), 1 ); + } + + public void failingtestMatchStruct(){ + CSearchPattern pattern = CSearchPattern.createPattern( "A", STRUCT, DECLARATIONS, EXACT_MATCH, true ); + + assertTrue( pattern instanceof ClassDeclarationPattern ); + + ClassDeclarationPattern clsPattern = (ClassDeclarationPattern) pattern; + + initialize( pattern ); + + matchLocator.locateMatches( new String[] { cppPath }, null, null ); + + Set matches = resultCollector.getMatches(); + assertEquals( matches.size(), 1 ); + + pattern = CSearchPattern.createPattern( "NS::B::A", TYPE, DECLARATIONS, EXACT_MATCH, true ); + + initialize( pattern ); + matchLocator.locateMatches( new String[] { cppPath }, null, null ); + + Set matches2 = resultCollector.getMatches(); + assertTrue( matches2 != null ); + assertEquals( matches2.size(), 1 ); + + Iterator iter = matches.iterator(); + Iterator iter2 = matches2.iterator(); + + CSearchResultCollector.Match match = (CSearchResultCollector.Match)iter.next(); + CSearchResultCollector.Match match2 = (CSearchResultCollector.Match)iter2.next(); + + assertTrue( match.path.equals( match2.path ) ); + assertEquals( match.start, match2.start ); + assertEquals( match.end, match2.end ); + } + +} diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java index 8d195362b4f..6be557d20cb 100644 --- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java +++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java @@ -6,27 +6,30 @@ */ package org.eclipse.cdt.core.suite; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import junit.framework.TestResult; -import junit.framework.TestListener; -import junit.framework.AssertionFailedError; -import junit.textui.TestRunner; - import java.text.DecimalFormat; import java.util.ArrayList; -import org.eclipse.core.boot.IPlatformRunnable; +import junit.framework.AssertionFailedError; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestListener; +import junit.framework.TestResult; +import junit.framework.TestSuite; +import junit.textui.TestRunner; import org.eclipse.cdt.core.build.managed.tests.AllBuildTests; +import org.eclipse.cdt.core.model.failedTests.CModelElementsFailedTests; import org.eclipse.cdt.core.model.tests.AllCoreTests; import org.eclipse.cdt.core.model.tests.BinaryTests; import org.eclipse.cdt.core.model.tests.ElementDeltaTests; import org.eclipse.cdt.core.model.tests.WorkingCopyTests; -import org.eclipse.cdt.core.parser.failedTests.*; +import org.eclipse.cdt.core.parser.failedTests.DOMFailedTest; +import org.eclipse.cdt.core.parser.failedTests.LokiFailures; +import org.eclipse.cdt.core.parser.failedTests.STLFailedTests; import org.eclipse.cdt.core.parser.tests.ParserTestSuite; -import org.eclipse.cdt.core.model.failedTests.*; +import org.eclipse.cdt.core.search.failedTests.PatternsFailedTests; +import org.eclipse.cdt.core.search.tests.ClassDeclarationPatternTests; +import org.eclipse.core.boot.IPlatformRunnable; /** * @author vhirsl @@ -77,6 +80,7 @@ public class AutomatedIntegrationSuite extends TestSuite suite.addTest(BinaryTests.suite()); suite.addTest(ElementDeltaTests.suite()); suite.addTest(WorkingCopyTests.suite()); + suite.addTestSuite(ClassDeclarationPatternTests.class ); // Last test to trigger report generation suite.addTest(suite.new GenerateReport("startFailedTests")); @@ -86,6 +90,7 @@ public class AutomatedIntegrationSuite extends TestSuite suite.addTestSuite(LokiFailures.class); suite.addTestSuite(STLFailedTests.class); suite.addTestSuite(CModelElementsFailedTests.class); + suite.addTestSuite(PatternsFailedTests.class); // Last test to trigger report generation suite.addTest(suite.new GenerateReport("generateReport")); diff --git a/core/org.eclipse.cdt.core/search/ChangeLog b/core/org.eclipse.cdt.core/search/ChangeLog index 5861bff8efa..68032c6737e 100644 --- a/core/org.eclipse.cdt.core/search/ChangeLog +++ b/core/org.eclipse.cdt.core/search/ChangeLog @@ -1,3 +1,8 @@ +2003-07-04 Andrew Niefer + * Modified ICSearchConstants to use new nested classes SearchFor and LimitTo instead of int + for stronger type safety + * Updated MatchLocator to invoke parser to do actual search. + 2003-06-27 Andrew Niefer Modified: search/org.eclipse.cdt.core.search.matching/MatchLocator.java diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchConstants.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchConstants.java index d87d276d7f2..606bc3531db 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchConstants.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchConstants.java @@ -33,64 +33,65 @@ public interface ICSearchConstants { * The nature of searched element or the nature * of match in unknown. */ - int UNKNOWN = -1; + public static final SearchFor UNKNOWN_SEARCH_FOR = new SearchFor( -1 ); + public static final LimitTo UNKNOWN_LIMIT_TO = new LimitTo( -1 ); /* Nature of searched element */ /** * The searched element is a type. */ - int TYPE= 0; + public static final SearchFor TYPE = new SearchFor( 0 ); /** * The searched element is a function. */ - int FUNCTION= 1; + public static final SearchFor FUNCTION = new SearchFor( 1 ); /** * The searched element is a namespace. */ - int NAMESPACE= 2; + public static final SearchFor NAMESPACE = new SearchFor( 2 ); /** * The searched element is a constructor. */ - int CONSTRUCTOR= 3; + public static final SearchFor CONSTRUCTOR = new SearchFor( 3 ); /** * The searched element is a member. */ - int MEMBER= 4; + public static final SearchFor MEMBER = new SearchFor( 4 ); /** * The searched element is a variable. * More selective than using TYPE */ - int VAR= 5; + public static final SearchFor VAR = new SearchFor( 5 ); /** * The searched element is a class. * More selective than using TYPE */ - int CLASS= 6; + public static final SearchFor CLASS = new SearchFor( 6 ); /** * The searched element is a struct. * More selective than using TYPE */ - int STRUCT= 7; + public static final SearchFor STRUCT = new SearchFor( 7 ); /** * The searched element is a enum. * More selective than using TYPE */ - int ENUM= 8; + public static final SearchFor ENUM = new SearchFor( 8 ); /** * The searched element is a union. * More selective than using TYPE */ - int UNION= 9; + public static final SearchFor UNION = new SearchFor( 9 ); /* Nature of match */ @@ -100,7 +101,7 @@ public interface ICSearchConstants { * Can be used in conjunction with any of the nature of searched elements * so as to better narrow down the search. */ - int DECLARATIONS= 0; + public static final LimitTo DECLARATIONS = new LimitTo( 0 ); /** * The search result is a type that implements an interface. @@ -109,7 +110,7 @@ public interface ICSearchConstants { * rather exclusively search for classes implementing an interface, or interfaces * extending an interface. */ - int DEFINITIONS= 1; + public static final LimitTo DEFINITIONS = new LimitTo( 1 ); /** * The search result is a reference. @@ -118,7 +119,7 @@ public interface ICSearchConstants { * References can contain implementers since they are more generic kind * of matches. */ - int REFERENCES= 2; + public static final LimitTo REFERENCES = new LimitTo( 2 ); /** * The search result is a declaration, a reference, or an implementer @@ -126,7 +127,7 @@ public interface ICSearchConstants { * Can be used in conjunction with any of the nature of searched elements * so as to better narrow down the search. */ - int ALL_OCCURRENCES= 3; + public static final LimitTo ALL_OCCURRENCES = new LimitTo( 3 ); /* Syntactic match modes */ @@ -180,4 +181,19 @@ public interface ICSearchConstants { int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady; + public class SearchFor{ + private SearchFor( int value ) + { + this.value = value; + } + private final int value; + } + + public class LimitTo { + private LimitTo( int value ) + { + this.value = value; + } + private final int value; + } } diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchResultCollector.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchResultCollector.java index 96955788165..3785f3915e5 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchResultCollector.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchResultCollector.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.core.search; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; /** @@ -74,5 +75,17 @@ public interface ICSearchResultCollector { * @return a progress monitor or null if no progress monitor is provided */ public IProgressMonitor getProgressMonitor(); + /** + * @param currentPath + * @param start + * @param end + * @param object + * @param accuracyLevel + */ + public void accept(IPath currentPath, + int start, + int end, + ICElement enclosingElement, + int accuracyLevel) throws CoreException; } diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java index e6b0ae7f9a2..f9e7ccbe282 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java @@ -31,7 +31,7 @@ import org.eclipse.core.runtime.SubProgressMonitor; * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ -public class SearchEngine { +public class SearchEngine implements ICSearchConstants{ private boolean VERBOSE = false; @@ -60,7 +60,7 @@ public class SearchEngine { return null; } - public static ICSearchPattern createSearchPattern( String stringPattern, int searchFor, int limitTo, boolean isCaseSensitive){ + public static ICSearchPattern createSearchPattern( String stringPattern, SearchFor searchFor, LimitTo limitTo, boolean isCaseSensitive){ int mode; if( stringPattern.indexOf( '*' ) != -1 || stringPattern.indexOf( '?' ) != -1 ){ @@ -127,7 +127,7 @@ public class SearchEngine { * @param _scope * @param _collector */ - public void search(IWorkspace workspace, ICElement elementPattern, int limitTo, ICSearchScope scope, ICSearchResultCollector collector) { + public void search(IWorkspace workspace, ICElement elementPattern, LimitTo limitTo, ICSearchScope scope, ICSearchResultCollector collector) { // TODO Auto-generated method stub } diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java index 69e0b217f08..6048b619d99 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java @@ -22,6 +22,7 @@ import org.eclipse.cdt.core.parser.IToken; import org.eclipse.cdt.core.parser.ParserFactory; import org.eclipse.cdt.core.parser.ParserMode; import org.eclipse.cdt.core.parser.ScannerException; +import org.eclipse.cdt.core.parser.ast.ClassKind; import org.eclipse.cdt.core.search.ICSearchConstants; import org.eclipse.cdt.core.search.ICSearchPattern; import org.eclipse.cdt.internal.core.search.CharOperation; @@ -56,26 +57,23 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte // TODO Auto-generated constructor stub } - public static CSearchPattern createPattern( String patternString, int searchFor, int limitTo, int matchMode, boolean caseSensitive ){ + public static CSearchPattern createPattern( String patternString, SearchFor searchFor, LimitTo limitTo, int matchMode, boolean caseSensitive ){ if( patternString == null || patternString.length() == 0 ){ return null; } CSearchPattern pattern = null; - switch( searchFor ){ - case ICSearchConstants.TYPE: - pattern = createClassPattern( patternString, limitTo, matchMode, caseSensitive ); - break; - //case ICSearchConstants.METHOD: + if( searchFor == TYPE || searchFor == CLASS || searchFor == STRUCT || searchFor == ENUM || searchFor == UNION ){ + pattern = createClassPattern( patternString, searchFor, limitTo, matchMode, caseSensitive ); + } else if ( searchFor == MEMBER ){ // pattern = createMethodPattern( patternString, limitTo, matchMode, caseSensitive ); - // break; - case ICSearchConstants.CONSTRUCTOR: - pattern = createConstructorPattern( patternString, limitTo, matchMode, caseSensitive ); - break; + } else if ( searchFor == CONSTRUCTOR ){ + pattern = createConstructorPattern( patternString, limitTo, matchMode, caseSensitive ); + } //case ICSearchConstants.FIELD: // pattern = createFieldPattern( patternString, limitTo, matchMode, caseSensitive ); // break; - } + return pattern; } @@ -87,7 +85,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte * @param caseSensitive * @return */ - private static CSearchPattern createFieldPattern(String patternString, int limitTo, int matchMode, boolean caseSensitive) { + private static CSearchPattern createFieldPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) { // TODO Auto-generated method stub return null; } @@ -99,7 +97,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte * @param caseSensitive * @return */ - private static CSearchPattern createMethodPattern(String patternString, int limitTo, int matchMode, boolean caseSensitive) { + private static CSearchPattern createMethodPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) { // TODO Auto-generated method stub return null; } @@ -111,7 +109,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte * @param caseSensitive * @return */ - private static CSearchPattern createConstructorPattern(String patternString, int limitTo, int matchMode, boolean caseSensitive) { + private static CSearchPattern createConstructorPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) { // TODO Auto-generated method stub return null; } @@ -123,7 +121,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte * @param caseSensitive * @return */ - private static CSearchPattern createClassPattern(String patternString, int limitTo, int matchMode, boolean caseSensitive) { + private static CSearchPattern createClassPattern(String patternString, SearchFor searchFor, LimitTo limitTo, int matchMode, boolean caseSensitive) { IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", null, null, ParserMode.QUICK_PARSE ); LinkedList list = new LinkedList(); @@ -147,9 +145,20 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte } catch (EndOfFile e) { } catch (ScannerException e) { } - - char [][] qualifications = new char[1][]; - return new ClassDeclarationPattern( name.toCharArray(), (char[][])list.toArray( qualifications ), null, matchMode, caseSensitive ); + + ClassKind kind = null; + if( searchFor == CLASS ){ + kind = ClassKind.CLASS; + } else if( searchFor == STRUCT ) { + kind = ClassKind.STRUCT; + } else if ( searchFor == ENUM ) { + kind = ClassKind.ENUM; + } else if ( searchFor == UNION ) { + kind = ClassKind.UNION; + } + + char [][] qualifications = new char[0][]; + return new ClassDeclarationPattern( name.toCharArray(), (char[][])list.toArray( qualifications ), kind, matchMode, caseSensitive ); } protected boolean matchesName( char[] pattern, char[] name ){ diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java index 97935a1d37a..8f02ee33bfb 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java @@ -58,24 +58,36 @@ public class ClassDeclarationPattern extends CSearchPattern { //check containing scopes String [] qualifications = clsSpec.getFullyQualifiedName(); - int size = containingTypes.length; - if( qualifications.length < size ) - return IMPOSSIBLE_MATCH; + if( qualifications != null ){ - for( int i = 0; i < containingTypes.length; i++ ){ - if( !matchesName( containingTypes[i], qualifications[i].toCharArray() ) ){ + int size = containingTypes.length; + if( qualifications.length < size ) return IMPOSSIBLE_MATCH; + + for( int i = 0; i < containingTypes.length; i++ ){ + if( !matchesName( containingTypes[i], qualifications[i].toCharArray() ) ){ + return IMPOSSIBLE_MATCH; + } } + } else if( containingTypes.length > 0 ) { + return IMPOSSIBLE_MATCH; } //check type - if( classKind != clsSpec.getClassKind() ){ + if( classKind != null && classKind != clsSpec.getClassKind() ){ return IMPOSSIBLE_MATCH; } return ACCURATE_MATCH; } + public char [] getName() { + return simpleName; + } + public char[] [] getContainingTypes () { + return containingTypes; + } + private char[] simpleName; private char[][] containingTypes; private ClassKind classKind; diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java index cb0a7ec53ac..1931869dbe2 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java @@ -13,21 +13,33 @@ */ package org.eclipse.cdt.internal.core.search.matching; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.Arrays; +import java.util.HashMap; import java.util.LinkedList; +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.ISourceElementRequestor; +import org.eclipse.cdt.core.parser.ParserFactory; +import org.eclipse.cdt.core.parser.ParserMode; import org.eclipse.cdt.core.parser.ast.*; 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.internal.core.model.IWorkingCopy; +import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Path; @@ -88,15 +100,36 @@ public class MatchLocator implements ISourceElementRequestor { String includePath = inclusion.getFullFileName(); IPath path = new Path( includePath ); - IResource resource = workspaceRoot.findMember( path, true ); - if( resource != null ){ - resourceStack.addFirst( currentResource ); - currentResource = resource; + IResource resource = null; + + if( workspaceRoot != null ){ + resource = workspaceRoot.findMember( path, true ); + if( resource == null ){ + IFile file = workspaceRoot.getFile( path ); + try{ + file.createLink( path, 0, null ); + } catch ( CoreException e ){ + file = null; + } + resource = file; + } } + + resourceStack.addFirst( ( currentResource != null ) ? (Object)currentResource : (Object)currentPath ); + + currentResource = resource; + currentPath = ( resource == null ) ? path : null; } public void exitInclusion(IASTInclusion inclusion) { - currentResource = (IResource) resourceStack.removeFirst(); + Object obj = resourceStack.removeFirst(); + if( obj instanceof IResource ){ + currentResource = (IResource)obj; + currentPath = null; + } else { + currentPath = (IPath) obj; + currentResource = null; + } } public void enterClassSpecifier(IASTClassSpecifier classSpecification) { @@ -109,16 +142,100 @@ public class MatchLocator implements ISourceElementRequestor { } public void locateMatches( String [] paths, IWorkspace workspace, IWorkingCopy[] workingCopies ){ - workspaceRoot = workspace.getRoot(); + workspaceRoot = (workspace != null) ? workspace.getRoot() : null; + + HashMap wcPaths = new HashMap(); + int wcLength = (workingCopies == null) ? 0 : workingCopies.length; + if( wcLength > 0 ){ + String [] newPaths = new String[ wcLength ]; + + for( int i = 0; i < wcLength; i++ ){ + IWorkingCopy workingCopy = workingCopies[ i ]; + String path = workingCopy.getOriginalElement().getPath().toString(); + wcPaths.put( path, workingCopy ); + newPaths[ i ] = path; + } + + int len = paths.length; + String [] tempArray = new String[ len + wcLength ]; + System.arraycopy( paths, 0, tempArray, 0, len ); + System.arraycopy( newPaths, 0, tempArray, len, wcLength ); + paths = tempArray; + } + + Arrays.sort( paths ); + + int length = paths.length; + if( progressMonitor != null ){ + progressMonitor.beginTask( "", length ); + } + + for( int i = 0; i < length; i++ ){ + if( progressMonitor != null && progressMonitor.isCanceled() ){ + throw new OperationCanceledException(); + } + + String pathString = paths[ i ]; + + //skip duplicates + if( i > 0 && pathString.equals( paths[ i - 1 ] ) ) continue; + + Reader reader = null; + if( workspaceRoot != null ){ + IWorkingCopy workingCopy = (IWorkingCopy)wcPaths.get( pathString ); + + if( workingCopy != null ){ + currentResource = workingCopy.getOriginalElement().getResource(); + } else { + currentResource = workspaceRoot.findMember( pathString, true ); + } + + try{ + if( currentResource == null ){ + IPath path = new Path( pathString ); + IFile file = workspaceRoot.getFile( path ); + file.createLink( path, 0, null ); + } + if( currentResource != null && currentResource instanceof IFile ){ + IFile file = (IFile) currentResource; + reader = new InputStreamReader( file.getContents() ); + } else continue; + } catch ( CoreException e ){ + continue; + } + } else { + IPath path = new Path( pathString ); + try { + currentPath = path; + reader = new FileReader( path.toFile() ); + } catch (FileNotFoundException e) { + continue; + } + } + + IScanner scanner = ParserFactory.createScanner( reader, pathString, null, null, ParserMode.QUICK_PARSE ); + IParser parser = ParserFactory.createParser( scanner, null, ParserMode.QUICK_PARSE ); + parser.setRequestor( this ); + + parser.parse(); + } } - protected void report( IASTOffsetableElement node, int accuracyLevel ){ + protected void report( IASTOffsetableNamedElement node, int accuracyLevel ){ try { - resultCollector.accept( currentResource, - node.getElementStartingOffset(), - node.getElementEndingOffset(), - null, - accuracyLevel ); + if( currentResource != null ){ + resultCollector.accept( currentResource, + node.getElementNameOffset(), + node.getElementNameOffset() + node.getName().length(), + null, + accuracyLevel ); + } else if( currentPath != null ){ + resultCollector.accept( currentPath, + node.getElementStartingOffset(), + node.getElementEndingOffset(), + null, + accuracyLevel ); + } } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -128,8 +245,9 @@ public class MatchLocator implements ISourceElementRequestor { private ICSearchPattern searchPattern; private ICSearchResultCollector resultCollector; private IProgressMonitor progressMonitor; - private IResource currentResource; + private IResource currentResource = null; + private IPath currentPath = null; private ICSearchScope searchScope; - private LinkedList resourceStack; + private LinkedList resourceStack = new LinkedList(); private IWorkspaceRoot workspaceRoot; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties index 5d86b689bed..f2ebd673cd7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties @@ -57,11 +57,9 @@ CSearchPage.searchFor.constructor= Co&nstructor CSearchPage.limitTo.label= Limit To CSearchPage.limitTo.declarations= Dec&larations -CSearchPage.limitTo.implementors= &Implementors +CSearchPage.limitTo.definitions= &Definitions CSearchPage.limitTo.references= &References CSearchPage.limitTo.allOccurrences= All &Occurrences -CSearchPage.limitTo.readReferences= Read A&ccess -CSearchPage.limitTo.writeReferences= Writ&e Access CSearchPage.expression.label= Se&arch string (* = any string, ? = any character): CSearchPage.expression.caseSensitive= Case sens&itive diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java index 8088974b781..6567e88248d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java @@ -33,21 +33,21 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation; * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ -public class CSearchOperation extends WorkspaceModifyOperation { +public class CSearchOperation extends WorkspaceModifyOperation implements ICSearchConstants{ - public CSearchOperation(IWorkspace workspace, ICElement element, int limitTo, ICSearchScope scope, String scopeDescription, CSearchResultCollector collector) { + public CSearchOperation(IWorkspace workspace, ICElement element, LimitTo limitTo, ICSearchScope scope, String scopeDescription, CSearchResultCollector collector) { this( workspace, limitTo, scope, scopeDescription, collector ); _elementPattern = element; } - public CSearchOperation(IWorkspace workspace, String pattern, boolean caseSensitive, int searchFor, int limitTo, ICSearchScope scope, String scopeDescription, CSearchResultCollector collector) { + public CSearchOperation(IWorkspace workspace, String pattern, boolean caseSensitive, SearchFor searchFor, LimitTo limitTo, ICSearchScope scope, String scopeDescription, CSearchResultCollector collector) { this( workspace, limitTo, scope, scopeDescription, collector ); _stringPattern = pattern; _caseSensitive = caseSensitive; _searchFor = searchFor; } - public CSearchOperation(IWorkspace workspace, int limitTo, ICSearchScope scope, String scopeDescription, CSearchResultCollector collector ){ + public CSearchOperation(IWorkspace workspace, LimitTo limitTo, ICSearchScope scope, String scopeDescription, CSearchResultCollector collector ){ _workspace = workspace; _limitTo = limitTo; _scope = scope; @@ -87,13 +87,13 @@ public class CSearchOperation extends WorkspaceModifyOperation { } String [] args = new String [] { desc, _scopeDescription }; - switch( _limitTo ){ - case ICSearchConstants.DECLARATIONS : - return CSearchMessages.getFormattedString( "CSearchOperation.singularDeclarationsPostfix", args ); //$NON_NLS-1$ - case ICSearchConstants.REFERENCES : - return CSearchMessages.getFormattedString( "CSearchOperation.singularReferencesPostfix", args ); //$NON_NLS-1$ - default: - return CSearchMessages.getFormattedString( "CSearchOperation.singularOccurencesPostfix", args ); //$NON_NLS-1$ + + if( _limitTo == DECLARATIONS ){ + return CSearchMessages.getFormattedString( "CSearchOperation.singularDeclarationsPostfix", args ); //$NON_NLS-1$ + } else if( _limitTo == REFERENCES ){ + return CSearchMessages.getFormattedString( "CSearchOperation.singularReferencesPostfix", args ); //$NON_NLS-1$ + } else { + return CSearchMessages.getFormattedString( "CSearchOperation.singularOccurencesPostfix", args ); //$NON_NLS-1$ } } @@ -110,13 +110,12 @@ public class CSearchOperation extends WorkspaceModifyOperation { } String [] args = new String [] { desc, "{0}", _scopeDescription }; - switch( _limitTo ){ - case ICSearchConstants.DECLARATIONS : - return CSearchMessages.getFormattedString( "CSearchOperation.pluralDeclarationsPostfix", args ); //$NON_NLS-1$ - case ICSearchConstants.REFERENCES : - return CSearchMessages.getFormattedString( "CSearchOperation.pluralReferencesPostfix", args ); //$NON_NLS-1$ - default: - return CSearchMessages.getFormattedString( "CSearchOperation.pluralOccurencesPostfix", args ); //$NON_NLS-1$ + if( _limitTo == DECLARATIONS ){ + return CSearchMessages.getFormattedString( "CSearchOperation.pluralDeclarationsPostfix", args ); //$NON_NLS-1$ + } else if ( _limitTo == REFERENCES ){ + return CSearchMessages.getFormattedString( "CSearchOperation.pluralReferencesPostfix", args ); //$NON_NLS-1$ + } else { + return CSearchMessages.getFormattedString( "CSearchOperation.pluralOccurencesPostfix", args ); //$NON_NLS-1$ } } @@ -138,8 +137,8 @@ public class CSearchOperation extends WorkspaceModifyOperation { private String _stringPattern; private String _scopeDescription; private boolean _caseSensitive; - private int _limitTo; - private int _searchFor; + private LimitTo _limitTo; + private SearchFor _searchFor; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java index 2e1671ec405..91aae843ccf 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java @@ -18,12 +18,14 @@ import java.io.IOException; import java.io.StringReader; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import org.eclipse.cdt.core.model.ICElement; 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.core.search.SearchFor; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.IAdaptable; @@ -229,21 +231,7 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons int index = fgPreviousSearchPatterns.size() - 1 - fPattern.getSelectionIndex(); fInitialData = (SearchPatternData) fgPreviousSearchPatterns.get( index ); - for (int i = 0; i < fSearchFor.length; i++) - fSearchFor[i].setSelection(false); - - for (int i = 0; i < fLimitTo.length; i++) - fLimitTo[i].setSelection(false); - - fSearchFor[ fInitialData.searchFor ].setSelection( true ); - setLimitTo( fInitialData.searchFor ); - fLimitTo[ fInitialData.limitTo ].setSelection( true ); - - fPattern.setText( fInitialData.pattern ); - fIsCaseSensitive = fInitialData.isCaseSensitive; - fCElement = fInitialData.cElement; - fCaseSensitive.setEnabled( fCElement == null ); - fCaseSensitive.setSelection( fInitialData.isCaseSensitive ); + updateSelections(); if( fInitialData.workingSets != null ) getContainer().setSelectedWorkingSets( fInitialData.workingSets ); @@ -272,43 +260,35 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons return result; } - private int getLimitTo() { + private LimitTo getLimitTo() { for (int i= 0; i < fLimitTo.length; i++) { if (fLimitTo[i].getSelection()) - return i; + return fLimitToValues[ i ]; } - return -1; + return null; } - private void setLimitTo(int searchFor) { - fLimitTo[ DECLARATIONS ].setEnabled( true ); - //fLimitTo[ IMPLEMENTORS ].setEnabled( false); - fLimitTo[ REFERENCES ].setEnabled( true ); - fLimitTo[ ALL_OCCURRENCES ].setEnabled( true ); - //fLimitTo[ READ_ACCESSES ].setEnabled( false); - //fLimitTo[ WRITE_ACCESSES ].setEnabled( false); + + private void setLimitTo( SearchFor searchFor ) { + HashSet set = new HashSet(); -// if (!(searchFor == TYPE || searchFor == INTERFACE) && fLimitTo[IMPLEMENTORS].getSelection()) { -// fLimitTo[ IMPLEMENTORS ].setSelection(false); -// fLimitTo[ REFERENCES ].setSelection(true); -// } -// -// if (!(searchFor == FIELD) && (getLimitTo() == READ_ACCESSES || getLimitTo() == WRITE_ACCESSES)) { -// fLimitTo[ getLimitTo()].setSelection(false); -// fLimitTo[ REFERENCES ].setSelection(true); -// } -// -// switch (searchFor) { -// case TYPE: -// case INTERFACE: -// fLimitTo[ IMPLEMENTORS ].setEnabled(true); -// break; -// case FIELD: -// fLimitTo[ READ_ACCESSES ].setEnabled(true); -// fLimitTo[ WRITE_ACCESSES ].setEnabled(true); -// break; -// default : -// break; -// } + if( searchFor == TYPE ){ + set.add( DECLARATIONS ); + set.add( REFERENCES ); + } else if ( searchFor == FUNCTION || searchFor == CONSTRUCTOR ) { + set.add( DECLARATIONS ); + set.add( DEFINITIONS ); + //set.add( REFERENCES ); + } else if( searchFor == NAMESPACE ) { + set.add( DECLARATIONS ); + set.add( REFERENCES ); + } else if( searchFor == MEMBER ) { + set.add( DECLARATIONS ); + set.add( REFERENCES ); + } + set.add( ALL_OCCURRENCES ); + + for( int i = 0; i < fLimitTo.length; i++ ) + fLimitTo[ i ].setEnabled( set.contains( fLimitToValues[ i ] ) ); } private Control createSearchFor(Composite parent) { @@ -334,13 +314,13 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons return result; } - private int getSearchFor() { + private SearchFor getSearchFor() { for (int i= 0; i < fSearchFor.length; i++) { - if (fSearchFor[i].getSelection()) - return i; + if( fSearchFor[i].getSelection() ) + return fSearchForValues[ i ]; } Assert.isTrue(false, "shouldNeverHappen"); //$NON-NLS-1$ - return -1; + return null; } public void setContainer(ISearchPageContainer container) { @@ -399,17 +379,28 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons private void initSelections() { fStructuredSelection = asStructuredSelection(); fInitialData = tryStructuredSelection( fStructuredSelection ); + updateSelections(); + } + + private void updateSelections(){ if (fInitialData == null) fInitialData = trySimpleTextSelection( getContainer().getSelection() ); if (fInitialData == null) fInitialData = getDefaultInitValues(); fCElement = fInitialData.cElement; + fIsCaseSensitive = fInitialData.isCaseSensitive; fCaseSensitive.setSelection( fInitialData.isCaseSensitive ); fCaseSensitive.setEnabled( fInitialData.cElement == null ); - fSearchFor[ fInitialData.searchFor ].setSelection( true ); + + for (int i = 0; i < fSearchFor.length; i++) + fSearchFor[i].setSelection( fSearchForValues[i] == fInitialData.searchFor ); + setLimitTo( fInitialData.searchFor ); - fLimitTo[ fInitialData.limitTo ].setSelection( true ); + + for (int i = 0; i < fLimitTo.length; i++) + fLimitTo[i].setSelection( fLimitToValues[i] == fInitialData.limitTo ); + fPattern.setText( fInitialData.pattern ); } @@ -456,13 +447,13 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons } catch (IOException ex) { text= ""; //$NON-NLS-1$ } - result= new SearchPatternData(TYPE, REFERENCES, fIsCaseSensitive, text, null); + result= new SearchPatternData( TYPE, REFERENCES, fIsCaseSensitive, text, null); } return result; } private SearchPatternData getDefaultInitValues() { - return new SearchPatternData(TYPE, REFERENCES, fIsCaseSensitive, "", null); //$NON-NLS-1$ + return new SearchPatternData( TYPE, REFERENCES, fIsCaseSensitive, "", null); //$NON-NLS-1$ } private String[] getPreviousSearchPatterns() { @@ -494,8 +485,8 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons if( element == null ) return null; - int searchFor = UNKNOWN; - int limitTo = UNKNOWN; + SearchFor searchFor = UNKNOWN_SEARCH_FOR; + LimitTo limitTo = UNKNOWN_LIMIT_TO; String pattern = null; switch( element.getElementType() ) { @@ -506,7 +497,7 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons break;*/ } - if( searchFor != UNKNOWN && limitTo != UNKNOWN && pattern != null ) + if( searchFor != UNKNOWN_SEARCH_FOR && limitTo != UNKNOWN_LIMIT_TO && pattern != null ) return new SearchPatternData( searchFor, limitTo, true, pattern, element ); return null; @@ -546,19 +537,19 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons } private static class SearchPatternData { - int searchFor; - int limitTo; + SearchFor searchFor; + LimitTo limitTo; String pattern; boolean isCaseSensitive; ICElement cElement; int scope; IWorkingSet[] workingSets; - public SearchPatternData(int s, int l, boolean i, String p, ICElement element) { + public SearchPatternData(SearchFor s, LimitTo l, boolean i, String p, ICElement element) { this(s, l, p, i, element, ISearchPageContainer.WORKSPACE_SCOPE, null); } - public SearchPatternData(int s, int l, String p, boolean i, ICElement element, int scope, IWorkingSet[] workingSets) { + public SearchPatternData(SearchFor s, LimitTo l, String p, boolean i, ICElement element, int scope, IWorkingSet[] workingSets) { searchFor= s; limitTo= l; pattern= p; @@ -573,9 +564,10 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons private final static String PAGE_NAME= "CSearchPage"; //$NON-NLS-1$ private final static String STORE_CASE_SENSITIVE= PAGE_NAME + "CASE_SENSITIVE"; //$NON-NLS-1$ - private static List fgPreviousSearchPatterns= new ArrayList(20); + private static List fgPreviousSearchPatterns = new ArrayList(20); private Button[] fSearchFor; + private SearchFor[] fSearchForValues = { TYPE, FUNCTION, NAMESPACE, CONSTRUCTOR, MEMBER }; private String[] fSearchForText= { CSearchMessages.getString("CSearchPage.searchFor.type"), //$NON-NLS-1$ CSearchMessages.getString("CSearchPage.searchFor.method"), //$NON-NLS-1$ @@ -584,13 +576,14 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons CSearchMessages.getString("CSearchPage.searchFor.field")}; //$NON-NLS-1$ private Button[] fLimitTo; + private LimitTo[] fLimitToValues = { DECLARATIONS, DEFINITIONS, REFERENCES, ALL_OCCURRENCES }; private String[] fLimitToText= { CSearchMessages.getString("CSearchPage.limitTo.declarations"), //$NON-NLS-1$ - CSearchMessages.getString("CSearchPage.limitTo.implementors"), //$NON-NLS-1$ + CSearchMessages.getString("CSearchPage.limitTo.definitions"), //$NON-NLS-1$ CSearchMessages.getString("CSearchPage.limitTo.references"), //$NON-NLS-1$ - CSearchMessages.getString("CSearchPage.limitTo.allOccurrences"), //$NON-NLS-1$ - CSearchMessages.getString("CSearchPage.limitTo.readReferences"), //$NON-NLS-1$ - CSearchMessages.getString("CSearchPage.limitTo.writeReferences")}; //$NON-NLS-1$ + CSearchMessages.getString("CSearchPage.limitTo.allOccurrences") }; //$NON-NLS-1$ + //CSearchMessages.getString("CSearchPage.limitTo.readReferences"), //$NON-NLS-1$ + //CSearchMessages.getString("CSearchPage.limitTo.writeReferences")}; //$NON-NLS-1$ private SearchPatternData fInitialData; private IStructuredSelection fStructuredSelection; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java index 47390cc1b56..892d5ecd362 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java @@ -15,12 +15,15 @@ package org.eclipse.cdt.internal.ui.search; import java.text.MessageFormat; import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.search.ICSearchResultCollector; import org.eclipse.core.resources.IMarker; 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.search.ui.IActionGroupFactory; import org.eclipse.search.ui.ISearchResultView; @@ -34,7 +37,6 @@ import org.eclipse.ui.actions.ActionGroup; * Window>Preferences>Java>Code Generation>Code and Comments */ public class CSearchResultCollector implements ICSearchResultCollector { - /** * */ @@ -94,6 +96,21 @@ public class CSearchResultCollector implements ICSearchResultCollector { _matchCount++; } + public void accept( + IPath path, + int start, + int end, + ICElement enclosingElement, + int accuracy) + throws CoreException + { + if( _matches == null ){ + _matches = new HashSet(); + } + + _matches.add( new Match( path.toString(), start, end ) ); + } + /* (non-Javadoc) * @see org.eclipse.cdt.core.search.ICSearchResultCollector#done() */ @@ -132,20 +149,38 @@ public class CSearchResultCollector implements ICSearchResultCollector { _operation = operation; } + public Set getMatches(){ + return _matches; + } + private class ActionGroupFactory implements IActionGroupFactory { public ActionGroup createActionGroup( ISearchResultView part ){ return new CSearchViewActionGroup( part ); } } + public static class Match { + public Match( String path, int start, int end ){ + this.path = path; + this.start = start; + this.end = end; + } + + public String path; + public int start; + public int end; + } + private static final String SEARCHING = CSearchMessages.getString("CSearchResultCollector.searching"); //$NON-NLS-1$ private static final String MATCH = CSearchMessages.getString("CSearchResultCollector.match"); //$NON-NLS-1$ private static final String MATCHES = CSearchMessages.getString("CSearchResultCollector.matches"); //$NON-NLS-1$ private static final String DONE = CSearchMessages.getString("CSearchResultCollector.done"); //$NON-NLS-1$ - + + private IProgressMonitor _monitor; private CSearchOperation _operation; private ISearchResultView _view; private int _matchCount; + private Set _matches; }