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 90c5ba82c89..66e273c9476 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 @@ -221,6 +221,11 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener "EntryResult: word=typeDecl/V/x, refs={ 1 }, offsets={ [ 21201, 21526] }"}; //$NON-NLS-1$ + String[] entryResultNameModel = {"Mail","Unknown","container","first_class","postcard","Mail","first_class","postcard","PO_Box","index","mail","size","temp","x"}; + int[] entryResultMetaModel = {IIndex.TYPE}; + int[] entryResultTypeModel = {IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_DERIVED,IIndex.TYPE_DERIVED,IIndex.TYPE_DERIVED, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR}; + int[] entryResultRefModel = {IIndex.DECLARATION}; + if (qresults.length != queryResultModel.length) fail("Query Result length different from model"); //$NON-NLS-1$ @@ -234,7 +239,10 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener for (int i=0;i 0) buffer.append(','); @@ -89,7 +95,7 @@ public String toString(){ } buffer.append(']'); } - buffer.append(" }"); //$NON-NLS-1$ + buffer.append(" }\n"); //$NON-NLS-1$ return buffer.toString(); } /* (non-Javadoc) @@ -116,19 +122,18 @@ public String extractSimpleName() { } private void decode(char [] word) { - String aWord = new String(word); int pos = 0; meta_type = 0; for (int i = 1; i < ICIndexStorageConstants.encodings.length; i ++){ - if (aWord.indexOf(new String(ICIndexStorageConstants.encodings[i]), pos) == 0) { + if (CharOperation.prefixEquals(ICIndexStorageConstants.encodings[i], word)) { meta_type = i; pos += ICIndexStorageConstants.encodings[i].length; break; } } - for ( int i = 1; i < ICIndexStorageConstants.encodingTypes.length; i++) { - if (aWord.indexOf(new String(ICIndexStorageConstants.encodingTypes[i]), pos) == pos) { + for ( int i = 1; i < ICIndexStorageConstants.encodingTypes.length; i++) { + if (CharOperation.fragmentEquals(ICIndexStorageConstants.encodingTypes[i], word, pos, true)) { reftype = i; pos += ICIndexStorageConstants.encodingTypes[i].length; break; @@ -181,6 +186,15 @@ public int getRefKind() { public String getName() { return longname; } +public String getStringMetaKind() { + return String.valueOf(ICIndexStorageConstants.encodings[meta_type]); +} +public String getStringKind() { + return ICIndexStorageConstants.typeConstantNames[kind]; +} +public String getStringRefKind() { + return String.valueOf(ICIndexStorageConstants.encodingTypes[reftype]); +} } 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 dbdaac4cbcd..2f58b0c690d 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 @@ -72,6 +72,19 @@ public interface ICIndexStorageConstants { 'I' // FWD_UNION }; + final static String[] typeConstantNames = { "", // not used + "Class", + "Struct", + "Union", + "Enum", + "Variable", + "Typedef", + "Derived", + "Friend", + "FWD Class", + "FWD Struct", + "FWD Union" +}; final static char [][] accessSpecifiers = { "".toCharArray(), // not used //$NON-NLS-1$ "private".toCharArray(), // private //$NON-NLS-1$ 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 3fcb8901a06..a92f0b2ca98 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 @@ -201,6 +201,30 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants input.close(); } } + + /** + * Returns the path list + */ + public String [] getDocumentList() throws IOException { + IndexInput input= new BlocksIndexInput(indexFile); + try { + input.open(); + int num = input.getNumFiles(); + String [] result = new String[num+1]; + for(int i = 1; i < num+1; i++) { + //i+1 since reference encoding starts at 1 + IndexedFileEntry file = input.getIndexedFile(i); + if (file != null) + result[i] = file.getPath(); + else + result[i] = null; + } + + return result; + } finally { + input.close(); + } + } /** * see IIndex.hasChanged */ @@ -265,7 +289,18 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants //rename the file created to become the main index File mainIndexFile= (File) mainIndexInput.getSource(); File tempIndexFile= (File) tempIndexOutput.getDestination(); - mainIndexFile.delete(); + boolean deleted = mainIndexFile.delete(); + + int counter=0; + while (!deleted && counter<5){ + System.out.println("Not deleted"); + try { + Thread.sleep(50); + } catch (InterruptedException e) {} + counter++; + deleted=mainIndexFile.delete(); + } + tempIndexFile.renameTo(mainIndexFile); } finally { //initialise remove vectors and addsindex, and change the state diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagEntry.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagEntry.java index e976294654e..aa7d5316bd1 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagEntry.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/ctagsindexer/CTagEntry.java @@ -13,6 +13,9 @@ package org.eclipse.cdt.internal.core.index.ctagsindexer; import java.util.HashMap; import java.util.StringTokenizer; +import org.eclipse.cdt.internal.core.index.IIndex; +import org.eclipse.cdt.internal.core.index.IIndexerOutput; + class CTagEntry{ private final CTagsConsoleParser parser; @@ -53,8 +56,10 @@ class CTagEntry{ case 2: // LINE NUMBER; try { String sub = token.trim(); - if (Character.isDigit(sub.charAt(0))) { - lineNumber = Integer.parseInt(sub); + int i = sub.indexOf(';'); + String num = sub.substring(0, i); + if (Character.isDigit(num.charAt(0))) { + lineNumber = Integer.parseInt(num); } } catch (NumberFormatException e) { } catch (IndexOutOfBoundsException e) { @@ -72,4 +77,75 @@ class CTagEntry{ } } } + + /** + * @param tempTag + * @return + */ + public char[][] getQualifiedName() { + char[][] fullName = null; + String name = null; + String[] types = {CTagsConsoleParser.NAMESPACE, CTagsConsoleParser.CLASS, CTagsConsoleParser.STRUCT, CTagsConsoleParser.UNION, CTagsConsoleParser.FUNCTION, CTagsConsoleParser.ENUM}; + + for (int i=0; i= 0) { - if (isChecked) buttons[i].setSelection(true); - else buttons[i].setSelection(false); + if (iAllTypes[i][0] == IIndex.TYPE) { + buttons[i].setSelection(isChecked); event.widget = buttons[i]; buttons[i].notifyListeners(SWT.Selection, event); } @@ -384,9 +423,8 @@ public class FilterIndexerViewDialog extends Dialog { // select/deselect all of the buttons in the buttons array for(int i=0; i= 0) { - if (isChecked) buttons[i].setSelection(true); - else buttons[i].setSelection(false); + if (iAllTypes[i][2] == IIndex.DECLARATION) { + buttons[i].setSelection(isChecked); event.widget = buttons[i]; buttons[i].notifyListeners(SWT.Selection, event); } @@ -419,9 +457,8 @@ public class FilterIndexerViewDialog extends Dialog { // select/deselect all of the buttons in the buttons array for(int i=0; i= 0) { - if (isChecked) buttons[i].setSelection(true); - else buttons[i].setSelection(false); + if (iAllTypes[i][2] == IIndex.REFERENCE) { + buttons[i].setSelection(isChecked); event.widget = buttons[i]; buttons[i].notifyListeners(SWT.Selection, event); } @@ -472,7 +509,7 @@ public class FilterIndexerViewDialog extends Dialog { pageSizeText.setLayoutData(data); pageSizeText.setFont(parent.getFont()); - pageSizeText.setText((pageSize == null ? BLANK_STRING : pageSize)); + pageSizeText.setText(String.valueOf(pageSize)); } /** @@ -549,7 +586,7 @@ public class FilterIndexerViewDialog extends Dialog { for(int i = 0; i < iAllTypes.length; i++) { section.put( - getStringDescription(iAllTypes[i][0], iAllTypes[i][1], iAllTypes[i][2]), + getUniqueStringDescription(i), fFilterMatcher[i] ); } @@ -559,6 +596,7 @@ public class FilterIndexerViewDialog extends Dialog { section.put(DECL_BUTTON, groupedButtonSelections[DECL_BUTTON_ID]); section.put(PAGE_SIZE, pageSize); + section.put(FILTER_TEXT, fFilter); } /** @@ -566,10 +604,11 @@ public class FilterIndexerViewDialog extends Dialog { */ protected void writeDefaultSettings(IDialogSettings section) { for(int i = 0; i < iAllTypes.length; i++) { - String description = getStringDescription(iAllTypes[i][0], iAllTypes[i][1], iAllTypes[i][2]); + String description = getUniqueStringDescription(i); section.put(description, true); } + section.put(FILTER_TEXT, fFilter); section.put(PAGE_SIZE, IndexerNodeParent.PAGE_SIZE); } @@ -616,14 +655,14 @@ public class FilterIndexerViewDialog extends Dialog { int height = section.getInt(SETTINGS_HEIGHT); fSize = new Point(width, height); - pageSize = String.valueOf(section.getInt(PAGE_SIZE)); + pageSize = section.getInt(PAGE_SIZE); } catch (NumberFormatException e) { fLocation = null; fSize = null; } for(int i = 0; i < iAllTypes.length; i++) { - fFilterMatcher[i] = section.getBoolean(getStringDescription(iAllTypes[i][0], iAllTypes[i][1], iAllTypes[i][2])); + fFilterMatcher[i] = section.getBoolean(getUniqueStringDescription(i)); } // get the grouped button selection status @@ -631,6 +670,9 @@ public class FilterIndexerViewDialog extends Dialog { groupedButtonSelections[TYPE_BUTTON_ID] = section.getBoolean(TYPE_BUTTON); groupedButtonSelections[REF_BUTTON_ID] = section.getBoolean(REF_BUTTON); groupedButtonSelections[DECL_BUTTON_ID] = section.getBoolean(DECL_BUTTON); + fFilter = section.get(FILTER_TEXT); + if (fFilter == null) + fFilter = BLANK_STRING; } public IndexerFilterManager createFilterManager() { @@ -639,21 +681,20 @@ public class FilterIndexerViewDialog extends Dialog { private void apply() { fFilter = filterText.getText(); - pageSize = pageSizeText.getText(); - writeSettings(getDialogSettings()); - root.setFilterManager(fFilterMatcher, fFilter); - - int size=IndexerNodeParent.PAGE_SIZE; + pageSize=IndexerNodeParent.PAGE_SIZE; try { - size = Integer.valueOf(pageSize).intValue(); - if (size<=0) size=IndexerNodeParent.PAGE_SIZE; + pageSize = Integer.valueOf(pageSizeText.getText()).intValue(); + if (pageSize<=0) + pageSize=IndexerNodeParent.PAGE_SIZE; } catch (NumberFormatException e) {} - - root.setPageSize(size); + + root.setFilterManager(fFilterMatcher, fFilter); + root.setPageSize(pageSize); root.reset(); + writeSettings(getDialogSettings()); } - public String getPageSize() { + public int getPageSize() { return pageSize; } 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 41715528407..f791977d35f 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 @@ -10,15 +10,10 @@ **********************************************************************/ package org.eclipse.cdt.ui.tests.IndexerView; -import java.io.File; -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.IndexedFileEntry; -import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput; -import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.ui.views.properties.IPropertyDescriptor; import org.eclipse.ui.views.properties.IPropertySource; @@ -31,14 +26,18 @@ public class IndexerNodeLeaf implements IAdaptable { private static final char EMPTY_SPACE = ' '; private int filtersType=0; - IEntryResult result = null; - File indexFile = null; + private IEntryResult result = null; + private String [] fileMap = null; + + public String[] getFileMap() { + return fileMap; + } private IndexerNodeParent parent = null; - public IndexerNodeLeaf(IEntryResult result, File indexFile) { + public IndexerNodeLeaf(IEntryResult result, String[] fileMap) { this.result = result; - this.indexFile = indexFile; + this.fileMap = fileMap; if (result != null) this.filtersType = IndexerView.getKey(result.getMetaKind(), result.getKind(), result.getRefKind()); } @@ -84,18 +83,14 @@ public class IndexerNodeLeaf implements IAdaptable { TextPropertyDescriptor text = null; - IndexInput input = new BlocksIndexInput(indexFile); - try { - input.open(); - // get the reference descriptors int[] references = entryResult.getFileReferences(); if (references != null) { for (int j = 0; j < references.length; ++j) { - IndexedFileEntry file = input.getIndexedFile(references[j]); - if (file != null && file.getPath() != null) { + String file = fileMap[references[j]]; + if (file != null) { String id = REFERENCE_NUMBER_ + String.valueOf(j); - text = new TextPropertyDescriptor(new TextDescriptorId(id, PathUtil.getWorkspaceRelativePath(file.getPath()).toOSString()), id); + text = new TextPropertyDescriptor(new TextDescriptorId(id, PathUtil.getWorkspaceRelativePath(file).toOSString()), id); text.setCategory(REFERENCES); descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text); } @@ -127,15 +122,24 @@ public class IndexerNodeLeaf implements IAdaptable { descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text); } } - + // add a word descriptor - text = new TextPropertyDescriptor(new TextDescriptorId(IENTRYRESULT_GETWORD__, String.valueOf(entryResult.toString())), IENTRYRESULT_GETWORD__); + text = new TextPropertyDescriptor(new TextDescriptorId("MetaKind", entryResult.getStringMetaKind()), "MetaKind"); text.setCategory(IENTRYRESULT); descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text); - - } catch (IOException e) { - } - + + // add a word descriptor + if (entryResult.getMetaKind() == IIndex.TYPE) { + text = new TextPropertyDescriptor(new TextDescriptorId("TypeKind", entryResult.getStringKind()), "TypeKind"); + text.setCategory(IENTRYRESULT); + descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text); + } + // add a word descriptor + text = new TextPropertyDescriptor(new TextDescriptorId("ReferenceKind", entryResult.getStringRefKind()), "ReferenceKind"); + text.setCategory(IENTRYRESULT); + descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text); + + return (IPropertyDescriptor[])ArrayUtil.trim(IPropertyDescriptor.class, descriptors); } diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeParent.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeParent.java index ecae9b4370c..675d5894574 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeParent.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerNodeParent.java @@ -10,7 +10,6 @@ **********************************************************************/ package org.eclipse.cdt.ui.tests.IndexerView; -import java.io.File; import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.internal.core.index.IEntryResult; import org.eclipse.cdt.ui.testplugin.CTestPlugin; @@ -34,18 +33,15 @@ public class IndexerNodeParent extends IndexerNodeLeaf { private boolean displayFullName=true; private boolean navigate=false; - public IndexerNodeParent(IEntryResult result, File indexerFile, IndexerView.ViewContentProvider view) { - super(result, indexerFile); + public IndexerNodeParent(IEntryResult result, String [] fileMap, IndexerView.ViewContentProvider view) { + super(result, fileMap); // create an IndexerFilterManager using the FilterIndexerViewDialog (since all of the work is done there anyways) FilterIndexerViewDialog dialog = new FilterIndexerViewDialog(CTestPlugin.getStandardDisplay().getActiveShell(), this, view.getProjectName()); dialog.readSettings(dialog.getDialogSettings()); filterManager = dialog.createFilterManager(); - - try { - pageSize = Integer.valueOf(dialog.getPageSize()).intValue(); - } catch (NumberFormatException e) {} + pageSize = dialog.getPageSize(); this.view = view; } diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerQuery.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerQuery.java index e076e5782c8..a232ced4aff 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerQuery.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerQuery.java @@ -10,17 +10,12 @@ **********************************************************************/ package org.eclipse.cdt.ui.tests.IndexerView; -import java.io.IOException; - import org.eclipse.cdt.core.browser.PathUtil; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.core.search.BasicSearchMatch; import org.eclipse.cdt.core.search.IMatch; import org.eclipse.cdt.internal.core.index.IEntryResult; -import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; -import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput; -import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; import org.eclipse.cdt.internal.ui.search.CSearchQuery; import org.eclipse.cdt.internal.ui.search.CSearchResult; import org.eclipse.cdt.internal.ui.search.NewSearchResultCollector; @@ -84,7 +79,7 @@ public class IndexerQuery extends CSearchQuery implements ISearchQuery { fileResource =tempResource; else fileResource = tempPath; - collector.acceptMatch( createMatch(fileResource, matches[i].getStart(), + collector.acceptMatch( createMatch(fileResource, matches[i].getOffsetType(), matches[i].getStart(), matches[i].getEnd(), matches[i].getName(), matches[i].getPath()) ); } } catch (CoreException ce) {} @@ -97,52 +92,50 @@ public class IndexerQuery extends CSearchQuery implements ISearchQuery { } private MatchInfo[] generateMatchInfo() { - IndexInput input = new BlocksIndexInput(leaf.indexFile); + String [] fileMap = leaf.getFileMap(); IEntryResult entryResult = leaf.getResult(); MatchInfo[] matches = new MatchInfo[DEFAULT_MATCH_INFO_SIZE]; - try { - input.open(); - int[] references = entryResult.getFileReferences(); - int[][]offsets = entryResult.getOffsets(); - int[][]offsetLengths = entryResult.getOffsetLengths(); - if (offsets != null){ - for (int j=0; j j-1) { - IndexedFileEntry file = input.getIndexedFile(references[j]); - if (file != null){ - IPath filePath = new Path(file.getPath()); - //If we can verify that the file exists within the workspace, we'll use it - //to open the appropriate editor - if not we can just set the path and we'll - //use the external editor mechanism - IFile tempFile = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath); - if (tempFile != null && tempFile.exists()) - match.setResource(tempFile); - else { - match.setPath(PathUtil.getWorkspaceRelativePath(file.getPath())); - } - - } + int[] references = entryResult.getFileReferences(); + int[][]offsets = entryResult.getOffsets(); + int[][]offsetLengths = entryResult.getOffsetLengths(); + if (offsets != null){ + for (int j=0; j j-1) { + String file = fileMap[references[j]]; + if (file != null){ + IPath filePath = new Path(file); + //If we can verify that the file exists within the workspace, we'll use it + //to open the appropriate editor - if not we can just set the path and we'll + //use the external editor mechanism + IFile tempFile = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath); + if (tempFile != null && tempFile.exists()) + match.setResource(tempFile); + else { + match.setPath(PathUtil.getWorkspaceRelativePath(file)); + } + } - int start=0; - int end=0; - try { - start=Integer.valueOf(String.valueOf(offsets[j][k]).substring(1)).intValue(); - end=start+offsetLengths[j][k]; - } catch (NumberFormatException nfe) {} - - match.setStart(start) ; - match.setEnd(end); - match.setName(leaf.getName()); - - matches = (MatchInfo[])ArrayUtil.append(MatchInfo.class, matches, match); } + int offsetType=0; + int start=0; + int end=0; + try { + offsetType=Integer.valueOf(String.valueOf(offsets[j][k]).substring(0,1)).intValue(); + start=Integer.valueOf(String.valueOf(offsets[j][k]).substring(1)).intValue(); + end=start+offsetLengths[j][k]; + } catch (NumberFormatException nfe) {} + + match.setOffsetType(offsetType); + match.setStart(start) ; + match.setEnd(end); + match.setName(leaf.getName()); + + matches = (MatchInfo[])ArrayUtil.append(MatchInfo.class, matches, match); } } - - } catch (IOException e) { } return matches; @@ -150,6 +143,7 @@ public class IndexerQuery extends CSearchQuery implements ISearchQuery { private class MatchInfo { private IPath path=null; + private int offsetType=0; private int start=0; private int end=0; private String name=null; @@ -158,7 +152,13 @@ public class IndexerQuery extends CSearchQuery implements ISearchQuery { public IPath getPath() { return path; } - public void setPath(IPath path) { + public void setOffsetType(int offsetType){ + this.offsetType=offsetType; + } + public int getOffsetType() { + return offsetType; + } + public void setPath(IPath path) { this.path = path; } public int getEnd() { @@ -187,7 +187,7 @@ public class IndexerQuery extends CSearchQuery implements ISearchQuery { } } - public IMatch createMatch( Object fileResource, int start, int end, String name, IPath referringElement ) { + public IMatch createMatch( Object fileResource,int offsetType, int start, int end, String name, IPath referringElement ) { BasicSearchMatch result = new BasicSearchMatch(); if( fileResource instanceof IResource ) result.resource = (IResource) fileResource; @@ -201,6 +201,8 @@ public class IndexerQuery extends CSearchQuery implements ISearchQuery { result.name = name; + result.offsetType = offsetType; + result.type = ICElement.C_FIELD; // TODO Devin static for now, want something like BasicSearchResultCollector#setElementInfo result.visibility = ICElement.CPP_PUBLIC; // TODO Devin static for now, want something like BasicSearchResultCollector#setElementInfo result.returnType = BLANK_STRING; 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 3597977f832..9d30049e941 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 @@ -127,12 +127,15 @@ public class IndexerView extends ViewPart { try { IEntryResult[] results = index.getEntries(IIndex.ANY, IIndex.ANY, IIndex.ANY ); + + if (results == null) return Status.CANCEL_STATUS; - + String [] fileMap = index.getDocumentList(); + int size = results.length; IndexerNodeLeaf[] children = new IndexerNodeLeaf[size]; for(int j=0; j