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 23929f68ca3..943f077f868 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 @@ -14,10 +14,8 @@ import java.io.IOException; import org.eclipse.cdt.core.browser.ITypeSearchScope; 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.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.io.BlocksIndexInput; @@ -90,9 +88,6 @@ public class IndexerDependenciesJob extends IndexerJob { } private IPath getIncludePath(IEntryResult entry) { - char[] word = entry.getWord(); - int firstSlash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, 0); - String include = String.valueOf(CharOperation.subarray(word, firstSlash + 1, -1)); - return PathUtil.getWorkspaceRelativePath(include); + return PathUtil.getWorkspaceRelativePath(entry.getName()); } } 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 607a46228af..ab0c8bf486d 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 @@ -19,10 +19,8 @@ import org.eclipse.cdt.core.browser.QualifiedTypeName; import org.eclipse.cdt.core.browser.TypeInfo; import org.eclipse.cdt.core.browser.TypeReference; 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.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.io.BlocksIndexInput; @@ -72,12 +70,9 @@ public class IndexerTypesJob extends IndexerJob { throw new InterruptedException(); IEntryResult entry = namespaceEntries[i]; - char[] word = entry.getWord(); - int firstSlash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, 0); - int slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1); - String name = String.valueOf(CharOperation.subarray(word, firstSlash + 1, slash)); + String name = entry.getName(); if (name.length() != 0) { - String[] enclosingNames = getEnclosingNames(word, slash); + String[] enclosingNames = entry.getEnclosingNames(); addType(input, project, entry, ICElement.C_NAMESPACE, name, enclosingNames, monitor); } } @@ -97,59 +92,30 @@ public class IndexerTypesJob extends IndexerJob { throw new InterruptedException(); IEntryResult entry = typeEntries[i]; - char[] word = entry.getWord(); - int firstSlash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, 0); - char decodedType = word[firstSlash + 1]; - int type = getElementType(decodedType); - if (type != 0) { - firstSlash += 2; - int slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1); - String name = String.valueOf(CharOperation.subarray(word, firstSlash + 1, slash)); + + String name = entry.getName(); + switch (entry.getKind() ) { + case IIndex.TYPE_CLASS : + case IIndex.TYPE_STRUCT : + case IIndex.TYPE_TYPEDEF : + case IIndex.TYPE_ENUM : + case IIndex.TYPE_UNION : if (name.length() != 0) { // skip anonymous structs - String[] enclosingNames = getEnclosingNames(word, slash); - addType(input, project, entry, type, name, enclosingNames, monitor); + addType(input, project, entry, entry.getKind(), name, entry.getEnclosingNames(), monitor); } - } else if (decodedType == ICIndexStorageConstants.DERIVED_SUFFIX) { - firstSlash += 2; - int slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1); - String name = String.valueOf(CharOperation.subarray(word, firstSlash + 1, slash)); + break; + case IIndex.TYPE_DERIVED : if (name.length() != 0) { // skip anonymous structs - String[] enclosingNames = getEnclosingNames(word, slash); - addSuperTypeReference(input, project, entry, name, enclosingNames, monitor); + addSuperTypeReference(input, project, entry, name, entry.getEnclosingNames(), monitor); } + break; + default: + break; } } } } - private int getElementType(char decodedType) { - switch (decodedType) { - case ICIndexStorageConstants.CLASS_SUFFIX : - return ICElement.C_CLASS; - case ICIndexStorageConstants.STRUCT_SUFFIX : - return ICElement.C_STRUCT; - case ICIndexStorageConstants.TYPEDEF_SUFFIX : - return ICElement.C_TYPEDEF; - case ICIndexStorageConstants.ENUM_SUFFIX : - return ICElement.C_ENUMERATION; - case ICIndexStorageConstants.UNION_SUFFIX : - return ICElement.C_UNION; - } - return 0; - } - - private String[] getEnclosingNames(char[] word, int slash) { - String[] enclosingNames= null; - if (slash != -1 && slash + 1 < word.length) { - char[][] temp = CharOperation.splitOn('/', CharOperation.subarray(word, slash + 1, -1)); - enclosingNames= new String[temp.length]; - for (int i = 0; i < temp.length; i++) { - enclosingNames[i] = String.valueOf(temp[temp.length - i - 1]); - } - } - return enclosingNames; - } - private void addType(IndexInput input, IProject project, IEntryResult entry, int type, String name, String[] enclosingNames, IProgressMonitor monitor) throws InterruptedException, IOException { QualifiedTypeName qualifiedName = new QualifiedTypeName(name, enclosingNames); diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java index 20ed3b3cde2..98a44688b6c 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java @@ -22,7 +22,12 @@ public interface IEntryResult { /** * Returns the encoded word of this entry */ - public char[] getWord(); + + public int getMetaKind(); + public int getKind(); + public int getRefKind(); + public String getName(); + /** * Returns the offsets for this entry - offsets are in the same position * as the file references (ex. the first offset array belongs to the first @@ -42,5 +47,6 @@ public interface IEntryResult { * typeDecl/V/foo/namespace returns "foo" */ public String extractSimpleName(); + public String[] getEnclosingNames(); } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java index 7e78c3708db..603351d242d 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java @@ -13,19 +13,25 @@ package org.eclipse.cdt.internal.core.index.cindexstorage; 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.search.indexing.IndexManager; +import org.eclipse.cdt.internal.core.search.processing.JobManager; public class EntryResult implements IEntryResult { - private char[] word; private int[] fileRefs; private int[][] offsets; private int[][] offsetLengths; + private int meta_type; + private int kind; + private int reftype; + private String longname; + public EntryResult(char[] word, int[] refs, int[][] offsets, int[][] offsetLengths) { - this.word = word; this.fileRefs = refs; this.offsets = offsets; this.offsetLengths = offsetLengths; + decode(word); } public boolean equals(Object anObject){ @@ -34,7 +40,11 @@ public boolean equals(Object anObject){ } if ((anObject != null) && (anObject instanceof EntryResult)) { EntryResult anEntryResult = (EntryResult) anObject; - if (!CharOperation.equals(this.word, anEntryResult.word)) return false; + if( this.meta_type != anEntryResult.meta_type || + this.kind != anEntryResult.kind || + this.reftype != anEntryResult.reftype || + ! this.longname.equals(anEntryResult.longname)) + return false; int length; int[] refs, otherRefs; @@ -51,12 +61,13 @@ public int[] getFileReferences() { return fileRefs; } public char[] getWord() { - return word; + return Index.encodeEntry(meta_type, kind, reftype, longname); } public int hashCode(){ - return CharOperation.hashCode(word); + return CharOperation.hashCode(getWord()); } public String toString(){ + char [] word = getWord(); StringBuffer buffer = new StringBuffer(word.length * 2); buffer.append("EntryResult: word="); //$NON-NLS-1$ buffer.append(word); @@ -97,34 +108,78 @@ public int[][] getOffsetLengths() { * @see org.eclipse.cdt.internal.core.index.IEntryResult#extractSimpleName() */ public String extractSimpleName() { - return EntryResult.extractSimpleName(getWord()); -} -/* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.index.IEntryResult#extractSimpleName(char[]) - */ -public static String extractSimpleName(char[] word) { - String aWord = new String(word); - String longName=null; - - String typeDecl = Index.getDescriptionOf(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION); - String typeDef = Index.getDescriptionOf(IIndex.TYPE, IIndex.ANY, IIndex.DEFINITION); - String typeRef = Index.getDescriptionOf(IIndex.TYPE, IIndex.ANY, IIndex.REFERENCE); - - if (aWord.indexOf(typeDecl) == 0) { - longName = aWord.substring(aWord.indexOf(IndexerOutput.SEPARATOR, typeDecl.length())+1); - } else if (aWord.indexOf(typeRef) == 0) { - longName = aWord.substring(aWord.indexOf(IndexerOutput.SEPARATOR, typeRef.length())+1); - } else if (aWord.indexOf(typeDef) == 0) { - longName = aWord.substring(aWord.indexOf(IndexerOutput.SEPARATOR, typeDef.length())+1); - } else { - longName = aWord.substring(aWord.indexOf(IndexerOutput.SEPARATOR)+1); - } - - int sepPos=longName.indexOf(IndexerOutput.SEPARATOR); + int sepPos=longname.indexOf(IndexerOutput.SEPARATOR); if (sepPos>=0) - return aWord.substring(0, longName.indexOf(IndexerOutput.SEPARATOR)); + return longname.substring(0, sepPos); else - return longName; + return longname; +} + +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) { + 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) { + reftype = i; + pos += ICIndexStorageConstants.encodingTypes[i].length; + break; + } + } + + if (meta_type == IIndex.TYPE) { + for (int i = 1; i < Index.typeConstants.length; i++) { + if (word[pos] == Index.typeConstants[i]) { + kind = i; + pos++; + break; + } + } + // skip over separator + if (word[pos] != ICIndexStorageConstants.SEPARATOR) { + if (IndexManager.VERBOSE) + JobManager.verbose("Invalid encoding encoutered while decoding Entry Result"); //$NON-NLS-1$ + } + pos++; + } + else + kind = IIndex.ANY; + + longname = new String(word, pos, word.length - pos); +} + +public String[] getEnclosingNames() { + int slash=longname.indexOf(IndexerOutput.SEPARATOR); + + String[] enclosingNames= null; + if (slash != -1 && slash + 1 < longname.length()) { + char[][] temp = CharOperation.splitOn('/', CharOperation.subarray(longname.toCharArray(), slash + 1, -1)); + enclosingNames= new String[temp.length]; + for (int i = 0; i < temp.length; i++) { + enclosingNames[i] = String.valueOf(temp[temp.length - i - 1]); + } + } + return enclosingNames; +} +public int getMetaKind() { + return meta_type; +} +public int getKind() { + return kind; +} +public int getRefKind() { + return reftype; +} +public String getName() { + return longname; } } 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 c90ba46bfef..feae6f4213f 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 @@ -30,7 +30,6 @@ 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.IIndex; -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.io.IndexInput; @@ -159,12 +158,12 @@ public class ClassDeclarationPattern extends CSearchPattern { protected char[] decodedSimpleName; private char[][] decodedContainingTypes; - protected char decodedType; + protected int decodedType; protected boolean isForward; public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] fileRefs, int[][] offsets, int[][] offsetLengths,IndexInput input, ICSearchScope scope) throws IOException { - boolean isClass = decodedType == ICIndexStorageConstants.CLASS_SUFFIX; + boolean isClass = decodedType == IIndex.TYPE_CLASS; for (int i = 0, max = fileRefs.length; i < max; i++) { IndexedFileEntry file = input.getIndexedFile(fileRefs[i]); @@ -194,16 +193,22 @@ public class ClassDeclarationPattern extends CSearchPattern { match.parentName = ""; //$NON-NLS-1$ - if (decodedType == ICIndexStorageConstants.CLASS_SUFFIX){ + switch (decodedType) { + case IIndex.TYPE_CLASS: match.type=ICElement.C_CLASS; - } else if (decodedType == ICIndexStorageConstants.STRUCT_SUFFIX){ + break; + case IIndex.TYPE_STRUCT : match.type=ICElement.C_STRUCT; - } else if (decodedType == ICIndexStorageConstants.UNION_SUFFIX){ + break; + case IIndex.TYPE_UNION : match.type=ICElement.C_UNION; - } else if (decodedType == ICIndexStorageConstants.ENUM_SUFFIX) { - match.type=ICElement.C_ENUMERATION; - } else if (decodedType == ICIndexStorageConstants.TYPEDEF_SUFFIX){ + break; + case IIndex.TYPE_ENUM : + match.type=ICElement.C_ENUMERATION; + break; + case IIndex.TYPE_TYPEDEF : match.type=ICElement.C_TYPEDEF; + break; } IFile tempFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path)); @@ -226,26 +231,15 @@ public class ClassDeclarationPattern extends CSearchPattern { decodedContainingTypes = null; } - protected void decodeIndexEntry(IEntryResult entryResult) { - char[] word = entryResult.getWord(); - int size = word.length; - - int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 ); - - this.decodedType = word[ firstSlash + 1 ]; - firstSlash += 2; - - int slash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1 ); - - this.decodedSimpleName = CharOperation.subarray( word, firstSlash + 1, slash ); - - if( slash != -1 && slash+1 < size ){ - char [][] temp = CharOperation.splitOn('/', CharOperation.subarray( word, slash + 1, size )); - this.decodedContainingTypes = new char [ temp.length ][]; - for( int i = 0; i < temp.length; i++ ){ - this.decodedContainingTypes[ i ] = temp[ temp.length - i - 1 ]; - } - } + protected void decodeIndexEntry(IEntryResult entryResult) { + this.decodedType = entryResult.getKind(); + this.decodedSimpleName = entryResult.extractSimpleName().toCharArray(); + String []missmatch = entryResult.getEnclosingNames(); + if(missmatch != null) { + this.decodedContainingTypes = new char[missmatch.length][]; + for (int i = 0; i < missmatch.length; i++) + this.decodedContainingTypes[i] = missmatch[i].toCharArray(); + } } public char[] indexEntryPrefix() { @@ -262,30 +256,30 @@ public class ClassDeclarationPattern extends CSearchPattern { protected boolean matchIndexEntry() { //check type matches if( classKind == null ){ - if( searchFor == TYPEDEF && decodedType != ICIndexStorageConstants.TYPEDEF_SUFFIX ){ + if( searchFor == TYPEDEF && decodedType != IIndex.TYPE_TYPEDEF ){ return false; } //don't match variable entries - if( decodedType == ICIndexStorageConstants.VAR_SUFFIX ){ + if( decodedType == IIndex.TYPE_VAR ){ return false; } } else if( classKind == ASTClassKind.CLASS ) { - if( decodedType != ICIndexStorageConstants.CLASS_SUFFIX && - decodedType != ICIndexStorageConstants.FWD_CLASS_SUFFIX){ + if( decodedType != IIndex.TYPE_CLASS && + decodedType != IIndex.TYPE_FWD_CLASS){ return false; } } else if ( classKind == ASTClassKind.STRUCT ) { - if( decodedType != ICIndexStorageConstants.STRUCT_SUFFIX && - decodedType != ICIndexStorageConstants.FWD_STRUCT_SUFFIX){ + if( decodedType != IIndex.TYPE_STRUCT && + decodedType != IIndex.TYPE_FWD_STRUCT){ return false; } } else if ( classKind == ASTClassKind.UNION ) { - if( decodedType != ICIndexStorageConstants.UNION_SUFFIX && - decodedType != ICIndexStorageConstants.FWD_UNION_SUFFIX){ + if( decodedType != IIndex.TYPE_UNION && + decodedType != IIndex.TYPE_FWD_UNION){ return false; } } else if ( classKind == ASTClassKind.ENUM ) { - if( decodedType != ICIndexStorageConstants.ENUM_SUFFIX ) { + if( decodedType != IIndex.TYPE_ENUM ) { return false; } } 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 2c97ffa3bd4..e99be747f89 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,7 +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.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.cindexstorage.Index; /** @@ -58,7 +58,7 @@ public class DerivedTypesPattern extends ClassDeclarationPattern { } protected boolean matchIndexEntry() { - if( decodedType != ICIndexStorageConstants.DERIVED_SUFFIX ){ + if( decodedType != IIndex.TYPE_DERIVED ){ return false; } 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 fcf7baa97df..80dee0f3554 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 @@ -28,9 +28,7 @@ import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter; import org.eclipse.cdt.core.parser.ast.IASTVariable; 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.cindexstorage.Index; import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry; import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput; @@ -134,32 +132,13 @@ public class FieldDeclarationPattern extends CSearchPattern { decodedQualifications = null; } - protected void decodeIndexEntry(IEntryResult entryResult) { - char[] word = entryResult.getWord(); - int size = word.length; - int firstSlash = 0; - int slash = 0; - - if( searchFor == FIELD ){ - firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 ); - slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1); - } else if( searchFor == VAR ) { - 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( ICIndexStorageConstants.SEPARATOR, word, 0 ); - slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1); - } - - this.decodedSimpleName = CharOperation.subarray(word, firstSlash + 1, slash); - - if( slash != -1 && slash+1 < size ){ - char [][] temp = CharOperation.splitOn('/', CharOperation.subarray(word, slash+1, size)); - this.decodedQualifications = new char [ temp.length ][]; - for( int i = 0; i < temp.length; i++ ){ - this.decodedQualifications[ i ] = temp[ temp.length - i - 1 ]; - } + protected void decodeIndexEntry(IEntryResult entryResult) { + this.decodedSimpleName = entryResult.extractSimpleName().toCharArray(); + String []missmatch = entryResult.getEnclosingNames(); + if(missmatch != null) { + this.decodedQualifications = new char[missmatch.length][]; + for (int i = 0; i < missmatch.length; i++) + this.decodedQualifications[i] = missmatch[i].toCharArray(); } } 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 0347d6128ef..80f5eb0e289 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,7 +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.ICIndexStorageConstants; +import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.cindexstorage.Index; /** @@ -57,7 +57,7 @@ public class FriendPattern extends ClassDeclarationPattern { } protected boolean matchIndexEntry() { - if( decodedType != ICIndexStorageConstants.FRIEND_SUFFIX ){ + if( decodedType != IIndex.TYPE_FRIEND ){ return false; } 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 85d3aaf3b46..d2f1c7c4ffb 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,7 +18,6 @@ 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.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.io.IndexInput; @@ -42,11 +41,7 @@ public class IncludePattern extends CSearchPattern { * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#decodeIndexEntry(org.eclipse.cdt.internal.core.index.IEntryResult) */ protected void decodeIndexEntry(IEntryResult entryResult) { - char[] word = entryResult.getWord(); - - int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 ); - - this.decodedSimpleName = CharOperation.subarray(word, firstSlash + 1, -1); + this.decodedSimpleName = entryResult.extractSimpleName().toCharArray(); } /* (non-Javadoc) 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 ed15dba18d6..82eb22a5391 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 @@ -22,10 +22,8 @@ import org.eclipse.cdt.core.parser.ast.IASTMacro; import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement; 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.IIndex; -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.io.IndexInput; @@ -122,11 +120,7 @@ public class MacroDeclarationPattern extends CSearchPattern { * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#decodeIndexEntry(org.eclipse.cdt.internal.core.index.IEntryResult) */ protected void decodeIndexEntry(IEntryResult entryResult) { - char[] word = entryResult.getWord(); - - int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 ); - - this.decodedSimpleName = CharOperation.subarray(word, firstSlash + 1, -1); + this.decodedSimpleName = entryResult.extractSimpleName().toCharArray(); } /* (non-Javadoc) 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 93f07cd03fb..a18c6f39503 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 @@ -27,7 +27,6 @@ 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.IIndex; -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.io.IndexInput; @@ -144,21 +143,12 @@ public class MethodDeclarationPattern extends CSearchPattern { } protected void decodeIndexEntry(IEntryResult entryResult) { - char[] word = entryResult.getWord(); - int size = word.length; - - int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 ); - - int slash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1 ); - - this.decodedSimpleName = CharOperation.subarray(word, firstSlash + 1, slash); - - if( slash != -1 && slash+1 < size ){ - char [][] temp = CharOperation.splitOn('/', CharOperation.subarray(word, slash + 1, size)); - this.decodedQualifications = new char [ temp.length ][]; - for( int i = 0; i < temp.length; i++ ){ - this.decodedQualifications[ i ] = temp[ temp.length - i - 1 ]; - } + this.decodedSimpleName = entryResult.extractSimpleName().toCharArray(); + String []missmatch = entryResult.getEnclosingNames(); + if(missmatch != null) { + this.decodedQualifications = new char[missmatch.length][]; + for (int i = 0; i < missmatch.length; i++) + this.decodedQualifications[i] = missmatch[i].toCharArray(); } } 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 a8f2b93fe72..04a6d88adb9 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 @@ -21,10 +21,8 @@ import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate; import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition; 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.IIndex; -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.io.IndexInput; @@ -136,23 +134,13 @@ public class NamespaceDeclarationPattern extends CSearchPattern { * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#decodeIndexEntry(org.eclipse.cdt.internal.core.index.IEntryResult) */ protected void decodeIndexEntry(IEntryResult entryResult) { - char[] word = entryResult.getWord(); - int size = word.length; - - int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 ); - - int slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1); - - this.decodedSimpleName = CharOperation.subarray(word, firstSlash+1, slash); - - if( slash != -1 && slash+1 < size ){ - char [][] temp = CharOperation.splitOn('/', CharOperation.subarray(word, slash+1, size)); - this.decodedContainingTypes = new char [ temp.length ][]; - for( int i = 0; i < temp.length; i++ ){ - this.decodedContainingTypes[ i ] = temp[ temp.length - i - 1 ]; - } - } - + this.decodedSimpleName = entryResult.extractSimpleName().toCharArray(); + String []missmatch = entryResult.getEnclosingNames(); + if(missmatch != null) { + this.decodedContainingTypes = new char[missmatch.length][]; + for (int i = 0; i < missmatch.length; i++) + this.decodedContainingTypes[i] = missmatch[i].toCharArray(); + } } /* (non-Javadoc) 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 876f4564e37..de385938209 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 @@ -70,55 +70,30 @@ 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 = 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 = getStringDescription(IIndex.FUNCTION, IIndex.ANY, IIndex.REFERENCE); - public static final int ENTRY_FUNCTION_DECL = 5; - 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 = getStringDescription(IIndex.NAMESPACE, IIndex.ANY, IIndex.REFERENCE); - public static final int ENTRY_NAMESPACE_DECL = 9; - 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 = getStringDescription(IIndex.FIELD, IIndex.ANY, IIndex.REFERENCE); - public static final int ENTRY_FIELD_DECL = 11; - 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 = getStringDescription(IIndex.ENUMTOR, IIndex.ANY, IIndex.REFERENCE); - public static final int ENTRY_ENUMTOR_DECL = 13; - 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 = getStringDescription(IIndex.METHOD, IIndex.ANY, IIndex.REFERENCE); - public static final int ENTRY_METHOD_DECL = 15; - 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 = getStringDescription(IIndex.MACRO, IIndex.ANY, IIndex.DECLARATION); - public static final int ENTRY_INCLUDE_REF = 17; - 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = getStringDescription(IIndex.TYPE, IIndex.TYPE_FWD_UNION, IIndex.DECLARATION); + public static final int ENTRY_MACRO_DECL = 0; + public static final int ENTRY_FUNCTION_DECL = 1; + public static final int ENTRY_NAMESPACE_DECL = 2; + public static final int ENTRY_FUNCTION_REF = 3; + public static final int ENTRY_NAMESPACE_REF = 4; + public static final int ENTRY_FIELD_DECL = 5; + public static final int ENTRY_ENUMTOR_DECL = 6; + public static final int ENTRY_METHOD_DECL = 7; + public static final int ENTRY_FIELD_REF = 8; + public static final int ENTRY_ENUMTOR_REF = 9; + public static final int ENTRY_METHOD_REF = 10; + public static final int ENTRY_TYPE_REF = 11; + public static final int ENTRY_TYPE_DECL_TYPEDEF = 12; + public static final int ENTRY_TYPE_DECL_CLASS = 13; + public static final int ENTRY_TYPE_DECL_VAR = 14; + public static final int ENTRY_TYPE_DECL_STRUCT = 15; + public static final int ENTRY_TYPE_DECL_ENUM = 16; + public static final int ENTRY_TYPE_DECL_UNION = 17; + public static final int ENTRY_TYPE_DECL_DERIVED = 18; + public static final int ENTRY_TYPE_DECL_FRIEND = 19; + public static final int ENTRY_TYPE_DECL_FWD_CLASS = 20; + public static final int ENTRY_TYPE_DECL_FWD_STRUCT = 21; + public static final int ENTRY_TYPE_DECL_FWD_UNION = 22; + public static final int ENTRY_INCLUDE_REF = 23; private String fDialogSection; @@ -136,22 +111,37 @@ public class FilterIndexerViewDialog extends Dialog { private String projName = null; // this also determines the order that the buttons are displayed - private static final int[] fAllTypes = { // ENTRY_TYPE_DECL, - /*ENTRY_REF,*/ /*ENTRY_SUPER_REF,*/ ENTRY_MACRO_DECL, - ENTRY_FUNCTION_DECL, ENTRY_NAMESPACE_DECL, /*ENTRY_CONSTRUCTOR_DECL,*/ - ENTRY_FUNCTION_REF, ENTRY_NAMESPACE_REF, /*ENTRY_CONSTRUCTOR_REF,*/ - ENTRY_FIELD_DECL, ENTRY_ENUMTOR_DECL, ENTRY_METHOD_DECL, - ENTRY_FIELD_REF, ENTRY_ENUMTOR_REF, ENTRY_METHOD_REF, - ENTRY_TYPE_REF, ENTRY_TYPE_DECL_T, ENTRY_TYPE_DECL_C, - ENTRY_TYPE_DECL_V, ENTRY_TYPE_DECL_S, ENTRY_TYPE_DECL_E, - ENTRY_TYPE_DECL_U, ENTRY_TYPE_DECL_D, ENTRY_TYPE_DECL_F, - ENTRY_TYPE_DECL_G, ENTRY_TYPE_DECL_H, ENTRY_TYPE_DECL_I, - ENTRY_INCLUDE_REF }; + private static int[][] iAllTypes = { + {IIndex.MACRO, IIndex.ANY, IIndex.DECLARATION}, + {IIndex.FUNCTION, IIndex.ANY, IIndex.DECLARATION}, + {IIndex.NAMESPACE, IIndex.ANY, IIndex.DECLARATION}, + {IIndex.FUNCTION, IIndex.ANY, IIndex.REFERENCE}, + {IIndex.NAMESPACE, IIndex.ANY, IIndex.REFERENCE}, + {IIndex.FIELD, IIndex.ANY, IIndex.DECLARATION}, + {IIndex.ENUMTOR, IIndex.ANY, IIndex.DECLARATION}, + {IIndex.METHOD, IIndex.ANY, IIndex.DECLARATION}, + {IIndex.FIELD, IIndex.ANY, IIndex.REFERENCE}, + {IIndex.ENUMTOR, IIndex.ANY, IIndex.REFERENCE}, + {IIndex.METHOD, IIndex.ANY, IIndex.REFERENCE}, + {IIndex.TYPE, IIndex.ANY, IIndex.REFERENCE}, + {IIndex.TYPE, IIndex.TYPE_TYPEDEF, IIndex.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_VAR, IIndex.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_STRUCT, IIndex.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_ENUM, IIndex.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_UNION, IIndex.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_DERIVED, Index.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_FRIEND, IIndex.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_FWD_CLASS, IIndex.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_FWD_STRUCT, IIndex.DECLARATION}, + {IIndex.TYPE, IIndex.TYPE_FWD_UNION, IIndex.DECLARATION}, + {IIndex.INCLUDE, IIndex.ANY, IIndex.REFERENCE} + }; - private Set fKnownTypes = new HashSet(fAllTypes.length); + private Set fKnownTypes = new HashSet(iAllTypes.length); // keep track of the buttons to programmatically change their state - protected Button[] buttons = new Button[fAllTypes.length]; + protected Button[] buttons = new Button[iAllTypes.length]; protected Button allButton = null; protected Button typeButton = null; protected Button declButton = null; @@ -163,7 +153,7 @@ public class FilterIndexerViewDialog extends Dialog { this.root = root; this.projName = projName; - setVisibleTypes(fAllTypes); + setVisibleTypes(iAllTypes.length); setDialogSettings(DIALOG_SETTINGS); } @@ -238,118 +228,26 @@ public class FilterIndexerViewDialog extends Dialog { * @param types * Array of CElement types. */ - public void setVisibleTypes(int[] types) { + public void setVisibleTypes(int len) { fKnownTypes.clear(); - for (int i = 0; i < types.length; ++i) { - fKnownTypes.add(new Integer(types[i])); + for (int i = 0; i < len; ++i) { + fKnownTypes.add(new Integer(i)); } } /** * Creates a type filter checkbox. */ - private void createTypeCheckbox(Composite parent, Integer typeObject) { - String name; - int type = typeObject.intValue(); - switch (type) { - /* case ENTRY_REF: - name = ENTRY_REF_STRING; - break;*/ - case ENTRY_TYPE_REF: - name = ENTRY_TYPE_REF_STRING; - break; -// case ENTRY_TYPE_DECL: -// name = ENTRY_TYPE_DECL_STRING; -// break; - case ENTRY_FUNCTION_REF: - name = ENTRY_FUNCTION_REF_STRING; - break; - case ENTRY_FUNCTION_DECL: - name = ENTRY_FUNCTION_DECL_STRING; - break; -/* case ENTRY_CONSTRUCTOR_REF: - name = ENTRY_CONSTRUCTOR_REF_STRING; - break; - case ENTRY_CONSTRUCTOR_DECL: - name = ENTRY_CONSTRUCTOR_DECL_STRING; - break;*/ - case ENTRY_NAMESPACE_REF: - name = ENTRY_NAMESPACE_REF_STRING; - break; - case ENTRY_NAMESPACE_DECL: - name = ENTRY_NAMESPACE_DECL_STRING; - break; - case ENTRY_FIELD_REF: - name = ENTRY_FIELD_REF_STRING; - break; - case ENTRY_FIELD_DECL: - name = ENTRY_FIELD_DECL_STRING; - break; - case ENTRY_ENUMTOR_REF: - name = ENTRY_ENUMTOR_REF_STRING; - break; - case ENTRY_ENUMTOR_DECL: - name = ENTRY_ENUMTOR_DECL_STRING; - break; - case ENTRY_METHOD_REF: - name = ENTRY_METHOD_REF_STRING; - break; - case ENTRY_METHOD_DECL: - name = ENTRY_METHOD_DECL_STRING; - break; - case ENTRY_MACRO_DECL: - name = ENTRY_MACRO_DECL_STRING; - break; - case ENTRY_INCLUDE_REF: - name = ENTRY_INCLUDE_REF_STRING; - break; -/* case ENTRY_SUPER_REF: - name = ENTRY_SUPER_REF_STRING; - break;*/ - case ENTRY_TYPE_DECL_T: - name = ENTRY_TYPE_DECL_T_STRING; - break; - case ENTRY_TYPE_DECL_C: - name = ENTRY_TYPE_DECL_C_STRING; - break; - case ENTRY_TYPE_DECL_V: - name = ENTRY_TYPE_DECL_V_STRING; - break; - case ENTRY_TYPE_DECL_S: - name = ENTRY_TYPE_DECL_S_STRING; - break; - case ENTRY_TYPE_DECL_E: - name = ENTRY_TYPE_DECL_E_STRING; - break; - case ENTRY_TYPE_DECL_U: - name = ENTRY_TYPE_DECL_U_STRING; - break; - case ENTRY_TYPE_DECL_D: - name = ENTRY_TYPE_DECL_D_STRING; - break; - case ENTRY_TYPE_DECL_F: - name = ENTRY_TYPE_DECL_F_STRING; - break; - case ENTRY_TYPE_DECL_G: - name = ENTRY_TYPE_DECL_G_STRING; - break; - case ENTRY_TYPE_DECL_H: - name = ENTRY_TYPE_DECL_H_STRING; - break; - case ENTRY_TYPE_DECL_I: - name = ENTRY_TYPE_DECL_I_STRING; - break; - default: - return; - } - Image icon = getTypeIcon(type); + private void createTypeCheckbox(Composite parent, int type) { + String name = getStringDescription(iAllTypes[type][0], iAllTypes[type][1], iAllTypes[type][2]); + Image icon = IndexerViewPluginImages.get(type); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; composite.setLayout(layout); - final Integer fTypeObject = typeObject; + final Integer fTypeObject = new Integer(type); Button checkbox = new Button(composite, SWT.CHECK); checkbox.setFont(composite.getFont()); checkbox.setText(name); @@ -373,73 +271,7 @@ public class FilterIndexerViewDialog extends Dialog { buttons = (Button[])ArrayUtil.append(Button.class, buttons, checkbox); } - - private Image getTypeIcon(int type) - { - switch (type) - { -/* case ENTRY_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_REF);*/ - case ENTRY_TYPE_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_TYPE_REF); -// case ENTRY_TYPE_DECL: -// return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_TYPE_DECL); - case ENTRY_FUNCTION_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_FUNCTION_REF); - case ENTRY_FUNCTION_DECL: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_FUNCTION_DECL); -/* case ENTRY_CONSTRUCTOR_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_CONSTRUCTOR_REF); - case ENTRY_CONSTRUCTOR_DECL: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_CONSTRUCTOR_DECL);*/ - case ENTRY_NAMESPACE_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_NAMESPACE_REF); - case ENTRY_NAMESPACE_DECL: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_NAMESPACE_DECL); - case ENTRY_FIELD_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_FIELD_REF); - case ENTRY_FIELD_DECL: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_FIELD_DECL); - case ENTRY_ENUMTOR_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_ENUMTOR_REF); - case ENTRY_ENUMTOR_DECL: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_ENUMTOR_DECL); - case ENTRY_METHOD_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_METHOD_REF); - case ENTRY_METHOD_DECL: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_METHOD_DECL); - case ENTRY_MACRO_DECL: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_MACRO_DECL); - case ENTRY_INCLUDE_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_INCLUDE_REF); - /* case ENTRY_SUPER_REF: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_SUPER_REF);*/ - case ENTRY_TYPE_DECL_T: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_TYPEDEF); - case ENTRY_TYPE_DECL_C: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_CLASS); - case ENTRY_TYPE_DECL_V: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_VARIABLE); - case ENTRY_TYPE_DECL_S: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_STRUCT); - case ENTRY_TYPE_DECL_E: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_ENUM); - case ENTRY_TYPE_DECL_U: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_UNION); - case ENTRY_TYPE_DECL_D: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_DERIVED); - case ENTRY_TYPE_DECL_F: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_FRIEND); - case ENTRY_TYPE_DECL_G: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_FWD_CLASS); - case ENTRY_TYPE_DECL_H: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_FWD_STRUCT); - case ENTRY_TYPE_DECL_I: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_FWD_UNION); - default: - return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_WARNING); - } - } + /** * Creates an area to filter types. @@ -460,10 +292,8 @@ public class FilterIndexerViewDialog extends Dialog { // the for loop is here to guarantee we always // create the checkboxes in the same order - for (int i = 0; i < fAllTypes.length; ++i) { - Integer typeObject = new Integer(fAllTypes[i]); - if (fKnownTypes.contains(typeObject)) - createTypeCheckbox(upperRow, typeObject); + for (int i = 0; i < iAllTypes.length; ++i) { + createTypeCheckbox(upperRow, i); } } @@ -753,35 +583,11 @@ public class FilterIndexerViewDialog extends Dialog { section.put(SETTINGS_WIDTH, size.x); section.put(SETTINGS_HEIGHT, size.y); - //section.put(ENTRY_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_REF))); - section.put(ENTRY_TYPE_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_REF))); -// section.put(ENTRY_TYPE_DECL_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL))); - section.put(ENTRY_FUNCTION_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_FUNCTION_REF))); - section.put(ENTRY_FUNCTION_DECL_STRING, fFilterMatcher.contains(new Integer(ENTRY_FUNCTION_DECL))); - //section.put(ENTRY_CONSTRUCTOR_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_CONSTRUCTOR_REF))); - //section.put(ENTRY_CONSTRUCTOR_DECL_STRING, fFilterMatcher.contains(new Integer(ENTRY_CONSTRUCTOR_DECL))); - section.put(ENTRY_NAMESPACE_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_NAMESPACE_REF))); - section.put(ENTRY_NAMESPACE_DECL_STRING, fFilterMatcher.contains(new Integer(ENTRY_NAMESPACE_DECL))); - section.put(ENTRY_FIELD_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_FIELD_REF))); - section.put(ENTRY_FIELD_DECL_STRING, fFilterMatcher.contains(new Integer(ENTRY_FIELD_DECL))); - section.put(ENTRY_ENUMTOR_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_ENUMTOR_REF))); - section.put(ENTRY_ENUMTOR_DECL_STRING, fFilterMatcher.contains(new Integer(ENTRY_ENUMTOR_DECL))); - section.put(ENTRY_METHOD_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_METHOD_REF))); - section.put(ENTRY_METHOD_DECL_STRING, fFilterMatcher.contains(new Integer(ENTRY_METHOD_DECL))); - section.put(ENTRY_MACRO_DECL_STRING, fFilterMatcher.contains(new Integer(ENTRY_MACRO_DECL))); - section.put(ENTRY_INCLUDE_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_INCLUDE_REF))); - //section.put(ENTRY_SUPER_REF_STRING, fFilterMatcher.contains(new Integer(ENTRY_SUPER_REF))); - section.put(ENTRY_TYPE_DECL_T_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_T))); - section.put(ENTRY_TYPE_DECL_C_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_C))); - section.put(ENTRY_TYPE_DECL_V_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_V))); - section.put(ENTRY_TYPE_DECL_S_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_S))); - section.put(ENTRY_TYPE_DECL_E_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_E))); - section.put(ENTRY_TYPE_DECL_U_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_U))); - section.put(ENTRY_TYPE_DECL_D_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_D))); - section.put(ENTRY_TYPE_DECL_F_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_F))); - section.put(ENTRY_TYPE_DECL_G_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_G))); - section.put(ENTRY_TYPE_DECL_H_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_H))); - section.put(ENTRY_TYPE_DECL_I_STRING, fFilterMatcher.contains(new Integer(ENTRY_TYPE_DECL_I))); + for(int i = 0; i < iAllTypes.length; i++) { + section.put( + getStringDescription(iAllTypes[i][0], iAllTypes[i][1], iAllTypes[i][2]), + fFilterMatcher.contains(new Integer(i)) ); + } section.put(ALL_BUTTON, groupedButtonSelections.contains(new Integer(ALL_BUTTON_ID))); section.put(TYPE_BUTTON, groupedButtonSelections.contains(new Integer(TYPE_BUTTON_ID))); @@ -794,37 +600,12 @@ public class FilterIndexerViewDialog extends Dialog { /** * Stores default dialog settings. */ - protected void writeDefaultSettings(IDialogSettings section) { - //section.put(ENTRY_REF_STRING, true); - section.put(ENTRY_TYPE_REF_STRING, true); -// section.put(ENTRY_TYPE_DECL_STRING, true); - section.put(ENTRY_FUNCTION_REF_STRING, true); - section.put(ENTRY_FUNCTION_DECL_STRING, true); - //section.put(ENTRY_CONSTRUCTOR_REF_STRING, true); - //section.put(ENTRY_CONSTRUCTOR_DECL_STRING, true); - section.put(ENTRY_NAMESPACE_REF_STRING, true); - section.put(ENTRY_NAMESPACE_DECL_STRING, true); - section.put(ENTRY_FIELD_REF_STRING, true); - section.put(ENTRY_FIELD_DECL_STRING, true); - section.put(ENTRY_ENUMTOR_REF_STRING, true); - section.put(ENTRY_ENUMTOR_DECL_STRING, true); - section.put(ENTRY_METHOD_REF_STRING, true); - section.put(ENTRY_METHOD_DECL_STRING, true); - section.put(ENTRY_MACRO_DECL_STRING, true); - section.put(ENTRY_INCLUDE_REF_STRING, true); - //section.put(ENTRY_SUPER_REF_STRING, true); - section.put(ENTRY_TYPE_DECL_T_STRING, true); - section.put(ENTRY_TYPE_DECL_C_STRING, true); - section.put(ENTRY_TYPE_DECL_V_STRING, true); - section.put(ENTRY_TYPE_DECL_S_STRING, true); - section.put(ENTRY_TYPE_DECL_E_STRING, true); - section.put(ENTRY_TYPE_DECL_U_STRING, true); - section.put(ENTRY_TYPE_DECL_D_STRING, true); - section.put(ENTRY_TYPE_DECL_F_STRING, true); - section.put(ENTRY_TYPE_DECL_G_STRING, true); - section.put(ENTRY_TYPE_DECL_H_STRING, true); - section.put(ENTRY_TYPE_DECL_I_STRING, true); - + 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]); + section.put(description, true); + } + section.put(PAGE_SIZE, IndexerNodeParent.PAGE_SIZE); } @@ -877,152 +658,14 @@ public class FilterIndexerViewDialog extends Dialog { fSize = null; } - /* if (section.getBoolean(ENTRY_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - }*/ - if (section.getBoolean(ENTRY_TYPE_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); + for(int i = 0; i < iAllTypes.length; i++) { + if (section.getBoolean(getStringDescription(iAllTypes[i][0], iAllTypes[i][1], iAllTypes[i][2]))) { + Integer typeObject = new Integer(i); + if (fKnownTypes.contains(typeObject)) + fFilterMatcher.add(typeObject); + } } -// if (section.getBoolean(ENTRY_TYPE_DECL_STRING)) { -// Integer typeObject = new Integer(ENTRY_TYPE_DECL); -// if (fKnownTypes.contains(typeObject)) -// fFilterMatcher.add(typeObject); -// } - if (section.getBoolean(ENTRY_FUNCTION_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_FUNCTION_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_FUNCTION_DECL_STRING)) { - Integer typeObject = new Integer(ENTRY_FUNCTION_DECL); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - /* if (section.getBoolean(ENTRY_CONSTRUCTOR_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_CONSTRUCTOR_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_CONSTRUCTOR_DECL_STRING)) { - Integer typeObject = new Integer(ENTRY_CONSTRUCTOR_DECL); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - }*/ - if (section.getBoolean(ENTRY_NAMESPACE_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_NAMESPACE_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_NAMESPACE_DECL_STRING)) { - Integer typeObject = new Integer(ENTRY_NAMESPACE_DECL); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_FIELD_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_FIELD_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_FIELD_DECL_STRING)) { - Integer typeObject = new Integer(ENTRY_FIELD_DECL); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_ENUMTOR_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_ENUMTOR_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_ENUMTOR_DECL_STRING)) { - Integer typeObject = new Integer(ENTRY_ENUMTOR_DECL); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_METHOD_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_METHOD_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_METHOD_DECL_STRING)) { - Integer typeObject = new Integer(ENTRY_METHOD_DECL); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_MACRO_DECL_STRING)) { - Integer typeObject = new Integer(ENTRY_MACRO_DECL); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_INCLUDE_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_INCLUDE_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - /*if (section.getBoolean(ENTRY_SUPER_REF_STRING)) { - Integer typeObject = new Integer(ENTRY_SUPER_REF); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - }*/ - if (section.getBoolean(ENTRY_TYPE_DECL_T_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_T); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_C_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_C); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_V_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_V); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_S_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_S); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_E_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_E); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_U_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_U); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_D_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_D); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_F_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_F); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_G_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_G); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_H_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_H); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - if (section.getBoolean(ENTRY_TYPE_DECL_I_STRING)) { - Integer typeObject = new Integer(ENTRY_TYPE_DECL_I); - if (fKnownTypes.contains(typeObject)) - fFilterMatcher.add(typeObject); - } - + // get the grouped button selection status if (section.getBoolean(ALL_BUTTON)) { Integer typeObject = new Integer(ALL_BUTTON_ID); 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 763b24a783c..e30d6ca95a1 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 @@ -49,96 +49,8 @@ public class IndexerNodeLeaf implements IAdaptable { private void setNameAndFiltersFlag() { if (result == null) return; - String word = String.valueOf(result.getWord()); - String stringBeforeName = null; - - // set the filtersFlag - if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_REF_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_REF_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_FUNCTION_REF_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_FUNCTION_REF_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_FUNCTION_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_FUNCTION_DECL_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_FUNCTION_DECL_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_FUNCTION_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_NAMESPACE_REF_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_NAMESPACE_REF_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_NAMESPACE_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_NAMESPACE_DECL_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_NAMESPACE_DECL_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_NAMESPACE_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_FIELD_REF_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_FIELD_REF_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_FIELD_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_FIELD_DECL_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_FIELD_DECL_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_FIELD_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_ENUMTOR_REF_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_ENUMTOR_REF_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_ENUMTOR_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_ENUMTOR_DECL_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_ENUMTOR_DECL_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_ENUMTOR_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_METHOD_REF_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_METHOD_REF_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_METHOD_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_METHOD_DECL_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_METHOD_DECL_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_METHOD_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_MACRO_DECL_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_MACRO_DECL_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_MACRO_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_INCLUDE_REF_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_INCLUDE_REF_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_INCLUDE_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_T_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_T_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_T; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_C_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_C_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_C; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_V_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_V_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_V; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_S_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_S_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_S; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_E_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_E_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_E; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_U_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_U_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_U; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_D_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_D_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_D; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_F_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_F_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_F; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_G_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_G_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_G; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_H_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_H_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_H; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_I_STRING)) { - stringBeforeName = FilterIndexerViewDialog.ENTRY_TYPE_DECL_I_STRING; - filtersType = FilterIndexerViewDialog.ENTRY_TYPE_DECL_I; - } - - // set the name - if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_REF_STRING)) { // if the name is after an additional field then reset stringBeforeName - int start = word.indexOf(stringBeforeName) + stringBeforeName.length(); - stringBeforeName = stringBeforeName + word.substring(start, start + 2); - } - if (stringBeforeName == null) { - name = word; - return; - } - - name = word.substring(word.indexOf(stringBeforeName) + stringBeforeName.length()); - + filtersType = IndexerView.getKey(result.getMetaKind(), result.getKind(), result.getRefKind()); + name = result.getName(); } public IndexerNodeParent getParent() { @@ -227,7 +139,7 @@ public class IndexerNodeLeaf implements IAdaptable { } // add a word descriptor - text = new TextPropertyDescriptor(new TextDescriptorId(IENTRYRESULT_GETWORD__, String.valueOf(entryResult.getWord())), IENTRYRESULT_GETWORD__); + text = new TextPropertyDescriptor(new TextDescriptorId(IENTRYRESULT_GETWORD__, String.valueOf(entryResult.toString())), IENTRYRESULT_GETWORD__); text.setCategory(IENTRYRESULT); descriptors = (IPropertyDescriptor[])ArrayUtil.append(IPropertyDescriptor.class, descriptors, text); 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 93b9298f0b0..be21d2b14ae 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 @@ -165,7 +165,7 @@ public class IndexerNodeParent extends IndexerNodeLeaf { if (sortName) { mid= list[(left + right) / 2].getName().toUpperCase(); } else { - mid= new String(list[(left + right) / 2].getResult().getWord()).toUpperCase(); + mid= new String(list[(left + right) / 2].getResult().getName()).toUpperCase(); } do { String compareL = null; @@ -174,15 +174,15 @@ public class IndexerNodeParent extends IndexerNodeLeaf { compareL = list[left].getName().toUpperCase(); compareR = list[right].getName().toUpperCase(); } else { - compareL = new String(list[left].getResult().getWord()).toUpperCase(); - compareR = new String(list[right].getResult().getWord()).toUpperCase(); + compareL = new String(list[left].getResult().getName()).toUpperCase(); + compareR = new String(list[right].getResult().getName()).toUpperCase(); } while (compareL.compareTo(mid) < 0) { left++; if (sortName) { compareL = list[left].getName().toUpperCase(); } else { - compareL = new String(list[left].getResult().getWord()).toUpperCase(); + compareL = new String(list[left].getResult().getName()).toUpperCase(); } } while (mid.compareTo(compareR) < 0) { @@ -190,7 +190,7 @@ public class IndexerNodeParent extends IndexerNodeLeaf { if (sortName) { compareR = list[right].getName().toUpperCase(); } else { - compareR = new String(list[right].getResult().getWord()).toUpperCase(); + compareR = new String(list[right].getResult().getName()).toUpperCase(); } } if (left <= right) { 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 882fc2b36e8..3597977f832 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 @@ -297,71 +297,14 @@ public class IndexerView extends ViewPart { } public Image getImage(Object obj) { - String imageKey = IndexerViewPluginImages.IMG_WARNING; - if (obj instanceof IndexerNodeLeaf) { - String word = String.valueOf(((IndexerNodeLeaf)obj).getResult().getWord()); - - /*if (word.startsWith(FilterIndexerViewDialog.ENTRY_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_REF; - } else*/ if (word.startsWith(FilterIndexerViewDialog.ENTRY_FUNCTION_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_FUNCTION_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_FUNCTION_DECL_STRING)) { - imageKey = IndexerViewPluginImages.IMG_FUNCTION_DECL; - } /*else if (word.startsWith(FilterIndexerViewDialog.ENTRY_CONSTRUCTOR_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_CONSTRUCTOR_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_CONSTRUCTOR_DECL_STRING)) { - imageKey = IndexerViewPluginImages.IMG_CONSTRUCTOR_DECL; - }*/ else if (word.startsWith(FilterIndexerViewDialog.ENTRY_NAMESPACE_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_NAMESPACE_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_NAMESPACE_DECL_STRING)) { - imageKey = IndexerViewPluginImages.IMG_NAMESPACE_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_FIELD_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_FIELD_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_FIELD_DECL_STRING)) { - imageKey = IndexerViewPluginImages.IMG_FIELD_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_ENUMTOR_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_ENUMTOR_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_ENUMTOR_DECL_STRING)) { - imageKey = IndexerViewPluginImages.IMG_ENUMTOR_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_METHOD_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_METHOD_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_METHOD_DECL_STRING)) { - imageKey = IndexerViewPluginImages.IMG_METHOD_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_MACRO_DECL_STRING)) { - imageKey = IndexerViewPluginImages.IMG_MACRO_DECL; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_INCLUDE_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_INCLUDE_REF; - }/* else if (word.startsWith(FilterIndexerViewDialog.ENTRY_SUPER_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_SUPER_REF; - }*/ else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_T_STRING)) { - imageKey = IndexerViewPluginImages.IMG_TYPEDEF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_C_STRING)) { - imageKey = IndexerViewPluginImages.IMG_CLASS; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_V_STRING)) { - imageKey = IndexerViewPluginImages.IMG_VARIABLE; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_S_STRING)) { - imageKey = IndexerViewPluginImages.IMG_STRUCT; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_E_STRING)) { - imageKey = IndexerViewPluginImages.IMG_ENUM; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_U_STRING)) { - imageKey = IndexerViewPluginImages.IMG_UNION; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_REF_STRING)) { - imageKey = IndexerViewPluginImages.IMG_TYPE_REF; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_D_STRING)) { - imageKey = IndexerViewPluginImages.IMG_DERIVED; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_F_STRING)) { - imageKey = IndexerViewPluginImages.IMG_FRIEND; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_G_STRING)) { - imageKey = IndexerViewPluginImages.IMG_FWD_CLASS; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_H_STRING)) { - imageKey = IndexerViewPluginImages.IMG_FWD_STRUCT; - } else if (word.startsWith(FilterIndexerViewDialog.ENTRY_TYPE_DECL_I_STRING)) { - imageKey = IndexerViewPluginImages.IMG_FWD_UNION; - } + IEntryResult result = ((IndexerNodeLeaf)obj).getResult(); + int index = getKey(result.getMetaKind(), result.getKind(), result.getRefKind()); + if (index > -1) + return IndexerViewPluginImages.get(index); } - return IndexerViewPluginImages.get(imageKey); + return IndexerViewPluginImages.get(IndexerViewPluginImages.IMG_WARNING); } } @@ -625,4 +568,47 @@ public class IndexerView extends ViewPart { } } } + + public static int getKey(int meta, int kind, int ref) { + switch (ref) { + case IIndex.REFERENCE : + switch (meta) { + case IIndex.TYPE : return FilterIndexerViewDialog.ENTRY_TYPE_REF; + case IIndex.FUNCTION : return FilterIndexerViewDialog.ENTRY_FUNCTION_REF; + case IIndex.METHOD : return FilterIndexerViewDialog.ENTRY_METHOD_REF; + case IIndex.FIELD : return FilterIndexerViewDialog.ENTRY_FIELD_REF; + case IIndex.MACRO : return -1; + case IIndex.NAMESPACE : return FilterIndexerViewDialog.ENTRY_NAMESPACE_REF; + case IIndex.ENUMTOR : return FilterIndexerViewDialog.ENTRY_ENUMTOR_REF; + case IIndex.INCLUDE : return FilterIndexerViewDialog.ENTRY_INCLUDE_REF; + } + break; + case IIndex.DECLARATION : + switch (meta) { + case IIndex.TYPE : + switch (kind) { + case IIndex.TYPE_CLASS : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_CLASS; + case IIndex.TYPE_STRUCT : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_STRUCT; + case IIndex.TYPE_UNION : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_UNION; + case IIndex.TYPE_ENUM : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_ENUM; + case IIndex.TYPE_VAR : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_VAR; + case IIndex.TYPE_TYPEDEF : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_TYPEDEF; + case IIndex.TYPE_DERIVED : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_DERIVED; + case IIndex.TYPE_FRIEND : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_FRIEND; + case IIndex.TYPE_FWD_CLASS : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_FWD_CLASS; + case IIndex.TYPE_FWD_STRUCT : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_FWD_STRUCT; + case IIndex.TYPE_FWD_UNION : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_FWD_UNION; + } + case IIndex.FUNCTION : return FilterIndexerViewDialog.ENTRY_FUNCTION_DECL; + case IIndex.METHOD : return FilterIndexerViewDialog.ENTRY_METHOD_DECL; + case IIndex.FIELD : return FilterIndexerViewDialog.ENTRY_FIELD_DECL; + case IIndex.MACRO : return FilterIndexerViewDialog.ENTRY_MACRO_DECL; + case IIndex.NAMESPACE : return FilterIndexerViewDialog.ENTRY_NAMESPACE_DECL; + case IIndex.ENUMTOR : return FilterIndexerViewDialog.ENTRY_ENUMTOR_DECL; + case IIndex.INCLUDE : return -1; + } + break; + } + return 0; + } } diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerViewPluginImages.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerViewPluginImages.java index 922fd9faa8e..4efe6e72398 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerViewPluginImages.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/IndexerView/IndexerViewPluginImages.java @@ -48,41 +48,42 @@ public class IndexerViewPluginImages { } catch (MalformedURLException e) {} } public static final String PLUGIN_ID = "org.eclipse.cdt.testplugin.CTestPlugin"; //$NON-NLS-1$ - private static final String NAME_PREFIX= PLUGIN_ID + '.'; + public static final String NAME_PREFIX= PLUGIN_ID + '.'; private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length(); public static final String ICON_PREFIX= "indexer_view/"; //$NON-NLS-1$ + public static final String [] icon_images = { + "macroDecl_obj.gif", + "function_obj.gif", + "namespace_obj.gif", + "function_ref_obj.gif", + "namespace_ref_obj.gif", + "field_obj.gif", + "enumerator_obj.gif", + "method_public_obj.gif", + "field_ref_obj.gif", + "enumerator_ref_obj.gif", + "method_public_ref_obj.gif", + "typedecl_ref_obj.gif", + "typedef_obj.gif", + "class_obj.gif", + "variable_obj.gif", + "struct_obj.gif", + "enum_obj.gif", + "union_obj.gif", + "derived.gif", + "friend.gif", + "fwd_class.gif", + "fwd_struct.gif", + "fwd_union.gif", + "include_obj.gif" + }; + public static final String IMG_REF= NAME_PREFIX + "ref_obj.gif"; //$NON-NLS-1$ - public static final String IMG_TYPE_REF= NAME_PREFIX + "typedecl_ref_obj.gif"; //$NON-NLS-1$ public static final String IMG_TYPE_DECL= NAME_PREFIX + "typedecl_obj.gif"; //$NON-NLS-1$ - public static final String IMG_FUNCTION_REF= NAME_PREFIX + "function_ref_obj.gif"; //$NON-NLS-1$ - public static final String IMG_FUNCTION_DECL= NAME_PREFIX + "function_obj.gif"; //$NON-NLS-1$ - public static final String IMG_CONSTRUCTOR_REF= NAME_PREFIX + "constructor_ref_obj.gif"; //$NON-NLS-1$ - public static final String IMG_CONSTRUCTOR_DECL= NAME_PREFIX + "constructor_obj.gif"; //$NON-NLS-1$ - public static final String IMG_NAMESPACE_REF= NAME_PREFIX + "namespace_ref_obj.gif"; //$NON-NLS-1$ - public static final String IMG_NAMESPACE_DECL= NAME_PREFIX + "namespace_obj.gif"; //$NON-NLS-1$ - public static final String IMG_FIELD_REF= NAME_PREFIX + "field_ref_obj.gif"; //$NON-NLS-1$ - public static final String IMG_FIELD_DECL= NAME_PREFIX + "field_obj.gif"; //$NON-NLS-1$ - public static final String IMG_ENUMTOR_REF= NAME_PREFIX + "enumerator_ref_obj.gif"; //$NON-NLS-1$ - public static final String IMG_ENUMTOR_DECL= NAME_PREFIX + "enumerator_obj.gif"; //$NON-NLS-1$ - public static final String IMG_METHOD_REF= NAME_PREFIX + "method_public_ref_obj.gif"; //$NON-NLS-1$ - public static final String IMG_METHOD_DECL= NAME_PREFIX + "method_public_obj.gif"; //$NON-NLS-1$ - public static final String IMG_MACRO_DECL= NAME_PREFIX + "macroDecl_obj.gif"; //$NON-NLS-1$ - public static final String IMG_INCLUDE_REF= NAME_PREFIX + "include_obj.gif"; //$NON-NLS-1$ public static final String IMG_SUPER_REF= NAME_PREFIX + "super_co.gif"; //$NON-NLS-1$ - public static final String IMG_VARIABLE= NAME_PREFIX + "variable_obj.gif"; //$NON-NLS-1$ - public static final String IMG_CLASS= NAME_PREFIX + "class_obj.gif"; //$NON-NLS-1$ - public static final String IMG_ENUM= NAME_PREFIX + "enum_obj.gif"; //$NON-NLS-1$ public static final String IMG_BACK= NAME_PREFIX + "ngback.gif"; //$NON-NLS-1$ public static final String IMG_NEXT= NAME_PREFIX + "ngnext.gif"; //$NON-NLS-1$ - public static final String IMG_STRUCT= NAME_PREFIX + "struct_obj.gif"; //$NON-NLS-1$ - public static final String IMG_TYPEDEF= NAME_PREFIX + "typedef_obj.gif"; //$NON-NLS-1$ - public static final String IMG_UNION= NAME_PREFIX + "union_obj.gif"; //$NON-NLS-1$ - public static final String IMG_DERIVED= NAME_PREFIX + "derived.gif"; //$NON-NLS-1$ - public static final String IMG_FRIEND= NAME_PREFIX + "friend.gif"; //$NON-NLS-1$ - public static final String IMG_FWD_CLASS= NAME_PREFIX + "fwd_class.gif"; //$NON-NLS-1$ - public static final String IMG_FWD_STRUCT= NAME_PREFIX + "fwd_struct.gif"; //$NON-NLS-1$ - public static final String IMG_FWD_UNION= NAME_PREFIX + "fwd_union.gif"; //$NON-NLS-1$ public static final String IMG_WARNING= NAME_PREFIX + "warning_icon.gif"; //$NON-NLS-1$ public static final String IMG_FILTER_BUTTON= NAME_PREFIX + "filterbutton.gif"; //$NON-NLS-1$ public static final String IMG_STATS= NAME_PREFIX + "stats.gif"; //$NON-NLS-1$ @@ -97,43 +98,23 @@ public class IndexerViewPluginImages { public static final String IMG_DISPLAY_FULL_NAME= NAME_PREFIX + "display_full_name.gif"; //$NON-NLS-1$ public static final ImageDescriptor DESC_REF= createManaged(ICON_PREFIX, IMG_REF); - public static final ImageDescriptor DESC_TYPE_REF= createManaged(ICON_PREFIX, IMG_TYPE_REF); - public static final ImageDescriptor DESC_TYPE_DECL= createManaged(ICON_PREFIX, IMG_TYPE_DECL); - public static final ImageDescriptor DESC_FUNCTION_REF= createManaged(ICON_PREFIX, IMG_FUNCTION_REF); - public static final ImageDescriptor DESC_FUNCTION_DECL= createManaged(ICON_PREFIX, IMG_FUNCTION_DECL); - public static final ImageDescriptor DESC_CONSTRUCTOR_REF= createManaged(ICON_PREFIX, IMG_CONSTRUCTOR_REF); - public static final ImageDescriptor DESC_CONSTRUCTOR_DECL= createManaged(ICON_PREFIX, IMG_CONSTRUCTOR_DECL); - public static final ImageDescriptor DESC_NAMESPACE_REF= createManaged(ICON_PREFIX, IMG_NAMESPACE_REF); - public static final ImageDescriptor DESC_NAMESPACE_DECL= createManaged(ICON_PREFIX, IMG_NAMESPACE_DECL); - public static final ImageDescriptor DESC_FIELD_REF= createManaged(ICON_PREFIX, IMG_FIELD_REF); - public static final ImageDescriptor DESC_FIELD_DECL= createManaged(ICON_PREFIX, IMG_FIELD_DECL); - public static final ImageDescriptor DESC_ENUMTOR_REF= createManaged(ICON_PREFIX, IMG_ENUMTOR_REF); - public static final ImageDescriptor DESC_ENUMTOR_DECL= createManaged(ICON_PREFIX, IMG_ENUMTOR_DECL); - public static final ImageDescriptor DESC_METHOD_REF= createManaged(ICON_PREFIX, IMG_METHOD_REF); - public static final ImageDescriptor DESC_METHOD_DECL= createManaged(ICON_PREFIX, IMG_METHOD_DECL); - public static final ImageDescriptor DESC_MACRO_DECL= createManaged(ICON_PREFIX, IMG_MACRO_DECL); - public static final ImageDescriptor DESC_INCLUDE_REF= createManaged(ICON_PREFIX, IMG_INCLUDE_REF); - public static final ImageDescriptor DESC_SUPER_REF= createManaged(ICON_PREFIX, IMG_SUPER_REF); - public static final ImageDescriptor DESC_VARIABLE= createManaged(ICON_PREFIX, IMG_VARIABLE); - public static final ImageDescriptor DESC_CLASS= createManaged(ICON_PREFIX, IMG_CLASS); - public static final ImageDescriptor DESC_ENUM= createManaged(ICON_PREFIX, IMG_ENUM); + static { + for (int i = 0 ; i < icon_images.length; i++) { + createManaged(ICON_PREFIX, NAME_PREFIX + icon_images[i]); + } + createManaged(ICON_PREFIX, IMG_TYPE_DECL); + createManaged(ICON_PREFIX, IMG_SUPER_REF); + createManaged(ICON_PREFIX, IMG_WARNING); + createManaged(ICON_PREFIX, IMG_GROUPED_ALL); + createManaged(ICON_PREFIX, IMG_GROUPED_DECL); + createManaged(ICON_PREFIX, IMG_GROUPED_REF); + createManaged(ICON_PREFIX, IMG_GROUPED_TYPE); + } + public static final ImageDescriptor DESC_BACK= createManaged(ICON_PREFIX, IMG_BACK); public static final ImageDescriptor DESC_NEXT= createManaged(ICON_PREFIX, IMG_NEXT); - public static final ImageDescriptor DESC_STRUCT= createManaged(ICON_PREFIX, IMG_STRUCT); - public static final ImageDescriptor DESC_TYPEDEF= createManaged(ICON_PREFIX, IMG_TYPEDEF); - public static final ImageDescriptor DESC_UNION= createManaged(ICON_PREFIX, IMG_UNION); - public static final ImageDescriptor DESC_DERIVED= createManaged(ICON_PREFIX, IMG_DERIVED); - public static final ImageDescriptor DESC_FRIEND= createManaged(ICON_PREFIX, IMG_FRIEND); - public static final ImageDescriptor DESC_FWD_CLASS= createManaged(ICON_PREFIX, IMG_FWD_CLASS); - public static final ImageDescriptor DESC_FWD_STRUCT= createManaged(ICON_PREFIX, IMG_FWD_STRUCT); - public static final ImageDescriptor DESC_FWD_UNION= createManaged(ICON_PREFIX, IMG_FWD_UNION); - public static final ImageDescriptor DESC_WARNING= createManaged(ICON_PREFIX, IMG_WARNING); public static final ImageDescriptor DESC_FILTER_BUTTON= createManaged(ICON_PREFIX, IMG_FILTER_BUTTON); public static final ImageDescriptor DESC_STATS= createManaged(ICON_PREFIX, IMG_STATS); - public static final ImageDescriptor DESC_GROUPED_ALL= createManaged(ICON_PREFIX, IMG_GROUPED_ALL); - public static final ImageDescriptor DESC_GROUPED_DECL= createManaged(ICON_PREFIX, IMG_GROUPED_DECL); - public static final ImageDescriptor DESC_GROUPED_REF= createManaged(ICON_PREFIX, IMG_GROUPED_REF); - public static final ImageDescriptor DESC_GROUPED_TYPE= createManaged(ICON_PREFIX, IMG_GROUPED_TYPE); public static final ImageDescriptor DESC_SEARCH_LOCATION= createManaged(ICON_PREFIX, IMG_SEARCH_LOCATION); public static final ImageDescriptor DESC_SORT= createManaged(ICON_PREFIX, IMG_SORT); public static final ImageDescriptor DESC_SORTED= createManaged(ICON_PREFIX, IMG_SORTED); @@ -164,6 +145,9 @@ public class IndexerViewPluginImages { public static Image get(String key) { return imageRegistry.get(key); } + public static Image get(int key) { + return imageRegistry.get(NAME_PREFIX + icon_images[key]); + } }