protected static String getFqn(String packageName, ICompilationUnit cu) { StringBuilder fqnBuilder = new StringBuilder(); if (StringUtils.isNotBlank(packageName)) { fqnBuilder.append(packageName); fqnBuilder.append('.'); } fqnBuilder.append(cu.getMainTypeName()); return fqnBuilder.toString(); }
@Override public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { if (!CharOperation.equals(sourceUnit.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME)) { // do not accept package-info.java as a type for completion engine // because it contains no extra info that will help in completion // https://bugs.eclipse.org/bugs/show_bug.cgi?id=343865 // Required after the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=337868 // because now we get a type corresponding to the package-info.java from the java model. super.accept(sourceUnit, accessRestriction); } }
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { if (!CharOperation.equals(sourceUnit.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME)) { // do not accept package-info.java as a type for completion engine // because it contains no extra info that will help in completion // https://bugs.eclipse.org/bugs/show_bug.cgi?id=343865 // Required after the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=337868 // because now we get a type corresponding to the package-info.java from the java model. super.accept(sourceUnit, accessRestriction); } }
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { if (!CharOperation.equals(sourceUnit.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME)) { // do not accept package-info.java as a type for completion engine // because it contains no extra info that will help in completion // https://bugs.eclipse.org/bugs/show_bug.cgi?id=343865 // Required after the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=337868 // because now we get a type corresponding to the package-info.java from the java model. super.accept(sourceUnit, accessRestriction); } }
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { if (!CharOperation.equals(sourceUnit.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME)) { // do not accept package-info.java as a type for completion engine // because it contains no extra info that will help in completion // https://bugs.eclipse.org/bugs/show_bug.cgi?id=343865 // Required after the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=337868 // because now we get a type corresponding to the package-info.java from the java model. super.accept(sourceUnit, accessRestriction); } }
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { if (!CharOperation.equals(sourceUnit.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME)) { // do not accept package-info.java as a type for completion engine // because it contains no extra info that will help in completion // https://bugs.eclipse.org/bugs/show_bug.cgi?id=343865 // Required after the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=337868 // because now we get a type corresponding to the package-info.java from the java model. super.accept(sourceUnit, accessRestriction); } }
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { if (!CharOperation.equals(sourceUnit.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME)) { // do not accept package-info.java as a type for completion engine // because it contains no extra info that will help in completion // https://bugs.eclipse.org/bugs/show_bug.cgi?id=343865 // Required after the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=337868 // because now we get a type corresponding to the package-info.java from the java model. super.accept(sourceUnit, accessRestriction); } }
/** * adds a compilation unit override * * @param cu * The override * @return {@code true} if there was a previous mapping which has been updated with this call. {@code false} if this is * the first override for this compilation unit or there was no change. */ public boolean addCompilationUnit(final ICompilationUnit cu) { final char[][] packageName0 = cu.getPackageName(); final CharBuffer key = CharBuffer.wrap(CharOperation.concatWith(packageName0, cu.getMainTypeName(), SEPARATOR)); boolean updatedExistingEntry = false; final ICompilationUnit existingIcu = m_overrideCompilationUnits.put(key, cu); if (existingIcu != null) { updatedExistingEntry = !Arrays.equals(existingIcu.getContents(), cu.getContents()); } //register additional packages if (packageName0 != null && packageName0.length > 0) { for (int i = 1; i <= packageName0.length; i++) { m_additionalPackages.add(CharBuffer.wrap(CharOperation.concatWith(CharOperation.subarray(packageName0, 0, i), SEPARATOR))); } } return updatedExistingEntry; }
/** * Add an additional compilation unit. * @param sourceUnit */ @Override public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { if (CharOperation.equals(TypeConstants.MODULE_INFO_NAME, sourceUnit.getMainTypeName())) { // module is needed for resolving, so parse and build it now: CompilationResult unitResult = new CompilationResult(sourceUnit, 1, 1, this.options.maxProblemsPerUnit); CompilationUnitDeclaration parsedUnit = basicParser().dietParse(sourceUnit, unitResult); this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction); this.lookupEnvironment.completeTypeBindings(parsedUnit, true); // work done inside checkAndSetImports() } else { //System.out.println("Cannot accept compilation units inside the HierarchyResolver."); this.lookupEnvironment.problemReporter.abortDueToInternalError( new StringBuffer(Messages.accept_cannot) .append(sourceUnit.getFileName()) .toString()); } } private Parser basicParser() {
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }
public char[] getMainTypeName() { if (this.compilationResult.compilationUnit == null) { char[] fileName = this.compilationResult.getFileName(); int start = CharOperation.lastIndexOf('/', fileName) + 1; if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName)) start = CharOperation.lastIndexOf('\\', fileName) + 1; int end = CharOperation.lastIndexOf('.', fileName); if (end == -1) end = fileName.length; return CharOperation.subarray(fileName, start, end); } else { return this.compilationResult.compilationUnit.getMainTypeName(); } }