diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index 4d905700af4..35b2745ba91 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -1,3 +1,6 @@ +2003-09-13 Andrew Niefer + - added testBadParameterInfo to ParserSymbolTableTest + 2003-09-12 Hoda Amer - Added lots of test cases to CompleteParseASTExpressionTest @@ -6,9 +9,6 @@ Moved LokiFailures::testBug40419() to QuickParseASTTests. Deleted LokiFailures as it was empty. -2003-09-12 Andrew Niefer - - added testBadParameterInfo to ParserSymbolTableTest - 2003-09-11 Andrew Niefer Created search/SearchTestSuite Added SearchTestSuite to AutomatedIntegrationSuite and removed the individual search tests diff --git a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexManagerTests.java b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexManagerTests.java index 00fcea22e63..ba28b81477c 100644 --- a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexManagerTests.java +++ b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexManagerTests.java @@ -107,6 +107,8 @@ public class IndexManagerTests extends TestCase { suite.addTest(new IndexManagerTests("testRefs")); suite.addTest(new IndexManagerTests("testMacros")); suite.addTest(new IndexManagerTests("testForwardDeclarations")); + //suite.addTest(new IndexManagerTests("testIndexContents")); + //suite.addTest(new IndexManagerTests("testIndexAll")); suite.addTest(new IndexManagerTests("testDependencyTree")); suite.addTest(new IndexManagerTests("testIndexShutdown")); @@ -193,7 +195,7 @@ public class IndexManagerTests extends TestCase { IQueryResult[] qresults = ind.queryPrefix(prefix); IEntryResult[] eresults = ind.queryEntries(prefix); String [] queryResultModel = {"IndexedFile(1: /IndexerTestProject/mail.cpp)"}; - String [] entryResultModel ={"EntryResult: word=typeDecl/C/Mail, refs={ 1 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 1 }", "EntryResult: word=typeDecl/C/container, refs={ 1 }", "EntryResult: word=typeDecl/C/first_class, refs={ 1 }", "EntryResult: word=typeDecl/C/postcard, refs={ 1 }"}; + String [] entryResultModel ={"EntryResult: word=typeDecl/C/Mail, refs={ 1 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 1 }", "EntryResult: word=typeDecl/C/container, refs={ 1 }", "EntryResult: word=typeDecl/C/first_class, refs={ 1 }", "EntryResult: word=typeDecl/C/postcard, refs={ 1 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 1 }", "EntryResult: word=typeDecl/V/x, refs={ 1 }"}; if (qresults.length != queryResultModel.length) fail("Query Result length different from model"); @@ -269,7 +271,7 @@ public class IndexManagerTests extends TestCase { try { testProject.delete(true,monitor); } catch (CoreException e) { - Thread.sleep(1000); + Thread.sleep(5000); testProject.delete(true,monitor); } @@ -334,7 +336,7 @@ public class IndexManagerTests extends TestCase { IEntryResult[] typerefreesults = ind.queryEntries(IIndexConstants.TYPE_REF); - String [] typeDeclEntryResultModel ={"EntryResult: word=typeDecl/C/Mail/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/C/Unknown/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/C/container/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/C/first_class/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/C/postcard/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/E/test/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/V/x/Z, refs={ 1 }"}; + String [] typeDeclEntryResultModel ={"EntryResult: word=typeDecl/C/Mail/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/C/Unknown/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/C/container/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/C/first_class/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/C/postcard/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/E/test/Y/X/Z, refs={ 1 }","EntryResult: word=typeDecl/T/int32, refs={ 1 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 1 }", "EntryResult: word=typeDecl/V/x, refs={ 1 }", "EntryResult: word=typeDecl/V/x/Z, refs={ 1 }"}; IEntryResult[] typedeclresults =ind.queryEntries(IIndexConstants.TYPE_DECL); if (typedeclresults.length != typeDeclEntryResultModel.length) @@ -345,7 +347,7 @@ public class IndexManagerTests extends TestCase { assertEquals(typeDeclEntryResultModel[i],typedeclresults[i].toString()); } - String [] typeDefEntryResultModel ={"EntryResult: word=typedefDecl/int32, refs={ 1 }"}; + String [] typeDefEntryResultModel ={"EntryResult: word=typeDecl/T/int32, refs={ 1 }"}; IEntryResult[] typedefresults =ind.queryEntries(IIndexConstants.TYPEDEF_DECL); if (typedefresults.length != typeDefEntryResultModel.length) @@ -367,7 +369,7 @@ public class IndexManagerTests extends TestCase { assertEquals(namespaceResultModel[i],namespaceresults[i].toString()); } - String [] fieldResultModel = {"EntryResult: word=fieldDecl/array/container/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/bye/test/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/cool/test/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/hi/test/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/index/container/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/postage/Mail/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/sz/container/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/type/Mail/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/why/test/Y/X/Z, refs={ 1 }"}; + String [] fieldResultModel = {"EntryResult: word=fieldDecl/array/container/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/bye/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/cool/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/hi/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/index/container/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/postage/Mail/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/sz/container/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/type/Mail/Y/X/Z, refs={ 1 }", "EntryResult: word=fieldDecl/why/Y/X/Z, refs={ 1 }"}; IEntryResult[] fieldresults =ind.queryEntries(IIndexConstants.FIELD_DECL); if (fieldresults.length != fieldResultModel.length) @@ -378,7 +380,7 @@ public class IndexManagerTests extends TestCase { assertEquals(fieldResultModel[i],fieldresults[i].toString()); } - String [] functionResultModel = {"EntryResult: word=functionDecl/doSomething, refs={ 1 }"}; + String [] functionResultModel = {"EntryResult: word=functionDecl/doSomething, refs={ 1 }", "EntryResult: word=functionDecl/main/Y/X/Z, refs={ 1 }"}; IEntryResult[] functionresults =ind.queryEntries(IIndexConstants.FUNCTION_DECL); if (functionresults.length != functionResultModel.length) @@ -389,7 +391,25 @@ public class IndexManagerTests extends TestCase { assertEquals(functionResultModel[i],functionresults[i].toString()); } - String [] methodResultModel = {"EntryResult: word=methodDecl/operator<Preferences>Java>Code Generation>Code and Comments */ -public class BasicSearchMatch implements IMatch { +public class BasicSearchMatch implements IMatch, Comparable { public BasicSearchMatch() { } @@ -77,6 +77,25 @@ public class BasicSearchMatch implements IMatch { return true; } + public int compareTo( Object o ){ + if( !( o instanceof BasicSearchMatch ) ){ + throw new ClassCastException(); + } + + BasicSearchMatch match = (BasicSearchMatch) o; + + String str1 = getLocation().toString(); + String str2 = match.getLocation().toString(); + + str1 += " " + getStartOffset()+ " "; + str2 += " " + match.getStartOffset()+ " "; + + str1 += getName() + " " + getParentName(); + str2 += match.getName() + " " + match.getParentName(); + + return str1.compareTo( str2 ); + } + public String name = null; public String parentName = null; diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java index bf55413df5f..cce2955e7fc 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java @@ -38,6 +38,7 @@ import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement; import org.eclipse.cdt.core.parser.ast.IASTReference; import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration; import org.eclipse.cdt.core.parser.ast.IASTVariable; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -252,6 +253,8 @@ public class BasicSearchResultCollector implements ICSearchResultCollector { match.type = ICElement.C_FUNCTION; IASTFunction function = (IASTFunction)node; match.isStatic = function.isStatic(); + } else if ( node instanceof IASTTypedefDeclaration ){ + match.type = ICElement.C_TYPEDEF; } } 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 788e6e8fa13..634369ff269 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 @@ -97,6 +97,8 @@ public interface ICSearchConstants { public static final SearchFor CLASS_STRUCT = new SearchFor( 11 ); + public static final SearchFor TYPEDEF = new SearchFor( 12 ); + /* Nature of match */ /** 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 2213778727e..f7969516059 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 @@ -90,7 +90,10 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte } CSearchPattern pattern = null; - if( searchFor == TYPE || searchFor == CLASS || searchFor == STRUCT || searchFor == ENUM || searchFor == UNION || searchFor == CLASS_STRUCT ){ + if( searchFor == TYPE || searchFor == CLASS || searchFor == STRUCT || + searchFor == ENUM || searchFor == UNION || searchFor == CLASS_STRUCT || + searchFor == TYPEDEF ) + { pattern = createClassPattern( patternString, searchFor, limitTo, matchMode, caseSensitive ); } else if ( searchFor == METHOD || searchFor == FUNCTION ){ pattern = createMethodPattern( patternString, searchFor, limitTo, matchMode, caseSensitive ); @@ -257,6 +260,15 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte orPattern.addPattern( createClassPattern( patternString, STRUCT, limitTo, matchMode, caseSensitive ) ); return orPattern; } +// else if( searchFor == TYPE ){ +// OrPattern orPattern = new OrPattern(); +// orPattern.addPattern( createClassPattern( patternString, CLASS, limitTo, matchMode, caseSensitive ) ); +// orPattern.addPattern( createClassPattern( patternString, STRUCT, limitTo, matchMode, caseSensitive ) ); +// orPattern.addPattern( createClassPattern( patternString, UNION, limitTo, matchMode, caseSensitive ) ); +// orPattern.addPattern( createClassPattern( patternString, ENUM, limitTo, matchMode, caseSensitive ) ); +// orPattern.addPattern( createClassPattern( patternString, TYPEDEF, limitTo, matchMode, caseSensitive ) ); +// return orPattern; +// } IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE, ParserLanguage.CPP, null ); @@ -270,28 +282,22 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte } if( token != null ){ + boolean nullifyToken = true; if( token.getType() == IToken.t_class ){ - kind = ASTClassKind.CLASS; + searchFor = CLASS; } else if ( token.getType() == IToken.t_struct ){ - kind = ASTClassKind.STRUCT; + searchFor = STRUCT; } else if ( token.getType() == IToken.t_union ){ - kind = ASTClassKind.UNION; + searchFor = UNION; } else if ( token.getType() == IToken.t_enum ){ - kind = ASTClassKind.ENUM; - } - if( kind != null ){ - token = null; + searchFor = ENUM; + } else if ( token.getType() == IToken.t_typedef ){ + searchFor = TYPEDEF; } else { - if( searchFor == CLASS ){ - kind = ASTClassKind.CLASS; - } else if( searchFor == STRUCT ) { - kind = ASTClassKind.STRUCT; - } else if ( searchFor == ENUM ) { - kind = ASTClassKind.ENUM; - } else if ( searchFor == UNION ) { - kind = ASTClassKind.UNION; - } + nullifyToken = false; } + if( nullifyToken ) + token = null; } LinkedList list = scanForNames( scanner, token ); @@ -299,7 +305,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte char[] name = (char [])list.removeLast(); char [][] qualifications = new char[0][]; - return new ClassDeclarationPattern( name, (char[][])list.toArray( qualifications ), kind, matchMode, limitTo, caseSensitive ); + return new ClassDeclarationPattern( name, (char[][])list.toArray( qualifications ), searchFor, limitTo, matchMode, caseSensitive ); } 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 ef31ede5ee5..d87f6f905de 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 @@ -22,6 +22,7 @@ import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement; import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement; +import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration; import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; @@ -37,11 +38,11 @@ import org.eclipse.cdt.internal.core.search.indexing.AbstractIndexer; public class ClassDeclarationPattern extends CSearchPattern { - public ClassDeclarationPattern( int matchMode, boolean caseSensitive ){ - super( matchMode, caseSensitive, DECLARATIONS ); - } +// public ClassDeclarationPattern( int matchMode, boolean caseSensitive ){ +// super( matchMode, caseSensitive, DECLARATIONS ); +// } - public ClassDeclarationPattern( char[] name, char[][] containers, ASTClassKind kind, int mode, LimitTo limit, boolean caseSensitive ){ + public ClassDeclarationPattern( char[] name, char[][] containers, SearchFor searchFor, LimitTo limit, int mode, boolean caseSensitive ){ super( mode, caseSensitive, limit ); simpleName = caseSensitive ? name : CharOperation.toLowerCase( name ); @@ -55,14 +56,35 @@ public class ClassDeclarationPattern extends CSearchPattern { } } - classKind = kind; + this.searchFor = searchFor; + + if( searchFor == CLASS ){ + classKind = ASTClassKind.CLASS; + } else if( searchFor == STRUCT ) { + classKind = ASTClassKind.STRUCT; + } else if ( searchFor == ENUM ) { + classKind = ASTClassKind.ENUM; + } else if ( searchFor == UNION ) { + classKind = ASTClassKind.UNION; + } else { + classKind = null; + } + } public int matchLevel( ISourceElementCallbackDelegate node, LimitTo limit ){ - - if( !( node instanceof IASTClassSpecifier ) && !( node instanceof IASTEnumerationSpecifier ) && !(node instanceof IASTElaboratedTypeSpecifier) ) + if( searchFor == TYPEDEF ){ + if( !( node instanceof IASTTypedefDeclaration ) ) + return IMPOSSIBLE_MATCH; + } else if( searchFor == ENUM ){ + if( !( node instanceof IASTEnumerationSpecifier ) ) + return IMPOSSIBLE_MATCH; + } else if ( !( node instanceof IASTClassSpecifier ) && + !( node instanceof IASTElaboratedTypeSpecifier ) ) + { return IMPOSSIBLE_MATCH; - + } + if( ! canAccept( limit ) ) return IMPOSSIBLE_MATCH; @@ -71,9 +93,11 @@ public class ClassDeclarationPattern extends CSearchPattern { { nodeName = ((IASTElaboratedTypeSpecifier)node).getName(); } - else + else if( node instanceof IASTOffsetableNamedElement ) { nodeName = ((IASTOffsetableNamedElement)node).getName(); + } else { + return IMPOSSIBLE_MATCH; } //check name, if simpleName == null, its treated the same as "*" @@ -102,8 +126,7 @@ public class ClassDeclarationPattern extends CSearchPattern { } else if (node instanceof IASTElaboratedTypeSpecifier ){ IASTElaboratedTypeSpecifier elabTypeSpec = (IASTElaboratedTypeSpecifier) node; return ( classKind == elabTypeSpec.getClassKind() ) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH; - - } + } } return ACCURATE_MATCH; @@ -122,6 +145,7 @@ public class ClassDeclarationPattern extends CSearchPattern { private char[] simpleName; private char[][] qualifications; private ASTClassKind classKind; + private SearchFor searchFor; protected char[] decodedSimpleName; private char[][] decodedContainingTypes; @@ -174,10 +198,10 @@ public class ClassDeclarationPattern extends CSearchPattern { public char[] indexEntryPrefix() { return AbstractIndexer.bestTypePrefix( + searchFor, getLimitTo(), simpleName, qualifications, - classKind, _matchMode, _caseSensitive ); @@ -186,6 +210,9 @@ public class ClassDeclarationPattern extends CSearchPattern { protected boolean matchIndexEntry() { //check type matches if( classKind == null ){ + if( searchFor == TYPEDEF && decodedType != TYPEDEF_SUFFIX ){ + return false; + } //don't match variable entries if( decodedType == VAR_SUFFIX ){ return false; 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 f5c85b0f465..06a0bf5b365 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 @@ -114,11 +114,8 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants public void acceptUsingDirective(IASTUsingDirective usageDirective) { } public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) { } public void acceptASMDefinition(IASTASMDefinition asmDefinition) { } - public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) { } - public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) {} - public void acceptTypedefReference( IASTTypedefReference reference ) { } - + public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) { } public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) { } public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) { } @@ -133,6 +130,15 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants public void exitCodeBlock(IASTCodeScope scope) { } + public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef){ + lastDeclaration = typedef; + check( DECLARATIONS, typedef ); + } + + public void acceptTypedefReference( IASTTypedefReference reference ){ + check( REFERENCES, reference ); + } + public void acceptEnumeratorReference(IASTEnumeratorReference reference){ check( REFERENCES, reference ); } diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 5472ed13481..90c15d32af7 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,10 @@ +2003-09-13 Andrew Niefer + - bug42836 - prepopulate template classes from Outline View + - bug43016 - Search: Cannot find macro declarations + - bug42902 - Search: Cannot find typedef + - modified performAction & determineInitValuesFrom in CSearchPage + - modified getImage in CSearchResultLabelProvider + 2003-09-11 Andrew Niefer - bug42837 - fixed populating search dialog on function declarations - modified determineInitValuesFrom in CSearchPage 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 84e547125ce..867c3326652 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 @@ -114,6 +114,10 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons for( int i = 0; i < fSearchFor.length - 1; i++ ){ searching.add( fSearchForValues[ i ] ); } + + //include those items not represented in the UI + searching.add( MACRO ); + searching.add( TYPEDEF ); } else { searching = data.searchFor; } @@ -529,19 +533,30 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons boolean forceMethod = ( pattern.indexOf("::") != -1 ); switch ( element.getElementType() ){ + case ICElement.C_TEMPLATE_FUNCTION: /*fall through to function */ case ICElement.C_FUNCTION_DECLARATION: /*fall through to function */ case ICElement.C_FUNCTION: if( forceMethod ) searchFor.add( METHOD ); else searchFor.add( FUNCTION ); break; + case ICElement.C_VARIABLE: searchFor.add( VAR ); break; - case ICElement.C_STRUCT: /* fall through to CLASS */ + + case ICElement.C_TEMPLATE_CLASS:/* fall through to CLASS */ + case ICElement.C_STRUCT: /* fall through to CLASS */ case ICElement.C_CLASS: searchFor.add( CLASS_STRUCT ); break; + case ICElement.C_UNION: searchFor.add( UNION ); break; + case ICElement.C_ENUMERATOR: /* fall through to FIELD */ case ICElement.C_FIELD: searchFor.add( FIELD ); break; + + case ICElement.C_TEMPLATE_METHOD : /*fall through to METHOD */ case ICElement.C_METHOD_DECLARATION : /*fall through to METHOD */ case ICElement.C_METHOD: searchFor.add( METHOD ); break; + case ICElement.C_NAMESPACE: searchFor.add( NAMESPACE ); break; + + default: searchFor.add( UNKNOWN_SEARCH_FOR ); break; } LimitTo limitTo = ALL_OCCURRENCES; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java index d0297dd8dab..967095c6f06 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java @@ -76,6 +76,7 @@ public class CSearchResultLabelProvider extends LabelProvider { case ICElement.C_FUNCTION: imageDescriptor = CPluginImages.DESC_OBJS_FUNCTION; break; case ICElement.C_VARIABLE: imageDescriptor = CPluginImages.DESC_OBJS_FIELD; break; case ICElement.C_ENUMERATOR: imageDescriptor = CPluginImages.DESC_OBJS_ENUMERATOR; break; + case ICElement.C_TYPEDEF: imageDescriptor = CPluginImages.DESC_OBJS_TYPEDEF; break; case ICElement.C_FIELD: { switch( match.getVisibility() ){