diff --git a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexerOffsetTests.java b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexerOffsetTests.java index 41e02cd5859..097860c80a6 100644 --- a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexerOffsetTests.java +++ b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexerOffsetTests.java @@ -14,6 +14,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; import org.eclipse.cdt.internal.core.index.cindexstorage.WordEntry; import org.eclipse.cdt.internal.core.index.cindexstorage.io.GammaCompressedIndexBlock; @@ -47,36 +48,36 @@ public class IndexerOffsetTests extends TestCase { public void testOffsetsResizing() throws Exception{ WordEntry word = new WordEntry("typeDecl/C/Test".toCharArray()); word.addRef(2); - word.addOffset(235,5,2,ICIndexStorageConstants.OFFSET); - word.addOffset(512,3,2,ICIndexStorageConstants.OFFSET); - word.addOffset(512,3,2,ICIndexStorageConstants.OFFSET); - word.addOffset(512,3,2,ICIndexStorageConstants.OFFSET); + word.addOffset(235,5,2,IIndex.OFFSET); + word.addOffset(512,3,2,IIndex.OFFSET); + word.addOffset(512,3,2,IIndex.OFFSET); + word.addOffset(512,3,2,IIndex.OFFSET); word.addRef(5); - word.addOffset(43,6,5,ICIndexStorageConstants.OFFSET); - word.addOffset(2,3,5,ICIndexStorageConstants.LINE); - word.addOffset(89,8,5,ICIndexStorageConstants.OFFSET); - word.addOffset(63,2,5,ICIndexStorageConstants.LINE); - word.addOffset(124,7,5,ICIndexStorageConstants.OFFSET); + word.addOffset(43,6,5,IIndex.OFFSET); + word.addOffset(2,3,5,IIndex.LINE); + word.addOffset(89,8,5,IIndex.OFFSET); + word.addOffset(63,2,5,IIndex.LINE); + word.addOffset(124,7,5,IIndex.OFFSET); word.addRef(9); - word.addOffset(433,5,9,ICIndexStorageConstants.OFFSET); - word.addOffset(234,3,9,ICIndexStorageConstants.OFFSET); + word.addOffset(433,5,9,IIndex.OFFSET); + word.addOffset(234,3,9,IIndex.OFFSET); word.addRef(11); - word.addOffset(4233,2,11,ICIndexStorageConstants.OFFSET); - word.addOffset(2314,7,11,ICIndexStorageConstants.OFFSET); + word.addOffset(4233,2,11,IIndex.OFFSET); + word.addOffset(2314,7,11,IIndex.OFFSET); word.addRef(17); - word.addOffset(2,7,17,ICIndexStorageConstants.OFFSET); - word.addOffset(52,8,17,ICIndexStorageConstants.OFFSET); + word.addOffset(2,7,17,IIndex.OFFSET); + word.addOffset(52,8,17,IIndex.OFFSET); int[] test =word.getOffsets(1); WordEntry word2 = new WordEntry("typeDecl/C/Test".toCharArray()); word2.addRef(4); - word2.addOffset(13,4,4, ICIndexStorageConstants.OFFSET); - word2.addOffset(17,3,4, ICIndexStorageConstants.OFFSET); - word2.addOffset(20,6,4,ICIndexStorageConstants.OFFSET); + word2.addOffset(13,4,4, IIndex.OFFSET); + word2.addOffset(17,3,4, IIndex.OFFSET); + word2.addOffset(20,6,4,IIndex.OFFSET); word2.addRef(7); - word2.addOffset(21,2,7, ICIndexStorageConstants.OFFSET); - word2.addOffset(24,3,7, ICIndexStorageConstants.OFFSET); - word2.addOffset(28,7,7,ICIndexStorageConstants.OFFSET); + word2.addOffset(21,2,7, IIndex.OFFSET); + word2.addOffset(24,3,7, IIndex.OFFSET); + word2.addOffset(28,7,7,IIndex.OFFSET); word.addWordInfo(word2.getRefs(), word2.getOffsets(), word2.getOffsetLengths(), word2.getOffsetCount()); diff --git a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/SourceIndexerTests.java b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/SourceIndexerTests.java index 814ce895d8d..90c5ba82c89 100644 --- a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/SourceIndexerTests.java +++ b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/SourceIndexerTests.java @@ -32,7 +32,6 @@ import org.eclipse.cdt.core.testplugin.CTestPlugin; import org.eclipse.cdt.internal.core.index.IEntryResult; import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.IQueryResult; -import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer; import org.eclipse.cdt.internal.core.search.indexing.IndexManager; import org.eclipse.core.resources.IFile; @@ -199,9 +198,8 @@ 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$ - char[] prefix = IndexerOutput.TYPE_DECL; //$NON-NLS-1$ - IQueryResult[] qresults = ind.queryPrefix(prefix); - IEntryResult[] eresults = ind.queryEntries(prefix); + IQueryResult[] qresults = ind.getPrefix(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION); + IEntryResult[] eresults = 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$ @@ -258,10 +256,10 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener ind = sourceIndexer.getIndex(testProjectPath,true,true); - char[] prefix = "typeDecl/C/CDocumentManager".toCharArray(); //$NON-NLS-1$ + String name = "CDocumentManager"; //$NON-NLS-1$ String [] entryResultModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }, offsets={ [ 2127] }"}; //$NON-NLS-1$ - IEntryResult[] eresults =ind.queryEntries(prefix); - IEntryResult[] bogRe = ind.queryEntries(IndexerOutput.TYPE_DECL); + IEntryResult[] eresults =ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION, name); + IEntryResult[] bogRe = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION); assertTrue("Entry Result exists", eresults != null); //$NON-NLS-1$ if (eresults.length != entryResultModel.length) @@ -322,8 +320,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener //Do a "before" deletion comparison //ind = indexManager.getIndex(testProjectPath,true,true); - char[] prefix = IndexerOutput.TYPE_DECL; //$NON-NLS-1$ - IEntryResult[] eresults = ind.queryEntries(prefix); + IEntryResult[] eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION); assertTrue("Entry result found for typdeDecl/", eresults != null); //$NON-NLS-1$ String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 2 }, offsets={ [ 2127] }", @@ -360,7 +357,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener //See if the index is still there ind = sourceIndexer.getIndex(testProjectPath,true,true); - eresults = ind.queryEntries(prefix); + eresults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION); 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$ @@ -383,7 +380,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true); assertTrue("Index exists for project",ind != null); //$NON-NLS-1$ //$NON-NLS-2$ - IEntryResult[] typerefreesults = ind.queryEntries(IndexerOutput.TYPE_REF); + IEntryResult[] typerefreesults = ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.REFERENCE); assertTrue("Type Ref Results exist", typerefreesults != null); //$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$ @@ -396,7 +393,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener "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(IndexerOutput.TYPE_DECL); + IEntryResult[] typedeclresults =ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION); assertTrue("Type Decl Results exist", typedeclresults != null); //$NON-NLS-1$ if (typedeclresults.length != typeDeclEntryResultModel.length) @@ -408,7 +405,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener } String [] typeDefEntryResultModel ={"EntryResult: word=typeDecl/T/int32, refs={ 1 }, offsets={ [ 2200] }"}; //$NON-NLS-1$ - IEntryResult[] typedefresults =ind.queryEntries((new String(IndexerOutput.TYPE_DECL) + IndexerOutput.TYPEDEF_SUFFIX).toCharArray()); + IEntryResult[] typedefresults =ind.getEntries(IIndex.TYPE, IIndex.TYPE_TYPEDEF, IIndex.DECLARATION); assertTrue("Type Def Results exist", typedefresults != null); //$NON-NLS-1$ if (typedefresults.length != typeDefEntryResultModel.length) @@ -422,7 +419,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener 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(IndexerOutput.NAMESPACE_DECL); + IEntryResult[] namespaceresults =ind.getEntries(IIndex.NAMESPACE, IIndex.ANY, IIndex.DECLARATION); assertTrue("Namespace Results exist", namespaceresults != null); //$NON-NLS-1$ if (namespaceresults.length != namespaceResultModel.length) @@ -436,7 +433,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener 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(IndexerOutput.FIELD_DECL); + IEntryResult[] fieldresults =ind.getEntries(IIndex.FIELD, IIndex.ANY, IIndex.DECLARATION); assertTrue("Field Results exist", fieldresults != null); //$NON-NLS-1$ if (fieldresults.length != fieldResultModel.length) @@ -450,7 +447,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener 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(IndexerOutput.ENUMTOR_DECL); + IEntryResult[] enumeratorresults =ind.getEntries(IIndex.ENUMTOR, IIndex.ANY, IIndex.DECLARATION); assertTrue("Enumerator Results exist", enumeratorresults != null); //$NON-NLS-1$ if (enumeratorresults.length != enumeratorResultModel.length) @@ -462,7 +459,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener } 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(IndexerOutput.FUNCTION_DECL); + IEntryResult[] functionresults =ind.getEntries(IIndex.FUNCTION, IIndex.ANY, IIndex.DECLARATION); if (functionresults.length != functionResultModel.length) fail("Entry Result length different from model for functionDecl"); //$NON-NLS-1$ @@ -489,7 +486,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener - IEntryResult[] methodresults =ind.queryEntries(IndexerOutput.METHOD_DECL); + IEntryResult[] methodresults =ind.getEntries(IIndex.METHOD, IIndex.ANY, IIndex.DECLARATION); assertTrue("Entry exists", methodresults != null); //$NON-NLS-1$ if (methodresults.length != methodResultModel.length) @@ -515,7 +512,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener "EntryResult: word=typeRef/G/ForwardA/A, refs={ 1 }, offsets={ [ 237] }", "EntryResult: word=typeRef/V/x/B/A, refs={ 1 }, offsets={ [ 2247] }"}; - IEntryResult[] typerefresults = ind.queryEntries(IndexerOutput.TYPE_REF); + IEntryResult[] typerefresults = ind.getEntries(IIndex.TYPE,IIndex.ANY,IIndex.REFERENCE); assertTrue("Entry exists",typerefresults != null); //$NON-NLS-1$ if (typerefresults.length != typeRefEntryResultModel.length) @@ -527,7 +524,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener } String [] funRefEntryResultModel ={"EntryResult: word=functionRef/something/A, refs={ 1 }, offsets={ [ 2316] }"};//$NON-NLS-1$ - IEntryResult[] funRefresults = ind.queryEntries(IndexerOutput.FUNCTION_REF); + IEntryResult[] funRefresults = ind.getEntries(IIndex.FUNCTION,IIndex.ANY, IIndex.REFERENCE); assertTrue("Entry exists",funRefresults != null); //$NON-NLS-1$ if (funRefresults.length != funRefEntryResultModel.length) @@ -539,7 +536,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener } String [] namespaceRefResultModel = {"EntryResult: word=namespaceRef/A, refs={ 1 }, offsets={ [ 2228, 2241, 2257, 2273, 2292, 2313, 2334] }", "EntryResult: word=namespaceRef/B/A, refs={ 1 }, offsets={ [ 2231, 2244, 2260, 2276, 2295, 2337] }"}; //$NON-NLS-1$ //$NON-NLS-2$ - IEntryResult[] namespacerefresults = ind.queryEntries(IndexerOutput.NAMESPACE_REF); + IEntryResult[] namespacerefresults = ind.getEntries(IIndex.NAMESPACE, IIndex.ANY, IIndex.REFERENCE); assertTrue("Entry exists",namespacerefresults!=null); //$NON-NLS-1$ if (namespacerefresults.length != namespaceRefResultModel.length) @@ -551,7 +548,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener } String [] fieldRefResultModel = {"EntryResult: word=fieldRef/y/C/B/A, refs={ 1 }, offsets={ [ 2282] }"}; //$NON-NLS-1$ - IEntryResult[] fieldrefresults = ind.queryEntries(IndexerOutput.FIELD_REF); + IEntryResult[] fieldrefresults = ind.getEntries(IIndex.FIELD, IIndex.ANY, IIndex.REFERENCE); assertTrue("Entry exists",fieldrefresults!=null); //$NON-NLS-1$ if (fieldrefresults.length != fieldRefResultModel.length) @@ -563,7 +560,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener } String [] methodRefResultModel = {"EntryResult: word=methodRef/bar/C/B/A, refs={ 1 }, offsets={ [ 2301] }"}; //$NON-NLS-1$ - IEntryResult[] methodrefresults = ind.queryEntries(IndexerOutput.METHOD_REF); + IEntryResult[] methodrefresults = ind.getEntries(IIndex.METHOD, IIndex.ANY, IIndex.REFERENCE); assertTrue("Entry exists", methodrefresults != null); //$NON-NLS-1$ if (methodrefresults.length != methodRefResultModel.length) @@ -587,8 +584,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.queryEntries((new String(IndexerOutput.TYPE_DECL) + IndexerOutput.CLASS_SUFFIX).toCharArray()); - IQueryResult[] qResult = ind.queryPrefix((new String(IndexerOutput.TYPE_DECL) + IndexerOutput.CLASS_SUFFIX).toCharArray()); + IEntryResult[] eResult = ind.getEntries(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION); + IQueryResult[] qResult = ind.getPrefix(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION); 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$ @@ -655,7 +652,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener IIndex ind = sourceIndexer.getIndex(testProjectPath,true,true); assertTrue("Index exists for project",ind != null); //$NON-NLS-1$ - IEntryResult[] macroresults = ind.queryEntries(IndexerOutput.MACRO_DECL); + IEntryResult[] macroresults = ind.getEntries(IIndex.MACRO, IIndex.ANY, IIndex.DECLARATION); assertTrue("Entry exists", macroresults != null); //$NON-NLS-1$ String [] macroResultModel = {"EntryResult: word=macroDecl/CASE, refs={ 1 }, offsets={ [ 2131] }", @@ -714,8 +711,7 @@ 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.queryEntries("typeDecl/C/ForwardA/A".toCharArray()); - IEntryResult[] fwdDclResults = ind.queryEntries("typeDecl/G/ForwardA/A".toCharArray()); //$NON-NLS-1$ + IEntryResult[] fwdDclResults = ind.getEntries(IIndex.TYPE, IIndex.TYPE_FWD_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$ @@ -728,7 +724,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener assertEquals(fwdDclModel[i],fwdDclResults[i].toString()); } - IEntryResult[] fwdDclRefResults = ind.queryEntries("typeRef/G/ForwardA/A".toCharArray()); //$NON-NLS-1$ + IEntryResult[] fwdDclRefResults = ind.getEntries(IIndex.TYPE, IIndex.TYPE_FWD_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$ diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java index 316d26a4095..95e89cf7712 100644 --- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java +++ b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java @@ -13,14 +13,12 @@ */ package org.eclipse.cdt.core.search.tests; -import java.util.Iterator; + import java.util.Set; -import java.util.TreeSet; import org.eclipse.cdt.core.search.BasicSearchMatch; import org.eclipse.cdt.core.search.ICSearchPattern; import org.eclipse.cdt.core.search.IMatch; -import org.eclipse.cdt.core.search.OrPattern; import org.eclipse.cdt.core.search.SearchEngine; import org.eclipse.cdt.core.testplugin.CTestPlugin; import org.eclipse.cdt.internal.core.CharOperation; diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob.java index 17849947969..08e07f16db9 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerDependenciesJob.java @@ -17,6 +17,7 @@ import org.eclipse.cdt.core.browser.PathUtil; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; import org.eclipse.cdt.internal.core.index.IIndex; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput; @@ -59,7 +60,7 @@ public class IndexerDependenciesJob extends IndexerJob { if (progressMonitor.isCanceled()) throw new InterruptedException(); - IEntryResult[] includeEntries = input.queryEntriesPrefixedBy(IndexerOutput.INCLUDE_REF); + IEntryResult[] includeEntries = input.queryEntriesPrefixedBy(Index.encodeEntry(IIndex.INCLUDE, IIndex.ANY, IIndex.REFERENCE)); if (includeEntries != null) { //TODO subprogress monitor for (int i = 0; i < includeEntries.length; ++i) { diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob.java index d7c827e7c14..d449b1be99f 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/IndexerTypesJob.java @@ -22,6 +22,7 @@ import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; import org.eclipse.cdt.internal.core.index.IIndex; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput; @@ -63,7 +64,7 @@ public class IndexerTypesJob extends IndexerJob { if (monitor.isCanceled()) throw new InterruptedException(); - IEntryResult[] namespaceEntries = input.queryEntriesPrefixedBy(IndexerOutput.NAMESPACE_DECL); + IEntryResult[] namespaceEntries = input.queryEntriesPrefixedBy(Index.encodeEntry(IIndex.NAMESPACE, IIndex.ANY, IIndex.DECLARATION)); if (namespaceEntries != null) { //TODO subprogress monitor for (int i = 0; i < namespaceEntries.length; ++i) { @@ -88,7 +89,7 @@ public class IndexerTypesJob extends IndexerJob { if (monitor.isCanceled()) throw new InterruptedException(); - IEntryResult[] typeEntries = input.queryEntriesPrefixedBy(IndexerOutput.TYPE_DECL); + IEntryResult[] typeEntries = input.queryEntriesPrefixedBy(Index.encodeEntry(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION)); if (typeEntries != null) { //TODO subprogress monitor for (int i = 0; i < typeEntries.length; ++i) { diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndex.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndex.java index 3d418481419..5e88c9e111c 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndex.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndex.java @@ -22,7 +22,45 @@ import org.eclipse.core.runtime.IPath; */ public interface IIndex { - /** + + //Used for offsets LINE = line based, while OFFSET = character offset + final static int LINE=1; + final static int OFFSET=2; + + // Constants used to refer to index items + final static int ANY = 0; + + // All index elements can be described as a triple (meta_kind, kind, type) + + // meta_kind + final static int TYPE = 1; + final static int FUNCTION = 2; + final static int METHOD = 3; + final static int FIELD = 4; + final static int MACRO = 5; + final static int NAMESPACE = 6; + final static int ENUMTOR = 7; + final static int INCLUDE = 8; + + // kind + final static int TYPE_CLASS = 1; + final static int TYPE_STRUCT = 2; + final static int TYPE_UNION = 3; + final static int TYPE_ENUM = 4; + final static int TYPE_VAR = 5; + 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 DECLARATION = 1; + final static int REFERENCE = 2; + final static int DEFINITION = 3; + + /** * Adds the given file to the index. */ void add(IFile file, IIndexer indexer) throws IOException; @@ -50,14 +88,14 @@ public interface IIndex { * Ansers true if has some changes to save. */ boolean hasChanged(); + /** - * Returns the paths of the documents containing the given word. + * Returns all entries for a given pattern. */ - IQueryResult[] query(String word) throws IOException; - /** - * Returns all entries for a given word. - */ - IEntryResult[] queryEntries(char[] pattern) throws IOException; + + IEntryResult[] getEntries(int meta_kind, int kind, int ref, String name) throws IOException; + IEntryResult[] getEntries(int meta_kind, int kind, int ref) throws IOException; + /** * Returns the paths of the documents whose names contain the given word. */ @@ -65,11 +103,15 @@ public interface IIndex { /** * Returns the paths of the documents containing the given word prefix. */ - IQueryResult[] queryPrefix(char[] prefix) throws IOException; + + IQueryResult[] getPrefix(int meta_kind, int kind, int ref, String name) throws IOException; + IQueryResult[] getPrefix(int meta_kind, int kind, int ref) throws IOException; + /** * Removes the corresponding document from the index. */ void remove(String documentName) throws IOException; + /** * Saves the index on the disk. */ diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java index 0ed6b378228..b79e38671d4 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java @@ -28,11 +28,11 @@ public interface IIndexerOutput { public void addFieldDecl(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); public void addFieldRef(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); - public void addMethodDecl(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); - public void addMethodRef(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); + public void addMethodDecl(int indexedFileNumber, char [][] name, /*char[][] parameterTypes,*/ int offset, int offsetLength, int offsetType); + public void addMethodRef(int indexedFileNumber, char [][] name, /*char[][] parameterTypes,*/ int offset, int offsetLength, int offsetType); - public void addFunctionDecl(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); - public void addFunctionRef(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); + public void addFunctionDecl(int indexedFileNumber, char [][] name, /*char[][] parameterTypes,*/int offset, int offsetLength, int offsetType); + public void addFunctionRef(int indexedFileNumber, char [][] name, /*char[][] parameterTypes,*/int offset, int offsetLength, int offsetType); public void addNamespaceDecl(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); public void addNamespaceRef(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); @@ -63,9 +63,6 @@ public interface IIndexerOutput { public void addFriendDecl(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); public void addFriendRef(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); - public void addVarDecl(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); - public void addVarRef(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); - public void addFwd_ClassDecl(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); public void addFwd_ClassRef(int indexedFileNumber, char [][] name, int offset, int offsetLength, int offsetType); diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/ICIndexStorageConstants.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/ICIndexStorageConstants.java index df92aa3a984..866e8686f93 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/ICIndexStorageConstants.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/ICIndexStorageConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at @@ -8,67 +8,67 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ + package org.eclipse.cdt.internal.core.index.cindexstorage; -/** - * This interface provides constants used by the search engine. - */ + public interface ICIndexStorageConstants { /** * The signature of the index file. */ + public static final String SIGNATURE= "INDEX FILE 0.016"; //$NON-NLS-1$ - /** - * The separator for files in the index file. - */ - public static final char FILE_SEPARATOR= '/'; + /** * The size of a block for a Block. */ public static final int BLOCK_SIZE= 8192; - /** - * Encodings used in CIndexStorage - can be used by clients to encode - * strings destined for the index. Proper format is: - * - * {encodings + encodingTypes} - * - * for everything except type strings which should look like: - * - * {encodings + encodingTypes + typeConstants + '/'}. - */ - final static int TYPE = 1; - final static int FUNCTION = 2; - final static int METHOD = 3; - final static int FIELD = 4; - final static int MACRO = 5; - final static int NAMESPACE = 6; - final static int ENUMTOR = 7; - final static int INCLUDE = 8; + final public static char SEPARATOR= '/'; + + // TODO: Remove these constants. + static final public char CLASS_SUFFIX = 'C'; // CLASS + static final public char DERIVED_SUFFIX = 'D'; // DERIVED + static final public char ENUM_SUFFIX = 'E'; // ENUM + static final public char FRIEND_SUFFIX = 'F'; // FRIEND + static final public char FWD_CLASS_SUFFIX = 'G'; // FWD_CLASS + static final public char FWD_STRUCT_SUFFIX = 'H'; // FWD_STRUCT + static final public char FWD_UNION_SUFFIX = 'I'; // FWD_UNION + static final public char STRUCT_SUFFIX = 'S'; // STRUCT + static final public char TYPEDEF_SUFFIX = 'T'; // TYPEDEF + static final public char UNION_SUFFIX = 'U'; // UNION + static final public char VAR_SUFFIX = 'V'; // VAR + + final static char [][] encodings = { + "".toCharArray(), // not used //$NON-NLS-1$ + "type".toCharArray(), // TYPES //$NON-NLS-1$ + "function".toCharArray(), // FUNCTIONS //$NON-NLS-1$ + "method".toCharArray(), // METHODS //$NON-NLS-1$ + "field".toCharArray(), // FIELDS //$NON-NLS-1$ + "macro".toCharArray(), // MACROS //$NON-NLS-1$ + "namespace".toCharArray(), // NAMESPACES //$NON-NLS-1$ + "enumtor".toCharArray(), // ENUMERATORS //$NON-NLS-1$ + "include" .toCharArray() // INCLUDES //$NON-NLS-1$ + }; - /** - * Encoding types - */ - final static int DECLARATION = 1; - final static int REFERENCE = 2; - final static int DEFINITION = 3; - - /** - * Encoding constants used in CIndexStorage - */ - final static int TYPE_CLASS = 1; - final static int TYPE_STRUCT = 2; - final static int TYPE_UNION = 3; - final static int TYPE_ENUM = 4; - final static int TYPE_VAR = 5; - 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; + final static char [][] encodingTypes = { + "".toCharArray(), //$NON-NLS-1$ + "Decl/".toCharArray(), // DECLARATIONS //$NON-NLS-1$ + "Ref/".toCharArray(), // REFERENCES //$NON-NLS-1$ + "Defn/".toCharArray() // DEFINTIONS //$NON-NLS-1$ + }; - //Used for offsets - final static int LINE=1; - final static int OFFSET=2; + final static char[] typeConstants = { ' ', // not used + 'C', // CLASS + 'S', // STRUCT + 'U', // UNION + 'E', // ENUM + 'V', // VAR + 'T', // TYPEDEF + 'D', // DERIVED + 'F', // FRIEND + 'G', // FWD_CLASS + 'H', // FWD_STRUCT + 'I' // FWD_UNION + }; } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/Index.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/Index.java index 2edd0e87dc6..a631939bca9 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/Index.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/Index.java @@ -20,6 +20,8 @@ import java.util.Map; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.index.ICDTIndexer; import org.eclipse.cdt.core.index.IIndexDelta; +import org.eclipse.cdt.core.search.ICSearchConstants; +import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.IIndexer; @@ -44,7 +46,7 @@ import org.eclipse.core.runtime.IPath; * The changes are only taken into account by the queries after a merge. */ -public class Index implements IIndex { +public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants { /** * Maximum size of the index in memory. */ @@ -282,18 +284,7 @@ public class Index implements IIndex { } } } - /** - * @see IIndex#query - */ - public IQueryResult[] query(String word) throws IOException { - //save(); - IndexInput input= new BlocksIndexInput(indexFile); - try { - return input.query(word); - } finally { - input.close(); - } - } + public IEntryResult[] queryEntries(char[] prefix) throws IOException { //save(); IndexInput input= new BlocksIndexInput(indexFile); @@ -437,16 +428,369 @@ public class Index implements IIndex { return (addsIndex.getFootprint() >= MAX_FOOTPRINT); } public String toString() { - String str = this.toString; - if (str == null) str = super.toString(); - str += "(length: "+ getIndexFile().length() +")"; //$NON-NLS-1$ //$NON-NLS-2$ - return str; -} + String str = this.toString; + if (str == null) + str = super.toString(); + str += "(length: " + getIndexFile().length() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + return str; + } public org.eclipse.cdt.core.index.ICDTIndexer getIndexer(){ return (org.eclipse.cdt.core.index.ICDTIndexer) indexer; } + public IEntryResult[] queryEntries(char[] prefix, char optionalType, char[] name, char[][] containingTypes, int matchMode, boolean isCaseSensitive) throws IOException { + return queryEntries(Index.bestPrefix(prefix, optionalType, name, containingTypes, matchMode, isCaseSensitive)); + } + + public static final char[] bestTypePrefix( SearchFor searchFor, LimitTo limitTo, char[] typeName, char[][] containingTypes, int matchMode, boolean isCaseSensitive) { + char [] prefix = null; + if( limitTo == DECLARATIONS ){ + prefix = encodeEntry(IIndex.TYPE, ANY, DECLARATION); + } else if( limitTo == REFERENCES ){ + prefix = encodeEntry(IIndex.TYPE, ANY, REFERENCE); + } else { + return encodeEntry(IIndex.TYPE, ANY, ANY); + } + + char classType = 0; + + if( searchFor == ICSearchConstants.CLASS ){ + classType = CLASS_SUFFIX; + } else if ( searchFor == ICSearchConstants.STRUCT ){ + classType = STRUCT_SUFFIX; + } else if ( searchFor == ICSearchConstants.UNION ){ + classType = UNION_SUFFIX; + } else if ( searchFor == ICSearchConstants.ENUM ){ + classType = ENUM_SUFFIX; + } else if ( searchFor == ICSearchConstants.TYPEDEF ){ + classType = TYPEDEF_SUFFIX; + } else if ( searchFor == ICSearchConstants.DERIVED){ + 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; + } + + return bestPrefix( prefix, classType, typeName, containingTypes, matchMode, isCaseSensitive ); + } + + public static final char[] bestNamespacePrefix(LimitTo limitTo, char[] namespaceName, char[][] containingTypes, int matchMode, boolean isCaseSensitive) { + char [] prefix = null; + if( limitTo == REFERENCES ){ + prefix = encodeEntry(IIndex.NAMESPACE, ANY, REFERENCE); + } else if ( limitTo == DECLARATIONS ) { + prefix = encodeEntry(IIndex.NAMESPACE, ANY, DECLARATION); + } else { + return encodeEntry(IIndex.NAMESPACE, ANY, ANY); + } + + return bestPrefix( prefix, (char) 0, namespaceName, containingTypes, matchMode, isCaseSensitive ); + } + + public static final char[] bestVariablePrefix( LimitTo limitTo, char[] varName, char[][] containingTypes, int matchMode, boolean isCaseSenstive ){ + char [] prefix = null; + if( limitTo == REFERENCES ){ + prefix = encodeEntry(IIndex.TYPE, ANY, REFERENCE); + } else if( limitTo == DECLARATIONS ){ + prefix = encodeEntry(IIndex.TYPE, ANY, DECLARATION); + } else { + return encodeEntry(IIndex.TYPE, ANY, ANY); + } + + return bestPrefix( prefix, VAR_SUFFIX, varName, containingTypes, matchMode, isCaseSenstive ); + } + public static final char[] bestFieldPrefix( LimitTo limitTo, char[] fieldName,char[][] containingTypes, int matchMode, boolean isCaseSensitive) { + char [] prefix = null; + if( limitTo == REFERENCES ){ + prefix = encodeEntry(IIndex.FIELD, ANY, REFERENCE); + } else if( limitTo == DECLARATIONS ){ + prefix = encodeEntry(IIndex.FIELD, ANY, DECLARATION); + } else { + return encodeEntry(IIndex.FIELD, ANY, ANY); + } + + return bestPrefix( prefix, (char)0, fieldName, containingTypes, matchMode, isCaseSensitive ); + } + + public static final char[] bestEnumeratorPrefix( LimitTo limitTo, char[] enumeratorName,char[][] containingTypes, int matchMode, boolean isCaseSensitive) { + char [] prefix = null; + if( limitTo == REFERENCES ){ + prefix = encodeEntry(IIndex.ENUMTOR, ANY, REFERENCE); + } else if( limitTo == DECLARATIONS ){ + prefix = encodeEntry(IIndex.ENUMTOR, ANY, DECLARATION); + } else if (limitTo == ALL_OCCURRENCES){ + return encodeEntry(IIndex.ENUMTOR, ANY, ANY); + } + else { + //Definitions + return "noEnumtorDefs".toCharArray(); //$NON-NLS-1$ + } + + return bestPrefix( prefix, (char)0, enumeratorName, containingTypes, matchMode, isCaseSensitive ); + } + public static final char[] bestMethodPrefix( LimitTo limitTo, char[] methodName,char[][] containingTypes, int matchMode, boolean isCaseSensitive) { + char [] prefix = null; + if( limitTo == REFERENCES ){ + prefix = encodeEntry(IIndex.METHOD, ANY, REFERENCE); + } else if( limitTo == DECLARATIONS ){ + prefix = encodeEntry(IIndex.METHOD, ANY, DECLARATION); + } else if( limitTo == DEFINITIONS ){ + //TODO prefix = METHOD_DEF; + return encodeEntry(IIndex.METHOD, ANY, ANY); + } else { + return encodeEntry(IIndex.METHOD, ANY, ANY); + } + + return bestPrefix( prefix, (char)0, methodName, containingTypes, matchMode, isCaseSensitive ); + } + + public static final char[] bestFunctionPrefix( LimitTo limitTo, char[] functionName, int matchMode, boolean isCaseSensitive) { + char [] prefix = null; + if( limitTo == REFERENCES ){ + prefix = encodeEntry(IIndex.FUNCTION, ANY, REFERENCE); + } else if( limitTo == DECLARATIONS ){ + prefix = encodeEntry(IIndex.FUNCTION, ANY, DECLARATION); + } else if ( limitTo == DEFINITIONS ){ + //TODO prefix = FUNCTION_DEF; + return encodeEntry(IIndex.FUNCTION, ANY, ANY); + } else { + return encodeEntry(IIndex.FUNCTION, ANY, ANY); + } + return bestPrefix( prefix, (char)0, functionName, null, matchMode, isCaseSensitive ); + } + + public static final char[] bestPrefix( char [] prefix, char optionalType, char[] name, char[][] containingTypes, int matchMode, boolean isCaseSensitive) { + char[] result = null; + int pos = 0; + + int wildPos, starPos = -1, questionPos; + + //length of prefix + separator + int length = prefix.length; + + //add length for optional type + another separator + if( optionalType != 0 ) + length += 2; + + if (!isCaseSensitive){ + //index is case sensitive, thus in case attempting case insensitive search, cannot consider + //type name. + name = null; + } else if( matchMode == PATTERN_MATCH && name != null ){ + int start = 0; + + char [] temp = new char [ name.length ]; + boolean isEscaped = false; + int tmpIdx = 0; + for( int i = 0; i < name.length; i++ ){ + if( name[i] == '\\' ){ + if( !isEscaped ){ + isEscaped = true; + continue; + } + isEscaped = false; + } else if( name[i] == '*' && !isEscaped ){ + starPos = i; + break; + } + temp[ tmpIdx++ ] = name[i]; + } + + name = new char [ tmpIdx ]; + System.arraycopy( temp, 0, name, 0, tmpIdx ); + + //starPos = CharOperation.indexOf( '*', name ); + questionPos = CharOperation.indexOf( '?', name ); + + if( starPos >= 0 ){ + if( questionPos >= 0 ) + wildPos = ( starPos < questionPos ) ? starPos : questionPos; + else + wildPos = starPos; + } else { + wildPos = questionPos; + } + + switch( wildPos ){ + case -1 : break; + case 0 : name = null; break; + default : name = CharOperation.subarray( name, 0, wildPos ); break; + } + } + //add length for name + if( name != null ){ + length += name.length; + } else { + //name is null, don't even consider qualifications. + result = new char [ length ]; + System.arraycopy( prefix, 0, result, 0, pos = prefix.length ); + if( optionalType != 0){ + result[ pos++ ] = optionalType; + result[ pos++ ] = SEPARATOR; + } + return result; + } + + //add the total length of the qualifiers + //we don't want to mess with the contents of this array (treat it as constant) + //so check for wild cards later. + if( containingTypes != null ){ + for( int i = 0; i < containingTypes.length; i++ ){ + if( containingTypes[i].length > 0 ){ + length += containingTypes[ i ].length; + length++; //separator + } + } + } + + //because we haven't checked qualifier wild cards yet, this array might turn out + //to be too long. So fill a temp array, then check the length after + char [] temp = new char [ length ]; + + System.arraycopy( prefix, 0, temp, 0, pos = prefix.length ); + + if( optionalType != 0 ){ + temp[ pos++ ] = optionalType; + temp[ pos++ ] = SEPARATOR; + } + + System.arraycopy( name, 0, temp, pos, name.length ); + pos += name.length; + + if( containingTypes != null ){ + for( int i = containingTypes.length - 1; i >= 0; i-- ){ + if( matchMode == PATTERN_MATCH ){ + starPos = CharOperation.indexOf( '*', containingTypes[i] ); + questionPos = CharOperation.indexOf( '?', containingTypes[i] ); + + if( starPos >= 0 ){ + if( questionPos >= 0 ) + wildPos = ( starPos < questionPos ) ? starPos : questionPos; + else + wildPos = starPos; + } else { + wildPos = questionPos; + } + + if( wildPos >= 0 ){ + temp[ pos++ ] = SEPARATOR; + System.arraycopy( containingTypes[i], 0, temp, pos, wildPos ); + pos += starPos; + break; + } + } + + if( containingTypes[i].length > 0 ){ + temp[ pos++ ] = SEPARATOR; + System.arraycopy( containingTypes[i], 0, temp, pos, containingTypes[i].length ); + pos += containingTypes[i].length; + } + } + } + + if( pos < length ){ + result = new char[ pos ]; + System.arraycopy( temp, 0, result, 0, pos ); + } else { + result = temp; + } + + return result; + } + + /** + * @param _limitTo + * @param simpleName + * @param _matchMode + * @param _caseSensitive + * @return + */ + public static final char[] bestMacroPrefix( LimitTo limitTo, char[] macroName, int matchMode, boolean isCaseSenstive ){ + //since we only index macro declarations we already know the prefix + char [] prefix = null; + if( limitTo == DECLARATIONS ){ + prefix = Index.encodeEntry(IIndex.MACRO, IIndex.ANY, IIndex.DECLARATION); + } else { + return null; + } + + return bestPrefix( prefix, (char)0, macroName, null, matchMode, isCaseSenstive ); + } + + /** + * @param _limitTo + * @param simpleName + * @param _matchMode + * @param _caseSensitive + * @return + */ + public static final char[] bestIncludePrefix( LimitTo limitTo, char[] incName, int matchMode, boolean isCaseSenstive ){ + //since we only index macro declarations we already know the prefix + char [] prefix = null; + if( limitTo == REFERENCES ){ + prefix = encodeEntry(IIndex.INCLUDE, IIndex.ANY, IIndex.REFERENCE); + } else { + return null; + } + + return bestPrefix( prefix, (char)0, incName, null, matchMode, isCaseSenstive ); + } + + public static String getDescriptionOf (int meta_kind, int kind, int ref) { + StringBuffer buff = new StringBuffer(); + buff.append(encodings[meta_kind]); + buff.append(encodingTypes[ref]); + if(kind != 0) { + buff.append(typeConstants[kind]); + buff.append(SEPARATOR); + } + return buff.toString(); + } + public static char [] encodeEntry (int meta_kind, int kind, int ref, String name) { +// if( kind == ANY && ref == ANY ) +// return encodings[meta_kind]; + StringBuffer buff = new StringBuffer(); + buff.append(encodings[meta_kind]); + buff.append(encodingTypes[ref]); + if(kind != 0) + buff.append(typeConstants[kind]); + if (name.length() != 0) { + buff.append( SEPARATOR ); + buff.append ( name ); + } + return buff.toString().toCharArray(); + } + + public static char [] encodeEntry (int meta_kind, int kind, int ref) { + StringBuffer buff = new StringBuffer(); + buff.append(encodings[meta_kind]); + buff.append(encodingTypes[ref]); + if(kind != 0) + buff.append(typeConstants[kind]); + return buff.toString().toCharArray(); + } + public IEntryResult[] getEntries(int meta_kind, int kind, int ref, String name) throws IOException { + return queryEntries(encodeEntry(meta_kind, kind, ref, name)); + } + public IEntryResult[] getEntries(int meta_kind, int kind, int ref) throws IOException { + return queryEntries(encodeEntry(meta_kind, kind, ref)); + } + + public IQueryResult[] getPrefix(int meta_kind, int kind, int ref, String name) throws IOException { + return queryPrefix(encodeEntry(meta_kind, kind, ref, name)); + } + public IQueryResult[] getPrefix(int meta_kind, int kind, int ref) throws IOException { + return queryPrefix(encodeEntry(meta_kind, kind, ref)); + } } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexerOutput.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexerOutput.java index 7dd1a579f26..21df1a34c3b 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexerOutput.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/IndexerOutput.java @@ -10,8 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.index.cindexstorage; -import org.eclipse.cdt.core.search.ICSearchConstants; -import org.eclipse.cdt.internal.core.CharOperation; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.IIndexerOutput; import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer; @@ -20,44 +19,7 @@ import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer; * an inMemoryIndex. */ -public class IndexerOutput implements IIndexerOutput, ICIndexStorageConstants, ICSearchConstants { - - static final public char CLASS_SUFFIX = 'C'; // CLASS - static final public char DERIVED_SUFFIX = 'D'; // DERIVED - static final public char ENUM_SUFFIX = 'E'; // ENUM - static final public char FRIEND_SUFFIX = 'F'; // FRIEND - static final public char FWD_CLASS_SUFFIX = 'G'; // FWD_CLASS - static final public char FWD_STRUCT_SUFFIX = 'H'; // FWD_STRUCT - static final public char FWD_UNION_SUFFIX = 'I'; // FWD_UNION - static final public char STRUCT_SUFFIX = 'S'; // STRUCT - static final public char TYPEDEF_SUFFIX = 'T'; // TYPEDEF - static final public char UNION_SUFFIX = 'U'; // UNION - static final public char VAR_SUFFIX = 'V'; // VAR - - final public static char SEPARATOR= '/'; - - static public char[] TYPE_REF= "typeRef/".toCharArray(); //$NON-NLS-1$ - static public char[] TYPE_DECL = "typeDecl/".toCharArray(); //$NON-NLS-1$ - static public char[] TYPE_ALL = "type".toCharArray(); //$NON-NLS-1$ - static public char[] NAMESPACE_REF= "namespaceRef/".toCharArray(); //$NON-NLS-1$ - static public char[] NAMESPACE_DECL= "namespaceDecl/".toCharArray(); //$NON-NLS-1$ - static public char[] NAMESPACE_ALL = "namespace".toCharArray(); //$NON-NLS-1$ - static public char[] FIELD_REF= "fieldRef/".toCharArray(); //$NON-NLS-1$ - static public char[] FIELD_DECL= "fieldDecl/".toCharArray(); //$NON-NLS-1$ - static public char[] FIELD_ALL= "field".toCharArray(); //$NON-NLS-1$ - static public char[] ENUMTOR_REF= "enumtorRef/".toCharArray(); //$NON-NLS-1$ - static public char[] ENUMTOR_DECL = "enumtorDecl/".toCharArray(); //$NON-NLS-1$ - static public char[] ENUMTOR_ALL = "enumtor".toCharArray(); //$NON-NLS-1$ - static public char[] METHOD_REF= "methodRef/".toCharArray(); //$NON-NLS-1$ - static public char[] METHOD_DECL= "methodDecl/".toCharArray(); //$NON-NLS-1$ - static public char[] METHOD_ALL= "method".toCharArray(); //$NON-NLS-1$ - static public char[] MACRO_DECL = "macroDecl/".toCharArray(); //$NON-NLS-1$ - static public char[] MACRO_REF = "macroRef/".toCharArray(); //$NON-NLS-1$ - static public char[] INCLUDE_REF = "includeRef/".toCharArray(); //$NON-NLS-1$ - static public char[] FUNCTION_REF= "functionRef/".toCharArray(); //$NON-NLS-1$ - static public char[] FUNCTION_DECL= "functionDecl/".toCharArray(); //$NON-NLS-1$ - static public char[] FUNCTION_ALL= "function".toCharArray(); //$NON-NLS-1$ - +public class IndexerOutput implements ICIndexStorageConstants, IIndexerOutput { protected InMemoryIndex index; /** * IndexerOutput constructor comment. @@ -66,7 +28,7 @@ public class IndexerOutput implements IIndexerOutput, ICIndexStorageConstants, I this.index= index; } - protected void addRef(int indexedFileNumber, char [][] name, int type, LimitTo limit, int offset, int offsetLength, int offsetType) { + protected void addRef(int indexedFileNumber, char [][] name, char suffix, int type, int offset, int offsetLength, int offsetType) { if (indexedFileNumber == 0) { throw new IllegalStateException(); } @@ -75,11 +37,11 @@ public class IndexerOutput implements IIndexerOutput, ICIndexStorageConstants, I offsetLength = 1; index.addRef( - encodeTypeEntry(name, type, limit), + encodeTypeEntry(name, suffix, type), indexedFileNumber, offset, offsetLength, offsetType); } - protected void addRef(int indexedFileNumber, char[][] name, char[] prefix, int prefixLength, int offset, int offsetLength, int offsetType) { + protected void addRef(int indexedFileNumber, char[][] name, int meta_kind, int ref, int offset, int offsetLength, int offsetType) { if (indexedFileNumber == 0) { throw new IllegalStateException(); } @@ -88,7 +50,7 @@ public class IndexerOutput implements IIndexerOutput, ICIndexStorageConstants, I offsetLength = 1; index.addRef( - encodeEntry(name, prefix, prefixLength), + encodeEntry(name, meta_kind, ref), indexedFileNumber, offset, offsetLength, offsetType); } @@ -123,578 +85,278 @@ public class IndexerOutput implements IIndexerOutput, ICIndexStorageConstants, I return index.addFile(path); } - /** - * Type entries are encoded as follow: 'typeDecl/' ('C' | 'S' | 'U' | 'E' ) '/' TypeName ['/' Qualifier]* - */ - protected static final char[] encodeTypeEntry( char[][] fullTypeName, int typeType, LimitTo encodeType){ - - int pos = 0, nameLength = 0; - for (int i=0; i 0){ - //Extract the name first - char [] tempName = fullTypeName[fullTypeName.length-1]; - System.arraycopy(tempName, 0, result, pos, tempName.length); - pos += tempName.length; - } - //Extract the qualifiers - for (int i=fullTypeName.length - 2; i >= 0; i--){ - result[pos++] = SEPARATOR; - char [] tempName = fullTypeName[i]; - System.arraycopy(tempName, 0, result, pos, tempName.length); - pos+=tempName.length; - } - - if (AbstractIndexer.VERBOSE) - AbstractIndexer.verbose(new String(result)); - - return result; - } - /** - * Namespace entries are encoded as follow: '[prefix]/' TypeName ['/' Qualifier]* - */ - protected static final char[] encodeEntry(char[][] elementName, char[] prefix, int prefixSize){ - int pos, nameLength = 0; - for (int i=0; i 0){ - //Extract the name first - char [] tempName = elementName[elementName.length-1]; - System.arraycopy(tempName, 0, result, pos, tempName.length); - pos += tempName.length; - } - //Extract the qualifiers - for (int i=elementName.length - 2; i>=0; i--){ - result[pos++] = SEPARATOR; - char [] tempName = elementName[i]; - System.arraycopy(tempName, 0, result, pos, tempName.length); - pos+=tempName.length; - } - - if (AbstractIndexer.VERBOSE) - AbstractIndexer.verbose(new String(result)); - - return result; - } - - public static final char[] bestTypePrefix( SearchFor searchFor, LimitTo limitTo, char[] typeName, char[][] containingTypes, int matchMode, boolean isCaseSensitive) { - char [] prefix = null; - if( limitTo == DECLARATIONS ){ - prefix = TYPE_DECL; - } else if( limitTo == REFERENCES ){ - prefix = TYPE_REF; - } else { - return TYPE_ALL; - } - - char classType = 0; - - if( searchFor == ICSearchConstants.CLASS ){ - classType = CLASS_SUFFIX; - } else if ( searchFor == ICSearchConstants.STRUCT ){ - classType = STRUCT_SUFFIX; - } else if ( searchFor == ICSearchConstants.UNION ){ - classType = UNION_SUFFIX; - } else if ( searchFor == ICSearchConstants.ENUM ){ - classType = ENUM_SUFFIX; - } else if ( searchFor == ICSearchConstants.TYPEDEF ){ - classType = TYPEDEF_SUFFIX; - } else if ( searchFor == ICSearchConstants.DERIVED){ - 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; - } - - return bestPrefix( prefix, classType, typeName, containingTypes, matchMode, isCaseSensitive ); - } - - public static final char[] bestNamespacePrefix(LimitTo limitTo, char[] namespaceName, char[][] containingTypes, int matchMode, boolean isCaseSensitive) { - char [] prefix = null; - if( limitTo == REFERENCES ){ - prefix = NAMESPACE_REF; - } else if ( limitTo == DECLARATIONS ) { - prefix = NAMESPACE_DECL; - } else { - return NAMESPACE_ALL; - } - - return bestPrefix( prefix, (char) 0, namespaceName, containingTypes, matchMode, isCaseSensitive ); - } - - public static final char[] bestVariablePrefix( LimitTo limitTo, char[] varName, char[][] containingTypes, int matchMode, boolean isCaseSenstive ){ - char [] prefix = null; - if( limitTo == REFERENCES ){ - prefix = TYPE_REF; - } else if( limitTo == DECLARATIONS ){ - prefix = TYPE_DECL; - } else { - return TYPE_ALL; - } - - return bestPrefix( prefix, VAR_SUFFIX, varName, containingTypes, matchMode, isCaseSenstive ); - } - - public static final char[] bestFieldPrefix( LimitTo limitTo, char[] fieldName,char[][] containingTypes, int matchMode, boolean isCaseSensitive) { - char [] prefix = null; - if( limitTo == REFERENCES ){ - prefix = FIELD_REF; - } else if( limitTo == DECLARATIONS ){ - prefix = FIELD_DECL; - } else { - return FIELD_ALL; - } - - return bestPrefix( prefix, (char)0, fieldName, containingTypes, matchMode, isCaseSensitive ); - } - - public static final char[] bestEnumeratorPrefix( LimitTo limitTo, char[] enumeratorName,char[][] containingTypes, int matchMode, boolean isCaseSensitive) { - char [] prefix = null; - if( limitTo == REFERENCES ){ - prefix = ENUMTOR_REF; - } else if( limitTo == DECLARATIONS ){ - prefix = ENUMTOR_DECL; - } else if (limitTo == ALL_OCCURRENCES){ - return ENUMTOR_ALL; - } - else { - //Definitions - return "noEnumtorDefs".toCharArray(); //$NON-NLS-1$ - } - - return bestPrefix( prefix, (char)0, enumeratorName, containingTypes, matchMode, isCaseSensitive ); - } - - public static final char[] bestMethodPrefix( LimitTo limitTo, char[] methodName,char[][] containingTypes, int matchMode, boolean isCaseSensitive) { - char [] prefix = null; - if( limitTo == REFERENCES ){ - prefix = METHOD_REF; - } else if( limitTo == DECLARATIONS ){ - prefix = METHOD_DECL; - } else if( limitTo == DEFINITIONS ){ - //TODO prefix = METHOD_DEF; - return METHOD_ALL; - } else { - return METHOD_ALL; - } - - return bestPrefix( prefix, (char)0, methodName, containingTypes, matchMode, isCaseSensitive ); - } - - public static final char[] bestFunctionPrefix( LimitTo limitTo, char[] functionName, int matchMode, boolean isCaseSensitive) { - char [] prefix = null; - if( limitTo == REFERENCES ){ - prefix = FUNCTION_REF; - } else if( limitTo == DECLARATIONS ){ - prefix = FUNCTION_DECL; - } else if ( limitTo == DEFINITIONS ){ - //TODO prefix = FUNCTION_DEF; - return FUNCTION_ALL; - } else { - return FUNCTION_ALL; - } - return bestPrefix( prefix, (char)0, functionName, null, matchMode, isCaseSensitive ); - } - - public static final char[] bestPrefix( char [] prefix, char optionalType, char[] name, char[][] containingTypes, int matchMode, boolean isCaseSensitive) { - char[] result = null; - int pos = 0; - - int wildPos, starPos = -1, questionPos; - - //length of prefix + separator - int length = prefix.length; - - //add length for optional type + another separator - if( optionalType != 0 ) - length += 2; - - if (!isCaseSensitive){ - //index is case sensitive, thus in case attempting case insensitive search, cannot consider - //type name. - name = null; - } else if( matchMode == PATTERN_MATCH && name != null ){ - int start = 0; - - char [] temp = new char [ name.length ]; - boolean isEscaped = false; - int tmpIdx = 0; - for( int i = 0; i < name.length; i++ ){ - if( name[i] == '\\' ){ - if( !isEscaped ){ - isEscaped = true; - continue; - } - isEscaped = false; - } else if( name[i] == '*' && !isEscaped ){ - starPos = i; - break; - } - temp[ tmpIdx++ ] = name[i]; - } - - name = new char [ tmpIdx ]; - System.arraycopy( temp, 0, name, 0, tmpIdx ); - - //starPos = CharOperation.indexOf( '*', name ); - questionPos = CharOperation.indexOf( '?', name ); - - if( starPos >= 0 ){ - if( questionPos >= 0 ) - wildPos = ( starPos < questionPos ) ? starPos : questionPos; - else - wildPos = starPos; - } else { - wildPos = questionPos; - } - - switch( wildPos ){ - case -1 : break; - case 0 : name = null; break; - default : name = CharOperation.subarray( name, 0, wildPos ); break; - } - } - //add length for name - if( name != null ){ - length += name.length; - } else { - //name is null, don't even consider qualifications. - result = new char [ length ]; - System.arraycopy( prefix, 0, result, 0, pos = prefix.length ); - if( optionalType != 0){ - result[ pos++ ] = optionalType; - result[ pos++ ] = SEPARATOR; - } - return result; - } - - //add the total length of the qualifiers - //we don't want to mess with the contents of this array (treat it as constant) - //so check for wild cards later. - if( containingTypes != null ){ - for( int i = 0; i < containingTypes.length; i++ ){ - if( containingTypes[i].length > 0 ){ - length += containingTypes[ i ].length; - length++; //separator - } - } - } - - //because we haven't checked qualifier wild cards yet, this array might turn out - //to be too long. So fill a temp array, then check the length after - char [] temp = new char [ length ]; - - System.arraycopy( prefix, 0, temp, 0, pos = prefix.length ); - - if( optionalType != 0 ){ - temp[ pos++ ] = optionalType; - temp[ pos++ ] = SEPARATOR; - } - - System.arraycopy( name, 0, temp, pos, name.length ); - pos += name.length; - - if( containingTypes != null ){ - for( int i = containingTypes.length - 1; i >= 0; i-- ){ - if( matchMode == PATTERN_MATCH ){ - starPos = CharOperation.indexOf( '*', containingTypes[i] ); - questionPos = CharOperation.indexOf( '?', containingTypes[i] ); - - if( starPos >= 0 ){ - if( questionPos >= 0 ) - wildPos = ( starPos < questionPos ) ? starPos : questionPos; - else - wildPos = starPos; - } else { - wildPos = questionPos; - } - - if( wildPos >= 0 ){ - temp[ pos++ ] = SEPARATOR; - System.arraycopy( containingTypes[i], 0, temp, pos, wildPos ); - pos += starPos; - break; - } - } - - if( containingTypes[i].length > 0 ){ - temp[ pos++ ] = SEPARATOR; - System.arraycopy( containingTypes[i], 0, temp, pos, containingTypes[i].length ); - pos += containingTypes[i].length; - } - } - } - - if( pos < length ){ - result = new char[ pos ]; - System.arraycopy( temp, 0, result, 0, pos ); - } else { - result = temp; - } - - return result; - } - - /** - * @param _limitTo - * @param simpleName - * @param _matchMode - * @param _caseSensitive - * @return - */ - public static final char[] bestMacroPrefix( LimitTo limitTo, char[] macroName, int matchMode, boolean isCaseSenstive ){ - //since we only index macro declarations we already know the prefix - char [] prefix = null; - if( limitTo == DECLARATIONS ){ - prefix = MACRO_DECL; - } else { - return null; - } - - return bestPrefix( prefix, (char)0, macroName, null, matchMode, isCaseSenstive ); - } - - /** - * @param _limitTo - * @param simpleName - * @param _matchMode - * @param _caseSensitive - * @return - */ - public static final char[] bestIncludePrefix( LimitTo limitTo, char[] incName, int matchMode, boolean isCaseSenstive ){ - //since we only index macro declarations we already know the prefix - char [] prefix = null; - if( limitTo == REFERENCES ){ - prefix = INCLUDE_REF; - } else { - return null; - } - - return bestPrefix( prefix, (char)0, incName, null, matchMode, isCaseSenstive ); - } - public void addEnumtorDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ENUMTOR_DECL, ENUMTOR_DECL.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, IIndex.ENUMTOR, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addEnumtorRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ENUMTOR_REF, ENUMTOR_REF.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, IIndex.ENUMTOR, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addMacroDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, MACRO_DECL, MACRO_DECL.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, IIndex.MACRO, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addMacroRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, MACRO_REF, MACRO_REF.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, IIndex.MACRO, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addFieldDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, FIELD_DECL, FIELD_DECL.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, IIndex.FIELD, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addFieldRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, FIELD_REF, FIELD_REF.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, IIndex.FIELD, IIndex.REFERENCE, offset,offsetLength, offsetType); } - public void addMethodDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, METHOD_DECL, METHOD_DECL.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + public void addMethodDecl(int indexedFileNumber, char[][] name, /*char[][] parameterTypes,*/ int offset, int offsetLength, int offsetType) { + addRef(indexedFileNumber, name, IIndex.METHOD, IIndex.DECLARATION, offset,offsetLength, offsetType); } - public void addMethodRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, METHOD_REF, METHOD_REF.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + public void addMethodRef(int indexedFileNumber, char[][] name, /*char[][] parameterTypes,*/int offset, int offsetLength, int offsetType) { + addRef(indexedFileNumber, name, IIndex.METHOD, IIndex.REFERENCE, offset,offsetLength, offsetType); } - public void addFunctionDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, FUNCTION_DECL, FUNCTION_DECL.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + public void addFunctionDecl(int indexedFileNumber, char[][] name,/*char[][] parameterTypes,*/ int offset, int offsetLength, int offsetType) { + addRef(indexedFileNumber, name, IIndex.FUNCTION, IIndex.DECLARATION, offset,offsetLength, offsetType); } - public void addFunctionRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, FUNCTION_REF, FUNCTION_REF.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + public void addFunctionRef(int indexedFileNumber, char[][] name, /*char[][] parameterTypes,*/int offset, int offsetLength, int offsetType) { + addRef(indexedFileNumber, name, IIndex.FUNCTION, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addNamespaceDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, NAMESPACE_DECL, NAMESPACE_DECL.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, IIndex.NAMESPACE, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addNamespaceRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, NAMESPACE_REF, NAMESPACE_REF.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, IIndex.NAMESPACE, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addIncludeRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, INCLUDE_REF, INCLUDE_REF.length, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, IIndex.INCLUDE, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addStructDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_STRUCT , ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, STRUCT_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addStructRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_STRUCT , ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, STRUCT_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addTypedefDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_TYPEDEF, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, TYPEDEF_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addTypedefRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_TYPEDEF, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, TYPEDEF_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addUnionDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_UNION, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, UNION_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addUnionRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_UNION, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, UNION_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addVariableDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_VAR, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, VAR_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addVariableRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_VAR, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, VAR_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addClassDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_CLASS, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, CLASS_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addClassRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_CLASS, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, CLASS_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addEnumDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_ENUM, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, ENUM_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addEnumRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_ENUM, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, ENUM_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addDerivedDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_DERIVED, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, DERIVED_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addDerivedRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_DERIVED, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, DERIVED_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addFriendDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_FRIEND, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, FRIEND_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addFriendRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_FRIEND, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); - } - - public void addVarDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_VAR, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); - } - - public void addVarRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_VAR, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, FRIEND_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addFwd_ClassDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_FWD_CLASS, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, FWD_CLASS_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addFwd_ClassRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_FWD_CLASS, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, FWD_CLASS_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addFwd_StructDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_FWD_STRUCT, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, FWD_STRUCT_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addFwd_StructRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_FWD_STRUCT, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, FWD_STRUCT_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } public void addFwd_UnionDecl(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_FWD_UNION, ICSearchConstants.DECLARATIONS, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, FWD_UNION_SUFFIX, IIndex.DECLARATION, offset,offsetLength, offsetType); } public void addFwd_UnionRef(int indexedFileNumber, char[][] name, int offset, int offsetLength, int offsetType) { - addRef(indexedFileNumber, name, ICIndexStorageConstants.TYPE_FWD_UNION, ICSearchConstants.REFERENCES, offset,offsetLength, ICIndexStorageConstants.OFFSET); + addRef(indexedFileNumber, name, FWD_UNION_SUFFIX, IIndex.REFERENCE, offset,offsetLength, offsetType); } + + /** + * Type entries are encoded as follow: 'typeDecl/' ('C' | 'S' | 'U' | 'E' ) '/' TypeName ['/' Qualifier]* + */ + protected static final char[] encodeTypeEntry(char[][] fullTypeName, char suffix, int type) { + + int pos = 0, nameLength = 0; + for (int i=0; i 0){ + //Extract the name first + char [] tempName = fullTypeName[fullTypeName.length-1]; + System.arraycopy(tempName, 0, result, pos, tempName.length); + pos += tempName.length; + } + //Extract the qualifiers + for (int i=fullTypeName.length - 2; i >= 0; i--){ + result[pos++] = SEPARATOR; + char [] tempName = fullTypeName[i]; + System.arraycopy(tempName, 0, result, pos, tempName.length); + pos+=tempName.length; + } + + if (AbstractIndexer.VERBOSE) + AbstractIndexer.verbose(new String(result)); + + return result; + } + /** + * Namespace entries are encoded as follow: '[prefix]/' TypeName ['/' Qualifier]* + */ + protected static final char[] encodeEntry(char[][] elementName, int meta_kind, int ref) { + int pos, nameLength = 0; + for (int i=0; i 0){ + //Extract the name first + char [] tempName = elementName[elementName.length-1]; + System.arraycopy(tempName, 0, result, pos, tempName.length); + pos += tempName.length; + } + //Extract the qualifiers + for (int i=elementName.length - 2; i>=0; i--){ + result[pos++] = SEPARATOR; + char [] tempName = elementName[i]; + System.arraycopy(tempName, 0, result, pos, tempName.length); + pos+=tempName.length; + } + + if (AbstractIndexer.VERBOSE) + AbstractIndexer.verbose(new String(result)); + + return result; + } + +// public static final char[] encodeEntry(char[][] elementName, int entryType, int encodeType) { +// // Temporarily +// if (elementName == null) { +// return "NPE".toCharArray(); //$NON-NLS-1$ +// } +// int pos, nameLength = 0; +// for (int i=0; i < elementName.length; i++){ +// char[] namePart = elementName[i]; +// nameLength += namePart.length; +// } +// char[][] encodedTypeNames = null; +// if (encodeType == IIndex.DECLARATION) { +// encodedTypeNames = IIndexEncodingConstants.encodedTypeNames_Decl; +// } +// else if (encodeType == IIndex.REFERENCE) { +// encodedTypeNames = IIndexEncodingConstants.encodedTypeNames_Ref; +// } +// char[] encodedTypeName = encodedTypeNames[entryType]; +// +// //char[] has to be of size - [type length + length of the name (including qualifiers) + +// //separators (need one less than fully qualified name length) +// char[] result = new char[encodedTypeName.length + nameLength + elementName.length - 1]; +// System.arraycopy(encodedTypeName, 0, result, 0, pos = encodedTypeName.length); +// if (elementName.length > 0) { +// //Extract the name first +// char [] tempName = elementName[elementName.length-1]; +// System.arraycopy(tempName, 0, result, pos, tempName.length); +// pos += tempName.length; +// } +// //Extract the qualifiers +// for (int i=elementName.length - 2; i>=0; i--){ +// result[pos++] = SEPARATOR; +// char [] tempName = elementName[i]; +// System.arraycopy(tempName, 0, result, pos, tempName.length); +// pos+=tempName.length; +// } +// +// if (AbstractIndexer.VERBOSE) +// AbstractIndexer.verbose(new String(result)); +// +// return result; +// } + + } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsConsoleParser.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsConsoleParser.java index d52e78470a8..5a9d1adbb73 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsConsoleParser.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsConsoleParser.java @@ -14,7 +14,7 @@ import java.util.StringTokenizer; import org.eclipse.cdt.core.IConsoleParser; import org.eclipse.cdt.core.search.ICSearchConstants; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; /** @@ -83,30 +83,30 @@ public class CTagsConsoleParser implements IConsoleParser { int lineNumber = Integer.parseInt( (String)tempTag.tagExtensionField.get(LINE) ); if (kind.equals(CLASS)){ - indexer.getOutput().addClassDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addClassDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(MACRO)){ - indexer.getOutput().addMacroDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addMacroDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(ENUMERATOR)){ - indexer.getOutput().addEnumtorDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addEnumtorDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(FUNCTION)){ - indexer.getOutput().addFunctionDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addFunctionDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(ENUM)){ - indexer.getOutput().addEnumDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addEnumDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(MEMBER)){ - indexer.getOutput().addFieldDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addFieldDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(NAMESPACE)){ - indexer.getOutput().addNamespaceDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addNamespaceDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(PROTOTYPE)){ - indexer.getOutput().addFunctionDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addFunctionDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); //type = ICSearchConstants.DEFINITIONS; } else if (kind.equals(STRUCT)){ - indexer.getOutput().addStructDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addStructDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(TYPEDEF)){ - indexer.getOutput().addTypedefDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addTypedefDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(UNION)){ - indexer.getOutput().addUnionDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addUnionDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(VARIABLE)){ - indexer.getOutput().addVariableDecl(getFileNumber(), fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + indexer.getOutput().addVariableDecl(getFileNumber(), fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(EXTERNALVAR)){ } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsFileReader.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsFileReader.java index 33962680866..520370e7e42 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsFileReader.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagsFileReader.java @@ -21,7 +21,6 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.IIndexer; import org.eclipse.cdt.internal.core.index.IIndexerOutput; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -113,30 +112,30 @@ public class CTagsFileReader { if (kind.equals(CTagsConsoleParser.CLASS)){ - output.addClassDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addClassDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.MACRO)){ - output.addMacroDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addMacroDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.ENUMERATOR)){ - output.addEnumtorDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addEnumtorDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.FUNCTION)){ - output.addFunctionDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addFunctionDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.ENUM)){ - output.addEnumDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addEnumDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.MEMBER)){ - output.addFieldDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addFieldDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.NAMESPACE)){ - output.addNamespaceDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addNamespaceDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.PROTOTYPE)){ - output.addFunctionDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addFunctionDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); //type = ICSearchConstants.DEFINITIONS; } else if (kind.equals(CTagsConsoleParser.STRUCT)){ - output.addStructDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addStructDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.TYPEDEF)){ - output.addTypedefDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addTypedefDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.UNION)){ - output.addUnionDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addUnionDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.VARIABLE)){ - output.addVariableDecl(fileNum, fullName, lineNumber, 1, ICIndexStorageConstants.LINE); + output.addVariableDecl(fileNum, fullName, lineNumber, 1, IIndex.LINE); } else if (kind.equals(CTagsConsoleParser.EXTERNALVAR)){ } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CGenerateIndexVisitor.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CGenerateIndexVisitor.java index d09c36c96b2..89eb2c872af 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CGenerateIndexVisitor.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CGenerateIndexVisitor.java @@ -29,7 +29,7 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.IVariable; import org.eclipse.cdt.core.dom.ast.c.CASTVisitor; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.domsourceindexer.IndexerOutputWrapper.EntryType; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.Path; @@ -179,7 +179,7 @@ public class CGenerateIndexVisitor extends CASTVisitor { fileNumber, loc.getNodeOffset(), loc.getNodeLength(), - ICIndexStorageConstants.OFFSET); + IIndex.OFFSET); } else if (name.isReference()) { IndexerOutputWrapper.addNameRef(indexer.getOutput(), @@ -188,7 +188,7 @@ public class CGenerateIndexVisitor extends CASTVisitor { fileNumber, loc.getNodeOffset(), loc.getNodeLength(), - ICIndexStorageConstants.OFFSET); + IIndex.OFFSET); } } } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CPPGenerateIndexVisitor.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CPPGenerateIndexVisitor.java index 54b9f3939c2..7dbe29dada3 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CPPGenerateIndexVisitor.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/CPPGenerateIndexVisitor.java @@ -40,7 +40,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier; import org.eclipse.cdt.core.search.ICSearchConstants; import org.eclipse.cdt.core.search.ICSearchConstants.LimitTo; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.domsourceindexer.IndexerOutputWrapper.EntryType; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.Path; @@ -241,7 +241,7 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor { fileNumber, loc.getNodeOffset(), loc.getNodeLength(), - ICIndexStorageConstants.OFFSET); + IIndex.OFFSET); } else if (limitTo == ICSearchConstants.REFERENCES) { IndexerOutputWrapper.addNameRef(indexer.getOutput(), @@ -250,7 +250,7 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor { fileNumber, loc.getNodeOffset(), loc.getNodeLength(), - ICIndexStorageConstants.OFFSET); + IIndex.OFFSET); } } } @@ -273,7 +273,7 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor { fileNumber, loc.getNodeOffset(), loc.getNodeLength(), - ICIndexStorageConstants.OFFSET); + IIndex.OFFSET); } } } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMSourceIndexerRunner.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMSourceIndexerRunner.java index 0ca8af2f763..07a61ef81e7 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMSourceIndexerRunner.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMSourceIndexerRunner.java @@ -35,7 +35,7 @@ import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICModelMarker; import org.eclipse.cdt.core.parser.ParseError; import org.eclipse.cdt.core.parser.ParserLanguage; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.impl.IndexDelta; import org.eclipse.cdt.internal.core.index.sourceindexer.AbstractIndexer; import org.eclipse.cdt.internal.core.index.sourceindexer.SourceIndexer; @@ -209,7 +209,7 @@ public class DOMSourceIndexerRunner extends AbstractIndexer { fileNumber, 1, 1, - ICIndexStorageConstants.OFFSET); + IIndex.OFFSET); /* See if this file has been encountered before */ indexer.haveEncounteredHeader(resourceFile.getProject().getFullPath(), new Path(include)); @@ -234,7 +234,7 @@ public class DOMSourceIndexerRunner extends AbstractIndexer { fileNumber, loc.getNodeOffset(), loc.getNodeLength(), - ICIndexStorageConstants.OFFSET); + IIndex.OFFSET); } } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexerOutputWrapper.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexerOutputWrapper.java index 94e8aa86fc9..67b9630cd83 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexerOutputWrapper.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexerOutputWrapper.java @@ -98,7 +98,7 @@ class IndexerOutputWrapper { indexerOutput.addEnumDecl(fileNumber, name, offset, length, offsetType); break; case VAR_CONST: - indexerOutput.addVarDecl(fileNumber, name, offset, length, offsetType); + indexerOutput.addVariableDecl(fileNumber, name, offset, length, offsetType); break; case TYPEDEF_CONST: indexerOutput.addTypedefDecl(fileNumber, name, offset, length, offsetType); @@ -163,7 +163,7 @@ class IndexerOutputWrapper { indexerOutput.addEnumRef(fileNumber, name, offset, length, offsetType); break; case VAR_CONST: - indexerOutput.addVarRef(fileNumber, name, offset, length, offsetType); + indexerOutput.addVariableRef(fileNumber, name, offset, length, offsetType); break; case TYPEDEF_CONST: indexerOutput.addTypedefRef(fileNumber, name, offset, length, offsetType); diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/sourceindexer/SourceIndexerRunner.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/sourceindexer/SourceIndexerRunner.java index 15a4c8566ca..e1801fd0263 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/sourceindexer/SourceIndexerRunner.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/sourceindexer/SourceIndexerRunner.java @@ -63,7 +63,7 @@ import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration; import org.eclipse.cdt.core.parser.ast.IASTTypedefReference; import org.eclipse.cdt.core.parser.ast.IASTVariable; import org.eclipse.cdt.core.parser.ast.IASTVariableReference; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.cdt.internal.core.index.impl.IndexDelta; import org.eclipse.core.resources.IFile; @@ -273,7 +273,7 @@ public class SourceIndexerRunner extends AbstractIndexer { char[][] baseFullyQualifiedName = baseClassSpec.getFullyQualifiedNameCharArrays(); int offset = baseClassSpec.getNameOffset(); int offsetLength = baseClassSpec.getNameEndOffset() - offset; - output.addDerivedDecl(fileNumber, baseFullyQualifiedName, offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addDerivedDecl(fileNumber, baseFullyQualifiedName, offset,offsetLength, IIndex.OFFSET); } } catch (ASTNotImplementedException e) {} } @@ -287,14 +287,14 @@ public class SourceIndexerRunner extends AbstractIndexer { char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays(); int offset = friendClassSpec.getNameOffset(); int offsetLength = friendClassSpec.getNameEndOffset() - offset; - output.addFriendDecl(fileNumber, baseFullyQualifiedName,offset, offsetLength, ICIndexStorageConstants.OFFSET); + output.addFriendDecl(fileNumber, baseFullyQualifiedName,offset, offsetLength, IIndex.OFFSET); } else if (decl instanceof IASTElaboratedTypeSpecifier){ IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl; char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays(); int offset = friendClassSpec.getNameOffset(); int offsetLength = friendClassSpec.getNameEndOffset() - offset; - output.addFriendDecl(fileNumber, baseFullyQualifiedName, offset, offsetLength, ICIndexStorageConstants.OFFSET); + output.addFriendDecl(fileNumber, baseFullyQualifiedName, offset, offsetLength, IIndex.OFFSET); } else if (decl instanceof IASTFunction){ @@ -307,7 +307,7 @@ public class SourceIndexerRunner extends AbstractIndexer { int offset = classSpecification.getNameOffset(); int offsetLength = classSpecification.getNameEndOffset() - offset; - output.addClassDecl(fileNumber, classSpecification.getFullyQualifiedNameCharArrays(), offset, offsetLength, ICIndexStorageConstants.OFFSET); + output.addClassDecl(fileNumber, classSpecification.getFullyQualifiedNameCharArrays(), offset, offsetLength, IIndex.OFFSET); } else if (classSpecification.getClassKind().equals(ASTClassKind.STRUCT)) { @@ -322,7 +322,7 @@ public class SourceIndexerRunner extends AbstractIndexer { char[][] baseFullyQualifiedName = baseClassSpec.getFullyQualifiedNameCharArrays(); int offset = baseClassSpec.getNameOffset(); int offsetLength = baseClassSpec.getNameEndOffset() - offset; - output.addDerivedDecl(fileNumber, baseFullyQualifiedName, offset, offsetLength, ICIndexStorageConstants.OFFSET); + output.addDerivedDecl(fileNumber, baseFullyQualifiedName, offset, offsetLength, IIndex.OFFSET); } } catch (ASTNotImplementedException e) {} } @@ -336,14 +336,14 @@ public class SourceIndexerRunner extends AbstractIndexer { char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays(); int offset = friendClassSpec.getNameOffset(); int offsetLength = friendClassSpec.getNameEndOffset() - offset; - output.addFriendDecl(fileNumber, baseFullyQualifiedName, offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFriendDecl(fileNumber, baseFullyQualifiedName, offset,offsetLength, IIndex.OFFSET); } else if (decl instanceof IASTElaboratedTypeSpecifier){ IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl; char[][] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedNameCharArrays(); int offset = friendClassSpec.getNameOffset(); int offsetLength = friendClassSpec.getNameEndOffset() - offset; - output.addFriendDecl(fileNumber, baseFullyQualifiedName, offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFriendDecl(fileNumber, baseFullyQualifiedName, offset,offsetLength, IIndex.OFFSET); } else if (decl instanceof IASTFunction){ @@ -355,13 +355,13 @@ public class SourceIndexerRunner extends AbstractIndexer { int offset = classSpecification.getNameOffset(); int offsetLength = classSpecification.getNameEndOffset() - offset; - output.addStructDecl(fileNumber, classSpecification.getFullyQualifiedNameCharArrays(), offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addStructDecl(fileNumber, classSpecification.getFullyQualifiedNameCharArrays(), offset,offsetLength, IIndex.OFFSET); } else if (classSpecification.getClassKind().equals(ASTClassKind.UNION)) { int offset = classSpecification.getNameOffset(); int offsetLength = classSpecification.getNameEndOffset() - offset; - output.addUnionDecl(fileNumber, classSpecification.getFullyQualifiedNameCharArrays(), offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addUnionDecl(fileNumber, classSpecification.getFullyQualifiedNameCharArrays(), offset,offsetLength, IIndex.OFFSET); } } @@ -369,7 +369,7 @@ public class SourceIndexerRunner extends AbstractIndexer { int offset = enumeration.getNameOffset(); int offsetLength = enumeration.getNameEndOffset() - offset; - output.addEnumDecl(fileNumber, enumeration.getFullyQualifiedNameCharArrays(), offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addEnumDecl(fileNumber, enumeration.getFullyQualifiedNameCharArrays(), offset,offsetLength, IIndex.OFFSET); Iterator i = enumeration.getEnumerators(); while (i.hasNext()) @@ -380,7 +380,7 @@ public class SourceIndexerRunner extends AbstractIndexer { offset = en.getNameOffset(); offsetLength = en.getNameEndOffset() - offset; - output.addEnumtorDecl(fileNumber, enumeratorFullName, offset, offsetLength, ICIndexStorageConstants.OFFSET); + output.addEnumtorDecl(fileNumber, enumeratorFullName, offset, offsetLength, IIndex.OFFSET); } } @@ -402,65 +402,65 @@ public class SourceIndexerRunner extends AbstractIndexer { IASTEnumerator enumerator = (IASTEnumerator)reference.getReferencedElement(); int offset = reference.getOffset(); int offsetLength = enumerator.getNameEndOffset() - enumerator.getNameOffset(); - output.addEnumtorRef(fileNumber, createEnumeratorFullyQualifiedName(enumerator),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addEnumtorRef(fileNumber, createEnumeratorFullyQualifiedName(enumerator),offset,offsetLength, IIndex.OFFSET); } public void addMacro(IASTMacro macro, int fileNumber) { char[][] macroName = new char[][] { macro.getNameCharArray() }; int offset = macro.getNameOffset(); int offsetLength = macro.getNameEndOffset() - offset; - output.addMacroDecl(fileNumber, macroName, offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addMacroDecl(fileNumber, macroName, offset,offsetLength, IIndex.OFFSET); } public void addEnumerationReference(IASTEnumerationReference reference, int fileNumber) { IASTEnumerationSpecifier enumeration = (IASTEnumerationSpecifier) reference.getReferencedElement(); int offset = reference.getOffset(); int offsetLength = enumeration.getNameEndOffset() - enumeration.getNameOffset(); - output.addEnumRef(fileNumber, enumeration.getFullyQualifiedNameCharArrays(), offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addEnumRef(fileNumber, enumeration.getFullyQualifiedNameCharArrays(), offset,offsetLength, IIndex.OFFSET); } public void addVariable(IASTVariable variable, int fileNumber) { int offset = variable.getNameOffset(); int offsetLength = variable.getNameEndOffset() - offset; - output.addVarDecl(fileNumber, variable.getFullyQualifiedNameCharArrays(), offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addVariableDecl(fileNumber, variable.getFullyQualifiedNameCharArrays(), offset,offsetLength, IIndex.OFFSET); } public void addVariableReference(IASTVariableReference reference, int fileNumber) { IASTVariable variable = (IASTVariable)reference.getReferencedElement(); int offset = reference.getOffset(); int offsetLength = variable.getNameEndOffset() - variable.getNameOffset(); - output.addVarRef(fileNumber, variable.getFullyQualifiedNameCharArrays(), offset, offsetLength, ICIndexStorageConstants.OFFSET); + output.addVariableRef(fileNumber, variable.getFullyQualifiedNameCharArrays(), offset, offsetLength, IIndex.OFFSET); } public void addParameterReference( IASTParameterReference reference, int fileNumber ){ IASTParameterDeclaration parameter = (IASTParameterDeclaration) reference.getReferencedElement(); int offset = reference.getOffset(); int offsetLength = parameter.getNameEndOffset() - parameter.getNameOffset(); - output.addVarRef(fileNumber, new char[][] { parameter.getNameCharArray() }, offset, offsetLength, ICIndexStorageConstants.OFFSET); + output.addVariableRef(fileNumber, new char[][] { parameter.getNameCharArray() }, offset, offsetLength, IIndex.OFFSET); } public void addTypedefDeclaration(IASTTypedefDeclaration typedef, int fileNumber) { int offset = typedef.getNameOffset(); int offsetLength = typedef.getNameEndOffset() - offset; - output.addTypedefDecl(fileNumber,typedef.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addTypedefDecl(fileNumber,typedef.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } public void addFieldDeclaration(IASTField field, int fileNumber) { int offset = field.getNameOffset(); int offsetLength = field.getNameEndOffset() - offset; - output.addFieldDecl(fileNumber, field.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFieldDecl(fileNumber, field.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } public void addFieldReference(IASTFieldReference reference, int fileNumber) { IASTField field=(IASTField) reference.getReferencedElement(); int offset = reference.getOffset(); int offsetLength = field.getNameEndOffset() - field.getNameOffset(); - output.addFieldRef(fileNumber, field.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFieldRef(fileNumber, field.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } public void addMethodDeclaration(IASTMethod method, int fileNumber) { int offset = method.getNameOffset(); int offsetLength = method.getNameEndOffset() - offset; - output.addMethodDecl(fileNumber, method.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addMethodDecl(fileNumber, method.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); Iterator i=method.getParameters(); while (i.hasNext()){ @@ -469,7 +469,7 @@ public class SourceIndexerRunner extends AbstractIndexer { IASTParameterDeclaration parmDecl = (IASTParameterDeclaration) parm; offset = parmDecl.getNameOffset(); offsetLength = parmDecl.getNameEndOffset() - offset; - output.addVarDecl(fileNumber, new char[][]{parmDecl.getNameCharArray()},offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addVariableDecl(fileNumber, new char[][]{parmDecl.getNameCharArray()},offset,offsetLength, IIndex.OFFSET); } } } @@ -478,7 +478,7 @@ public class SourceIndexerRunner extends AbstractIndexer { IASTMethod method = (IASTMethod) reference.getReferencedElement(); int offset = reference.getOffset(); int offsetLength = method.getNameEndOffset() - method.getNameOffset(); - output.addMethodRef(fileNumber, method.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addMethodRef(fileNumber, method.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } public void addElaboratedForwardDeclaration(IASTElaboratedTypeSpecifier elaboratedType, int fileNumber) { @@ -487,15 +487,15 @@ public class SourceIndexerRunner extends AbstractIndexer { if (elaboratedType.getClassKind().equals(ASTClassKind.CLASS)) { - output.addFwd_ClassDecl(fileNumber,elaboratedType.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFwd_ClassDecl(fileNumber,elaboratedType.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } else if (elaboratedType.getClassKind().equals(ASTClassKind.STRUCT)) { - output.addFwd_StructDecl(fileNumber,elaboratedType.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFwd_StructDecl(fileNumber,elaboratedType.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } else if (elaboratedType.getClassKind().equals(ASTClassKind.UNION)) { - output.addFwd_UnionDecl(fileNumber,elaboratedType.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFwd_UnionDecl(fileNumber,elaboratedType.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } } @@ -517,7 +517,7 @@ public class SourceIndexerRunner extends AbstractIndexer { int offset = function.getNameOffset(); int offsetLength = function.getNameEndOffset() - offset; - output.addFunctionDecl(fileNumber, function.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFunctionDecl(fileNumber, function.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); Iterator i=function.getParameters(); while (i.hasNext()){ @@ -526,7 +526,7 @@ public class SourceIndexerRunner extends AbstractIndexer { IASTParameterDeclaration parmDecl = (IASTParameterDeclaration) parm; offset = parmDecl.getNameOffset(); offsetLength = parmDecl.getNameEndOffset() - offset; - output.addVarDecl(fileNumber, new char[][]{parmDecl.getNameCharArray()},offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addVariableDecl(fileNumber, new char[][]{parmDecl.getNameCharArray()},offset,offsetLength, IIndex.OFFSET); } } } @@ -535,7 +535,7 @@ public class SourceIndexerRunner extends AbstractIndexer { IASTFunction function=(IASTFunction) reference.getReferencedElement(); int offset = reference.getOffset(); int offsetLength = function.getNameEndOffset() - function.getNameOffset(); - output.addFunctionRef(fileNumber, function.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFunctionRef(fileNumber, function.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } public void addNameReference(){ @@ -545,21 +545,21 @@ public class SourceIndexerRunner extends AbstractIndexer { public void addNamespaceDefinition(IASTNamespaceDefinition namespace, int fileNumber){ int offset = namespace.getNameOffset(); int offsetLength = namespace.getNameEndOffset() - offset; - output.addNamespaceDecl(fileNumber, namespace.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addNamespaceDecl(fileNumber, namespace.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } public void addNamespaceReference(IASTNamespaceReference reference, int fileNumber) { IASTNamespaceDefinition namespace = (IASTNamespaceDefinition)reference.getReferencedElement(); int offset = reference.getOffset(); int offsetLength = namespace.getNameEndOffset() - namespace.getNameOffset(); - output.addNamespaceRef(fileNumber, namespace.getFullyQualifiedNameCharArrays(),offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addNamespaceRef(fileNumber, namespace.getFullyQualifiedNameCharArrays(),offset,offsetLength, IIndex.OFFSET); } public void addTypedefReference( IASTTypedefReference reference, int fileNumber ){ IASTTypedefDeclaration typedef = (IASTTypedefDeclaration) reference.getReferencedElement(); int offset = reference.getOffset(); int offsetLength = typedef.getNameEndOffset() - typedef.getNameOffset(); - output.addTypedefRef(fileNumber, typedef.getFullyQualifiedNameCharArrays(), offset, offsetLength, ICIndexStorageConstants.OFFSET); + output.addTypedefRef(fileNumber, typedef.getFullyQualifiedNameCharArrays(), offset, offsetLength, IIndex.OFFSET); } private void addSuperTypeReference(int modifiers, char[] packageName, char[] typeName, char[][] enclosingTypeNames, char classOrInterface, char[] superTypeName, char superClassOrInterface){ @@ -593,15 +593,15 @@ public class SourceIndexerRunner extends AbstractIndexer { if (classKind.equals(ASTClassKind.CLASS)) { - output.addClassRef(fileNumber, fullyQualifiedName,offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addClassRef(fileNumber, fullyQualifiedName,offset,offsetLength, IIndex.OFFSET); } else if (classKind.equals(ASTClassKind.STRUCT)) { - output.addStructRef(fileNumber, fullyQualifiedName,offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addStructRef(fileNumber, fullyQualifiedName,offset,offsetLength, IIndex.OFFSET); } else if (classKind.equals(ASTClassKind.UNION)) { - output.addUnionRef(fileNumber, fullyQualifiedName,offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addUnionRef(fileNumber, fullyQualifiedName,offset,offsetLength, IIndex.OFFSET); } } @@ -624,15 +624,15 @@ public class SourceIndexerRunner extends AbstractIndexer { if (classKind.equals(ASTClassKind.CLASS)) { - output.addFwd_ClassRef(fileNumber, fullyQualifiedName, offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFwd_ClassRef(fileNumber, fullyQualifiedName, offset,offsetLength, IIndex.OFFSET); } else if (classKind.equals(ASTClassKind.STRUCT)) { - output.addFwd_StructRef(fileNumber, fullyQualifiedName, offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFwd_StructRef(fileNumber, fullyQualifiedName, offset,offsetLength, IIndex.OFFSET); } else if (classKind.equals(ASTClassKind.UNION)) { - output.addFwd_UnionRef(fileNumber, fullyQualifiedName, offset,offsetLength, ICIndexStorageConstants.OFFSET); + output.addFwd_UnionRef(fileNumber, fullyQualifiedName, offset,offsetLength, IIndex.OFFSET); } } @@ -645,6 +645,6 @@ public class SourceIndexerRunner extends AbstractIndexer { incName[0] = inclusion.getFullFileName().toCharArray(); //TODO: Kludge! Get rid of BOGUS entry - need to restructure Dep Tree to use reference indexes int BOGUS_ENTRY = 1; - this.output.addIncludeRef(fileNumber, incName,1,1, ICIndexStorageConstants.OFFSET); + this.output.addIncludeRef(fileNumber, incName,1,1, IIndex.OFFSET); } } diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java index bc0607dacdc..0206d912679 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java @@ -29,7 +29,8 @@ import org.eclipse.cdt.core.search.BasicSearchMatch; import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; @@ -182,13 +183,13 @@ public class ClassDeclarationPattern extends CSearchPattern { //Don't forget that offsets are encoded ICIndexStorageConstants //Offsets can either be LINE or OFFSET int offsetType = Integer.valueOf(String.valueOf(offsets[i][j]).substring(0,1)).intValue(); - if (offsetType==ICIndexStorageConstants.LINE){ + if (offsetType==IIndex.LINE){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); - match.offsetType = ICIndexStorageConstants.LINE; - }else if (offsetType==ICIndexStorageConstants.OFFSET){ + match.offsetType = IIndex.LINE; + }else if (offsetType==IIndex.OFFSET){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); match.endOffset= match.startOffset + offsetLengths[i][j]; - match.offsetType=ICIndexStorageConstants.OFFSET; + match.offsetType=IIndex.OFFSET; } match.parentName = ""; //$NON-NLS-1$ @@ -248,7 +249,7 @@ public class ClassDeclarationPattern extends CSearchPattern { } public char[] indexEntryPrefix() { - return IndexerOutput.bestTypePrefix( + return Index.bestTypePrefix( searchFor, getLimitTo(), simpleName, diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/DerivedTypesPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/DerivedTypesPattern.java index 105e44b2d4e..891506cb491 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/DerivedTypesPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/DerivedTypesPattern.java @@ -23,6 +23,7 @@ import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException; import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; /** @@ -46,7 +47,7 @@ public class DerivedTypesPattern extends ClassDeclarationPattern { } public char[] indexEntryPrefix() { - return IndexerOutput.bestTypePrefix( + return Index.bestTypePrefix( searchFor, getLimitTo(), simpleName, diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java index b27e1daf1c6..fcf7baa97df 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java @@ -31,8 +31,8 @@ import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; -import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor; import org.eclipse.core.resources.IFile; @@ -116,15 +116,15 @@ public class FieldDeclarationPattern extends CSearchPattern { public char[] indexEntryPrefix() { if( searchFor == FIELD ){ - return IndexerOutput.bestFieldPrefix( _limitTo, simpleName, qualifications, _matchMode, _caseSensitive ); + return Index.bestFieldPrefix( _limitTo, simpleName, qualifications, _matchMode, _caseSensitive ); } else if( searchFor == VAR ) { - return IndexerOutput.bestVariablePrefix( + return Index.bestVariablePrefix( _limitTo, simpleName, qualifications, _matchMode, _caseSensitive ); } else if (searchFor == ENUMTOR) { - return IndexerOutput.bestEnumeratorPrefix(_limitTo, simpleName, qualifications, _matchMode, _caseSensitive ); + return Index.bestEnumeratorPrefix(_limitTo, simpleName, qualifications, _matchMode, _caseSensitive ); } return null; } @@ -141,15 +141,15 @@ public class FieldDeclarationPattern extends CSearchPattern { int slash = 0; if( searchFor == FIELD ){ - firstSlash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, 0 ); - slash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, firstSlash + 1); + firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 ); + slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1); } else if( searchFor == VAR ) { - int realStart = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, 0 ); - firstSlash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, realStart + 1); - slash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, firstSlash + 1); + int realStart = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 ); + firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, realStart + 1); + slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1); } else if ( searchFor == ENUMTOR ){ - firstSlash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, 0 ); - slash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, firstSlash + 1); + firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 ); + slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1); } this.decodedSimpleName = CharOperation.subarray(word, firstSlash + 1, slash); @@ -181,13 +181,13 @@ public class FieldDeclarationPattern extends CSearchPattern { //Don't forget that offsets are encoded ICIndexStorageConstants //Offsets can either be LINE or OFFSET int offsetType = Integer.valueOf(String.valueOf(offsets[i][j]).substring(0,1)).intValue(); - if (offsetType==ICIndexStorageConstants.LINE){ + if (offsetType==Index.LINE){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); - match.offsetType = ICIndexStorageConstants.LINE; - }else if (offsetType==ICIndexStorageConstants.OFFSET){ + match.offsetType = Index.LINE; + }else if (offsetType==Index.OFFSET){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); match.endOffset= match.startOffset + offsetLengths[i][j]; - match.offsetType=ICIndexStorageConstants.OFFSET; + match.offsetType=Index.OFFSET; } match.parentName = ""; //$NON-NLS-1$ if (searchFor == FIELD){ diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FriendPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FriendPattern.java index e3681e0ee84..dd9efba8457 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FriendPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/FriendPattern.java @@ -22,6 +22,7 @@ import java.util.Iterator; import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; /** @@ -45,7 +46,7 @@ public class FriendPattern extends ClassDeclarationPattern { } public char[] indexEntryPrefix() { - return IndexerOutput.bestTypePrefix( + return Index.bestTypePrefix( searchFor, getLimitTo(), simpleName, diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/IncludePattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/IncludePattern.java index 3a59b5c99c0..10de76e642e 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/IncludePattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/IncludePattern.java @@ -18,6 +18,7 @@ import org.eclipse.cdt.core.parser.ast.IASTInclusion; import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; @@ -74,7 +75,7 @@ public class IncludePattern extends CSearchPattern { * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#indexEntryPrefix() */ public char[] indexEntryPrefix() { - return IndexerOutput.bestIncludePrefix( + return Index.bestIncludePrefix( _limitTo, simpleName, _matchMode, _caseSensitive diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MacroDeclarationPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MacroDeclarationPattern.java index 9c4e452cbfb..28c87f70d33 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MacroDeclarationPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MacroDeclarationPattern.java @@ -24,7 +24,8 @@ import org.eclipse.cdt.core.search.BasicSearchMatch; import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; @@ -90,13 +91,13 @@ public class MacroDeclarationPattern extends CSearchPattern { //Don't forget that offsets are encoded ICIndexStorageConstants //Offsets can either be LINE or OFFSET int offsetType = Integer.valueOf(String.valueOf(offsets[i][j]).substring(0,1)).intValue(); - if (offsetType==ICIndexStorageConstants.LINE){ + if (offsetType==IIndex.LINE){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); - match.offsetType = ICIndexStorageConstants.LINE; - }else if (offsetType==ICIndexStorageConstants.OFFSET){ + match.offsetType=IIndex.LINE; + }else if (offsetType==IIndex.OFFSET){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); - match.endOffset= match.startOffset + offsetLengths[i][j]; - match.offsetType=ICIndexStorageConstants.OFFSET; + match.endOffset= match.startOffset + offsetLengths[i][j]; + match.offsetType=IIndex.OFFSET; } match.parentName = ""; //$NON-NLS-1$ match.type = ICElement.C_MACRO; @@ -132,7 +133,7 @@ public class MacroDeclarationPattern extends CSearchPattern { * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#indexEntryPrefix() */ public char[] indexEntryPrefix() { - return IndexerOutput.bestMacroPrefix( + return Index.bestMacroPrefix( _limitTo, simpleName, _matchMode, _caseSensitive diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java index daf8a0329ad..57a7305b11e 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java @@ -26,7 +26,8 @@ import org.eclipse.cdt.core.search.BasicSearchMatch; import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; @@ -131,9 +132,9 @@ public class MethodDeclarationPattern extends CSearchPattern { public char[] indexEntryPrefix() { if( searchFor == FUNCTION ) - return IndexerOutput.bestFunctionPrefix( _limitTo, simpleName, _matchMode, _caseSensitive ); + return Index.bestFunctionPrefix( _limitTo, simpleName, _matchMode, _caseSensitive ); else if( searchFor == METHOD ) - return IndexerOutput.bestMethodPrefix( _limitTo, simpleName, qualifications, _matchMode, _caseSensitive ); + return Index.bestMethodPrefix( _limitTo, simpleName, qualifications, _matchMode, _caseSensitive ); else return null; } @@ -194,13 +195,13 @@ public class MethodDeclarationPattern extends CSearchPattern { //Don't forget that offsets are encoded ICIndexStorageConstants //Offsets can either be LINE or OFFSET int offsetType = Integer.valueOf(String.valueOf(offsets[i][j]).substring(0,1)).intValue(); - if (offsetType==ICIndexStorageConstants.LINE){ + if (offsetType==IIndex.LINE){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); - match.offsetType = ICIndexStorageConstants.LINE; - }else if (offsetType==ICIndexStorageConstants.OFFSET){ + match.offsetType = IIndex.LINE; + }else if (offsetType==IIndex.OFFSET){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); match.endOffset= match.startOffset + offsetLengths[i][j]; - match.offsetType=ICIndexStorageConstants.OFFSET; + match.offsetType=IIndex.OFFSET; } match.parentName = ""; //$NON-NLS-1$ if (searchFor == METHOD){ diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java index 6370ddeee8a..407802b1273 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java @@ -23,7 +23,8 @@ import org.eclipse.cdt.core.search.BasicSearchMatch; import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; @@ -102,13 +103,13 @@ public class NamespaceDeclarationPattern extends CSearchPattern { //Don't forget that offsets are encoded ICIndexStorageConstants //Offsets can either be LINE or OFFSET int offsetType = Integer.valueOf(String.valueOf(offsets[i][j]).substring(0,1)).intValue(); - if (offsetType==ICIndexStorageConstants.LINE){ + if (offsetType==IIndex.LINE){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); - match.offsetType = ICIndexStorageConstants.LINE; - }else if (offsetType==ICIndexStorageConstants.OFFSET){ + match.offsetType = IIndex.LINE; + }else if (offsetType==IIndex.OFFSET){ match.startOffset=Integer.valueOf(String.valueOf(offsets[i][j]).substring(1)).intValue(); match.endOffset= match.startOffset + offsetLengths[i][j]; - match.offsetType=ICIndexStorageConstants.OFFSET; + match.offsetType=IIndex.OFFSET; } match.parentName = ""; //$NON-NLS-1$ match.type=ICElement.C_NAMESPACE; @@ -158,7 +159,7 @@ public class NamespaceDeclarationPattern extends CSearchPattern { * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#indexEntryPrefix() */ public char[] indexEntryPrefix() { - return IndexerOutput.bestNamespacePrefix( + return Index.bestNamespacePrefix( _limitTo, simpleName, qualifications, diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/FilterIndexerViewDialog.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/FilterIndexerViewDialog.java index 7e63aa947f7..876f4564e37 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/FilterIndexerViewDialog.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/FilterIndexerViewDialog.java @@ -15,7 +15,8 @@ import java.util.HashSet; import java.util.Set; import org.eclipse.cdt.core.parser.util.ArrayUtil; -import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; +import org.eclipse.cdt.internal.core.index.IIndex; +import org.eclipse.cdt.internal.core.index.cindexstorage.Index; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.browser.typeinfo.TypeInfoMessages; import org.eclipse.jface.dialogs.Dialog; @@ -42,6 +43,9 @@ import org.eclipse.swt.widgets.Text; */ public class FilterIndexerViewDialog extends Dialog { + private static String getStringDescription(int meta, int kind, int ref) { + return Index.getDescriptionOf(meta, kind, ref); + } private static final int DECL_BUTTON_ID = 4; private static final int REF_BUTTON_ID = 3; private static final int TYPE_BUTTON_ID = 2; @@ -67,54 +71,54 @@ public class FilterIndexerViewDialog extends Dialog { private String message = "Filter Indexer Results (. = any character, .* = any string):"; //$NON-NLS-1$ public static final int ENTRY_TYPE_REF = 2; - public static final String ENTRY_TYPE_REF_STRING = String.valueOf(IndexerOutput.TYPE_REF); - public static final String ENTRY_TYPE_DECL_STRING = String.valueOf(IndexerOutput.TYPE_DECL); + public static final String ENTRY_TYPE_REF_STRING = getStringDescription(IIndex.TYPE, IIndex.ANY, IIndex.REFERENCE); + public static final String ENTRY_TYPE_DECL_STRING = getStringDescription(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION); public static final int ENTRY_FUNCTION_REF = 4; - public static final String ENTRY_FUNCTION_REF_STRING = String.valueOf(IndexerOutput.FUNCTION_REF); + public static final String ENTRY_FUNCTION_REF_STRING = getStringDescription(IIndex.FUNCTION, IIndex.ANY, IIndex.REFERENCE); public static final int ENTRY_FUNCTION_DECL = 5; - public static final String ENTRY_FUNCTION_DECL_STRING = String.valueOf(IndexerOutput.FUNCTION_DECL); + public static final String ENTRY_FUNCTION_DECL_STRING = getStringDescription(IIndex.FUNCTION, IIndex.ANY, IIndex.DECLARATION); public static final int ENTRY_NAMESPACE_REF = 8; - public static final String ENTRY_NAMESPACE_REF_STRING = String.valueOf(IndexerOutput.NAMESPACE_REF); + public static final String ENTRY_NAMESPACE_REF_STRING = getStringDescription(IIndex.NAMESPACE, IIndex.ANY, IIndex.REFERENCE); public static final int ENTRY_NAMESPACE_DECL = 9; - public static final String ENTRY_NAMESPACE_DECL_STRING = String.valueOf(IndexerOutput.NAMESPACE_DECL); + public static final String ENTRY_NAMESPACE_DECL_STRING = getStringDescription(IIndex.NAMESPACE, IIndex.ANY, IIndex.DECLARATION); public static final int ENTRY_FIELD_REF = 10; - public static final String ENTRY_FIELD_REF_STRING = String.valueOf(IndexerOutput.FIELD_REF); + public static final String ENTRY_FIELD_REF_STRING = getStringDescription(IIndex.FIELD, IIndex.ANY, IIndex.REFERENCE); public static final int ENTRY_FIELD_DECL = 11; - public static final String ENTRY_FIELD_DECL_STRING = String.valueOf(IndexerOutput.FIELD_DECL); + public static final String ENTRY_FIELD_DECL_STRING = getStringDescription(IIndex.FIELD, IIndex.ANY, IIndex.DECLARATION); public static final int ENTRY_ENUMTOR_REF = 12; - public static final String ENTRY_ENUMTOR_REF_STRING = String.valueOf(IndexerOutput.ENUMTOR_REF); + public static final String ENTRY_ENUMTOR_REF_STRING = getStringDescription(IIndex.ENUMTOR, IIndex.ANY, IIndex.REFERENCE); public static final int ENTRY_ENUMTOR_DECL = 13; - public static final String ENTRY_ENUMTOR_DECL_STRING = String.valueOf(IndexerOutput.ENUMTOR_DECL); + public static final String ENTRY_ENUMTOR_DECL_STRING = getStringDescription(IIndex.ENUMTOR, IIndex.ANY, IIndex.DECLARATION); public static final int ENTRY_METHOD_REF = 14; - public static final String ENTRY_METHOD_REF_STRING = String.valueOf(IndexerOutput.METHOD_REF); + public static final String ENTRY_METHOD_REF_STRING = getStringDescription(IIndex.METHOD, IIndex.ANY, IIndex.REFERENCE); public static final int ENTRY_METHOD_DECL = 15; - public static final String ENTRY_METHOD_DECL_STRING = String.valueOf(IndexerOutput.METHOD_DECL); + public static final String ENTRY_METHOD_DECL_STRING = getStringDescription(IIndex.METHOD, IIndex.ANY, IIndex.DECLARATION); public static final int ENTRY_MACRO_DECL = 16; - public static final String ENTRY_MACRO_DECL_STRING = String.valueOf(IndexerOutput.MACRO_DECL); + public static final String ENTRY_MACRO_DECL_STRING = getStringDescription(IIndex.MACRO, IIndex.ANY, IIndex.DECLARATION); public static final int ENTRY_INCLUDE_REF = 17; - public static final String ENTRY_INCLUDE_REF_STRING = String.valueOf(IndexerOutput.INCLUDE_REF); + public static final String ENTRY_INCLUDE_REF_STRING = getStringDescription(IIndex.INCLUDE, IIndex.ANY, IIndex.REFERENCE); public static final int ENTRY_TYPE_DECL_T = 19; - public static final String ENTRY_TYPE_DECL_T_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.TYPEDEF_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_T_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_TYPEDEF, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_C = 20; - public static final String ENTRY_TYPE_DECL_C_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.CLASS_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_C_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_V = 21; - public static final String ENTRY_TYPE_DECL_V_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.VAR_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_V_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_VAR, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_S = 22; - public static final String ENTRY_TYPE_DECL_S_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.STRUCT_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_S_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_STRUCT, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_E = 23; - public static final String ENTRY_TYPE_DECL_E_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.ENUM_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_E_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_ENUM, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_U = 24; - public static final String ENTRY_TYPE_DECL_U_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.UNION_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_U_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_UNION, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_D = 25; - public static final String ENTRY_TYPE_DECL_D_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.DERIVED_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_D_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_DERIVED, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_F = 26; - public static final String ENTRY_TYPE_DECL_F_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.FRIEND_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_F_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_FRIEND, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_G = 27; - public static final String ENTRY_TYPE_DECL_G_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.FWD_CLASS_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_G_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_FWD_CLASS, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_H = 28; - public static final String ENTRY_TYPE_DECL_H_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.FWD_STRUCT_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_H_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_FWD_STRUCT, IIndex.DECLARATION); public static final int ENTRY_TYPE_DECL_I = 29; - public static final String ENTRY_TYPE_DECL_I_STRING = String.valueOf(IndexerOutput.TYPE_DECL) + String.valueOf(IndexerOutput.FWD_UNION_SUFFIX) + String.valueOf(IndexerOutput.SEPARATOR); + public static final String ENTRY_TYPE_DECL_I_STRING = getStringDescription(IIndex.TYPE, IIndex.TYPE_FWD_UNION, IIndex.DECLARATION); private String fDialogSection; diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeLeaf.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeLeaf.java index 601fc6ccf60..763b24a783c 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeLeaf.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeLeaf.java @@ -16,8 +16,8 @@ import java.io.IOException; import org.eclipse.cdt.core.browser.PathUtil; import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.internal.core.index.IEntryResult; +import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; -import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput; import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; import org.eclipse.core.runtime.IAdaptable; @@ -279,7 +279,7 @@ public class IndexerNodeLeaf implements IAdaptable { } public String toString() { - if (!parent.isDisplayFullName() && name.indexOf(IndexerOutput.SEPARATOR) > 0) + if (!parent.isDisplayFullName() && name.indexOf(ICIndexStorageConstants.SEPARATOR) > 0) return getShortName(); return name; @@ -298,8 +298,8 @@ public class IndexerNodeLeaf implements IAdaptable { } public String getShortName() { - if (name.indexOf(IndexerOutput.SEPARATOR) > 0) - return name.substring(0, name.indexOf(IndexerOutput.SEPARATOR)); + if (name.indexOf(ICIndexStorageConstants.SEPARATOR) > 0) + return name.substring(0, name.indexOf(ICIndexStorageConstants.SEPARATOR)); return name; } diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerView.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerView.java index 45dee07f757..882fc2b36e8 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerView.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerView.java @@ -13,11 +13,9 @@ package org.eclipse.cdt.ui.tests.IndexerView; import java.io.IOException; import org.eclipse.cdt.core.index.ICDTIndexer; -import org.eclipse.cdt.core.search.ICSearchConstants; import org.eclipse.cdt.internal.core.index.IEntryResult; import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.IIndexer; -import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput; import org.eclipse.cdt.ui.testplugin.CTestPlugin; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IProgressMonitor; @@ -127,17 +125,8 @@ public class IndexerView extends ViewPart { if (index==null) return Status.CANCEL_STATUS; - try { - char[] prefix = BLANK_STRING.toCharArray(); - char optionalType = (char)0; - char[] name = ALL_NAME_SEARCH.toCharArray(); - char [][] containingTypes = new char[0][]; - int matchMode = ICSearchConstants.PATTERN_MATCH; - boolean isCaseSensitive = false; - - char[] queryString = IndexerOutput.bestPrefix( prefix, optionalType, name, containingTypes, matchMode, isCaseSensitive); - - IEntryResult[] results = index.queryEntries(queryString); + try { + IEntryResult[] results = index.getEntries(IIndex.ANY, IIndex.ANY, IIndex.ANY ); if (results == null) return Status.CANCEL_STATUS; int size = results.length; diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionProposalsBaseTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionProposalsBaseTest.java index 10de097a7a4..d2f570f0bf8 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionProposalsBaseTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionProposalsBaseTest.java @@ -21,7 +21,6 @@ import java.io.FileInputStream; import junit.framework.TestCase; import org.eclipse.cdt.core.CCProjectNature; -import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICProject; @@ -31,7 +30,6 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode; import org.eclipse.cdt.core.parser.ast.IASTNode; import org.eclipse.cdt.core.parser.ast.IASTScope; import org.eclipse.cdt.core.testplugin.CProjectHelper; -import org.eclipse.cdt.internal.core.search.indexing.IndexManager; import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProcessor; import org.eclipse.cdt.ui.testplugin.CTestPlugin; import org.eclipse.core.resources.IFile; diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java index 0964e249c07..fa927b019a2 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java @@ -22,7 +22,6 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICProject; diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/OpenTypeInHierarchyAction.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/OpenTypeInHierarchyAction.java index 278bf240b85..79a0bbc5637 100644 --- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/OpenTypeInHierarchyAction.java +++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/typehierarchy/OpenTypeInHierarchyAction.java @@ -17,7 +17,6 @@ import org.eclipse.cdt.core.browser.ITypeInfo; import org.eclipse.cdt.core.browser.ITypeSearchScope; import org.eclipse.cdt.core.browser.TypeSearchScope; import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.internal.ui.browser.opentype.OpenTypeDialog; import org.eclipse.cdt.internal.ui.browser.opentype.OpenTypeMessages; import org.eclipse.cdt.internal.ui.util.ExceptionHandler; import org.eclipse.cdt.ui.CUIPlugin; diff --git a/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java b/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java index aeb168a7aa9..09ad422a0c9 100644 --- a/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java +++ b/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java @@ -43,7 +43,6 @@ import org.eclipse.cdt.core.search.ICSearchConstants; import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.core.search.OrPattern; import org.eclipse.cdt.core.search.SearchEngine; -import org.eclipse.cdt.internal.core.model.CElement; import org.eclipse.cdt.internal.corext.Assert; import org.eclipse.cdt.internal.corext.refactoring.Checks; import org.eclipse.cdt.internal.corext.refactoring.CompositeChange; @@ -187,8 +186,8 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc name.append(function.getSignature()); } else { if (element instanceof IEnumerator) { - IEnumeration enum = (IEnumeration) element.getParent(); - name.append(getElementQualifiedName(enum.getParent())); + IEnumeration enum1 = (IEnumeration) element.getParent(); + name.append(getElementQualifiedName(enum1.getParent())); }else { name.append(getElementQualifiedName(element.getParent())); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java index 98d04acc85d..5c3ea01450c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java @@ -9,17 +9,14 @@ import java.util.ResourceBundle; import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.IContextMenuConstants; -import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.text.ITextOperationTarget; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorActionBarContributor; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.editors.text.TextEditorActionContributor; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java index 37e5117f2c5..ab23ab6d4ae 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java @@ -17,7 +17,7 @@ import java.util.HashMap; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.search.BasicSearchMatch; -import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.ICHelpContextIds; import org.eclipse.cdt.internal.ui.editor.ExternalSearchFile; @@ -195,10 +195,10 @@ public class CSearchResultPage extends AbstractTextSearchViewPage { try { IMarker marker= file.createMarker(NewSearchUI.SEARCH_MARKER); HashMap attributes= new HashMap(4); - if (offsetType==ICIndexStorageConstants.OFFSET){ + if (offsetType==IIndex.OFFSET){ attributes.put(IMarker.CHAR_START, new Integer(offset)); attributes.put(IMarker.CHAR_END, new Integer(offset + length)); - } else if (offsetType == ICIndexStorageConstants.LINE){ + } else if (offsetType == IIndex.LINE){ attributes.put(IMarker.LINE_NUMBER, new Integer(offset)); } marker.setAttributes(attributes); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java index c93d55b605a..d31c935569e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java @@ -43,7 +43,6 @@ import org.eclipse.jface.text.rules.DefaultDamagerRepairer; import org.eclipse.jface.text.rules.RuleBasedScanner; import org.eclipse.jface.text.source.IAnnotationHover; import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell;