mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Put in various CTags problem reporting via IndexMarkers.
Changed CTags execution to pass just the arguments in the Launch array. Modified creation of CTags file to work on all platforms. Cleaned up CTags block UI. Fixed IndexerTests to take into account new toString() representation of IEntryResults.
This commit is contained in:
parent
605504d745
commit
985b120edf
11 changed files with 232 additions and 226 deletions
|
@ -153,11 +153,11 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
suite.addTest(new SourceIndexerTests("testAddNewFileToIndex")); //$NON-NLS-1$
|
||||
suite.addTest(new SourceIndexerTests("testForwardDeclarations")); //$NON-NLS-1$
|
||||
suite.addTest(new SourceIndexerTests("testIndexAll")); //$NON-NLS-1$
|
||||
//suite.addTest(new SourceIndexerTests("testIndexContents")); //$NON-NLS-1$
|
||||
//suite.addTest(new SourceIndexerTests("testMacros")); //$NON-NLS-1$
|
||||
//suite.addTest(new SourceIndexerTests("testRefs")); //$NON-NLS-1$
|
||||
suite.addTest(new SourceIndexerTests("testIndexContents")); //$NON-NLS-1$
|
||||
suite.addTest(new SourceIndexerTests("testMacros")); //$NON-NLS-1$
|
||||
suite.addTest(new SourceIndexerTests("testRefs")); //$NON-NLS-1$
|
||||
suite.addTest(new SourceIndexerTests("testExactDeclarations")); //$NON-NLS-1$
|
||||
//suite.addTest(new SourceIndexerTests("testRemoveFileFromIndex")); //$NON-NLS-1$
|
||||
suite.addTest(new SourceIndexerTests("testRemoveFileFromIndex")); //$NON-NLS-1$
|
||||
suite.addTest(new SourceIndexerTests("testRemoveProjectFromIndex")); //$NON-NLS-1$
|
||||
suite.addTest(new SourceIndexerTests("testIndexShutdown")); //$NON-NLS-1$
|
||||
|
||||
|
@ -326,15 +326,22 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
IEntryResult[] eresults = ind.queryEntries(prefix);
|
||||
assertTrue("Entry result found for typdeDecl/", eresults != null); //$NON-NLS-1$
|
||||
|
||||
String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/C/Mail, refs={ 3 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 3 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/C/container, refs={ 3 }", "EntryResult: word=typeDecl/C/first_class, refs={ 3 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/C/postcard, refs={ 3 }", "EntryResult: word=typeDecl/D/Mail, refs={ 3 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/D/first_class, refs={ 3 }", "EntryResult: word=typeDecl/D/postcard, refs={ 3 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/, refs={ 1, 2 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 3 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/index, refs={ 3 }", "EntryResult: word=typeDecl/V/mail, refs={ 3 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/size, refs={ 3 }", "EntryResult: word=typeDecl/V/temp, refs={ 3 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/x, refs={ 3 }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }, offsets={ [ 2127] }",
|
||||
"EntryResult: word=typeDecl/C/Mail, refs={ 3 }, offsets={ [ 294] }",
|
||||
"EntryResult: word=typeDecl/C/Unknown, refs={ 3 }, offsets={ [ 2738] }",
|
||||
"EntryResult: word=typeDecl/C/container, refs={ 3 }, offsets={ [ 21084] }",
|
||||
"EntryResult: word=typeDecl/C/first_class, refs={ 3 }, offsets={ [ 2506] }",
|
||||
"EntryResult: word=typeDecl/C/postcard, refs={ 3 }, offsets={ [ 2298] }",
|
||||
"EntryResult: word=typeDecl/D/Mail, refs={ 3 }, offsets={ [ 294] }",
|
||||
"EntryResult: word=typeDecl/D/first_class, refs={ 3 }, offsets={ [ 2506] }",
|
||||
"EntryResult: word=typeDecl/D/postcard, refs={ 3 }, offsets={ [ 2298] }",
|
||||
"EntryResult: word=typeDecl/V/PO_Box, refs={ 3 }, offsets={ [ 21371] }",
|
||||
"EntryResult: word=typeDecl/V/index, refs={ 3 }, offsets={ [ 21303, 21846] }",
|
||||
"EntryResult: word=typeDecl/V/mail, refs={ 3 }, offsets={ [ 21336, 21912] }",
|
||||
"EntryResult: word=typeDecl/V/size, refs={ 3 }, offsets={ [ 21927] }",
|
||||
"EntryResult: word=typeDecl/V/temp, refs={ 3 }, offsets={ [ 21964] }",
|
||||
"EntryResult: word=typeDecl/V/x, refs={ 3 }, offsets={ [ 21201, 21526] }"};
|
||||
|
||||
if (eresults.length != entryResultBeforeModel.length)
|
||||
fail("Entry Result length different from model"); //$NON-NLS-1$
|
||||
|
||||
|
@ -356,7 +363,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
eresults = ind.queryEntries(prefix);
|
||||
assertTrue("Entry exists", eresults != null); //$NON-NLS-1$
|
||||
|
||||
String [] entryResultAfterModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }", "EntryResult: word=typeDecl/V/, refs={ 1, 2 }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String [] entryResultAfterModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }, offsets={ [ 2127] }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (eresults.length != entryResultAfterModel.length)
|
||||
fail("Entry Result length different from model"); //$NON-NLS-1$
|
||||
|
||||
|
@ -379,15 +386,15 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
IEntryResult[] typerefreesults = ind.queryEntries(IIndexConstants.TYPE_REF);
|
||||
assertTrue("Type Ref Results exist", typerefreesults != null); //$NON-NLS-1$
|
||||
|
||||
String [] typeDeclEntryResultModel ={"EntryResult: word=typeDecl/C/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2329] }","EntryResult: word=typeDecl/C/Unknown/Y/X/Z, refs={ 1 }, offsets={ [ 21057] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/C/container/Y/X/Z, refs={ 1 }, offsets={ [ 21439] }","EntryResult: word=typeDecl/C/first_class/Y/X/Z, refs={ 1 }, offsets={ [ 2798] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/C/postcard/Y/X/Z, refs={ 1 }, offsets={ [ 2566] }","EntryResult: word=typeDecl/D/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2329] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/D/first_class/Y/X/Z, refs={ 1 }, offsets={ [ 2798] }", "EntryResult: word=typeDecl/D/postcard/Y/X/Z, refs={ 1 }, offsets={ [ 2566] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/E/test/Y/X/Z, refs={ 1 }, offsets={ [ 2297] }","EntryResult: word=typeDecl/T/int32, refs={ 1 }, offsets={ [ 2188] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/PO_Box, refs={ 1 }, offsets={ [ 21782] }","EntryResult: word=typeDecl/V/index, refs={ 1 }, offsets={ [ 21702, 22329] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/mail, refs={ 1 }, offsets={ [ 21736, 22396] }", "EntryResult: word=typeDecl/V/size, refs={ 1 }, offsets={ [ 22419] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/temp, refs={ 1 }, offsets={ [ 22459] }", "EntryResult: word=typeDecl/V/x, refs={ 1 }, offsets={ [ 21585, 21961] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/x/Z, refs={ 1 }, offsets={ [ 2255] }"}; //$NON-NLS-1$
|
||||
String [] typeDeclEntryResultModel ={"EntryResult: word=typeDecl/C/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2335] }","EntryResult: word=typeDecl/C/Unknown/Y/X/Z, refs={ 1 }, offsets={ [ 21063] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/C/container/Y/X/Z, refs={ 1 }, offsets={ [ 21445] }","EntryResult: word=typeDecl/C/first_class/Y/X/Z, refs={ 1 }, offsets={ [ 2804] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/C/postcard/Y/X/Z, refs={ 1 }, offsets={ [ 2572] }","EntryResult: word=typeDecl/D/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2335] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/D/first_class/Y/X/Z, refs={ 1 }, offsets={ [ 2804] }", "EntryResult: word=typeDecl/D/postcard/Y/X/Z, refs={ 1 }, offsets={ [ 2572] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/E/test/Y/X/Z, refs={ 1 }, offsets={ [ 2302] }","EntryResult: word=typeDecl/T/int32, refs={ 1 }, offsets={ [ 2200] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/PO_Box, refs={ 1 }, offsets={ [ 21792] }","EntryResult: word=typeDecl/V/index, refs={ 1 }, offsets={ [ 21706, 22333] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/mail, refs={ 1 }, offsets={ [ 21742, 22402] }", "EntryResult: word=typeDecl/V/size, refs={ 1 }, offsets={ [ 22423] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/temp, refs={ 1 }, offsets={ [ 22463] }", "EntryResult: word=typeDecl/V/x, refs={ 1 }, offsets={ [ 21589, 21965] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeDecl/V/x/Z, refs={ 1 }, offsets={ [ 2259] }"}; //$NON-NLS-1$
|
||||
|
||||
IEntryResult[] typedeclresults =ind.queryEntries(IIndexConstants.TYPE_DECL);
|
||||
assertTrue("Type Decl Results exist", typedeclresults != null); //$NON-NLS-1$
|
||||
|
@ -400,7 +407,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(typeDeclEntryResultModel[i],typedeclresults[i].toString());
|
||||
}
|
||||
|
||||
String [] typeDefEntryResultModel ={"EntryResult: word=typeDecl/T/int32, refs={ 1 }, offsets={ [ 2188] }"}; //$NON-NLS-1$
|
||||
String [] typeDefEntryResultModel ={"EntryResult: word=typeDecl/T/int32, refs={ 1 }, offsets={ [ 2200] }"}; //$NON-NLS-1$
|
||||
IEntryResult[] typedefresults =ind.queryEntries(IIndexConstants.TYPEDEF_DECL);
|
||||
assertTrue("Type Def Results exist", typedefresults != null); //$NON-NLS-1$
|
||||
|
||||
|
@ -412,8 +419,8 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(typeDefEntryResultModel[i],typedefresults[i].toString());
|
||||
}
|
||||
|
||||
String [] namespaceResultModel = {"EntryResult: word=namespaceDecl/X/Z, refs={ 1 }, offsets={ [ 2264] }", "EntryResult: word=namespaceDecl/Y/X/Z, refs={ 1 }, offsets={ [ 2280] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=namespaceDecl/Z, refs={ 1 }, offsets={ [ 2240] }"}; //$NON-NLS-1$
|
||||
String [] namespaceResultModel = {"EntryResult: word=namespaceDecl/X/Z, refs={ 1 }, offsets={ [ 2274] }", "EntryResult: word=namespaceDecl/Y/X/Z, refs={ 1 }, offsets={ [ 2290] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=namespaceDecl/Z, refs={ 1 }, offsets={ [ 2250] }"}; //$NON-NLS-1$
|
||||
|
||||
IEntryResult[] namespaceresults =ind.queryEntries(IIndexConstants.NAMESPACE_DECL);
|
||||
assertTrue("Namespace Results exist", namespaceresults != null); //$NON-NLS-1$
|
||||
|
@ -426,9 +433,9 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(namespaceResultModel[i],namespaceresults[i].toString());
|
||||
}
|
||||
|
||||
String [] fieldResultModel = {"EntryResult: word=fieldDecl/array/container/Y/X/Z, refs={ 1 }, offsets={ [ 21478] }", "EntryResult: word=fieldDecl/index/container/Y/X/Z, refs={ 1 }, offsets={ [ 21478] }, EntryResult: word=fieldDecl/index/container/Y/X/Z, refs={ 1 }, offsets={ [ 21496] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=fieldDecl/postage/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2463] }", "EntryResult: word=fieldDecl/sz/container/Y/X/Z, refs={ 1 }, offsets={ [ 21511] }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=fieldDecl/type/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2482] }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String [] fieldResultModel = {"EntryResult: word=fieldDecl/array/container/Y/X/Z, refs={ 1 }, offsets={ [ 21485] }", "EntryResult: word=fieldDecl/index/container/Y/X/Z, refs={ 1 }, offsets={ [ 21500] }",
|
||||
"EntryResult: word=fieldDecl/postage/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2469] }", "EntryResult: word=fieldDecl/sz/container/Y/X/Z, refs={ 1 }, offsets={ [ 21515] }",
|
||||
"EntryResult: word=fieldDecl/type/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2488] }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
IEntryResult[] fieldresults =ind.queryEntries(IIndexConstants.FIELD_DECL);
|
||||
assertTrue("Field Results exist", fieldresults != null); //$NON-NLS-1$
|
||||
|
||||
|
@ -440,8 +447,8 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(fieldResultModel[i],fieldresults[i].toString());
|
||||
}
|
||||
|
||||
String [] enumeratorResultModel = {"EntryResult: word=enumtorDecl/bye/Y/X/Z, refs={ 1 }", "EntryResult: word=enumtorDecl/cool/Y/X/Z, refs={ 1 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=enumtorDecl/hi/Y/X/Z, refs={ 1 }", "EntryResult: word=enumtorDecl/why/Y/X/Z, refs={ 1 }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String [] enumeratorResultModel = {"EntryResult: word=enumtorDecl/bye/Y/X/Z, refs={ 1 }, offsets={ [ 2315] }", "EntryResult: word=enumtorDecl/cool/Y/X/Z, refs={ 1 }, offsets={ [ 2307] }",
|
||||
"EntryResult: word=enumtorDecl/hi/Y/X/Z, refs={ 1 }, offsets={ [ 2312] }", "EntryResult: word=enumtorDecl/why/Y/X/Z, refs={ 1 }, offsets={ [ 2319] }"};
|
||||
|
||||
IEntryResult[] enumeratorresults =ind.queryEntries(IIndexConstants.ENUMTOR_DECL);
|
||||
assertTrue("Enumerator Results exist", enumeratorresults != null); //$NON-NLS-1$
|
||||
|
@ -454,7 +461,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(enumeratorResultModel[i],enumeratorresults[i].toString());
|
||||
}
|
||||
|
||||
String [] functionResultModel = {"EntryResult: word=functionDecl/doSomething, refs={ 1 }", "EntryResult: word=functionDecl/main/Y/X/Z, refs={ 1 }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String [] functionResultModel = {"EntryResult: word=functionDecl/doSomething, refs={ 1 }, offsets={ [ 2222] }", "EntryResult: word=functionDecl/main/Y/X/Z, refs={ 1 }, offsets={ [ 21765] }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
IEntryResult[] functionresults =ind.queryEntries(IIndexConstants.FUNCTION_DECL);
|
||||
|
||||
if (functionresults.length != functionResultModel.length)
|
||||
|
@ -465,13 +472,19 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(functionResultModel[i],functionresults[i].toString());
|
||||
}
|
||||
|
||||
String [] methodResultModel = {"EntryResult: word=methodDecl/Mail/Mail/Y/X/Z, refs={ 1 }", "EntryResult: word=methodDecl/Unknown/Unknown/Y/X/Z, refs={ 1 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=methodDecl/container/container/Y/X/Z, refs={ 1 }", "EntryResult: word=methodDecl/first_class/first_class/Y/X/Z, refs={ 1 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=methodDecl/operator =/container/Y/X/Z, refs={ 1 }","EntryResult: word=methodDecl/operator []/container/Y/X/Z, refs={ 1 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=methodDecl/postcard/postcard/Y/X/Z, refs={ 1 }", "EntryResult: word=methodDecl/print/Mail/Y/X/Z, refs={ 1 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=methodDecl/print/Unknown/Y/X/Z, refs={ 1 }", "EntryResult: word=methodDecl/print/first_class/Y/X/Z, refs={ 1 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=methodDecl/print/postcard/Y/X/Z, refs={ 1 }", "EntryResult: word=methodDecl/size/container/Y/X/Z, refs={ 1 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=methodDecl/~container/container/Y/X/Z, refs={ 1 }"}; //$NON-NLS-1$
|
||||
String [] methodResultModel = {"EntryResult: word=methodDecl/Mail/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2362] }",
|
||||
"EntryResult: word=methodDecl/Unknown/Unknown/Y/X/Z, refs={ 1 }, offsets={ [ 21152] }",
|
||||
"EntryResult: word=methodDecl/container/container/Y/X/Z, refs={ 1 }, offsets={ [ 21535] }",
|
||||
"EntryResult: word=methodDecl/first_class/first_class/Y/X/Z, refs={ 1 }, offsets={ [ 2852] }",
|
||||
"EntryResult: word=methodDecl/operator =/container/Y/X/Z, refs={ 1 }, offsets={ [ 21724, 22384] }",
|
||||
"EntryResult: word=methodDecl/operator []/container/Y/X/Z, refs={ 1 }, offsets={ [ 21691, 22318] }",
|
||||
"EntryResult: word=methodDecl/postcard/postcard/Y/X/Z, refs={ 1 }, offsets={ [ 2617] }",
|
||||
"EntryResult: word=methodDecl/print/Mail/Y/X/Z, refs={ 1 }, offsets={ [ 2388] }",
|
||||
"EntryResult: word=methodDecl/print/Unknown/Y/X/Z, refs={ 1 }, offsets={ [ 21293] }",
|
||||
"EntryResult: word=methodDecl/print/first_class/Y/X/Z, refs={ 1 }, offsets={ [ 2923] }",
|
||||
"EntryResult: word=methodDecl/print/postcard/Y/X/Z, refs={ 1 }, offsets={ [ 2681] }",
|
||||
"EntryResult: word=methodDecl/size/container/Y/X/Z, refs={ 1 }, offsets={ [ 21661] }",
|
||||
"EntryResult: word=methodDecl/~container/container/Y/X/Z, refs={ 1 }, offsets={ [ 21563] }"};
|
||||
|
||||
|
||||
|
||||
|
@ -497,8 +510,10 @@ 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 [] typeRefEntryResultModel ={"EntryResult: word=typeRef/C/C/B/A, refs={ 1 }", "EntryResult: word=typeRef/E/e1/B/A, refs={ 1 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=typeRef/G/ForwardA/A, refs={ 1 }", "EntryResult: word=typeRef/V/x/B/A, refs={ 1 }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String [] typeRefEntryResultModel ={"EntryResult: word=typeRef/C/C/B/A, refs={ 1 }, offsets={ [ 2142] }",
|
||||
"EntryResult: word=typeRef/E/e1/B/A, refs={ 1 }, offsets={ [ 2104] }",
|
||||
"EntryResult: word=typeRef/G/ForwardA/A, refs={ 1 }, offsets={ [ 225] }",
|
||||
"EntryResult: word=typeRef/V/x/B/A, refs={ 1 }, offsets={ [ 2128] }"};
|
||||
|
||||
IEntryResult[] typerefresults = ind.queryEntries(IIndexConstants.TYPE_REF);
|
||||
assertTrue("Entry exists",typerefresults != null); //$NON-NLS-1$
|
||||
|
@ -511,7 +526,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(typeRefEntryResultModel[i],typerefresults[i].toString());
|
||||
}
|
||||
|
||||
String [] funRefEntryResultModel ={"EntryResult: word=functionRef/something/A, refs={ 1 }"};//$NON-NLS-1$
|
||||
String [] funRefEntryResultModel ={"EntryResult: word=functionRef/something/A, refs={ 1 }, offsets={ [ 259] }"};//$NON-NLS-1$
|
||||
IEntryResult[] funRefresults = ind.queryEntries(IIndexConstants.FUNCTION_REF);
|
||||
assertTrue("Entry exists",funRefresults != null); //$NON-NLS-1$
|
||||
|
||||
|
@ -523,7 +538,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(funRefEntryResultModel[i],funRefresults[i].toString());
|
||||
}
|
||||
|
||||
String [] namespaceRefResultModel = {"EntryResult: word=namespaceRef/A, refs={ 1 }", "EntryResult: word=namespaceRef/B/A, refs={ 1 }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String [] namespaceRefResultModel = {"EntryResult: word=namespaceRef/A, refs={ 1 }, offsets={ [ 210] }", "EntryResult: word=namespaceRef/B/A, refs={ 1 }, offsets={ [ 288] }"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
IEntryResult[] namespacerefresults = ind.queryEntries(IIndexConstants.NAMESPACE_REF);
|
||||
assertTrue("Entry exists",namespacerefresults!=null); //$NON-NLS-1$
|
||||
|
||||
|
@ -535,7 +550,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(namespaceRefResultModel[i],namespacerefresults[i].toString());
|
||||
}
|
||||
|
||||
String [] fieldRefResultModel = {"EntryResult: word=fieldRef/y/C/B/A, refs={ 1 }"}; //$NON-NLS-1$
|
||||
String [] fieldRefResultModel = {"EntryResult: word=fieldRef/y/C/B/A, refs={ 1 }, offsets={ [ 2161] }"}; //$NON-NLS-1$
|
||||
IEntryResult[] fieldrefresults = ind.queryEntries(IIndexConstants.FIELD_REF);
|
||||
assertTrue("Entry exists",fieldrefresults!=null); //$NON-NLS-1$
|
||||
|
||||
|
@ -547,7 +562,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
assertEquals(fieldRefResultModel[i],fieldrefresults[i].toString());
|
||||
}
|
||||
|
||||
String [] methodRefResultModel = {"EntryResult: word=methodRef/bar/C/B/A, refs={ 1 }"}; //$NON-NLS-1$
|
||||
String [] methodRefResultModel = {"EntryResult: word=methodRef/bar/C/B/A, refs={ 1 }, offsets={ [ 2184] }"}; //$NON-NLS-1$
|
||||
IEntryResult[] methodrefresults = ind.queryEntries(IIndexConstants.METHOD_REF);
|
||||
assertTrue("Entry exists", methodrefresults != null); //$NON-NLS-1$
|
||||
|
||||
|
@ -643,8 +658,9 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
IEntryResult[] macroresults = ind.queryEntries(IIndexConstants.MACRO_DECL);
|
||||
assertTrue("Entry exists", macroresults != null); //$NON-NLS-1$
|
||||
|
||||
String [] macroResultModel = {"EntryResult: word=macroDecl/CASE, refs={ 1 }", "EntryResult: word=macroDecl/MAX, refs={ 1 }", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"EntryResult: word=macroDecl/PRINT, refs={ 1 }"}; //$NON-NLS-1$
|
||||
String [] macroResultModel = {"EntryResult: word=macroDecl/CASE, refs={ 1 }, offsets={ [ 2131] }",
|
||||
"EntryResult: word=macroDecl/MAX, refs={ 1 }, offsets={ [ 2156] }",
|
||||
"EntryResult: word=macroDecl/PRINT, refs={ 1 }, offsets={ [ 296] }"};
|
||||
|
||||
if (macroresults.length != macroResultModel.length)
|
||||
fail("Entry Result length different from model for macros"); //$NON-NLS-1$
|
||||
|
|
|
@ -128,4 +128,11 @@ public interface ICDTIndexer extends IIndexer {
|
|||
*/
|
||||
public IIndex getIndex(IPath path, boolean reuseExistingFile, boolean createIfMissing);
|
||||
|
||||
/**
|
||||
* Called the index manager when a project changes its indexer to a new indexer. This can be
|
||||
* used to clean up specific indexer properties.
|
||||
* @param project
|
||||
*/
|
||||
public void indexerChangeNotification(IProject project);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,10 +12,12 @@
|
|||
package org.eclipse.cdt.internal.core.index.ctagsindexer;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexer;
|
||||
|
@ -30,21 +32,37 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.resources.IProject;
|
||||
|
||||
public class CTagsFileReader {
|
||||
|
||||
String filename = null;
|
||||
List list = null;
|
||||
IProject project;
|
||||
IIndex index;
|
||||
CTagsIndexer indexer;
|
||||
|
||||
public CTagsFileReader(IProject project,String filename) {
|
||||
public CTagsFileReader(IProject project,String filename, CTagsIndexer indexer) {
|
||||
this.filename = filename;
|
||||
this.project = project;
|
||||
this.indexer = indexer;
|
||||
}
|
||||
|
||||
public void parse() {
|
||||
BufferedReader reader = null;
|
||||
try{
|
||||
reader = new BufferedReader(new FileReader(filename));
|
||||
} catch (FileNotFoundException ex){
|
||||
indexer.createProblemMarker(CCorePlugin.getResourceString("CTagsIndexMarker.fileMissing") + " - " + filename, project); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return;
|
||||
}
|
||||
|
||||
public void parse() throws IOException {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(filename));
|
||||
CTagsHeader header = new CTagsHeader();
|
||||
// Skip the header.
|
||||
|
||||
try {
|
||||
header.parse(reader);
|
||||
} catch (IOException e) {
|
||||
indexer.createProblemMarker(e.getMessage(), project);
|
||||
return;
|
||||
}
|
||||
|
||||
String s;
|
||||
String currentFileName = null;
|
||||
|
@ -56,6 +74,7 @@ public class CTagsFileReader {
|
|||
if (index == null)
|
||||
return;
|
||||
|
||||
try {
|
||||
while ((s = reader.readLine()) != null) {
|
||||
CTagEntry tagEntry = parser.processLineReturnTag(s);
|
||||
|
||||
|
@ -75,6 +94,7 @@ public class CTagsFileReader {
|
|||
String lineNumber = (String) tagEntry.tagExtensionField.get(CTagsConsoleParser.LINE);
|
||||
indexer.addToOutput(fullName,(String)tagEntry.tagExtensionField.get(CTagsConsoleParser.KIND), Integer.parseInt(lineNumber));
|
||||
}
|
||||
} catch (IOException e){}
|
||||
}
|
||||
|
||||
class MiniIndexer implements IIndexer, IIndexConstants {
|
||||
|
|
|
@ -20,7 +20,7 @@ public class CTagsHeader {
|
|||
final static String TAG_FILE_FORMAT =
|
||||
"!_TAG_FILE_FORMAT\t2\t/extended format; --format=1 will not append ;\" to lines/"; //$NON-NLS-1$
|
||||
final static String TAG_FILE_SORTED =
|
||||
"!_TAG_FILE_SORTED\t0\t/0=unsorted, 1=sorted/"; //$NON-NLS-1$
|
||||
"!_TAG_FILE_SORTED\t0\t/0=unsorted, 1=sorted, 2=foldcase/"; //$NON-NLS-1$
|
||||
final static String TAG_PROGRAM_AUTHOR =
|
||||
"!_TAG_PROGRAM_AUTHOR\tDarren Hiebert\t/dhiebert@users.sourceforge.net/"; //$NON-NLS-1$
|
||||
final static String TAG_PROGRAM_NAME =
|
||||
|
@ -57,16 +57,15 @@ public class CTagsHeader {
|
|||
void parse (BufferedReader in) throws IOException {
|
||||
// !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
||||
format = in.readLine();
|
||||
//If we care about verifying header info we can put this back in
|
||||
/*if (format == null || !format.equals(TAG_FILE_FORMAT)) {
|
||||
throw new IOException("Wrong Tag Format Header");
|
||||
}*/
|
||||
if (format == null || !format.equals(TAG_FILE_FORMAT)) {
|
||||
throw new IOException("Wrong Tag Format Header: Needs to be --format=2"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// !_TAG_FILE_SORTED 0 /0=unsorted, 1=sorted/
|
||||
sorted = in.readLine();
|
||||
/*if (sorted == null || !sorted.equals(TAG_FILE_SORTED)) {
|
||||
throw new IOException("Wrong Tag Format Header");
|
||||
}*/
|
||||
if (sorted == null || !sorted.equals(TAG_FILE_SORTED)) {
|
||||
throw new IOException("Wrong Tag Format Header: Sort needs to be --sort=no"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
|
||||
author = in.readLine();
|
||||
|
@ -76,20 +75,20 @@ public class CTagsHeader {
|
|||
|
||||
// !_TAG_PROGRAM_NAME Exuberant Ctags //
|
||||
name = in.readLine();
|
||||
/*if (name == null || !name.equals(TAG_PROGRAM_NAME)) {
|
||||
throw new IOException("Wrong Tag Format Header");
|
||||
}*/
|
||||
if (name == null || !name.equals(TAG_PROGRAM_NAME)) {
|
||||
throw new IOException("Wrong Tag Format Header: Must use Exuberant Ctags"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
||||
url = in.readLine();
|
||||
/*if (url == null || !url.equals(TAG_PROGRAM_URL)) {
|
||||
throw new IOException("Wrong Tag Format Header");
|
||||
throw new IOException("Wrong Tag Format Header"); //$NON-NLS-1$
|
||||
}*/
|
||||
|
||||
// !_TAG_PROGRAM_VERSION 5.2.3 //
|
||||
// !_TAG_PROGRAM_VERSION 5.5.4 //
|
||||
version = in.readLine();
|
||||
/*if (version == null || !version.equals(TAG_PROGRAM_VERSION)) {
|
||||
throw new IOException("Wrong Tag Format Header");
|
||||
throw new IOException("Wrong Tag Format Header: Need Exuberant CTags 5.5.4"); //$NON-NLS-1$
|
||||
}*/
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.io.IOException;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CommandLauncher;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage;
|
||||
|
@ -22,6 +23,8 @@ 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.JobManager;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
@ -31,7 +34,7 @@ import org.eclipse.core.runtime.Path;
|
|||
*/
|
||||
class CTagsIndexAll extends CTagsIndexRequest {
|
||||
IProject project;
|
||||
static String ctagsFile = CCorePlugin.getDefault().getStateLocation().toOSString() + "\\tempctags"; //$NON-NLS-1$
|
||||
static String ctagsFile = CCorePlugin.getDefault().getStateLocation().append("tempctags").toOSString(); //$NON-NLS-1$
|
||||
|
||||
public CTagsIndexAll(IProject project, CTagsIndexer indexer) {
|
||||
super(project.getFullPath(), indexer);
|
||||
|
@ -67,6 +70,11 @@ class CTagsIndexAll extends CTagsIndexRequest {
|
|||
//Timing support
|
||||
long startTime=0, cTagsEndTime=0, endTime=0;
|
||||
|
||||
//Remove any existing problem markers
|
||||
try {
|
||||
project.deleteMarkers(ICModelMarker.INDEXER_MARKER, true,IResource.DEPTH_ZERO);
|
||||
} catch (CoreException e) {}
|
||||
|
||||
if (AbstractIndexer.TIMING)
|
||||
startTime = System.currentTimeMillis();
|
||||
|
||||
|
@ -81,7 +89,7 @@ class CTagsIndexAll extends CTagsIndexRequest {
|
|||
|
||||
if (success) {
|
||||
//Parse the CTag File
|
||||
CTagsFileReader reader = new CTagsFileReader(project,ctagsFile);
|
||||
CTagsFileReader reader = new CTagsFileReader(project,ctagsFile,indexer);
|
||||
reader.setIndex(index);
|
||||
reader.parse();
|
||||
|
||||
|
@ -113,8 +121,7 @@ class CTagsIndexAll extends CTagsIndexRequest {
|
|||
* @return
|
||||
*/
|
||||
private boolean runCTags() {
|
||||
String[] args = {"ctags", //$NON-NLS-1$
|
||||
"--excmd=number", //$NON-NLS-1$
|
||||
String[] args = {"--excmd=number", //$NON-NLS-1$
|
||||
"--format=2", //$NON-NLS-1$
|
||||
"--sort=no", //$NON-NLS-1$
|
||||
"--fields=aiKlmnsz", //$NON-NLS-1$
|
||||
|
@ -136,12 +143,17 @@ class CTagsIndexAll extends CTagsIndexRequest {
|
|||
|
||||
IPath fileDirectory = project.getLocation();
|
||||
//Process p = launcher.execute(fCompileCommand, args, setEnvironment(launcher), fWorkingDirectory);
|
||||
Process p = launcher.execute(new Path(""), args, null, fileDirectory); //$NON-NLS-1$
|
||||
Process p = launcher.execute(new Path("ctags"), args, null, fileDirectory); //$NON-NLS-1$
|
||||
p.waitFor();
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
return false;
|
||||
}
|
||||
catch (NullPointerException e){
|
||||
//CTags not installed
|
||||
indexer.createProblemMarker(CCorePlugin.getResourceString("CTagsIndexMarker.CTagsMissing"), project); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.ICLogConstants;
|
||||
import org.eclipse.cdt.core.index.ICDTIndexer;
|
||||
import org.eclipse.cdt.core.index.IIndexStorage;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.CIndexStorage;
|
||||
|
@ -25,8 +26,11 @@ 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.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
/**
|
||||
|
@ -324,6 +328,46 @@ public class CTagsIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
this.indexAll(project);
|
||||
}
|
||||
|
||||
protected void createProblemMarker(String message, IProject project){
|
||||
|
||||
try {
|
||||
IMarker[] markers = project.findMarkers(ICModelMarker.INDEXER_MARKER, true,IResource.DEPTH_ZERO);
|
||||
|
||||
boolean newProblem = true;
|
||||
|
||||
if (markers.length > 0) {
|
||||
IMarker tempMarker = null;
|
||||
String tempMsgString = null;
|
||||
|
||||
for (int i=0; i<markers.length; i++) {
|
||||
tempMarker = markers[i];
|
||||
tempMsgString = (String) tempMarker.getAttribute(IMarker.MESSAGE);
|
||||
if (tempMsgString.equalsIgnoreCase( message )){
|
||||
newProblem = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newProblem){
|
||||
IMarker marker = project.createMarker(ICModelMarker.INDEXER_MARKER);
|
||||
int start = 0;
|
||||
int end = 1;
|
||||
marker.setAttribute(IMarker.MESSAGE, message);
|
||||
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
|
||||
marker.setAttribute(IMarker.CHAR_START, start);
|
||||
marker.setAttribute(IMarker.CHAR_END, end);
|
||||
}
|
||||
} catch (CoreException e1) {}
|
||||
}
|
||||
|
||||
public void indexerChangeNotification(IProject project) {
|
||||
//Remove any existing problem markers
|
||||
try {
|
||||
project.deleteMarkers(ICModelMarker.INDEXER_MARKER, true,IResource.DEPTH_ZERO);
|
||||
} catch (CoreException e) {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,11 +16,14 @@ import java.io.OutputStream;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CommandLauncher;
|
||||
import org.eclipse.cdt.core.IConsoleParser;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
||||
import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
@ -53,7 +56,7 @@ public class CTagsIndexerRunner extends AbstractIndexer {
|
|||
protected void indexFile(IFile file) throws IOException {
|
||||
IndexedFileEntry indFile =output.addIndexedFile(file.getFullPath().toString());
|
||||
|
||||
String[] args = {"ctags", //$NON-NLS-1$
|
||||
String[] args = {
|
||||
"--excmd=number", //$NON-NLS-1$
|
||||
"--format=2", //$NON-NLS-1$
|
||||
"--sort=no", //$NON-NLS-1$
|
||||
|
@ -63,15 +66,22 @@ public class CTagsIndexerRunner extends AbstractIndexer {
|
|||
"--languages=c,c++", //$NON-NLS-1$
|
||||
"-f", "-", resourceFile.getName()}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
try {
|
||||
IConsole console = CCorePlugin.getDefault().getConsole(null);
|
||||
console.start(resourceFile.getProject());
|
||||
OutputStream cos = console.getOutputStream();
|
||||
OutputStream cos;
|
||||
try {
|
||||
cos = console.getOutputStream();
|
||||
} catch (CoreException e1) {
|
||||
return;
|
||||
}
|
||||
|
||||
String errMsg = null;
|
||||
CommandLauncher launcher = new CommandLauncher();
|
||||
// Print the command for visual interaction.
|
||||
launcher.showCommand(true);
|
||||
|
||||
//Remove any existing problem markers
|
||||
try {
|
||||
resourceFile.getProject().deleteMarkers(ICModelMarker.INDEXER_MARKER, true,IResource.DEPTH_ZERO);
|
||||
} catch (CoreException e) {}
|
||||
|
||||
long startTime=0;
|
||||
if (AbstractIndexer.TIMING)
|
||||
|
@ -86,7 +96,7 @@ public class CTagsIndexerRunner extends AbstractIndexer {
|
|||
|
||||
IPath fileDirectory = resourceFile.getRawLocation().removeLastSegments(1);
|
||||
//Process p = launcher.execute(fCompileCommand, args, setEnvironment(launcher), fWorkingDirectory);
|
||||
Process p = launcher.execute(new Path(""), args, null, fileDirectory); //$NON-NLS-1$
|
||||
Process p = launcher.execute(new Path("ctags"), args, null, fileDirectory); //$NON-NLS-1$
|
||||
if (p != null) {
|
||||
try {
|
||||
// Close the input of the Process explicitely.
|
||||
|
@ -100,10 +110,7 @@ public class CTagsIndexerRunner extends AbstractIndexer {
|
|||
}
|
||||
else {
|
||||
errMsg = launcher.getErrorMessage();
|
||||
}
|
||||
|
||||
if (errMsg != null) {
|
||||
System.out.println(errMsg);
|
||||
indexer.createProblemMarker(CCorePlugin.getResourceString("CTagsIndexMarker.CTagsMissing"), resourceFile.getProject()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
consoleOut.close();
|
||||
|
@ -114,14 +121,6 @@ public class CTagsIndexerRunner extends AbstractIndexer {
|
|||
System.out.println("CTagsIndexer Total Time: " + (System.currentTimeMillis() - startTime)); //$NON-NLS-1$
|
||||
System.out.flush();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -134,4 +133,6 @@ public class CTagsIndexerRunner extends AbstractIndexer {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -71,12 +71,6 @@ public class SourceIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
public final static QualifiedName activationKey = new QualifiedName(INDEX_MODEL_ID, ACTIVATION);
|
||||
public final static QualifiedName problemsActivationKey = new QualifiedName( INDEX_MODEL_ID, PROBLEM_ACTIVATION );
|
||||
|
||||
/*public static final String INDEXER_ENABLED = "indexEnabled"; //$NON-NLS-1$
|
||||
public static final String INDEXER_PROBLEMS_ENABLED = "indexerProblemsEnabled"; //$NON-NLS-1$
|
||||
public static final String SOURCE_INDEXER = "cdt_source_indexer"; //$NON-NLS-1$
|
||||
public static final String INDEXER_VALUE = "indexValue"; //$NON-NLS-1$
|
||||
public static final String INDEXER_PROBLEMS_VALUE = "indexProblemsValue"; //$NON-NLS-1$
|
||||
*/
|
||||
public static final int PREPROCESSOR_PROBLEMS_BIT = 1;
|
||||
public static final int SEMANTIC_PROBLEMS_BIT = 1 << 1;
|
||||
public static final int SYNTACTIC_PROBLEMS_BIT = 1 << 2;
|
||||
|
@ -658,4 +652,17 @@ public class SourceIndexer extends AbstractCExtension implements ICDTIndexer {
|
|||
public void notifyIndexerChange(IProject project) {
|
||||
this.indexAll(project);
|
||||
}
|
||||
|
||||
public void indexerChangeNotification(IProject project) {
|
||||
//Remove any existing problem markers
|
||||
/*try {
|
||||
IMarker[] markers = project.findMarkers(ICModelMarker.INDEXER_MARKER, true, IResource.DEPTH_INFINITE);
|
||||
for (int i=0; i<markers.length; i++){
|
||||
removeIndexerProblems(markers[i].getResource());
|
||||
}
|
||||
} catch (CoreException e) {}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -340,6 +340,9 @@ public class IndexManager extends JobManager{
|
|||
|
||||
//Get rid of the old index file
|
||||
ICDTIndexer currentIndexer = getIndexerForProject(project);
|
||||
|
||||
currentIndexer.indexerChangeNotification(project);
|
||||
|
||||
IIndexStorage storage = currentIndexer.getIndexStorage();
|
||||
if (storage instanceof CIndexStorage)
|
||||
((CIndexStorage) storage).removeIndex(project.getFullPath());
|
||||
|
|
|
@ -64,3 +64,6 @@ Util.unknownName=unknown C++ encoded name
|
|||
Util.unknownFormat=Unknown debug format
|
||||
|
||||
PathEntryVariableResolver.0=CDT PathEntry variable not specified
|
||||
|
||||
CTagsIndexMarker.fileMissing=CTags output file missing
|
||||
CTagsIndexMarker.CTagsMissing=CTags not installed or not in path
|
|
@ -10,150 +10,44 @@
|
|||
**********************************************************************/
|
||||
package org.eclipse.cdt.ui.dialogs;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ICDescriptor;
|
||||
import org.eclipse.cdt.core.ICExtensionReference;
|
||||
import org.eclipse.cdt.internal.ui.CUIMessages;
|
||||
import org.eclipse.cdt.ui.index.AbstractIndexerPage;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
|
||||
/**
|
||||
* @author Bogdan Gheorghe
|
||||
*/
|
||||
public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||
|
||||
private Button indexerEnabled;
|
||||
private boolean oldIndexerValue;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.index.AbstractIndexerPage#initialize(org.eclipse.core.resources.IProject)
|
||||
*/
|
||||
public void initialize(IProject project) {
|
||||
|
||||
try {
|
||||
loadPersistedValues(project);
|
||||
this.currentProject = project;
|
||||
} catch (CoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public void performApply(IProgressMonitor monitor) throws CoreException {
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
|
||||
monitor.beginTask(CUIMessages.getString("IndexerOptiosn.task.savingAttributes "), 1); //$NON-NLS-1$
|
||||
ICOptionContainer container = getContainer();
|
||||
IProject proj = null;
|
||||
|
||||
if (container != null){
|
||||
proj = container.getProject();
|
||||
}
|
||||
else{
|
||||
proj = currentProject;
|
||||
}
|
||||
|
||||
if (proj != null) {
|
||||
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj, false);
|
||||
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
||||
if (cext.length > 0) {
|
||||
//initializeIndexerId();
|
||||
for (int i = 0; i < cext.length; i++) {
|
||||
String id = cext[i].getID();
|
||||
//if (cext[i].getID().equals(parserID)) {
|
||||
String orig = cext[i].getExtensionData("indexenabled"); //$NON-NLS-1$
|
||||
String indexEnabled = getIndexerEnabledString();
|
||||
if (orig == null || !orig.equals(indexEnabled)) {
|
||||
cext[i].setExtensionData("indexenabled", indexEnabled); //$NON-NLS-1$
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
} /*else {
|
||||
Preferences store = null;
|
||||
if (container != null){
|
||||
store = container.getPreferences();
|
||||
}
|
||||
|
||||
if (store != null) {
|
||||
String indexEnabled = getIndexerEnabledString();
|
||||
String indexMarkers = getIndexerProblemsValuesString();
|
||||
store.setValue(PREF_INDEX_ENABLED, indexEnabled);
|
||||
store.setValue(PREF_INDEX_MARKERS, indexMarkers);
|
||||
}
|
||||
}
|
||||
|
||||
boolean indexProject = getIndexerValue();
|
||||
|
||||
if ((indexProject != oldIndexerValue)
|
||||
&& (currentProject != null)
|
||||
&& indexProject) {
|
||||
ICDTIndexer indexer = CCorePlugin.getDefault().getCoreModel().getIndexManager().getIndexerForProject(currentProject);
|
||||
if (indexer instanceof SourceIndexer)
|
||||
((SourceIndexer) indexer).indexAll(currentProject);
|
||||
}*/
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
||||
*/
|
||||
public void performDefaults() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
public void createControl(Composite parent) {
|
||||
Composite page = ControlFactory.createComposite(parent, 1);
|
||||
|
||||
Group group = ControlFactory.createGroup(page,"CTags Indexer",1); //$NON-NLS-1$
|
||||
|
||||
GridData gd = (GridData) group.getLayoutData();
|
||||
gd.grabExcessHorizontalSpace = true;
|
||||
gd.horizontalAlignment = GridData.FILL;
|
||||
|
||||
indexerEnabled = ControlFactory.createCheckBox(group, "Enable Indexing" ); //$NON-NLS-1$
|
||||
|
||||
setControl(page);
|
||||
}
|
||||
|
||||
public void loadPersistedValues(IProject project) throws CoreException {
|
||||
|
||||
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(project, false);
|
||||
ICExtensionReference[] cext = cdesc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
||||
if (cext.length > 0) {
|
||||
for (int i = 0; i < cext.length; i++) {
|
||||
String id = cext[i].getID();
|
||||
String orig = cext[i].getExtensionData("indexenabled"); //$NON-NLS-1$
|
||||
if (orig != null){
|
||||
Boolean tempBool = new Boolean(orig);
|
||||
oldIndexerValue = tempBool.booleanValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getIndexerEnabledString(){
|
||||
if (indexerEnabled.getSelection())
|
||||
return "true"; //$NON-NLS-1$
|
||||
|
||||
return "false"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue