1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Patch for David Daoust.

Cleaning up the Indexer View.
This commit is contained in:
John Camelon 2005-05-31 19:23:26 +00:00
parent b208d1adfd
commit e5610988d7

View file

@ -10,7 +10,6 @@
**********************************************************************/
package org.eclipse.cdt.ui.tests.IndexerView;
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.IIndex;
@ -60,14 +59,12 @@ public class IndexerNodeLeaf implements IAdaptable {
private class IndexerPropertySource implements IPropertySource {
private static final String IENTRYRESULT = "IEntryResult"; //$NON-NLS-1$
private static final String NAME = "Name"; //$NON-NLS-1$
private static final String IENTRYRESULT_GETWORD__ = "IEntryResult#getWord()"; //$NON-NLS-1$
private static final String REFERENCES = "References"; //$NON-NLS-1$
private static final String REFERENCE_NUMBER_ = "reference# "; //$NON-NLS-1$
private static final String OFFSETS = "Offsets"; //$NON-NLS-1$
private static final String OFFSETS_NUMBER = "offsets for #"; //$NON-NLS-1$
private static final String REFS = "References"; //$NON-NLS-1$
private static final String OFFSETS_LINE = "Line "; //$NON-NLS-1$
private static final String OFFSETS_OFFSET = "Offset "; //$NON-NLS-1$
private static final int DEFAULT_DESCRIPTOR_SIZE = 4;
private static final int DEFAULT_DESCRIPTOR_SIZE = 64;
IEntryResult entryResult = null;
public IndexerPropertySource(IEntryResult result) {
@ -83,26 +80,13 @@ public class IndexerNodeLeaf implements IAdaptable {
TextPropertyDescriptor text = null;
// get the reference descriptors
// Add reference block
int[] references = entryResult.getFileReferences();
if (references != null) {
for (int j = 0; j < references.length; ++j) {
String file = fileMap[references[j]];
if (file != null) {
String id = REFERENCE_NUMBER_ + String.valueOf(j);
text = new TextPropertyDescriptor(new TextDescriptorId(id, PathUtil.getWorkspaceRelativePath(file).toOSString()), id);
text.setCategory(REFERENCES);
descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text);
}
}
}
//offsets
int[][]offsets = entryResult.getOffsets();
int[][]offsetLengths = entryResult.getOffsetLengths();
if (offsets != null){
for (int j=0; j<offsets.length; j++){
String id = OFFSETS_NUMBER + j;
String id = fileMap[references[j]];
String offsetString = ""; //$NON-NLS-1$
for (int k=0; k<offsets[j].length; k++){
String rawOffset = String.valueOf(offsets[j][k]) ;
@ -118,28 +102,30 @@ public class IndexerNodeLeaf implements IAdaptable {
}
text = new TextPropertyDescriptor(new TextDescriptorId(id, offsetString), id);
text.setCategory(OFFSETS);
text.setCategory(REFS);
descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text);
}
}
// add a word descriptor
// add Name Block
text = new TextPropertyDescriptor(new TextDescriptorId(NAME, entryResult.getName()), NAME);
text.setCategory(IENTRYRESULT);
descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text);
// add IEntryResult
text = new TextPropertyDescriptor(new TextDescriptorId("MetaKind", entryResult.getStringMetaKind()), "MetaKind");
text.setCategory(IENTRYRESULT);
descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text);
// 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);
}