public CompletionOnKeywordModuleInfo(char[] token, long pos, char[][] possibleKeywords) { super(new ImportReference(new char[][] {token}, new long[] {pos}, false, 0), null); // dummy this.token = token; this.possibleKeywords = possibleKeywords; this.sourceStart = (int) (pos>>>32) ; this.sourceEnd = (int) (pos & 0x00000000FFFFFFFFL); }
public boolean isStatic() { return this.reference != null && this.reference.isStatic(); } public char[] readableName() {
/** * Searches a type declared in imports. * * @param typeName * Expected type name. * @param imports * Search the type in imports. * @return qualified name of the expected type. */ static String searchType(String typeName, ImportReference[] imports) { if (typeName == null || imports == null) { return null; } for (ImportReference anImport : imports) { final String importType = CharOperation.charToString(anImport.getImportName()[anImport.getImportName().length - 1]); if (typeName.equals(importType)) { return CharOperation.toString(anImport.getImportName()); } } return null; }
if (CharOperation.equals(anImport.getImportName()[anImport.getImportName().length - 1], expectedName)) { if (anImport.isStatic()) { int indexDeclaring = 2; if ((anImport.bits & ASTNode.OnDemand) != 0) { char[][] packageName = CharOperation.subarray(anImport.getImportName(), 0, anImport.getImportName().length - indexDeclaring); char[][] className = CharOperation.subarray(anImport.getImportName(), anImport.getImportName().length - indexDeclaring, anImport.getImportName().length - (indexDeclaring - 1)); PackageBinding aPackage; try { char[][] chars = CharOperation.subarray(anImport.getImportName(), 0, anImport.getImportName().length - 1);
public StringBuffer print(int indent, StringBuffer output) { if (this.currentPackage != null) { printIndent(indent, output).append("package "); //$NON-NLS-1$ this.currentPackage.print(0, output, false).append(";\n"); //$NON-NLS-1$ } if (this.imports != null) for (int i = 0; i < this.imports.length; i++) { printIndent(indent, output).append("import "); //$NON-NLS-1$ ImportReference currentImport = this.imports[i]; if (currentImport.isStatic()) { output.append("static "); //$NON-NLS-1$ } currentImport.print(0, output).append(";\n"); //$NON-NLS-1$ } if (this.types != null) { for (int i = 0; i < this.types.length; i++) { this.types[i].print(indent, output).append("\n"); //$NON-NLS-1$ } } return output; }
@Override public String toString(int tab) { return tabString(tab) + "Recovered import: " + this.importReference.toString(); //$NON-NLS-1$ } public ImportReference updatedImportReference(){
@Override public StringBuffer print(int indent, StringBuffer output) { return print(indent, output, true); }
public StringBuffer print(int indent, StringBuffer output) { if (this.currentPackage != null) { printIndent(indent, output).append("package "); //$NON-NLS-1$ this.currentPackage.print(0, output, false).append(";\n"); //$NON-NLS-1$ } if (this.imports != null) for (int i = 0; i < this.imports.length; i++) { printIndent(indent, output).append("import "); //$NON-NLS-1$ ImportReference currentImport = this.imports[i]; if (currentImport.isStatic()) { output.append("static "); //$NON-NLS-1$ } currentImport.print(0, output).append(";\n"); //$NON-NLS-1$ } if (this.types != null) { for (int i = 0; i < this.types.length; i++) { this.types[i].print(indent, output).append("\n"); //$NON-NLS-1$ } } return output; }
public String toString(int tab) { return tabString(tab) + "Recovered import: " + this.importReference.toString(); //$NON-NLS-1$ } public ImportReference updatedImportReference(){
public StringBuffer print(int indent, StringBuffer output) { return print(indent, output, true); }
public StringBuffer print(int indent, StringBuffer output) { if (this.currentPackage != null) { printIndent(indent, output).append("package "); //$NON-NLS-1$ this.currentPackage.print(0, output, false).append(";\n"); //$NON-NLS-1$ } if (this.imports != null) for (int i = 0; i < this.imports.length; i++) { printIndent(indent, output).append("import "); //$NON-NLS-1$ ImportReference currentImport = this.imports[i]; if (currentImport.isStatic()) { output.append("static "); //$NON-NLS-1$ } currentImport.print(0, output).append(";\n"); //$NON-NLS-1$ } if (this.types != null) { for (int i = 0; i < this.types.length; i++) { this.types[i].print(indent, output).append("\n"); //$NON-NLS-1$ } } return output; }
public CompletionOnKeywordModuleInfo(char[] token, long pos, char[][] possibleKeywords) { super(new ImportReference(new char[][] {token}, new long[] {pos}, false, 0), null); // dummy this.token = token; this.possibleKeywords = possibleKeywords; this.sourceStart = (int) (pos>>>32) ; this.sourceEnd = (int) (pos & 0x00000000FFFFFFFFL); }
public boolean isStatic() { return this.reference != null && this.reference.isStatic(); } @Override
/** * @see ISourceElementRequestor#acceptPackage(ImportReference) */ @Override public void acceptPackage(ImportReference importReference) { this.packageName = CharOperation.concatWith(importReference.getImportName(), '.'); } /**
public String toString(int tab) { return tabString(tab) + "Recovered import: " + this.importReference.toString(); //$NON-NLS-1$ } public ImportReference updatedImportReference(){
public StringBuffer print(int indent, StringBuffer output) { return print(indent, output, true); }
public StringBuffer print(int indent, StringBuffer output) { if (this.currentPackage != null) { printIndent(indent, output).append("package "); //$NON-NLS-1$ this.currentPackage.print(0, output, false).append(";\n"); //$NON-NLS-1$ } if (this.imports != null) for (int i = 0; i < this.imports.length; i++) { printIndent(indent, output).append("import "); //$NON-NLS-1$ ImportReference currentImport = this.imports[i]; if (currentImport.isStatic()) { output.append("static "); //$NON-NLS-1$ } currentImport.print(0, output).append(";\n"); //$NON-NLS-1$ } if (this.types != null) { for (int i = 0; i < this.types.length; i++) { this.types[i].print(indent, output).append("\n"); //$NON-NLS-1$ } } return output; }
protected ImportReference newImportReference(char[][] tokens, long[] positions, boolean onDemand, int mod) { return new ImportReference(tokens, positions, onDemand, mod); } protected QualifiedNameReference newQualifiedNameReference(char[][] tokens, long[] positions, int sourceStart, int sourceEnd) {
public boolean isStatic() { return this.reference != null && this.reference.isStatic(); } public char[] readableName() {