mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Fix for 92296 (Source Indexer doesn't encode definitions)
Fix fo 92628 (Definitions missing in new Search Engine) Got rid of FWD_CLASS, FWD_STRUCT and FWD_UNION encodings (updated all 3 indexers) Updated Indexer View (got rid of FWD declarations)
This commit is contained in:
parent
8fca28089c
commit
f20ffd5b51
28 changed files with 411 additions and 253 deletions
|
@ -592,7 +592,7 @@ import org.eclipse.core.runtime.Platform;
|
|||
|
||||
testProject.setSessionProperty(SourceIndexer.activationKey,new Boolean(true));
|
||||
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "Z", ICSearchConstants.TYPE, ICSearchConstants.DECLARATIONS, true );
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "Z", ICSearchConstants.TYPE, ICSearchConstants.DEFINITIONS, true );
|
||||
|
||||
search(workspace,pattern,scope,resultCollector);
|
||||
|
||||
|
|
|
@ -198,33 +198,35 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
IIndex ind = sourceIndexer.getIndex(testProject.getFullPath(),true,true);
|
||||
assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
|
||||
|
||||
IQueryResult[] qresults = ind.getPrefix(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
|
||||
IEntryResult[] eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
|
||||
IQueryResult[] qresults = ind.getPrefix(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
|
||||
IEntryResult[] eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
|
||||
IEntryResult[] eresultsDecls = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
|
||||
|
||||
assertTrue("Query Results exist", qresults != null); //$NON-NLS-1$
|
||||
assertTrue("Entry Results exist", eresults != null); //$NON-NLS-1$
|
||||
|
||||
String [] queryResultModel = {"IndexedFile(1: /IndexerTestProject/mail.cpp)"}; //$NON-NLS-1$
|
||||
String [] entryResultModel ={"EntryResult: word=typeDecl/C/Mail, refs={ 1 }, offsets={ [ 294] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/C/Unknown, refs={ 1 }, offsets={ [ 2738] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/C/container, refs={ 1 }, offsets={ [ 21084] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/C/first_class, refs={ 1 }, offsets={ [ 2506] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/C/postcard, refs={ 1 }, offsets={ [ 2298] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/C/Unknown, refs={ 1 }, offsets={ [ 2738] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/C/container, refs={ 1 }, offsets={ [ 21084] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/C/first_class, refs={ 1 }, offsets={ [ 2506] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/C/postcard, refs={ 1 }, offsets={ [ 2298] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/V/PO_Box, refs={ 1 }, offsets={ [ 21371] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/V/size, refs={ 1 }, offsets={ [ 21927] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/V/temp, refs={ 1 }, offsets={ [ 21964] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/V/x, refs={ 1 }, offsets={ [ 21201, 21526] }"}; //$NON-NLS-1$
|
||||
|
||||
String [] entryResultDeclsModel = {
|
||||
"EntryResult: word=typeDecl/D/Mail, refs={ 1 }, offsets={ [ 294] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/D/first_class, refs={ 1 }, offsets={ [ 2506] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/D/postcard, refs={ 1 }, offsets={ [ 2298] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/V/PO_Box, refs={ 1 }, offsets={ [ 21371] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/V/index, refs={ 1 }, offsets={ [ 21303, 21846] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/V/mail, refs={ 1 }, offsets={ [ 21336, 21912] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/V/size, refs={ 1 }, offsets={ [ 21927] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/V/temp, refs={ 1 }, offsets={ [ 21964] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/V/x, refs={ 1 }, offsets={ [ 21201, 21526] }"}; //$NON-NLS-1$
|
||||
|
||||
|
||||
String[] entryResultNameModel = {"Mail","Unknown","container","first_class","postcard","Mail","first_class","postcard","PO_Box","index","mail","size","temp","x"};
|
||||
};
|
||||
String[] entryResultNameModel = {"Mail","Unknown","container","first_class","postcard","PO_Box","size","temp","x"};
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_DERIVED,IIndex.TYPE_DERIVED,IIndex.TYPE_DERIVED, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR};
|
||||
int[] entryResultRefModel = {IIndex.DECLARATION};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR};
|
||||
int[] entryResultRefModel = {IIndex.DEFINITION};
|
||||
|
||||
if (qresults.length != queryResultModel.length)
|
||||
fail("Query Result length different from model"); //$NON-NLS-1$
|
||||
|
@ -232,6 +234,9 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
if (eresults.length != entryResultModel.length)
|
||||
fail("Entry Result length different from model"); //$NON-NLS-1$
|
||||
|
||||
if (eresultsDecls.length != entryResultDeclsModel.length)
|
||||
fail("Entry Result length different from model"); //$NON-NLS-1$
|
||||
|
||||
for (int i=0; i<qresults.length;i++)
|
||||
{
|
||||
assertEquals(queryResultModel[i],qresults[i].toString());
|
||||
|
@ -269,10 +274,10 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
String[] entryResultNameModel = {"CDocumentManager"};
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS};
|
||||
int[] entryResultRefModel = {IIndex.DECLARATION};
|
||||
int[] entryResultRefModel = {IIndex.DEFINITION};
|
||||
|
||||
IEntryResult[] eresults =ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION, name);
|
||||
IEntryResult[] bogRe = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
|
||||
IEntryResult[] eresults =ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DEFINITION, name);
|
||||
IEntryResult[] bogRe = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
|
||||
assertTrue("Entry Result exists", eresults != null); //$NON-NLS-1$
|
||||
|
||||
if (eresults.length != entryResultNameModel.length)
|
||||
|
@ -336,8 +341,10 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
|
||||
//Do a "before" deletion comparison
|
||||
//ind = indexManager.getIndex(testProjectPath,true,true);
|
||||
IEntryResult[] eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
|
||||
assertTrue("Entry result found for typdeDecl/", eresults != null); //$NON-NLS-1$
|
||||
IEntryResult[] eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
|
||||
IEntryResult[] eresultsDecls = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
|
||||
|
||||
assertTrue("Entry result found for typdeDefn/", eresults != null); //$NON-NLS-1$
|
||||
|
||||
String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }, offsets={ [ 2127] }",
|
||||
"EntryResult: word=typeDecl/C/Mail, refs={ 3 }, offsets={ [ 294] }",
|
||||
|
@ -355,10 +362,10 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
"EntryResult: word=typeDecl/V/temp, refs={ 3 }, offsets={ [ 21964] }",
|
||||
"EntryResult: word=typeDecl/V/x, refs={ 3 }, offsets={ [ 21201, 21526] }"};
|
||||
|
||||
String[] entryResultNameModel = {"CDocumentManager","Mail","Unknown","container","first_class","postcard","Mail","first_class","postcard","PO_Box","index","mail","size","temp","x"};
|
||||
String[] entryResultNameModel = {"CDocumentManager","Mail","Unknown","container","first_class","postcard","PO_Box", "size","temp","x"};
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_DERIVED,IIndex.TYPE_DERIVED,IIndex.TYPE_DERIVED, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR};
|
||||
int[] entryResultRefModel = {IIndex.DECLARATION};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR};
|
||||
int[] entryResultRefModel = {IIndex.DEFINITION};
|
||||
|
||||
if (eresults.length != entryResultNameModel.length)
|
||||
fail("Entry Result length different from model"); //$NON-NLS-1$
|
||||
|
@ -381,7 +388,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
|
||||
//See if the index is still there
|
||||
ind = sourceIndexer.getIndex(testProjectPath,true,true);
|
||||
eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
|
||||
eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION);
|
||||
assertTrue("Entry exists", eresults != null); //$NON-NLS-1$
|
||||
|
||||
String [] entryResultAfterModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }, offsets={ [ 2127] }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
@ -389,7 +396,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
String[] entryResultANameModel = {"CDocumentManager"};
|
||||
int[] entryResultAMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultATypeModel = {IIndex.TYPE_CLASS};
|
||||
int[] entryResultARefModel = {IIndex.DECLARATION};
|
||||
int[] entryResultARefModel = {IIndex.DEFINITION};
|
||||
|
||||
if (eresults.length != entryResultANameModel.length)
|
||||
fail("Entry Result length different from model"); //$NON-NLS-1$
|
||||
|
@ -416,26 +423,27 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
IEntryResult[] typerefreesults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.REFERENCE);
|
||||
assertTrue("Type Ref Results exist", typerefreesults != null); //$NON-NLS-1$
|
||||
|
||||
String[] entryResultNameModel = {"Mail/Y/X/Z", "Unknown/Y/X/Z", "container/Y/X/Z", "first_class/Y/X/Z", "postcard/Y/X/Z", "Mail/Y/X/Z",
|
||||
"first_class/Y/X/Z", "postcard/Y/X/Z", "test/Y/X/Z", "int32", "PO_Box", "index", "mail", "size", "temp", "x", "x/Z" };
|
||||
String[] entryResultDeclNameModel = {"Mail/Y/X/Z","first_class/Y/X/Z", "postcard/Y/X/Z", "test/Y/X/Z", "int32", "index", "mail",};
|
||||
String[] entryResultDefnNameModel = {"Mail/Y/X/Z", "Unknown/Y/X/Z", "container/Y/X/Z", "first_class/Y/X/Z", "postcard/Y/X/Z", "PO_Box", "size", "temp", "x", "x/Z" };
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS,
|
||||
IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_ENUM, IIndex.TYPE_TYPEDEF, IIndex.TYPE_VAR,
|
||||
IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR};
|
||||
int[] entryResultRefModel = {IIndex.DECLARATION};
|
||||
int[] entryResultDefnTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS,
|
||||
IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR};
|
||||
int[] entryResultDeclTypeModel = {IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_ENUM, IIndex.TYPE_TYPEDEF,IIndex.TYPE_VAR,IIndex.TYPE_VAR};
|
||||
|
||||
|
||||
IEntryResult[] typedeclresults =ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
|
||||
IEntryResult[] typedefinitionsresults = ind.getEntries(IIndex.TYPE, IIndex.ANY , IIndex.DEFINITION);
|
||||
assertTrue("Type Decl Results exist", typedeclresults != null); //$NON-NLS-1$
|
||||
|
||||
if (typedeclresults.length != entryResultNameModel.length)
|
||||
fail("Entry Result length different from model for typeDecl"); //$NON-NLS-1$
|
||||
if (typedefinitionsresults.length != entryResultDefnNameModel.length)
|
||||
fail("Entry Result length different from model for typeDefn"); //$NON-NLS-1$
|
||||
|
||||
for (int i=0;i<typedeclresults.length; i++)
|
||||
{
|
||||
assertEquals(entryResultNameModel[i],typedeclresults[i].getName());
|
||||
assertEquals(entryResultMetaModel[0],typedeclresults[i].getMetaKind());
|
||||
assertEquals(entryResultTypeModel[i],typedeclresults[i].getKind());
|
||||
assertEquals(entryResultRefModel[0],typedeclresults[i].getRefKind());
|
||||
assertEquals(entryResultDefnNameModel[i],typedefinitionsresults[i].getName());
|
||||
assertEquals(entryResultMetaModel[0],typedefinitionsresults[i].getMetaKind());
|
||||
assertEquals(entryResultDefnTypeModel[i],typedefinitionsresults[i].getKind());
|
||||
assertEquals(IIndex.DEFINITION,typedefinitionsresults[i].getRefKind());
|
||||
}
|
||||
|
||||
String[] entryResultTNameModel = {"int32" };
|
||||
|
@ -452,17 +460,17 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
|
||||
for (int i=0;i<typedefresults.length; i++)
|
||||
{
|
||||
assertEquals(entryResultNameModel[i],typedeclresults[i].getName());
|
||||
assertEquals(entryResultMetaModel[i],typedeclresults[i].getMetaKind());
|
||||
assertEquals(entryResultTypeModel[i],typedeclresults[i].getKind());
|
||||
assertEquals(entryResultRefModel[i],typedeclresults[i].getRefKind());
|
||||
assertEquals(entryResultTNameModel[i],typedefresults[i].getName());
|
||||
assertEquals(entryResultTMetaModel[i],typedefresults[i].getMetaKind());
|
||||
assertEquals(entryResultTTypeModel[i],typedefresults[i].getKind());
|
||||
assertEquals(entryResultTRefModel[i],typedefresults[i].getRefKind());
|
||||
}
|
||||
|
||||
String[] entryResultNNameModel = {"X/Z", "Y/X/Z" , "Z" };
|
||||
int[] entryResultNMetaModel = {IIndex.NAMESPACE};
|
||||
int[] entryResultNRefModel = {IIndex.DECLARATION};
|
||||
int[] entryResultNRefModel = {IIndex.DEFINITION};
|
||||
|
||||
IEntryResult[] namespaceresults =ind.getEntries(IIndex.NAMESPACE, IIndex.ANY, IIndex.DECLARATION);
|
||||
IEntryResult[] namespaceresults =ind.getEntries(IIndex.NAMESPACE, IIndex.ANY, IIndex.DEFINITION);
|
||||
assertTrue("Namespace Results exist", namespaceresults != null); //$NON-NLS-1$
|
||||
|
||||
if (namespaceresults.length != entryResultNNameModel.length)
|
||||
|
@ -477,9 +485,9 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
|
||||
String[] entryResultFNameModel = {"array/container/Y/X/Z", "index/container/Y/X/Z" , "postage/Mail/Y/X/Z","sz/container/Y/X/Z", "type/Mail/Y/X/Z"};
|
||||
int[] entryResultFMetaModel = {IIndex.FIELD};
|
||||
int[] entryResultFRefModel = {IIndex.DECLARATION};
|
||||
int[] entryResultFRefModel = {IIndex.DEFINITION};
|
||||
|
||||
IEntryResult[] fieldresults =ind.getEntries(IIndex.FIELD, IIndex.ANY, IIndex.DECLARATION);
|
||||
IEntryResult[] fieldresults =ind.getEntries(IIndex.FIELD, IIndex.ANY, IIndex.DEFINITION);
|
||||
assertTrue("Field Results exist", fieldresults != null); //$NON-NLS-1$
|
||||
|
||||
if (fieldresults.length != entryResultFNameModel.length)
|
||||
|
@ -510,7 +518,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(entryResultERefModel[0],enumeratorresults[i].getRefKind());
|
||||
}
|
||||
|
||||
String[] entryResultFNNameModel = {"doSomething", "main/Y/X/Z"};
|
||||
String[] entryResultFNNameModel = {"doSomething"};
|
||||
int[] entryResultFNMetaModel = {IIndex.FUNCTION};
|
||||
int[] entryResultFNRefModel = {IIndex.DECLARATION};
|
||||
|
||||
|
@ -527,24 +535,29 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
}
|
||||
|
||||
|
||||
String[] entryResultMNameModel = {"Mail/Mail/Y/X/Z", "Unknown/Unknown/Y/X/Z" , "container/container/Y/X/Z", "first_class/first_class/Y/X/Z",
|
||||
"operator =/container/Y/X/Z", "operator []/container/Y/X/Z","postcard/postcard/Y/X/Z","print/Mail/Y/X/Z", "print/Unknown/Y/X/Z",
|
||||
"print/first_class/Y/X/Z", "print/postcard/Y/X/Z", "size/container/Y/X/Z", "~container/container/Y/X/Z"};
|
||||
int[] entryResultMMetaModel = {IIndex.METHOD};
|
||||
int[] entryResultMRefModel = {IIndex.DECLARATION};
|
||||
String[] entryResultMNameDefnModel = {"Mail/Mail/Y/X/Z", "Unknown/Unknown/Y/X/Z" , "container/container/Y/X/Z", "first_class/first_class/Y/X/Z",
|
||||
"print/Unknown/Y/X/Z","print/first_class/Y/X/Z", "print/postcard/Y/X/Z", "size/container/Y/X/Z", "~container/container/Y/X/Z"};
|
||||
int[] entryResultMMetaDefnModel = {IIndex.METHOD};
|
||||
int[] entryResultMRefDefnModel = {IIndex.DEFINITION};
|
||||
|
||||
|
||||
String [] entryResultMNameDeclModel = {"operator =/container/Y/X/Z", "operator []/container/Y/X/Z","print/Mail/Y/X/Z"};
|
||||
int[] entryResultMMetaDeclModel = {IIndex.METHOD};
|
||||
int[] entryResultMRefDeclModel = {IIndex.DECLARATION};
|
||||
|
||||
IEntryResult[] methodresults =ind.getEntries(IIndex.METHOD, IIndex.ANY, IIndex.DECLARATION);
|
||||
assertTrue("Entry exists", methodresults != null); //$NON-NLS-1$
|
||||
|
||||
if (methodresults.length != entryResultMNameModel.length)
|
||||
if (methodresults.length != entryResultMNameDeclModel.length)
|
||||
fail("Entry Result length different from model for functionDecl"); //$NON-NLS-1$
|
||||
|
||||
for (int i=0;i<methodresults.length; i++)
|
||||
{
|
||||
assertEquals(entryResultMNameModel[i],methodresults[i].getName());
|
||||
assertEquals(entryResultMMetaModel[0],methodresults[i].getMetaKind());
|
||||
assertEquals(entryResultMRefModel[0],methodresults[i].getRefKind());
|
||||
assertEquals(entryResultMNameDeclModel[i],methodresults[i].getName());
|
||||
assertEquals(entryResultMMetaDeclModel[0],methodresults[i].getMetaKind());
|
||||
assertEquals(entryResultMRefDeclModel[0],methodresults[i].getRefKind());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testRefs() throws Exception{
|
||||
|
@ -556,9 +569,9 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
|
||||
assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
|
||||
|
||||
String[] entryResultNameModel = {"C/B/A", "e1/B/A", "ForwardA/A", "x/B/A"};
|
||||
String[] entryResultNameModel = {"C/B/A","ForwardA/A", "e1/B/A", "x/B/A"};
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_ENUM, IIndex.TYPE_FWD_CLASS, IIndex.TYPE_VAR};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_ENUM, IIndex.TYPE_VAR};
|
||||
int[] entryResultRefModel = {IIndex.REFERENCE};
|
||||
|
||||
|
||||
|
@ -663,8 +676,8 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
importFile("DepTest3.h","resources/dependency/DepTest3.h");//$NON-NLS-1$ //$NON-NLS-2$
|
||||
importFile("DepTest3.cpp","resources/dependency/DepTest3.cpp");//$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
IEntryResult[] eResult = ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION);
|
||||
IQueryResult[] qResult = ind.getPrefix(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION);
|
||||
IEntryResult[] eResult = ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DEFINITION);
|
||||
IQueryResult[] qResult = ind.getPrefix(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DEFINITION);
|
||||
|
||||
assertTrue("Expected 2 files indexed", qResult.length == 2); //$NON-NLS-1$
|
||||
assertTrue("Checking DepTest3.h location", qResult[0].getPath().equals("/IndexerTestProject/DepTest3.h")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
@ -792,13 +805,13 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
IPath testProjectPath = testProject.getFullPath();
|
||||
IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true);
|
||||
assertTrue("Index exists for project",ind != null); //$NON-NLS-1$
|
||||
IEntryResult[] fwdDclResults = ind.getEntries(IIndex.TYPE, IIndex.TYPE_FWD_CLASS, IIndex.DECLARATION, "ForwardA/A" ); //$NON-NLS-1$
|
||||
IEntryResult[] fwdDclResults = ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION, "ForwardA/A" ); //$NON-NLS-1$
|
||||
assertTrue("Entry exists",fwdDclResults != null); //$NON-NLS-1$
|
||||
|
||||
String [] fwdDclModel = {"EntryResult: word=typeDecl/G/ForwardA/A, refs={ 1 }, offsets={ [ 225] }"}; //$NON-NLS-1$
|
||||
String[] entryResultNameModel = {"ForwardA/A"};
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_FWD_CLASS};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS};
|
||||
int[] entryResultRefModel = {IIndex.DECLARATION};
|
||||
|
||||
if (fwdDclResults.length != fwdDclModel.length)
|
||||
|
@ -812,13 +825,13 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(entryResultRefModel[i],fwdDclResults[i].getRefKind());
|
||||
}
|
||||
|
||||
IEntryResult[] fwdDclRefResults = ind.getEntries(IIndex.TYPE, IIndex.TYPE_FWD_CLASS, IIndex.REFERENCE, "ForwardA/A"); //$NON-NLS-1$
|
||||
IEntryResult[] fwdDclRefResults = ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.REFERENCE, "ForwardA/A"); //$NON-NLS-1$
|
||||
assertTrue("Entry exists", fwdDclRefResults!= null); //$NON-NLS-1$
|
||||
|
||||
String [] fwdDclRefModel = {"EntryResult: word=typeRef/G/ForwardA/A, refs={ 1 }, offsets={ [ 237] }"}; //$NON-NLS-1$
|
||||
String[] entryResultName2Model = {"ForwardA/A"};
|
||||
int[] entryResultMeta2Model = {IIndex.TYPE};
|
||||
int[] entryResultType2Model = {IIndex.TYPE_FWD_CLASS};
|
||||
int[] entryResultType2Model = {IIndex.TYPE_CLASS};
|
||||
int[] entryResultRef2Model = {IIndex.REFERENCE};
|
||||
|
||||
if (fwdDclRefResults.length != fwdDclRefModel.length)
|
||||
|
|
|
@ -88,6 +88,7 @@ public class CodeReaderCacheTest extends CDOMBaseTest {
|
|||
parse(file);
|
||||
|
||||
ICodeReaderCache cache = CDOM.getInstance().getCodeReaderFactory(CDOM.PARSE_SAVED_RESOURCES).getCodeReaderCache();
|
||||
cache.flush();
|
||||
CodeReader reader = cache.get(file.getLocation().toOSString());
|
||||
assertNotNull(reader);
|
||||
assertEquals(cache.getCurrentSpace(), 1);
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.core.index.IIndexChangeListener;
|
|||
import org.eclipse.cdt.core.index.IIndexDelta;
|
||||
import org.eclipse.cdt.core.index.IndexChangeEvent;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||
import org.eclipse.cdt.core.search.BasicSearchResultCollector;
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||
|
@ -171,11 +172,11 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
suite.addTest( new SearchRegressionTests("testClassStructReference") ); //$NON-NLS-1$
|
||||
|
||||
suite.addTest( new SearchRegressionTests("testNamespaceDeclaration") ); //$NON-NLS-1$
|
||||
suite.addTest( new FailingTest( new SearchRegressionTests("testNamespaceDefinition"),92296)); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testNamespaceDefinition")); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testNamespaceReference") ); //$NON-NLS-1$
|
||||
|
||||
suite.addTest( new FailingTest( new SearchRegressionTests("testMethodDeclaration"), 92299) ); //$NON-NLS-1$
|
||||
suite.addTest( new FailingTest( new SearchRegressionTests("testMethodDefinition"), 92296)); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testMethodDeclaration")); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testMethodDefinition")); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testMethodReference") ); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testMethodReferenceOperator") ); //$NON-NLS-1$
|
||||
suite.addTest( new FailingTest( new SearchRegressionTests("testMethodReferenceImplicitOperator"), 80117 ) ); //defect80117 //$NON-NLS-1$
|
||||
|
@ -191,17 +192,17 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
suite.addTest( new SearchRegressionTests("testDestructorReference") ); //defect79792 //$NON-NLS-1$
|
||||
|
||||
suite.addTest( new SearchRegressionTests("testFunctionDeclaration") ); //$NON-NLS-1$
|
||||
suite.addTest( new FailingTest(new SearchRegressionTests("testFunctionDefinition"), 92296) ); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testFunctionDefinition")); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testFunctionReference") ); //$NON-NLS-1$
|
||||
|
||||
suite.addTest( new SearchRegressionTests("testFieldDeclaration") ); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testBitFieldDeclaration") ); //$NON-NLS-1$
|
||||
suite.addTest( new FailingTest(new SearchRegressionTests("testFieldDefinition"),92296 )); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testFieldDefinition")); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testFieldReference") ); //$NON-NLS-1$
|
||||
suite.addTest( new FailingTest( new SearchRegressionTests("testNestedFieldReference"), 76203 ) ); //defect76203//$NON-NLS-1$
|
||||
|
||||
suite.addTest( new SearchRegressionTests("testVarDeclaration") ); //$NON-NLS-1$
|
||||
suite.addTest( new FailingTest(new SearchRegressionTests("testVarDefinition"), 92296) ); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testVarDefinition")); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testVarReference") ); //$NON-NLS-1$
|
||||
suite.addTest( new SearchRegressionTests("testVarDeclarationArgument")); //defect75901 //$NON-NLS-1$
|
||||
//var in initializer list of constructor not found
|
||||
|
@ -275,7 +276,7 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
String code = writer.toString();
|
||||
IFile gh = importFile( "ClassStructDeclaration.h", code ); //$NON-NLS-1$
|
||||
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "N1::*", CLASS_STRUCT, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "N1::*", CLASS_STRUCT, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
Set matches = search( pattern );
|
||||
|
||||
assertEquals( 2, matches.size() );
|
||||
|
@ -364,7 +365,7 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
ICElement[] list = new ICElement[1];
|
||||
list[0]=cproject.getCProject();
|
||||
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", NAMESPACE, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", NAMESPACE, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
Set matches = search( pattern,list );
|
||||
|
||||
assertEquals( 3, matches.size() );
|
||||
|
@ -484,19 +485,17 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
ICElement[] list = new ICElement[1];
|
||||
list[0]=cproject.getCProject();
|
||||
Set matches = search(pattern,list);
|
||||
assertEquals( 3, matches.size());
|
||||
assertEquals( 1, matches.size());
|
||||
assertMatch( matches, gh, code.indexOf( "M/*dec1*/" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "M/*dec2*/" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "~M/*dec3*/" ) ); //$NON-NLS-1$
|
||||
|
||||
//vp2 method, static, inline
|
||||
pattern=SearchEngine.createSearchPattern("m*", METHOD, DECLARATIONS, true); //$NON-NLS-1$
|
||||
matches = search(pattern,list);
|
||||
assertEquals( 3, matches.size());
|
||||
assertEquals( 1, matches.size());
|
||||
assertMatch( matches, gh, code.indexOf( "m1/*dec4*/" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "m2/*dec5*/" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "m3/*dec6*/" ) ); //$NON-NLS-1$
|
||||
|
||||
//vp3 namespace scope, fully qualified search
|
||||
pattern=SearchEngine.createSearchPattern("N::C::m3", METHOD, DECLARATIONS, true); //$NON-NLS-1$
|
||||
pattern=SearchEngine.createSearchPattern("N::C::m3", METHOD, DEFINITIONS, true); //$NON-NLS-1$
|
||||
matches = search(pattern,list);
|
||||
assertEquals( 1, matches.size());
|
||||
assertMatch( matches, gh, code.indexOf( "m3/*dec6*/" ) ); //$NON-NLS-1$
|
||||
|
@ -556,11 +555,11 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
assertMatch( matches, cpp, code.indexOf( "foo/*def6*/" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, cpp, code.indexOf( "M/*def7*/" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, cpp, code.indexOf( "m1/*def8*/" ) ); //$NON-NLS-1$
|
||||
assertEquals( 8, matches.size());
|
||||
assertEquals( 9, matches.size());
|
||||
//vp2 operator with space in search pattern
|
||||
pattern=SearchEngine.createSearchPattern("operator |*", METHOD, DEFINITIONS, true); //$NON-NLS-1$
|
||||
matches = search(pattern, list);
|
||||
assertEquals( 1, matches.size());
|
||||
assertEquals( 2, matches.size());
|
||||
assertMatch( matches, cpp, code.indexOf( "operator|/*def1*/" ) ); //$NON-NLS-1$
|
||||
}
|
||||
// test SE50, SE100c
|
||||
|
@ -804,12 +803,12 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
ICElement[] list = new ICElement[1];
|
||||
list[0]=cproject.getCProject();
|
||||
Set matches = search( pattern,list );
|
||||
assertMatch( matches, h, header.indexOf( "f1" ) ); //$NON-NLS-1$
|
||||
//assertMatch( matches, h, header.indexOf( "f1" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, h, header.indexOf( "f2" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, h, header.indexOf( "f3" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, h, header.indexOf( "f4" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, cpp, source.indexOf( "f5" ) ); //$NON-NLS-1$
|
||||
assertEquals( 5, matches.size());
|
||||
//assertMatch( matches, h, header.indexOf( "f4" ) ); //$NON-NLS-1$
|
||||
//assertMatch( matches, cpp, source.indexOf( "f5" ) ); //$NON-NLS-1$
|
||||
assertEquals( 2, matches.size());
|
||||
|
||||
}
|
||||
public void testFunctionDefinition() throws Exception {
|
||||
|
@ -837,6 +836,12 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
ICElement[] list = new ICElement[1];
|
||||
list[0]=cproject.getCProject();
|
||||
Set matches = search( pattern,list );
|
||||
Iterator i = matches.iterator();
|
||||
while (i.hasNext()){
|
||||
BasicSearchMatch match =(BasicSearchMatch) i.next();
|
||||
int x=0;
|
||||
}
|
||||
|
||||
assertMatch( matches, h, header.indexOf( "f1" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, cpp, source.indexOf( "f2" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, h, header.indexOf( "f4" ) ); //$NON-NLS-1$
|
||||
|
@ -898,18 +903,17 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
String code = writer.toString();
|
||||
IFile gh = importFile( "FieldDeclaration.h", code ); //$NON-NLS-1$
|
||||
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern("*", FIELD, DECLARATIONS, true); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern("*", FIELD, DEFINITIONS, true); //$NON-NLS-1$
|
||||
ICElement[] list = new ICElement[1];
|
||||
list[0]=cproject.getCProject();
|
||||
Set matches = search( pattern,list);
|
||||
assertMatch( matches, gh, code.indexOf( "field1" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "field2" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "sfield" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "field3" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "field4" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "field5" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "field6" ) ); //$NON-NLS-1$
|
||||
assertEquals( 7, matches.size());
|
||||
assertEquals( 6, matches.size());
|
||||
|
||||
}
|
||||
public void testBitFieldDeclaration() throws Exception {
|
||||
|
@ -924,7 +928,7 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
String code = writer.toString();
|
||||
IFile cpp = importFile( "BitFieldDeclaration.cpp", code ); //$NON-NLS-1$
|
||||
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern("n*", FIELD, DECLARATIONS, true); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern("n*", FIELD, DEFINITIONS, true); //$NON-NLS-1$
|
||||
ICElement[] list = new ICElement[1];
|
||||
list[0]=cproject.getCProject();
|
||||
Set matches = search( pattern,list);
|
||||
|
@ -1077,14 +1081,8 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
ICElement[] list = new ICElement[1];
|
||||
list[0]=cproject.getCProject();
|
||||
Set matches = search( pattern,list);
|
||||
assertEquals( 7, matches.size());
|
||||
assertMatch( matches, gh, code.indexOf( "var1" ) ); //$NON-NLS-1$
|
||||
assertEquals( 1, matches.size());
|
||||
assertMatch( matches, gh, code.indexOf( "var2" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "var3" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "var4" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "var5" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "var6" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, gh, code.indexOf( "var7" ) ); //$NON-NLS-1$
|
||||
}
|
||||
// SE63a var field defn
|
||||
public void testVarDefinition() throws Exception {
|
||||
|
@ -1223,9 +1221,8 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
IFile z = importFile( "VarDeclarationArgument.cpp", code ); //$NON-NLS-1$
|
||||
ICSearchPattern pattern=SearchEngine.createSearchPattern("s", VAR, DEFINITIONS, true); //$NON-NLS-1$
|
||||
Set matches = search(pattern);
|
||||
assertEquals( 2, matches.size());
|
||||
assertMatch( matches, z, code.indexOf( "s/*def1*/" ) ); //$NON-NLS-1$
|
||||
assertMatch( matches, z, code.indexOf( "s/*def2*/" ) ); //$NON-NLS-1$
|
||||
//Changed to 0 as we no longer encode parameter strings as individual references
|
||||
assertEquals( 0, matches.size());
|
||||
|
||||
}
|
||||
|
||||
|
@ -1259,7 +1256,7 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
String code = writer.toString();
|
||||
IFile uh = importFile( "UnionDeclaration.h", code ); //$NON-NLS-1$
|
||||
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", UNION, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "*", UNION, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
ICElement[] list = new ICElement[1];
|
||||
list[0]=cproject.getCProject();
|
||||
Set matches = search( pattern,list );
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
}
|
||||
|
||||
public void testMatchSimpleDeclaration(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "A", TYPE, DECLARATIONS, true );
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "A", TYPE, DEFINITIONS, false );
|
||||
|
||||
assertTrue( pattern instanceof ClassDeclarationPattern );
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
}
|
||||
|
||||
public void testMatchNamespaceNestedDeclaration(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "NS::B", TYPE, DECLARATIONS, true );
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "NS::B", TYPE, DEFINITIONS, true );
|
||||
|
||||
assertTrue( pattern instanceof ClassDeclarationPattern );
|
||||
|
||||
|
@ -65,12 +65,11 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
Set matches = resultCollector.getSearchResults();
|
||||
//Changed to 2 since we also return Derived as a Typdecl
|
||||
assertEquals( 2, matches.size() );
|
||||
assertEquals( 1, matches.size() );
|
||||
}
|
||||
|
||||
public void testBug39652() {
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B", TYPE, DECLARATIONS, true );
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B", TYPE, DEFINITIONS, true );
|
||||
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
Set matches = resultCollector.getSearchResults();
|
||||
|
@ -79,13 +78,13 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
assertTrue( matches != null );
|
||||
assertTrue( matches.size() == 1 );
|
||||
|
||||
pattern = SearchEngine.createSearchPattern( "NS::NS2::a", TYPE, DECLARATIONS, true );
|
||||
pattern = SearchEngine.createSearchPattern( "NS::NS2::a", TYPE, DEFINITIONS, true );
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
matches = resultCollector.getSearchResults();
|
||||
assertTrue( matches != null );
|
||||
|
||||
pattern = SearchEngine.createSearchPattern( "NS::B::AA", TYPE, DECLARATIONS, true ); //TODO was NS::B::A, changed for bug 41445
|
||||
pattern = SearchEngine.createSearchPattern( "NS::B::AA", TYPE, DEFINITIONS, true ); //TODO was NS::B::A, changed for bug 41445
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
matches = resultCollector.getSearchResults();
|
||||
|
@ -93,7 +92,7 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
}
|
||||
|
||||
public void testMatchStruct(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "AA", STRUCT, DECLARATIONS, true ); //TODO was A, changed for bug 41445
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "AA", STRUCT, DEFINITIONS, true ); //TODO was A, changed for bug 41445
|
||||
|
||||
assertTrue( pattern instanceof ClassDeclarationPattern );
|
||||
|
||||
|
@ -102,7 +101,7 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
Set matches = resultCollector.getSearchResults();
|
||||
assertEquals( matches.size(), 1 );
|
||||
|
||||
pattern = SearchEngine.createSearchPattern( "NS::B::AA", TYPE, DECLARATIONS, true ); //TODO was 2, changed for bug 41445
|
||||
pattern = SearchEngine.createSearchPattern( "NS::B::AA", TYPE, DEFINITIONS, true ); //TODO was 2, changed for bug 41445
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
Set matches2 = resultCollector.getSearchResults();
|
||||
|
@ -121,13 +120,13 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
}
|
||||
|
||||
public void testWildcardQualification() {
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "::*::A", TYPE, DECLARATIONS, true );
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "::*::A", TYPE, DEFINITIONS, true );
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
Set matches = resultCollector.getSearchResults();
|
||||
assertEquals( matches.size(), 0 );
|
||||
|
||||
pattern = SearchEngine.createSearchPattern( "NS::*::A", TYPE, DECLARATIONS, false );
|
||||
pattern = SearchEngine.createSearchPattern( "NS::*::A", TYPE, DEFINITIONS, false );
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
matches = resultCollector.getSearchResults();
|
||||
|
@ -135,19 +134,19 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
}
|
||||
|
||||
public void testElaboratedType(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "struct AA", TYPE, DECLARATIONS, true ); //TODO was 2, changed for bug 41445
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "struct AA", TYPE, DEFINITIONS, true ); //TODO was 2, changed for bug 41445
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
Set matches = resultCollector.getSearchResults();
|
||||
assertEquals( matches.size(), 1 );
|
||||
|
||||
pattern = SearchEngine.createSearchPattern( "union u", TYPE, DECLARATIONS, true );
|
||||
pattern = SearchEngine.createSearchPattern( "union u", TYPE, DEFINITIONS, true );
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
matches = resultCollector.getSearchResults();
|
||||
assertEquals( matches.size(), 2 );
|
||||
|
||||
pattern = SearchEngine.createSearchPattern( "union ::*::u", TYPE, DECLARATIONS, true );
|
||||
pattern = SearchEngine.createSearchPattern( "union ::*::u", TYPE, DEFINITIONS, true );
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
matches = resultCollector.getSearchResults();
|
||||
|
@ -172,16 +171,15 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
}
|
||||
|
||||
public void testGloballyQualifiedItem(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "::A", TYPE, DECLARATIONS, true );
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "::A", TYPE, DEFINITIONS, true );
|
||||
assertTrue( pattern instanceof ClassDeclarationPattern );
|
||||
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
Set matches = resultCollector.getSearchResults();
|
||||
//Changed to 2 since we return 2 typeDecls - one typeDecl/C/A and one typeDecl/D/A
|
||||
assertEquals( matches.size(), 2 );
|
||||
assertEquals( matches.size(), 1 );
|
||||
|
||||
pattern = SearchEngine.createSearchPattern( "::u", TYPE, DECLARATIONS, true );
|
||||
pattern = SearchEngine.createSearchPattern( "::u", TYPE, DEFINITIONS, true );
|
||||
assertTrue( pattern instanceof ClassDeclarationPattern );
|
||||
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
@ -227,7 +225,7 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
|
|||
}
|
||||
|
||||
public void testHeadersVisitedTwice(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "Hea*", CLASS, DECLARATIONS, true );
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "Hea*", CLASS, DEFINITIONS, true );
|
||||
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
|
|
|
@ -44,14 +44,14 @@ public class OtherPatternTests extends BaseSearchTest {
|
|||
}
|
||||
|
||||
public void testNamespaceIndexPrefix(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B::c", NAMESPACE, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B::c", NAMESPACE, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
assertTrue( pattern instanceof NamespaceDeclarationPattern );
|
||||
|
||||
NamespaceDeclarationPattern nsPattern = (NamespaceDeclarationPattern)pattern;
|
||||
assertEquals( getSearchPattern(IIndex.NAMESPACE, IIndex.ANY, IIndex.DECLARATION, "c/B/A"), nsPattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.NAMESPACE, IIndex.ANY, IIndex.DEFINITION, "c/B/A"), nsPattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
|
||||
nsPattern = (NamespaceDeclarationPattern) SearchEngine.createSearchPattern( "::*::A::B::c", NAMESPACE, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.NAMESPACE, IIndex.ANY, IIndex.DECLARATION, "c/B/A/"), nsPattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
nsPattern = (NamespaceDeclarationPattern) SearchEngine.createSearchPattern( "::*::A::B::c", NAMESPACE, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.NAMESPACE, IIndex.ANY, IIndex.DEFINITION, "c/B/A/"), nsPattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
|
||||
nsPattern = (NamespaceDeclarationPattern) SearchEngine.createSearchPattern( "::RT*::c", NAMESPACE, REFERENCES, true ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.NAMESPACE, IIndex.ANY, IIndex.REFERENCE, "c/RT"), nsPattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
|
@ -95,7 +95,7 @@ public class OtherPatternTests extends BaseSearchTest {
|
|||
}
|
||||
|
||||
public void testNamespaceDeclaration(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "NS*", NAMESPACE, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "NS*", NAMESPACE, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class OtherPatternTests extends BaseSearchTest {
|
|||
}
|
||||
|
||||
public void testFieldDeclaration(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "a*Struct", FIELD, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "a*Struct", FIELD, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class OtherPatternTests extends BaseSearchTest {
|
|||
}
|
||||
|
||||
public void testVariableDeclaration(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "b?", VAR, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "b?", VAR, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
|
||||
|
@ -356,12 +356,12 @@ public class OtherPatternTests extends BaseSearchTest {
|
|||
}
|
||||
|
||||
public void testBug68235(){
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "bug68235::xTag", STRUCT, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "bug68235::xTag", STRUCT, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
Set matches = resultCollector.getSearchResults();
|
||||
assertEquals( matches.size(), 1 );
|
||||
|
||||
pattern = SearchEngine.createSearchPattern( "bug68235::yTag", STRUCT, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
pattern = SearchEngine.createSearchPattern( "bug68235::yTag", STRUCT, DEFINITIONS, true ); //$NON-NLS-1$
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
matches = resultCollector.getSearchResults();
|
||||
assertEquals( matches.size(), 1 );
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.internal.core.index.IIndexer;
|
|||
import org.eclipse.cdt.internal.core.index.impl.IndexDelta;
|
||||
import org.eclipse.cdt.internal.core.search.processing.IIndexJob;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
|
@ -78,6 +79,21 @@ public interface ICDTIndexer extends IIndexer {
|
|||
*/
|
||||
public void removeRequest(IProject project, IResourceDelta delta, int kind);
|
||||
|
||||
/**
|
||||
* Adds the given resource to the IProject's index
|
||||
*/
|
||||
public void addResource(IProject project, IResource resource);
|
||||
|
||||
/**
|
||||
* Removes the given resource from the IProject's index
|
||||
*/
|
||||
public void removeResource(IProject project, IResource resource);
|
||||
|
||||
/**
|
||||
* Attempts to add the resource type specified by the path to the project's index
|
||||
*/
|
||||
public void addResourceByPath(IProject project, IPath path, int resourceType);
|
||||
|
||||
/**
|
||||
* The <code>IndexManager</code> will send out a jobFinishedEvent to the indexer that
|
||||
* had scheduled the previous runnign job to give that indexer a chance to update its
|
||||
|
@ -141,4 +157,5 @@ public interface ICDTIndexer extends IIndexer {
|
|||
*/
|
||||
public void indexerRemoved(IProject project);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -51,9 +51,7 @@ public interface IIndex {
|
|||
final static int TYPE_TYPEDEF = 6;
|
||||
final static int TYPE_DERIVED = 7;
|
||||
final static int TYPE_FRIEND = 8;
|
||||
final static int TYPE_FWD_CLASS = 9;
|
||||
final static int TYPE_FWD_STRUCT = 10;
|
||||
final static int TYPE_FWD_UNION = 11;
|
||||
|
||||
|
||||
// type
|
||||
final static int UNKNOWN = 0;
|
||||
|
|
|
@ -66,10 +66,7 @@ public interface ICIndexStorageConstants {
|
|||
'V', // VAR
|
||||
'T', // TYPEDEF
|
||||
'D', // DERIVED
|
||||
'F', // FRIEND
|
||||
'G', // FWD_CLASS
|
||||
'H', // FWD_STRUCT
|
||||
'I' // FWD_UNION
|
||||
'F' // FRIEND
|
||||
};
|
||||
|
||||
final static String[] typeConstantNames = { "", // not used //$NON-NLS-1$
|
||||
|
@ -81,9 +78,6 @@ public interface ICIndexStorageConstants {
|
|||
"Typedef", //$NON-NLS-1$
|
||||
"Derived", //$NON-NLS-1$
|
||||
"Friend", //$NON-NLS-1$
|
||||
"FWD Class", //$NON-NLS-1$
|
||||
"FWD Struct", //$NON-NLS-1$
|
||||
"FWD Union" //$NON-NLS-1$
|
||||
};
|
||||
|
||||
final static String[] allSpecifiers = {"", //not used //$NON-NLS-1$
|
||||
|
|
|
@ -477,6 +477,8 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants
|
|||
char [] prefix = null;
|
||||
if( limitTo == DECLARATIONS ){
|
||||
prefix = encodeEntry(IIndex.TYPE, ANY, DECLARATION);
|
||||
} else if (limitTo == DEFINITIONS){
|
||||
prefix = encodeEntry(IIndex.TYPE, ANY, DEFINITION);
|
||||
} else if( limitTo == REFERENCES ){
|
||||
prefix = encodeEntry(IIndex.TYPE, ANY, REFERENCE);
|
||||
} else {
|
||||
|
@ -499,12 +501,6 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants
|
|||
classType = DERIVED_SUFFIX;
|
||||
} else if ( searchFor == ICSearchConstants.FRIEND){
|
||||
classType = FRIEND_SUFFIX;
|
||||
} else if ( searchFor == ICSearchConstants.FWD_CLASS) {
|
||||
classType = FWD_CLASS_SUFFIX;
|
||||
} else if ( searchFor == ICSearchConstants.FWD_STRUCT) {
|
||||
classType = FWD_STRUCT_SUFFIX;
|
||||
} else if ( searchFor == ICSearchConstants.FWD_UNION) {
|
||||
classType = FWD_UNION_SUFFIX;
|
||||
} else {
|
||||
//could be TYPE or CLASS_STRUCT, best we can do for these is the prefix
|
||||
return prefix;
|
||||
|
@ -517,8 +513,8 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants
|
|||
char [] prefix = null;
|
||||
if( limitTo == REFERENCES ){
|
||||
prefix = encodeEntry(IIndex.NAMESPACE, ANY, REFERENCE);
|
||||
} else if ( limitTo == DECLARATIONS ) {
|
||||
prefix = encodeEntry(IIndex.NAMESPACE, ANY, DECLARATION);
|
||||
} else if ( limitTo == DEFINITIONS ) {
|
||||
prefix = encodeEntry(IIndex.NAMESPACE, ANY, DEFINITION);
|
||||
} else {
|
||||
return encodeEntry(IIndex.NAMESPACE, ANY, ANY);
|
||||
}
|
||||
|
@ -532,6 +528,8 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants
|
|||
prefix = encodeEntry(IIndex.TYPE, ANY, REFERENCE);
|
||||
} else if( limitTo == DECLARATIONS ){
|
||||
prefix = encodeEntry(IIndex.TYPE, ANY, DECLARATION);
|
||||
} else if( limitTo == DEFINITIONS ){
|
||||
prefix = encodeEntry(IIndex.TYPE, ANY, DEFINITION);
|
||||
} else {
|
||||
return encodeEntry(IIndex.TYPE, ANY, ANY);
|
||||
}
|
||||
|
@ -545,6 +543,8 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants
|
|||
prefix = encodeEntry(IIndex.FIELD, ANY, REFERENCE);
|
||||
} else if( limitTo == DECLARATIONS ){
|
||||
prefix = encodeEntry(IIndex.FIELD, ANY, DECLARATION);
|
||||
} else if( limitTo == DEFINITIONS ){
|
||||
prefix = encodeEntry(IIndex.FIELD, ANY, DEFINITION);
|
||||
} else {
|
||||
return encodeEntry(IIndex.FIELD, ANY, ANY);
|
||||
}
|
||||
|
@ -576,8 +576,7 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants
|
|||
} else if( limitTo == DECLARATIONS ){
|
||||
prefix = encodeEntry(IIndex.METHOD, ANY, DECLARATION);
|
||||
} else if( limitTo == DEFINITIONS ){
|
||||
//TODO prefix = METHOD_DEF;
|
||||
return encodeEntry(IIndex.METHOD, ANY, ANY);
|
||||
return encodeEntry(IIndex.METHOD, ANY, DEFINITION);
|
||||
} else {
|
||||
return encodeEntry(IIndex.METHOD, ANY, ANY);
|
||||
}
|
||||
|
|
|
@ -162,11 +162,11 @@ class CTagEntry{
|
|||
typeEntry.setNameOffset(lineNumber, 1, IIndex.LINE);
|
||||
typeEntry.serialize(output);
|
||||
} else if (kind.equals(CTagsConsoleParser.MEMBER)){
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.FIELD, IIndex.DECLARATION,fullName,getModifiers(),fileNum);
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.FIELD, IIndex.DEFINITION,fullName,getModifiers(),fileNum);
|
||||
namedEntry.setNameOffset(lineNumber, 1, IIndex.LINE);
|
||||
namedEntry.serialize(output);
|
||||
} else if (kind.equals(CTagsConsoleParser.NAMESPACE)){
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.NAMESPACE, IIndex.DECLARATION,fullName,getModifiers(),fileNum);
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.NAMESPACE, IIndex.DEFINITION,fullName,getModifiers(),fileNum);
|
||||
namedEntry.setNameOffset(lineNumber, 1, IIndex.LINE);
|
||||
namedEntry.serialize(output);
|
||||
} else if (kind.equals(CTagsConsoleParser.PROTOTYPE)){
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.io.OutputStream;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.AbstractCExtension;
|
||||
|
@ -37,10 +38,12 @@ import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
|||
import org.eclipse.cdt.internal.core.search.indexing.ReadWriteMonitor;
|
||||
import org.eclipse.cdt.internal.core.search.processing.IIndexJob;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.resources.IResourceVisitor;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -97,9 +100,10 @@ public class CTagsIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
this.indexAll(project);
|
||||
break;
|
||||
|
||||
/*case ICDTIndexer.FOLDER:
|
||||
this.indexSourceFolder(element.getCProject().getProject(),element.getPath(),null);
|
||||
break;*/
|
||||
case ICDTIndexer.FOLDER:
|
||||
IFolder folder = (IFolder) delta.getResource();
|
||||
this.indexSourceFolder(project,folder);
|
||||
break;
|
||||
|
||||
|
||||
case ICDTIndexer.COMPILATION_UNIT:
|
||||
|
@ -115,6 +119,26 @@ public class CTagsIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
|
||||
}
|
||||
|
||||
public void indexSourceFolder(IProject project, IFolder folder) {
|
||||
|
||||
final HashSet indexables = new HashSet();
|
||||
try {
|
||||
folder.accept(new IResourceVisitor(){
|
||||
public boolean visit(IResource resource) throws CoreException {
|
||||
if (resource instanceof IFile)
|
||||
indexables.add(resource);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
} catch (CoreException e) {}
|
||||
|
||||
Iterator i = indexables.iterator();
|
||||
while (i.hasNext()){
|
||||
this.addSource((IFile) i.next(), project.getFullPath());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project
|
||||
*/
|
||||
|
@ -149,7 +173,7 @@ public class CTagsIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
IFile file = (IFile) delta.getResource();
|
||||
this.remove(file.getFullPath().toString(), file.getProject().getFullPath());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -509,4 +533,39 @@ public class CTagsIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
public void shutdown() {}
|
||||
}
|
||||
|
||||
public void addResource(IProject project, IResource resource) {
|
||||
|
||||
if (resource instanceof IProject){
|
||||
this.indexAll(project);
|
||||
}
|
||||
else if (resource instanceof IFolder){
|
||||
IFolder folder = (IFolder) resource;
|
||||
this.indexSourceFolder(project,folder);
|
||||
}
|
||||
else if (resource instanceof IFile){
|
||||
IFile file = (IFile) resource;
|
||||
this.addSource(file, project.getFullPath());
|
||||
}
|
||||
else {
|
||||
this.indexAll(project);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeResource(IProject project, IResource resource) {
|
||||
if (resource instanceof IProject){
|
||||
IPath fullPath = project.getFullPath();
|
||||
indexManager.discardJobs(fullPath.segment(0));
|
||||
indexStorage.removeIndexFamily(fullPath);
|
||||
}
|
||||
else if (resource instanceof IFile){
|
||||
IFile file = (IFile) resource;
|
||||
this.remove(file.getFullPath().toString(), file.getProject().getFullPath());
|
||||
}
|
||||
}
|
||||
|
||||
public void addResourceByPath(IProject project, IPath path, int resourceType) {
|
||||
//Nothing yet
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -162,12 +162,12 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
|||
case ICompositeType.k_struct:
|
||||
iEntryType = IIndex.TYPE_STRUCT;
|
||||
if (name.isDeclaration() && prop == IASTElaboratedTypeSpecifier.TYPE_NAME)
|
||||
iEntryType = IIndex.TYPE_FWD_STRUCT;
|
||||
iEntryType = IIndex.TYPE_STRUCT;
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
iEntryType = IIndex.TYPE_UNION;
|
||||
if (name.isDeclaration() && prop == IASTElaboratedTypeSpecifier.TYPE_NAME)
|
||||
iEntryType = IIndex.TYPE_FWD_UNION;
|
||||
iEntryType = IIndex.TYPE_UNION;
|
||||
break;
|
||||
}
|
||||
int modifiers = 0;
|
||||
|
|
|
@ -188,19 +188,19 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
|||
case ICPPClassType.k_class:
|
||||
iEntryType = IIndex.TYPE_CLASS;
|
||||
if (name.isDeclaration() && prop == IASTElaboratedTypeSpecifier.TYPE_NAME) {
|
||||
iEntryType = IIndex.TYPE_FWD_CLASS;
|
||||
iEntryType = IIndex.TYPE_CLASS;
|
||||
}
|
||||
break;
|
||||
case ICompositeType.k_struct:
|
||||
iEntryType = IIndex.TYPE_STRUCT;
|
||||
if (name.isDeclaration() && prop == IASTElaboratedTypeSpecifier.TYPE_NAME) {
|
||||
iEntryType = IIndex.TYPE_FWD_STRUCT;
|
||||
iEntryType = IIndex.TYPE_STRUCT;
|
||||
}
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
iEntryType = IIndex.TYPE_UNION;
|
||||
if (name.isDeclaration() && prop == IASTElaboratedTypeSpecifier.TYPE_NAME) {
|
||||
iEntryType = IIndex.TYPE_FWD_UNION;
|
||||
iEntryType = IIndex.TYPE_UNION;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,9 +43,6 @@ class IndexerOutputWrapper {
|
|||
private final static int TYPEDEF_CONST = 6;
|
||||
private final static int DERIVED_CONST = 7;
|
||||
private final static int FRIEND_CONST = 8;
|
||||
private final static int FWD_CLASS_CONST = 9;
|
||||
private final static int FWD_STRUCT_CONST = 10;
|
||||
private final static int FWD_UNION_CONST = 11;
|
||||
private final static int NAMESPACE_CONST = 12;
|
||||
private final static int ENUMERATOR_CONST = 13;
|
||||
private final static int FIELD_CONST = 14;
|
||||
|
@ -64,9 +61,6 @@ class IndexerOutputWrapper {
|
|||
final static EntryType TYPEDEF = new EntryType(TYPEDEF_CONST);
|
||||
final static EntryType DERIVED = new EntryType(DERIVED_CONST);
|
||||
final static EntryType FRIEND = new EntryType(FRIEND_CONST);
|
||||
final static EntryType FWD_CLASS = new EntryType(FWD_CLASS_CONST);
|
||||
final static EntryType FWD_STRUCT = new EntryType(FWD_STRUCT_CONST);
|
||||
final static EntryType FWD_UNION = new EntryType(FWD_UNION_CONST);
|
||||
final static EntryType NAMESPACE = new EntryType(NAMESPACE_CONST);
|
||||
final static EntryType ENUMERATOR = new EntryType(ENUMERATOR_CONST);
|
||||
final static EntryType FIELD = new EntryType(FIELD_CONST);
|
||||
|
@ -139,21 +133,6 @@ class IndexerOutputWrapper {
|
|||
typeEntry.setNameOffset(offset, length, offsetType);
|
||||
typeEntry.serialize(indexerOutput);
|
||||
break;
|
||||
case FWD_CLASS_CONST:
|
||||
typeEntry = new TypeEntry(IIndex.TYPE_FWD_CLASS ,entryKind, name, 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, length, offsetType);
|
||||
typeEntry.serialize(indexerOutput);
|
||||
break;
|
||||
case FWD_STRUCT_CONST:
|
||||
typeEntry = new TypeEntry(IIndex.TYPE_FWD_STRUCT ,entryKind, name, 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, length, offsetType);
|
||||
typeEntry.serialize(indexerOutput);
|
||||
break;
|
||||
case FWD_UNION_CONST:
|
||||
typeEntry = new TypeEntry(IIndex.TYPE_FWD_UNION ,entryKind, name, 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, length, offsetType);
|
||||
typeEntry.serialize(indexerOutput);
|
||||
break;
|
||||
case NAMESPACE_CONST:
|
||||
namedEntry = new NamedEntry(IIndex.NAMESPACE, entryKind, name, 0 /*getModifiers()*/, fileNumber);
|
||||
namedEntry.setNameOffset(offset, length, offsetType);
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.eclipse.cdt.internal.core.index.impl.IndexDelta;
|
|||
import org.eclipse.cdt.internal.core.search.processing.IIndexJob;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
|
@ -87,4 +88,19 @@ public class NullIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
|
||||
}
|
||||
|
||||
public void addResource(IProject project, IResource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void removeResource(IProject project, IResource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void addResourceByPath(IProject project, IPath path, int resourceType) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.cdt.internal.core.search.indexing.ReadWriteMonitor;
|
|||
import org.eclipse.cdt.internal.core.search.processing.IIndexJob;
|
||||
import org.eclipse.cdt.internal.core.sourcedependency.UpdateDependency;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
|
@ -629,4 +630,28 @@ public class SourceIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
removeIndexerProblems(project);
|
||||
}
|
||||
|
||||
public void addResource(IProject project, IResource resource) {
|
||||
|
||||
if (resource instanceof IProject){
|
||||
this.indexAll(project);
|
||||
}
|
||||
else if (resource instanceof IFolder){
|
||||
this.indexSourceFolder(project,resource.getFullPath(),null);
|
||||
}
|
||||
else if (resource instanceof IFile){
|
||||
IFile file = (IFile) resource;
|
||||
this.addSource(file, project.getFullPath());
|
||||
}
|
||||
}
|
||||
|
||||
public void removeResource(IProject project, IResource resource) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void addResourceByPath(IProject project, IPath path, int resourceType) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ public class SourceIndexerRequestor implements ISourceElementRequestor {
|
|||
//or if it occurs in another file
|
||||
int indexFlag = calculateIndexFlags();
|
||||
|
||||
indexer.addFunctionDeclaration(function,indexFlag);
|
||||
indexer.addFunctionDefinition(function,indexFlag);
|
||||
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ public class SourceIndexerRequestor implements ISourceElementRequestor {
|
|||
//or if it occurs in another file
|
||||
int indexFlag = calculateIndexFlags();
|
||||
|
||||
indexer.addMethodDeclaration(method, indexFlag);
|
||||
indexer.addMethodDefinition(method, indexFlag);
|
||||
}
|
||||
|
||||
public void exitMethodBody(IASTMethod method) {}
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.naming.Name;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ICLogConstants;
|
||||
import org.eclipse.cdt.core.index.IIndexDelta;
|
||||
|
@ -52,6 +54,7 @@ import org.eclipse.cdt.core.parser.ast.IASTFieldReference;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunctionReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTMacro;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
|
@ -313,7 +316,7 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
int offset = classSpecification.getNameOffset();
|
||||
int offsetLength = classSpecification.getNameEndOffset() - offset;
|
||||
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_CLASS,IIndex.DECLARATION, classSpecification.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_CLASS,IIndex.DEFINITION, classSpecification.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
//typeEntry.setBaseTypes(getInherits());
|
||||
typeEntry.serialize(output);
|
||||
|
@ -374,7 +377,7 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
int offset = classSpecification.getNameOffset();
|
||||
int offsetLength = classSpecification.getNameEndOffset() - offset;
|
||||
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_STRUCT,IIndex.DECLARATION, classSpecification.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_STRUCT,IIndex.DEFINITION, classSpecification.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
//typeEntry.setBaseTypes(getInherits());
|
||||
typeEntry.serialize(output);
|
||||
|
@ -384,7 +387,7 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
int offset = classSpecification.getNameOffset();
|
||||
int offsetLength = classSpecification.getNameEndOffset() - offset;
|
||||
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_UNION,IIndex.DECLARATION, classSpecification.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_UNION,IIndex.DEFINITION, classSpecification.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset,offsetLength, IIndex.OFFSET);
|
||||
//typeEntry.setBaseTypes(getInherits());
|
||||
typeEntry.serialize(output);
|
||||
|
@ -462,8 +465,16 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
int offset = variable.getNameOffset();
|
||||
int offsetLength = variable.getNameEndOffset() - offset;
|
||||
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_VAR ,IIndex.DECLARATION, variable.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
IASTInitializerClause initClause = variable.getInitializerClause();
|
||||
TypeEntry typeEntry;
|
||||
if ((variable.isExtern() && initClause == null )||
|
||||
variable.isStatic()){
|
||||
typeEntry = new TypeEntry(IIndex.TYPE_VAR ,IIndex.DECLARATION, variable.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
} else {
|
||||
typeEntry = new TypeEntry(IIndex.TYPE_VAR ,IIndex.DEFINITION, variable.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
}
|
||||
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
typeEntry.serialize(output);
|
||||
}
|
||||
|
||||
|
@ -500,9 +511,15 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
int offset = field.getNameOffset();
|
||||
int offsetLength = field.getNameEndOffset() - offset;
|
||||
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.FIELD, IIndex.DECLARATION, field.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
namedEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
namedEntry.serialize(output);
|
||||
if (field.isStatic()){
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.FIELD, IIndex.DECLARATION, field.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
namedEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
namedEntry.serialize(output);
|
||||
} else {
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.FIELD, IIndex.DEFINITION, field.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
namedEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
namedEntry.serialize(output);
|
||||
}
|
||||
}
|
||||
|
||||
public void addFieldReference(IASTFieldReference reference, int fileNumber) {
|
||||
|
@ -540,6 +557,30 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
}
|
||||
}
|
||||
|
||||
public void addMethodDefinition(IASTMethod method, int fileNumber) {
|
||||
int offset = method.getNameOffset();
|
||||
int offsetLength = method.getNameEndOffset() - offset;
|
||||
|
||||
FunctionEntry functionEntry = new FunctionEntry(IIndex.METHOD, IIndex.DEFINITION, method.getFullyQualifiedNameCharArrays(),0 /*getModifiers()*/, fileNumber);
|
||||
//funEntry.setSignature(getFunctionSignature());
|
||||
functionEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
functionEntry.serialize(output);
|
||||
|
||||
Iterator i=method.getParameters();
|
||||
while (i.hasNext()){
|
||||
Object parm = i.next();
|
||||
if (parm instanceof IASTParameterDeclaration){
|
||||
IASTParameterDeclaration parmDecl = (IASTParameterDeclaration) parm;
|
||||
offset = parmDecl.getNameOffset();
|
||||
offsetLength = parmDecl.getNameEndOffset() - offset;
|
||||
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_VAR ,IIndex.DECLARATION, new char[][]{parmDecl.getNameCharArray()}, 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
typeEntry.serialize(output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addMethodReference(IASTMethodReference reference, int fileNumber) {
|
||||
IASTMethod method = (IASTMethod) reference.getReferencedElement();
|
||||
int offset = reference.getOffset();
|
||||
|
@ -557,19 +598,19 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
|
||||
if (elaboratedType.getClassKind().equals(ASTClassKind.CLASS))
|
||||
{
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_FWD_CLASS ,IIndex.DECLARATION, elaboratedType.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_CLASS ,IIndex.DECLARATION, elaboratedType.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
typeEntry.serialize(output);
|
||||
}
|
||||
else if (elaboratedType.getClassKind().equals(ASTClassKind.STRUCT))
|
||||
{
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_FWD_STRUCT ,IIndex.DECLARATION, elaboratedType.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_STRUCT ,IIndex.DECLARATION, elaboratedType.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
typeEntry.serialize(output);
|
||||
}
|
||||
else if (elaboratedType.getClassKind().equals(ASTClassKind.UNION))
|
||||
{
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_FWD_UNION,IIndex.DECLARATION, elaboratedType.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_UNION,IIndex.DECLARATION, elaboratedType.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
typeEntry.serialize(output);
|
||||
}
|
||||
|
@ -613,6 +654,30 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
}
|
||||
}
|
||||
|
||||
public void addFunctionDefinition(IASTFunction function, int fileNumber){
|
||||
int offset = function.getNameOffset();
|
||||
int offsetLength = function.getNameEndOffset() - offset;
|
||||
|
||||
FunctionEntry functionEntry = new FunctionEntry(IIndex.FUNCTION, IIndex.DEFINITION, function.getFullyQualifiedNameCharArrays(),0 /*getModifiers()*/, fileNumber);
|
||||
//funEntry.setSignature(getFunctionSignature());
|
||||
functionEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
functionEntry.serialize(output);
|
||||
|
||||
/*Iterator i=function.getParameters();
|
||||
while (i.hasNext()){
|
||||
Object parm = i.next();
|
||||
if (parm instanceof IASTParameterDeclaration){
|
||||
IASTParameterDeclaration parmDecl = (IASTParameterDeclaration) parm;
|
||||
offset = parmDecl.getNameOffset();
|
||||
offsetLength = parmDecl.getNameEndOffset() - offset;
|
||||
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_VAR ,IIndex.DECLARATION, new char[][]{parmDecl.getNameCharArray()}, 0 getModifiers(), fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
typeEntry.serialize(output);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void addFunctionReference(IASTFunctionReference reference, int fileNumber){
|
||||
IASTFunction function=(IASTFunction) reference.getReferencedElement();
|
||||
int offset = reference.getOffset();
|
||||
|
@ -632,7 +697,7 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
int offset = namespace.getNameOffset();
|
||||
int offsetLength = namespace.getNameEndOffset() - offset;
|
||||
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.NAMESPACE, IIndex.DECLARATION, namespace.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.NAMESPACE, IIndex.DEFINITION, namespace.getFullyQualifiedNameCharArrays(), 0 /*getModifiers()*/, fileNumber);
|
||||
namedEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
namedEntry.serialize(output);
|
||||
}
|
||||
|
@ -720,19 +785,19 @@ public class SourceIndexerRunner extends AbstractIndexer {
|
|||
|
||||
if (classKind.equals(ASTClassKind.CLASS))
|
||||
{
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_FWD_CLASS ,IIndex.REFERENCE, fullyQualifiedName, 0 /*getModifiers()*/, fileNumber);
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_CLASS ,IIndex.REFERENCE, fullyQualifiedName, 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
typeEntry.serialize(output);
|
||||
}
|
||||
else if (classKind.equals(ASTClassKind.STRUCT))
|
||||
{
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_FWD_STRUCT ,IIndex.REFERENCE, fullyQualifiedName, 0 /*getModifiers()*/, fileNumber);
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_STRUCT ,IIndex.REFERENCE, fullyQualifiedName, 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
typeEntry.serialize(output);
|
||||
}
|
||||
else if (classKind.equals(ASTClassKind.UNION))
|
||||
{
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_FWD_UNION ,IIndex.REFERENCE, fullyQualifiedName, 0 /*getModifiers()*/, fileNumber);
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_UNION ,IIndex.REFERENCE, fullyQualifiedName, 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, offsetLength, IIndex.OFFSET);
|
||||
typeEntry.serialize(output);
|
||||
}
|
||||
|
|
|
@ -132,6 +132,40 @@ public class IndexManager extends JobManager{
|
|||
indexer.removeRequest(project, delta, kind);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @param element
|
||||
* @param delta
|
||||
*/
|
||||
public void addResource(IProject project, IResource resource) {
|
||||
//Get indexer for this project
|
||||
ICDTIndexer indexer = getIndexerForProject(project);
|
||||
|
||||
if (indexer != null)
|
||||
indexer.addResource(project, resource);
|
||||
}
|
||||
|
||||
public void addResourceByPath(IProject project, IPath path, int resourceType) {
|
||||
//Get indexer for this project
|
||||
ICDTIndexer indexer = getIndexerForProject(project);
|
||||
|
||||
if (indexer != null)
|
||||
indexer.addResourceByPath(project, path,resourceType);
|
||||
|
||||
}
|
||||
/**
|
||||
* @param project
|
||||
* @param element
|
||||
* @param delta
|
||||
*/
|
||||
public void removeResource(IProject project, IResource resource) {
|
||||
//Get the indexer for this project
|
||||
ICDTIndexer indexer = null;
|
||||
indexer = (ICDTIndexer) indexerMap.get(project);
|
||||
|
||||
if (indexer != null)
|
||||
indexer.removeResource(project, resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the background process
|
||||
|
@ -402,4 +436,5 @@ public class IndexManager extends JobManager{
|
|||
job.schedule();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -107,11 +107,6 @@ public interface ICSearchConstants {
|
|||
|
||||
public static final SearchFor FRIEND = new SearchFor( 16 );
|
||||
|
||||
public static final SearchFor FWD_CLASS = new SearchFor ( 17 );
|
||||
|
||||
public static final SearchFor FWD_STRUCT = new SearchFor ( 18 );
|
||||
|
||||
public static final SearchFor FWD_UNION = new SearchFor ( 19 );
|
||||
|
||||
/* Nature of match */
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
|||
|
||||
CSearchPattern pattern = null;
|
||||
if( searchFor == TYPE || searchFor == CLASS || searchFor == STRUCT ||
|
||||
searchFor == FWD_CLASS || searchFor == FWD_STRUCT || searchFor == FWD_UNION ||
|
||||
searchFor == ENUM || searchFor == UNION || searchFor == CLASS_STRUCT ||
|
||||
searchFor == TYPEDEF )
|
||||
{
|
||||
|
@ -171,7 +170,6 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
|||
private static CSearchPattern createNamespacePattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
|
||||
if( limitTo == ALL_OCCURRENCES ){
|
||||
OrPattern orPattern = new OrPattern();
|
||||
orPattern.addPattern( createNamespacePattern( patternString, DECLARATIONS, matchMode, caseSensitive ) );
|
||||
orPattern.addPattern( createNamespacePattern( patternString, DEFINITIONS, matchMode, caseSensitive ) );
|
||||
orPattern.addPattern( createNamespacePattern( patternString, REFERENCES, matchMode, caseSensitive ) );
|
||||
return orPattern;
|
||||
|
@ -332,6 +330,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
|||
if( limitTo == ALL_OCCURRENCES ){
|
||||
OrPattern orPattern = new OrPattern();
|
||||
orPattern.addPattern( createClassPattern( patternString, searchFor, DECLARATIONS, matchMode, caseSensitive ) );
|
||||
orPattern.addPattern( createClassPattern( patternString, searchFor, DEFINITIONS, matchMode, caseSensitive ) );
|
||||
orPattern.addPattern( createClassPattern( patternString, searchFor, REFERENCES, matchMode, caseSensitive ) );
|
||||
return orPattern;
|
||||
}
|
||||
|
@ -343,11 +342,6 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
|||
return orPattern;
|
||||
}
|
||||
|
||||
boolean isForward = false;
|
||||
if (searchFor == FWD_CLASS || searchFor == FWD_STRUCT || searchFor == FWD_UNION){
|
||||
isForward = true;
|
||||
}
|
||||
|
||||
char [] patternArray = patternString.toCharArray();
|
||||
|
||||
IScanner scanner =null;
|
||||
|
@ -396,10 +390,9 @@ 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 ), searchFor, limitTo, matchMode, caseSensitive, isForward );
|
||||
return new ClassDeclarationPattern( name, (char[][])list.toArray( qualifications ), searchFor, limitTo, matchMode, caseSensitive);
|
||||
}
|
||||
|
||||
|
||||
private static CSearchPattern createDerivedPattern(String patternString, SearchFor searchFor, LimitTo limitTo, int matchMode, boolean caseSensitive) {
|
||||
char [] patternArray = patternString.toCharArray();
|
||||
|
||||
|
|
|
@ -52,10 +52,9 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
// super( matchMode, caseSensitive, DECLARATIONS );
|
||||
// }
|
||||
|
||||
public ClassDeclarationPattern( char[] name, char[][] containers, SearchFor searchFor, LimitTo limit, int mode, boolean caseSensitive, boolean isForward ){
|
||||
public ClassDeclarationPattern( char[] name, char[][] containers, SearchFor searchFor, LimitTo limit, int mode, boolean caseSensitive ){
|
||||
super( mode, caseSensitive, limit );
|
||||
|
||||
this.isForward = isForward;
|
||||
simpleName = caseSensitive ? name : CharOperation.toLowerCase( name );
|
||||
if( caseSensitive || containers == null ){
|
||||
qualifications = containers;
|
||||
|
@ -69,13 +68,13 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
|
||||
this.searchFor = searchFor;
|
||||
|
||||
if( searchFor == CLASS || searchFor == FWD_CLASS ){
|
||||
if( searchFor == CLASS ){
|
||||
classKind = ASTClassKind.CLASS;
|
||||
} else if( searchFor == STRUCT || searchFor == FWD_STRUCT) {
|
||||
} else if( searchFor == STRUCT ) {
|
||||
classKind = ASTClassKind.STRUCT;
|
||||
} else if ( searchFor == ENUM ) {
|
||||
classKind = ASTClassKind.ENUM;
|
||||
} else if ( searchFor == UNION || searchFor == FWD_UNION ) {
|
||||
} else if ( searchFor == UNION ) {
|
||||
classKind = ASTClassKind.UNION;
|
||||
} else {
|
||||
classKind = null;
|
||||
|
@ -97,11 +96,6 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
if( ! canAccept( limit ) )
|
||||
return IMPOSSIBLE_MATCH;
|
||||
|
||||
if ((node instanceof IASTElaboratedTypeSpecifier &&!isForward)||
|
||||
(node instanceof IASTClassSpecifier && isForward)){
|
||||
return IMPOSSIBLE_MATCH;
|
||||
}
|
||||
|
||||
char[] nodeName = null;
|
||||
if (node instanceof IASTElaboratedTypeSpecifier)
|
||||
{
|
||||
|
@ -161,8 +155,6 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
protected char[] decodedSimpleName;
|
||||
private char[][] decodedContainingTypes;
|
||||
protected int decodedType;
|
||||
protected boolean isForward;
|
||||
|
||||
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] fileRefs, int[][] offsets, int[][] offsetLengths,IndexInput input, ICSearchScope scope) throws IOException {
|
||||
boolean isClass = decodedType == IIndex.TYPE_CLASS;
|
||||
|
@ -265,18 +257,15 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
return false;
|
||||
}
|
||||
} else if( classKind == ASTClassKind.CLASS ) {
|
||||
if( decodedType != IIndex.TYPE_CLASS &&
|
||||
decodedType != IIndex.TYPE_FWD_CLASS){
|
||||
if( decodedType != IIndex.TYPE_CLASS ){
|
||||
return false;
|
||||
}
|
||||
} else if ( classKind == ASTClassKind.STRUCT ) {
|
||||
if( decodedType != IIndex.TYPE_STRUCT &&
|
||||
decodedType != IIndex.TYPE_FWD_STRUCT){
|
||||
if( decodedType != IIndex.TYPE_STRUCT){
|
||||
return false;
|
||||
}
|
||||
} else if ( classKind == ASTClassKind.UNION ) {
|
||||
if( decodedType != IIndex.TYPE_UNION &&
|
||||
decodedType != IIndex.TYPE_FWD_UNION){
|
||||
if( decodedType != IIndex.TYPE_UNION){
|
||||
return false;
|
||||
}
|
||||
} else if ( classKind == ASTClassKind.ENUM ) {
|
||||
|
|
|
@ -43,7 +43,7 @@ public class DerivedTypesPattern extends ClassDeclarationPattern {
|
|||
* @param caseSensitive
|
||||
*/
|
||||
public DerivedTypesPattern(char[] name, char[][] containers, SearchFor searchFor, LimitTo limit, int mode, boolean caseSensitive) {
|
||||
super(name, containers, searchFor, limit, mode, caseSensitive, false);
|
||||
super(name, containers, searchFor, limit, mode, caseSensitive);
|
||||
}
|
||||
|
||||
public char[] indexEntryPrefix() {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class FriendPattern extends ClassDeclarationPattern {
|
|||
* @param caseSensitive
|
||||
*/
|
||||
public FriendPattern(char[] name, char[][] containers, SearchFor searchFor, LimitTo limit, int mode, boolean caseSensitive) {
|
||||
super(name, containers, searchFor, limit, mode, caseSensitive, false);
|
||||
super(name, containers, searchFor, limit, mode, caseSensitive);
|
||||
}
|
||||
|
||||
public char[] indexEntryPrefix() {
|
||||
|
|
|
@ -91,10 +91,7 @@ public class FilterIndexerViewDialog extends Dialog {
|
|||
public static final int ENTRY_TYPE_DECL_UNION = 17;
|
||||
public static final int ENTRY_TYPE_DECL_DERIVED = 18;
|
||||
public static final int ENTRY_TYPE_DECL_FRIEND = 19;
|
||||
public static final int ENTRY_TYPE_DECL_FWD_CLASS = 20;
|
||||
public static final int ENTRY_TYPE_DECL_FWD_STRUCT = 21;
|
||||
public static final int ENTRY_TYPE_DECL_FWD_UNION = 22;
|
||||
public static final int ENTRY_INCLUDE_REF = 23;
|
||||
public static final int ENTRY_INCLUDE_REF = 20;
|
||||
|
||||
private String fDialogSection;
|
||||
|
||||
|
@ -133,9 +130,6 @@ public class FilterIndexerViewDialog extends Dialog {
|
|||
{IIndex.TYPE, IIndex.TYPE_UNION, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_DERIVED, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_FRIEND, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_FWD_CLASS, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_FWD_STRUCT, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_FWD_UNION, IIndex.DECLARATION},
|
||||
{IIndex.INCLUDE, IIndex.ANY, IIndex.REFERENCE}
|
||||
};
|
||||
|
||||
|
@ -160,9 +154,6 @@ public class FilterIndexerViewDialog extends Dialog {
|
|||
"Union",
|
||||
"Derived",
|
||||
"Friend",
|
||||
"Fwd Class",
|
||||
"Fwd Struct",
|
||||
"Fwd Union",
|
||||
"Include"
|
||||
};
|
||||
// keep track of the buttons to programmatically change their state
|
||||
|
|
|
@ -599,9 +599,6 @@ public class IndexerView extends ViewPart {
|
|||
case IIndex.TYPE_TYPEDEF : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_TYPEDEF;
|
||||
case IIndex.TYPE_DERIVED : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_DERIVED;
|
||||
case IIndex.TYPE_FRIEND : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_FRIEND;
|
||||
case IIndex.TYPE_FWD_CLASS : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_FWD_CLASS;
|
||||
case IIndex.TYPE_FWD_STRUCT : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_FWD_STRUCT;
|
||||
case IIndex.TYPE_FWD_UNION : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_FWD_UNION;
|
||||
}
|
||||
case IIndex.FUNCTION : return FilterIndexerViewDialog.ENTRY_FUNCTION_DECL;
|
||||
case IIndex.METHOD : return FilterIndexerViewDialog.ENTRY_METHOD_DECL;
|
||||
|
|
|
@ -122,10 +122,6 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
|
|||
//include those items not represented in the UI
|
||||
searching.add( MACRO );
|
||||
searching.add( TYPEDEF );
|
||||
searching.add( FWD_CLASS );
|
||||
searching.add( FWD_STRUCT );
|
||||
searching.add( FWD_UNION );
|
||||
|
||||
} else {
|
||||
searching = data.searchFor;
|
||||
}
|
||||
|
@ -345,7 +341,8 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
|
|||
for (Iterator iter = searchFor.iterator(); iter.hasNext();) {
|
||||
SearchFor element = (SearchFor) iter.next();
|
||||
if( element == FUNCTION || element == METHOD || element == VAR ||
|
||||
element == FIELD || element == NAMESPACE || element == UNKNOWN_SEARCH_FOR ){
|
||||
element == FIELD || element == NAMESPACE || element == CLASS_STRUCT ||
|
||||
element == UNION || element == UNKNOWN_SEARCH_FOR ){
|
||||
set.add( DEFINITIONS );
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue