mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 16:56:04 +02:00
This patch is for the following bugs:
bug42836 - Navigate/search: prepopulate template classes from Outline... bug42902 - Search: Cannot find typedef bug43016 - Search: Cannot find macro declarations Core: - add Typedefs to index as Types with suffix T (bug42902) - added addTypedefReference to AbstractIndexer - modified bestTypePrefix in AbstractIndexer - added TYPEDEF_DECL, TYPEDEF_SUFFIX to IIndexConstants - modified acceptTypedefReference in SourceIndexerRequestor -Searching for Typedefs: (bug42902) - modified setElementInfo in BasicSearchResultCollector - added TYPEDEF to ICSearchConstants - modified CSearchPattern & ClassDeclarationPattern - implemented acceptTypedef* in MatchLocator Core.tests - updated testIndexContents and testIndexAll and added them back into the IndexManagerTests suite - modified resources/search/classDecl.cpp to include a typedef - added testbug42902_TypeDefs to ClassDeclarationPatternTests - updated testNamespaceReferenceInClassBaseClause in OtherPatternTests UI - modified performAction & determineInitValuesFrom in CSearchPage - modified getImage in CSearchResultLabelProvider
This commit is contained in:
parent
bc7648a24e
commit
7c1af2188d
19 changed files with 218 additions and 76 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
2003-09-13 Andrew Niefer
|
||||||
|
- added testBadParameterInfo to ParserSymbolTableTest
|
||||||
|
|
||||||
2003-09-12 Hoda Amer
|
2003-09-12 Hoda Amer
|
||||||
- Added lots of test cases to CompleteParseASTExpressionTest
|
- Added lots of test cases to CompleteParseASTExpressionTest
|
||||||
|
|
||||||
|
@ -6,9 +9,6 @@
|
||||||
Moved LokiFailures::testBug40419() to QuickParseASTTests.
|
Moved LokiFailures::testBug40419() to QuickParseASTTests.
|
||||||
Deleted LokiFailures as it was empty.
|
Deleted LokiFailures as it was empty.
|
||||||
|
|
||||||
2003-09-12 Andrew Niefer
|
|
||||||
- added testBadParameterInfo to ParserSymbolTableTest
|
|
||||||
|
|
||||||
2003-09-11 Andrew Niefer
|
2003-09-11 Andrew Niefer
|
||||||
Created search/SearchTestSuite
|
Created search/SearchTestSuite
|
||||||
Added SearchTestSuite to AutomatedIntegrationSuite and removed the individual search tests
|
Added SearchTestSuite to AutomatedIntegrationSuite and removed the individual search tests
|
||||||
|
|
|
@ -107,6 +107,8 @@ public class IndexManagerTests extends TestCase {
|
||||||
suite.addTest(new IndexManagerTests("testRefs"));
|
suite.addTest(new IndexManagerTests("testRefs"));
|
||||||
suite.addTest(new IndexManagerTests("testMacros"));
|
suite.addTest(new IndexManagerTests("testMacros"));
|
||||||
suite.addTest(new IndexManagerTests("testForwardDeclarations"));
|
suite.addTest(new IndexManagerTests("testForwardDeclarations"));
|
||||||
|
//suite.addTest(new IndexManagerTests("testIndexContents"));
|
||||||
|
//suite.addTest(new IndexManagerTests("testIndexAll"));
|
||||||
suite.addTest(new IndexManagerTests("testDependencyTree"));
|
suite.addTest(new IndexManagerTests("testDependencyTree"));
|
||||||
suite.addTest(new IndexManagerTests("testIndexShutdown"));
|
suite.addTest(new IndexManagerTests("testIndexShutdown"));
|
||||||
|
|
||||||
|
@ -193,7 +195,7 @@ public class IndexManagerTests extends TestCase {
|
||||||
IQueryResult[] qresults = ind.queryPrefix(prefix);
|
IQueryResult[] qresults = ind.queryPrefix(prefix);
|
||||||
IEntryResult[] eresults = ind.queryEntries(prefix);
|
IEntryResult[] eresults = ind.queryEntries(prefix);
|
||||||
String [] queryResultModel = {"IndexedFile(1: /IndexerTestProject/mail.cpp)"};
|
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)
|
if (qresults.length != queryResultModel.length)
|
||||||
fail("Query Result length different from model");
|
fail("Query Result length different from model");
|
||||||
|
@ -269,7 +271,7 @@ public class IndexManagerTests extends TestCase {
|
||||||
try {
|
try {
|
||||||
testProject.delete(true,monitor);
|
testProject.delete(true,monitor);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(5000);
|
||||||
testProject.delete(true,monitor);
|
testProject.delete(true,monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +336,7 @@ public class IndexManagerTests extends TestCase {
|
||||||
|
|
||||||
IEntryResult[] typerefreesults = ind.queryEntries(IIndexConstants.TYPE_REF);
|
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);
|
IEntryResult[] typedeclresults =ind.queryEntries(IIndexConstants.TYPE_DECL);
|
||||||
|
|
||||||
if (typedeclresults.length != typeDeclEntryResultModel.length)
|
if (typedeclresults.length != typeDeclEntryResultModel.length)
|
||||||
|
@ -345,7 +347,7 @@ public class IndexManagerTests extends TestCase {
|
||||||
assertEquals(typeDeclEntryResultModel[i],typedeclresults[i].toString());
|
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);
|
IEntryResult[] typedefresults =ind.queryEntries(IIndexConstants.TYPEDEF_DECL);
|
||||||
|
|
||||||
if (typedefresults.length != typeDefEntryResultModel.length)
|
if (typedefresults.length != typeDefEntryResultModel.length)
|
||||||
|
@ -367,7 +369,7 @@ public class IndexManagerTests extends TestCase {
|
||||||
assertEquals(namespaceResultModel[i],namespaceresults[i].toString());
|
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);
|
IEntryResult[] fieldresults =ind.queryEntries(IIndexConstants.FIELD_DECL);
|
||||||
|
|
||||||
if (fieldresults.length != fieldResultModel.length)
|
if (fieldresults.length != fieldResultModel.length)
|
||||||
|
@ -378,7 +380,7 @@ public class IndexManagerTests extends TestCase {
|
||||||
assertEquals(fieldResultModel[i],fieldresults[i].toString());
|
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);
|
IEntryResult[] functionresults =ind.queryEntries(IIndexConstants.FUNCTION_DECL);
|
||||||
|
|
||||||
if (functionresults.length != functionResultModel.length)
|
if (functionresults.length != functionResultModel.length)
|
||||||
|
@ -389,7 +391,25 @@ public class IndexManagerTests extends TestCase {
|
||||||
assertEquals(functionResultModel[i],functionresults[i].toString());
|
assertEquals(functionResultModel[i],functionresults[i].toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
String [] methodResultModel = {"EntryResult: word=methodDecl/operator<</Mail/Y/X/Z, refs={ 1 }","EntryResult: word=methodDecl/operator=/container/Y/X/Z, refs={ 1 }","EntryResult: word=methodDecl/operator[]/container/Y/X/Z, refs={ 1 }","EntryResult: word=methodDecl/print/Mail/Y/X/Z, refs={ 1 }"};
|
String [] methodResultModel = {"EntryResult: word=methodDecl/Mail/Mail/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/Unknown/Unknown/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/container/container/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/first_class/first_class/Y/X/Z, refs={ 1 }",
|
||||||
|
//"EntryResult: word=methodDecl/operator=/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/operator=/container/Y/X/Z, refs={ 1 }",
|
||||||
|
//"EntryResult: word=methodDecl/operator[]/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/operator[]/container/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/postcard/postcard/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/print/Mail/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/print/Unknown/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/print/first_class/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/print/postcard/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/size/container/Y/X/Z, refs={ 1 }",
|
||||||
|
"EntryResult: word=methodDecl/~container/container/Y/X/Z, refs={ 1 }" };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IEntryResult[] methodresults =ind.queryEntries(IIndexConstants.METHOD_DECL);
|
IEntryResult[] methodresults =ind.queryEntries(IIndexConstants.METHOD_DECL);
|
||||||
|
|
||||||
if (methodresults.length != methodResultModel.length)
|
if (methodresults.length != methodResultModel.length)
|
||||||
|
|
|
@ -41,7 +41,9 @@ namespace NS3{
|
||||||
}
|
}
|
||||||
|
|
||||||
A::B b1;
|
A::B b1;
|
||||||
NS::B b2;
|
|
||||||
|
typedef NS::B NS_B;
|
||||||
|
NS_B b2;
|
||||||
|
|
||||||
union u{
|
union u{
|
||||||
};
|
};
|
||||||
|
|
|
@ -274,5 +274,14 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
||||||
assertTrue( match.getParentName().equals("") );
|
assertTrue( match.getParentName().equals("") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testbug42902_TypeDefs(){
|
||||||
|
ICSearchPattern pattern = SearchEngine.createSearchPattern("NS_B", TYPEDEF, ALL_OCCURRENCES, true );
|
||||||
|
|
||||||
|
search( workspace, pattern, scope, resultCollector );
|
||||||
|
Set matches = resultCollector.getSearchResults();
|
||||||
|
|
||||||
|
assertEquals( matches.size(), 2 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ package org.eclipse.cdt.core.search.tests;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||||
import org.eclipse.cdt.core.search.IMatch;
|
import org.eclipse.cdt.core.search.IMatch;
|
||||||
|
@ -122,20 +123,16 @@ public class OtherPatternTests extends BaseSearchTest {
|
||||||
Set matches = resultCollector.getSearchResults();
|
Set matches = resultCollector.getSearchResults();
|
||||||
assertEquals( matches.size(), 2 );
|
assertEquals( matches.size(), 2 );
|
||||||
|
|
||||||
Iterator iter = matches.iterator();
|
TreeSet sorted = new TreeSet( matches );
|
||||||
|
|
||||||
|
Iterator iter = sorted.iterator();
|
||||||
IMatch match = (IMatch) iter.next();
|
IMatch match = (IMatch) iter.next();
|
||||||
if( match.getName().equals("b2") ){
|
|
||||||
assertTrue( match.getParentName().equals("") );
|
assertTrue( match.getName().equals( "C" ) );
|
||||||
match = (IMatch) iter.next();
|
assertTrue( match.getParentName().equals( "NS3" ));
|
||||||
assertTrue( match.getName().equals( "C" ) );
|
match = (IMatch) iter.next();
|
||||||
assertTrue( match.getParentName().equals( "NS3" ));
|
assertTrue( match.getName().equals( "NS_B" ) );
|
||||||
} else {
|
assertTrue( match.getParentName().equals( "" ));
|
||||||
assertTrue( match.getName().equals( "C" ) );
|
|
||||||
assertTrue( match.getParentName().equals( "NS3" ));
|
|
||||||
match = (IMatch) iter.next();
|
|
||||||
assertTrue( match.getName().equals( "b2" ) );
|
|
||||||
assertTrue( match.getParentName().equals( "" ));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFieldDeclaration(){
|
public void testFieldDeclaration(){
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2003-09-13 Andrew Niefer
|
||||||
|
- add Typedefs to index as Types with suffix T (bug42902)
|
||||||
|
- added addTypedefReference to AbstractIndexer
|
||||||
|
- modified bestTypePrefix in AbstractIndexer
|
||||||
|
- added TYPEDEF_DECL, TYPEDEF_SUFFIX to IIndexConstants
|
||||||
|
- modified acceptTypedefReference in SourceIndexerRequestor
|
||||||
|
|
||||||
2003-09-09 Andrew Niefer
|
2003-09-09 Andrew Niefer
|
||||||
Enumerator references
|
Enumerator references
|
||||||
- Added createEnumeratorFullyQualifiedName in AbstractIndexer
|
- Added createEnumeratorFullyQualifiedName in AbstractIndexer
|
||||||
|
|
|
@ -41,7 +41,8 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
|
||||||
final static int UNION = 3;
|
final static int UNION = 3;
|
||||||
final static int ENUM = 4;
|
final static int ENUM = 4;
|
||||||
final static int VAR = 5;
|
final static int VAR = 5;
|
||||||
|
final static int TYPEDEF = 6;
|
||||||
|
|
||||||
public static boolean VERBOSE = false;
|
public static boolean VERBOSE = false;
|
||||||
|
|
||||||
public AbstractIndexer() {
|
public AbstractIndexer() {
|
||||||
|
@ -185,6 +186,10 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
|
||||||
public void addNamespaceReference(IASTNamespaceDefinition namespace) {
|
public void addNamespaceReference(IASTNamespaceDefinition namespace) {
|
||||||
this.output.addRef(encodeEntry(namespace.getFullyQualifiedName(),NAMESPACE_REF,NAMESPACE_REF_LENGTH));
|
this.output.addRef(encodeEntry(namespace.getFullyQualifiedName(),NAMESPACE_REF,NAMESPACE_REF_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addTypedefReference( IASTTypedefDeclaration typedef ){
|
||||||
|
this.output.addRef( encodeTypeEntry( typedef.getFullyQualifiedName(), TYPEDEF, ICSearchConstants.REFERENCES) );
|
||||||
|
}
|
||||||
|
|
||||||
private void addSuperTypeReference(int modifiers, char[] packageName, char[] typeName, char[][] enclosingTypeNames, char classOrInterface, char[] superTypeName, char superClassOrInterface){
|
private void addSuperTypeReference(int modifiers, char[] packageName, char[] typeName, char[][] enclosingTypeNames, char classOrInterface, char[] superTypeName, char superClassOrInterface){
|
||||||
|
|
||||||
|
@ -265,6 +270,10 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
|
||||||
case (VAR):
|
case (VAR):
|
||||||
result[pos++] = VAR_SUFFIX;
|
result[pos++] = VAR_SUFFIX;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case (TYPEDEF):
|
||||||
|
result[pos++] = TYPEDEF_SUFFIX;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
result[pos++] = SEPARATOR;
|
result[pos++] = SEPARATOR;
|
||||||
//Encode in the following manner
|
//Encode in the following manner
|
||||||
|
@ -350,7 +359,7 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
|
||||||
* Type entries are encoded as follow: 'typeDecl/' ('C' | 'S' | 'U' ) '/' TypeName '/'
|
* Type entries are encoded as follow: 'typeDecl/' ('C' | 'S' | 'U' ) '/' TypeName '/'
|
||||||
* Current encoding is optimized for queries: all classes
|
* Current encoding is optimized for queries: all classes
|
||||||
*/
|
*/
|
||||||
public static final char[] bestTypePrefix( LimitTo limitTo, char[] typeName, char[][] containingTypes, ASTClassKind classKind, int matchMode, boolean isCaseSensitive) {
|
public static final char[] bestTypePrefix( SearchFor searchFor, LimitTo limitTo, char[] typeName, char[][] containingTypes, int matchMode, boolean isCaseSensitive) {
|
||||||
char [] prefix = null;
|
char [] prefix = null;
|
||||||
if( limitTo == DECLARATIONS ){
|
if( limitTo == DECLARATIONS ){
|
||||||
prefix = TYPE_DECL;
|
prefix = TYPE_DECL;
|
||||||
|
@ -359,21 +368,22 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
|
||||||
} else {
|
} else {
|
||||||
return TYPE_ALL;
|
return TYPE_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Class kind not provided, best we can do
|
char classType = 0;
|
||||||
if (classKind == null){
|
|
||||||
return prefix;
|
if( searchFor == ICSearchConstants.CLASS ){
|
||||||
}
|
classType = CLASS_SUFFIX;
|
||||||
|
} else if ( searchFor == ICSearchConstants.STRUCT ){
|
||||||
char classType=CLASS_SUFFIX;
|
|
||||||
if (classKind == ASTClassKind.STRUCT){
|
|
||||||
classType = STRUCT_SUFFIX;
|
classType = STRUCT_SUFFIX;
|
||||||
}
|
} else if ( searchFor == ICSearchConstants.UNION ){
|
||||||
else if (classKind == ASTClassKind.UNION){
|
|
||||||
classType = UNION_SUFFIX;
|
classType = UNION_SUFFIX;
|
||||||
}
|
} else if ( searchFor == ICSearchConstants.ENUM ){
|
||||||
else if (classKind == ASTClassKind.ENUM){
|
|
||||||
classType = ENUM_SUFFIX;
|
classType = ENUM_SUFFIX;
|
||||||
|
} else if ( searchFor == ICSearchConstants.TYPEDEF ){
|
||||||
|
classType = TYPEDEF_SUFFIX;
|
||||||
|
} else {
|
||||||
|
//could be TYPE or CLASS_STRUCT, best we can do for these is the prefix
|
||||||
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bestPrefix( prefix, classType, typeName, containingTypes, matchMode, isCaseSensitive );
|
return bestPrefix( prefix, classType, typeName, containingTypes, matchMode, isCaseSensitive );
|
||||||
|
|
|
@ -57,8 +57,8 @@ public interface IIndexConstants {
|
||||||
char[] METHOD_ALL= "method".toCharArray(); //$NON-NLS-1$
|
char[] METHOD_ALL= "method".toCharArray(); //$NON-NLS-1$
|
||||||
int METHOD_DECL_LENGTH = 11;
|
int METHOD_DECL_LENGTH = 11;
|
||||||
|
|
||||||
char[] TYPEDEF_DECL = "typedefDecl/".toCharArray(); //$NON-NLS-1$
|
char[] TYPEDEF_DECL = "typeDecl/T/".toCharArray(); //$NON-NLS-1$
|
||||||
int TYPEDEF_DECL_LENGTH = 12;
|
int TYPEDEF_DECL_LENGTH = 11;
|
||||||
|
|
||||||
char[] MACRO_DECL = "macroDecl/".toCharArray();
|
char[] MACRO_DECL = "macroDecl/".toCharArray();
|
||||||
int MACRO_DECL_LENGTH = 10;
|
int MACRO_DECL_LENGTH = 10;
|
||||||
|
@ -92,6 +92,7 @@ public interface IIndexConstants {
|
||||||
char STRUCT_SUFFIX = 'S';
|
char STRUCT_SUFFIX = 'S';
|
||||||
char ENUM_SUFFIX = 'E';
|
char ENUM_SUFFIX = 'E';
|
||||||
char UNION_SUFFIX = 'U';
|
char UNION_SUFFIX = 'U';
|
||||||
|
char TYPEDEF_SUFFIX = 'T';
|
||||||
|
|
||||||
char TYPE_SUFFIX = 0;
|
char TYPE_SUFFIX = 0;
|
||||||
char SEPARATOR= '/';
|
char SEPARATOR= '/';
|
||||||
|
|
|
@ -366,6 +366,8 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
|
||||||
*/
|
*/
|
||||||
public void acceptTypedefReference(IASTTypedefReference reference) {
|
public void acceptTypedefReference(IASTTypedefReference reference) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
if( reference.getReferencedElement() instanceof IASTTypedefDeclaration )
|
||||||
|
indexer.addTypedefReference( (IASTTypedefDeclaration) reference.getReferencedElement() );
|
||||||
|
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2003-09-13 Andrew Niefer
|
||||||
|
-Searching for Typedefs: (bug42902)
|
||||||
|
- modified setElementInfo in BasicSearchResultCollector
|
||||||
|
- added TYPEDEF to ICSearchConstants
|
||||||
|
- modified CSearchPattern & ClassDeclarationPattern
|
||||||
|
- implemented acceptTypedef* in MatchLocator
|
||||||
|
- modified BasicSearchMatch to implement Comparable
|
||||||
|
|
||||||
2003-09-11 Andrew Niefer
|
2003-09-11 Andrew Niefer
|
||||||
- Modified ICSearchResultCollector.createMatch to not take a parent parameter
|
- Modified ICSearchResultCollector.createMatch to not take a parent parameter
|
||||||
- modified BasicSearchResultCollector to create the parent string from the fully qualified name of the node
|
- modified BasicSearchResultCollector to create the parent string from the fully qualified name of the node
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
* To change the template for this generated type comment go to
|
* To change the template for this generated type comment go to
|
||||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
*/
|
*/
|
||||||
public class BasicSearchMatch implements IMatch {
|
public class BasicSearchMatch implements IMatch, Comparable {
|
||||||
|
|
||||||
public BasicSearchMatch() {
|
public BasicSearchMatch() {
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,25 @@ public class BasicSearchMatch implements IMatch {
|
||||||
return true;
|
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 name = null;
|
||||||
public String parentName = null;
|
public String parentName = null;
|
||||||
|
|
||||||
|
|
|
@ -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.IASTReference;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
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.cdt.core.parser.ast.IASTVariable;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -252,6 +253,8 @@ public class BasicSearchResultCollector implements ICSearchResultCollector {
|
||||||
match.type = ICElement.C_FUNCTION;
|
match.type = ICElement.C_FUNCTION;
|
||||||
IASTFunction function = (IASTFunction)node;
|
IASTFunction function = (IASTFunction)node;
|
||||||
match.isStatic = function.isStatic();
|
match.isStatic = function.isStatic();
|
||||||
|
} else if ( node instanceof IASTTypedefDeclaration ){
|
||||||
|
match.type = ICElement.C_TYPEDEF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,8 @@ public interface ICSearchConstants {
|
||||||
|
|
||||||
public static final SearchFor CLASS_STRUCT = new SearchFor( 11 );
|
public static final SearchFor CLASS_STRUCT = new SearchFor( 11 );
|
||||||
|
|
||||||
|
public static final SearchFor TYPEDEF = new SearchFor( 12 );
|
||||||
|
|
||||||
/* Nature of match */
|
/* Nature of match */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -90,7 +90,10 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
||||||
}
|
}
|
||||||
|
|
||||||
CSearchPattern pattern = null;
|
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 );
|
pattern = createClassPattern( patternString, searchFor, limitTo, matchMode, caseSensitive );
|
||||||
} else if ( searchFor == METHOD || searchFor == FUNCTION ){
|
} else if ( searchFor == METHOD || searchFor == FUNCTION ){
|
||||||
pattern = createMethodPattern( patternString, searchFor, limitTo, matchMode, caseSensitive );
|
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 ) );
|
orPattern.addPattern( createClassPattern( patternString, STRUCT, limitTo, matchMode, caseSensitive ) );
|
||||||
return orPattern;
|
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 );
|
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 ){
|
if( token != null ){
|
||||||
|
boolean nullifyToken = true;
|
||||||
if( token.getType() == IToken.t_class ){
|
if( token.getType() == IToken.t_class ){
|
||||||
kind = ASTClassKind.CLASS;
|
searchFor = CLASS;
|
||||||
} else if ( token.getType() == IToken.t_struct ){
|
} else if ( token.getType() == IToken.t_struct ){
|
||||||
kind = ASTClassKind.STRUCT;
|
searchFor = STRUCT;
|
||||||
} else if ( token.getType() == IToken.t_union ){
|
} else if ( token.getType() == IToken.t_union ){
|
||||||
kind = ASTClassKind.UNION;
|
searchFor = UNION;
|
||||||
} else if ( token.getType() == IToken.t_enum ){
|
} else if ( token.getType() == IToken.t_enum ){
|
||||||
kind = ASTClassKind.ENUM;
|
searchFor = ENUM;
|
||||||
}
|
} else if ( token.getType() == IToken.t_typedef ){
|
||||||
if( kind != null ){
|
searchFor = TYPEDEF;
|
||||||
token = null;
|
|
||||||
} else {
|
} else {
|
||||||
if( searchFor == CLASS ){
|
nullifyToken = false;
|
||||||
kind = ASTClassKind.CLASS;
|
|
||||||
} else if( searchFor == STRUCT ) {
|
|
||||||
kind = ASTClassKind.STRUCT;
|
|
||||||
} else if ( searchFor == ENUM ) {
|
|
||||||
kind = ASTClassKind.ENUM;
|
|
||||||
} else if ( searchFor == UNION ) {
|
|
||||||
kind = ASTClassKind.UNION;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if( nullifyToken )
|
||||||
|
token = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedList list = scanForNames( scanner, token );
|
LinkedList list = scanForNames( scanner, token );
|
||||||
|
@ -299,7 +305,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
||||||
char[] name = (char [])list.removeLast();
|
char[] name = (char [])list.removeLast();
|
||||||
char [][] qualifications = new char[0][];
|
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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.IASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
|
import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
|
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.core.search.ICSearchScope;
|
||||||
import org.eclipse.cdt.internal.core.CharOperation;
|
import org.eclipse.cdt.internal.core.CharOperation;
|
||||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
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 class ClassDeclarationPattern extends CSearchPattern {
|
||||||
|
|
||||||
public ClassDeclarationPattern( int matchMode, boolean caseSensitive ){
|
// public ClassDeclarationPattern( int matchMode, boolean caseSensitive ){
|
||||||
super( matchMode, caseSensitive, DECLARATIONS );
|
// 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 );
|
super( mode, caseSensitive, limit );
|
||||||
|
|
||||||
simpleName = caseSensitive ? name : CharOperation.toLowerCase( name );
|
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 ){
|
public int matchLevel( ISourceElementCallbackDelegate node, LimitTo limit ){
|
||||||
|
if( searchFor == TYPEDEF ){
|
||||||
if( !( node instanceof IASTClassSpecifier ) && !( node instanceof IASTEnumerationSpecifier ) && !(node instanceof IASTElaboratedTypeSpecifier) )
|
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;
|
return IMPOSSIBLE_MATCH;
|
||||||
|
}
|
||||||
|
|
||||||
if( ! canAccept( limit ) )
|
if( ! canAccept( limit ) )
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
|
|
||||||
|
@ -71,9 +93,11 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
||||||
{
|
{
|
||||||
nodeName = ((IASTElaboratedTypeSpecifier)node).getName();
|
nodeName = ((IASTElaboratedTypeSpecifier)node).getName();
|
||||||
}
|
}
|
||||||
else
|
else if( node instanceof IASTOffsetableNamedElement )
|
||||||
{
|
{
|
||||||
nodeName = ((IASTOffsetableNamedElement)node).getName();
|
nodeName = ((IASTOffsetableNamedElement)node).getName();
|
||||||
|
} else {
|
||||||
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check name, if simpleName == null, its treated the same as "*"
|
//check name, if simpleName == null, its treated the same as "*"
|
||||||
|
@ -102,8 +126,7 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
||||||
} else if (node instanceof IASTElaboratedTypeSpecifier ){
|
} else if (node instanceof IASTElaboratedTypeSpecifier ){
|
||||||
IASTElaboratedTypeSpecifier elabTypeSpec = (IASTElaboratedTypeSpecifier) node;
|
IASTElaboratedTypeSpecifier elabTypeSpec = (IASTElaboratedTypeSpecifier) node;
|
||||||
return ( classKind == elabTypeSpec.getClassKind() ) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
|
return ( classKind == elabTypeSpec.getClassKind() ) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ACCURATE_MATCH;
|
return ACCURATE_MATCH;
|
||||||
|
@ -122,6 +145,7 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
||||||
private char[] simpleName;
|
private char[] simpleName;
|
||||||
private char[][] qualifications;
|
private char[][] qualifications;
|
||||||
private ASTClassKind classKind;
|
private ASTClassKind classKind;
|
||||||
|
private SearchFor searchFor;
|
||||||
|
|
||||||
protected char[] decodedSimpleName;
|
protected char[] decodedSimpleName;
|
||||||
private char[][] decodedContainingTypes;
|
private char[][] decodedContainingTypes;
|
||||||
|
@ -174,10 +198,10 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
||||||
|
|
||||||
public char[] indexEntryPrefix() {
|
public char[] indexEntryPrefix() {
|
||||||
return AbstractIndexer.bestTypePrefix(
|
return AbstractIndexer.bestTypePrefix(
|
||||||
|
searchFor,
|
||||||
getLimitTo(),
|
getLimitTo(),
|
||||||
simpleName,
|
simpleName,
|
||||||
qualifications,
|
qualifications,
|
||||||
classKind,
|
|
||||||
_matchMode,
|
_matchMode,
|
||||||
_caseSensitive
|
_caseSensitive
|
||||||
);
|
);
|
||||||
|
@ -186,6 +210,9 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
||||||
protected boolean matchIndexEntry() {
|
protected boolean matchIndexEntry() {
|
||||||
//check type matches
|
//check type matches
|
||||||
if( classKind == null ){
|
if( classKind == null ){
|
||||||
|
if( searchFor == TYPEDEF && decodedType != TYPEDEF_SUFFIX ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//don't match variable entries
|
//don't match variable entries
|
||||||
if( decodedType == VAR_SUFFIX ){
|
if( decodedType == VAR_SUFFIX ){
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -114,11 +114,8 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
|
||||||
public void acceptUsingDirective(IASTUsingDirective usageDirective) { }
|
public void acceptUsingDirective(IASTUsingDirective usageDirective) { }
|
||||||
public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) { }
|
public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) { }
|
||||||
public void acceptASMDefinition(IASTASMDefinition asmDefinition) { }
|
public void acceptASMDefinition(IASTASMDefinition asmDefinition) { }
|
||||||
public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) { }
|
|
||||||
|
|
||||||
public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) {}
|
public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) {}
|
||||||
public void acceptTypedefReference( IASTTypedefReference reference ) { }
|
|
||||||
|
|
||||||
public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) { }
|
public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) { }
|
||||||
public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) { }
|
public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) { }
|
||||||
public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) { }
|
public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) { }
|
||||||
|
@ -133,6 +130,15 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
|
||||||
public void exitCodeBlock(IASTCodeScope scope) { }
|
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){
|
public void acceptEnumeratorReference(IASTEnumeratorReference reference){
|
||||||
check( REFERENCES, reference );
|
check( REFERENCES, reference );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
2003-09-11 Andrew Niefer
|
||||||
- bug42837 - fixed populating search dialog on function declarations
|
- bug42837 - fixed populating search dialog on function declarations
|
||||||
- modified determineInitValuesFrom in CSearchPage
|
- modified determineInitValuesFrom in CSearchPage
|
||||||
|
|
|
@ -114,6 +114,10 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
|
||||||
for( int i = 0; i < fSearchFor.length - 1; i++ ){
|
for( int i = 0; i < fSearchFor.length - 1; i++ ){
|
||||||
searching.add( fSearchForValues[ i ] );
|
searching.add( fSearchForValues[ i ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//include those items not represented in the UI
|
||||||
|
searching.add( MACRO );
|
||||||
|
searching.add( TYPEDEF );
|
||||||
} else {
|
} else {
|
||||||
searching = data.searchFor;
|
searching = data.searchFor;
|
||||||
}
|
}
|
||||||
|
@ -529,19 +533,30 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
|
||||||
boolean forceMethod = ( pattern.indexOf("::") != -1 );
|
boolean forceMethod = ( pattern.indexOf("::") != -1 );
|
||||||
|
|
||||||
switch ( element.getElementType() ){
|
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_DECLARATION: /*fall through to function */
|
||||||
case ICElement.C_FUNCTION: if( forceMethod ) searchFor.add( METHOD );
|
case ICElement.C_FUNCTION: if( forceMethod ) searchFor.add( METHOD );
|
||||||
else searchFor.add( FUNCTION );
|
else searchFor.add( FUNCTION );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICElement.C_VARIABLE: searchFor.add( VAR ); 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_CLASS: searchFor.add( CLASS_STRUCT ); break;
|
||||||
|
|
||||||
case ICElement.C_UNION: searchFor.add( UNION ); break;
|
case ICElement.C_UNION: searchFor.add( UNION ); break;
|
||||||
|
|
||||||
case ICElement.C_ENUMERATOR: /* fall through to FIELD */
|
case ICElement.C_ENUMERATOR: /* fall through to FIELD */
|
||||||
case ICElement.C_FIELD: searchFor.add( FIELD ); break;
|
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_DECLARATION : /*fall through to METHOD */
|
||||||
case ICElement.C_METHOD: searchFor.add( METHOD ); break;
|
case ICElement.C_METHOD: searchFor.add( METHOD ); break;
|
||||||
|
|
||||||
case ICElement.C_NAMESPACE: searchFor.add( NAMESPACE ); break;
|
case ICElement.C_NAMESPACE: searchFor.add( NAMESPACE ); break;
|
||||||
|
|
||||||
|
default: searchFor.add( UNKNOWN_SEARCH_FOR ); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LimitTo limitTo = ALL_OCCURRENCES;
|
LimitTo limitTo = ALL_OCCURRENCES;
|
||||||
|
|
|
@ -76,6 +76,7 @@ public class CSearchResultLabelProvider extends LabelProvider {
|
||||||
case ICElement.C_FUNCTION: imageDescriptor = CPluginImages.DESC_OBJS_FUNCTION; break;
|
case ICElement.C_FUNCTION: imageDescriptor = CPluginImages.DESC_OBJS_FUNCTION; break;
|
||||||
case ICElement.C_VARIABLE: imageDescriptor = CPluginImages.DESC_OBJS_FIELD; break;
|
case ICElement.C_VARIABLE: imageDescriptor = CPluginImages.DESC_OBJS_FIELD; break;
|
||||||
case ICElement.C_ENUMERATOR: imageDescriptor = CPluginImages.DESC_OBJS_ENUMERATOR; 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:
|
case ICElement.C_FIELD:
|
||||||
{
|
{
|
||||||
switch( match.getVisibility() ){
|
switch( match.getVisibility() ){
|
||||||
|
|
Loading…
Add table
Reference in a new issue