@Override public void enterModule(ModuleInfo moduleInfo) { this.moduleNameRange = new SourceRange(moduleInfo.nameSourceStart, moduleInfo.nameSourceEnd - moduleInfo.nameSourceStart + 1); this.moduleDeclarationStart = moduleInfo.declarationStart; // module type modifiers this.moduleModifiers = moduleInfo.modifiers; if (this.binaryTypeOrModule instanceof IModuleDescription) { // categories addCategories(this.binaryTypeOrModule, moduleInfo.categories); } }
private void exitAbstractMethod(int declarationEnd) { if (this.typeDepth >= 0) { IType currentType = this.types[this.typeDepth]; SourceRange sourceRange = new SourceRange( this.memberDeclarationStart[this.typeDepth], declarationEnd - this.memberDeclarationStart[this.typeDepth] + 1); IMethod method = currentType.getMethod( this.memberName[this.typeDepth], convertTypeNamesToSigs(this.methodParameterTypes[this.typeDepth])); setSourceRange( method, sourceRange, this.memberNameRange[this.typeDepth]); setMethodParameterNames( method, this.methodParameterNames[this.typeDepth]); } }
/** * @see ISourceElementRequestor */ @Override public void enterConstructor(MethodInfo methodInfo) { enterAbstractMethod(methodInfo); }
convertTypeNamesToSigs(this.methodParameterTypes[this.typeDepth])); TypeParameterInfo typeParameterInfo = methodInfo.typeParameters[i]; ITypeParameter typeParameter = method.getTypeParameter(new String(typeParameterInfo.name)); setSourceRange( typeParameter, new SourceRange( addCategories(method, methodInfo.categories);
this.anonymousCounter++; if (this.anonymousCounter == this.anonymousClassName) { this.types[this.typeDepth] = getType(this.binaryType.getElementName()); } else { this.types[this.typeDepth] = getType(new String(typeInfo.name)); this.types[this.typeDepth] = getType(new String(typeInfo.name)); TypeParameterInfo typeParameterInfo = typeInfo.typeParameters[i]; ITypeParameter typeParameter = currentType.getTypeParameter(new String(typeParameterInfo.name)); setSourceRange( typeParameter, new SourceRange( addCategories(currentType, typeInfo.categories);
source = getSourceForRootPath(this.rootPath, name); if (source == null) { source = getSourceForRootPath("", name); //$NON-NLS-1$ computeAllRootPaths(typeOrModule); if (this.rootPaths != null) { loop: for (Iterator iterator = this.rootPaths.iterator(); iterator.hasNext(); ) { String currentRootPath = (String) iterator.next(); if (!currentRootPath.equals(this.rootPath)) { source = getSourceForRootPath(currentRootPath, name); if (source != null) {
private char[] getSourceForRootPath(String currentRootPath, String name) { String newFullName; if (!currentRootPath.equals(IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH)) { if (currentRootPath.endsWith("/")) { //$NON-NLS-1$ newFullName = currentRootPath + name; } else { newFullName = currentRootPath + '/' + name; } } else { newFullName = name; } return this.findSource(newFullName); }
/** * @see ISourceElementRequestor */ @Override public void exitMethod(int declarationEnd, Expression defaultValue) { exitAbstractMethod(declarationEnd); } private void exitAbstractMethod(int declarationEnd) {
if (target instanceof IContainer) { IContainer folder = (IContainer)target; computeRootPath(folder, firstLevelPackageNames, containsADefaultPackage, tempRoots, folder.getFullPath().segmentCount()/*if external folder, this is the linked folder path*/); } else { JavaModelManager manager = JavaModelManager.getJavaModelManager();
SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) { SourceMapper mapper = new SourceMapper( sourcePath, rootPath == null ? null : rootPath.toOSString(), getJavaProject().getOptions(true)); // cannot use workspace options if external jar is 1.5 jar and workspace options are 1.4 options return mapper; } /*
protected void reportBinaryMemberDeclaration(IResource resource, IMember binaryMember, Binding binaryMemberBinding, IBinaryType info, int accuracy) throws CoreException { ClassFile classFile = (ClassFile) binaryMember.getClassFile(); ISourceRange range = classFile.isOpen() ? binaryMember.getNameRange() : SourceMapper.UNKNOWN_RANGE; if (range.getOffset() == -1) { BinaryType type = (BinaryType) classFile.getType(); String sourceFileName = type.sourceFileName(info); if (sourceFileName != null) { SourceMapper mapper = classFile.getSourceMapper(); if (mapper != null) { char[] contents = mapper.findSource(type, sourceFileName); if (contents != null) range = mapper.mapSource(type, contents, info, binaryMember); } } } if (resource == null) resource = this.currentPossibleMatch.resource; SearchMatch match = newDeclarationMatch(binaryMember, binaryMemberBinding, accuracy, range.getOffset(), range.getLength(), getParticipant(), resource); report(match); }
/** * {@inheritDoc} * @since 3.7 */ public int getFlags() { if (this.flags == -1) { SourceMapper mapper= getSourceMapper(); if (mapper != null) { try { // ensure the class file's buffer is open so that source ranges are computed ClassFile classFile = (ClassFile)getClassFile(); if (classFile != null) { classFile.getBuffer(); return mapper.getFlags(this); } } catch(JavaModelException e) { // ignore } } return 0; } return this.flags & ExtraCompilerModifiers.AccJustFlag; }
oldMapper.close();
convertTypeNamesToSigs(this.methodParameterTypes[this.typeDepth])); TypeParameterInfo typeParameterInfo = methodInfo.typeParameters[i]; ITypeParameter typeParameter = method.getTypeParameter(new String(typeParameterInfo.name)); setSourceRange( typeParameter, new SourceRange( addCategories(method, methodInfo.categories);
this.anonymousCounter++; if (this.anonymousCounter == this.anonymousClassName) { this.types[this.typeDepth] = getType(this.binaryType.getElementName()); } else { this.types[this.typeDepth] = getType(new String(typeInfo.name)); this.types[this.typeDepth] = getType(new String(typeInfo.name)); TypeParameterInfo typeParameterInfo = typeInfo.typeParameters[i]; ITypeParameter typeParameter = currentType.getTypeParameter(new String(typeParameterInfo.name)); setSourceRange( typeParameter, new SourceRange( addCategories(currentType, typeInfo.categories);
source = getSourceForRootPath(this.rootPath, name); if (source == null) { source = getSourceForRootPath("", name); //$NON-NLS-1$ computeAllRootPaths(typeOrModule); if (this.rootPaths != null) { loop: for (Iterator iterator = this.rootPaths.iterator(); iterator.hasNext(); ) { String currentRootPath = (String) iterator.next(); if (!currentRootPath.equals(this.rootPath)) { source = getSourceForRootPath(currentRootPath, name); if (source != null) {
private char[] getSourceForRootPath(String currentRootPath, String name) { String newFullName; if (!currentRootPath.equals(IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH)) { if (currentRootPath.endsWith("/")) { //$NON-NLS-1$ newFullName = currentRootPath + name; } else { newFullName = currentRootPath + '/' + name; } } else { newFullName = name; } return this.findSource(newFullName); }
/** * @see ISourceElementRequestor */ @Override public void exitConstructor(int declarationEnd) { exitAbstractMethod(declarationEnd); }
if (target instanceof IContainer) { IContainer folder = (IContainer)target; computeRootPath(folder, firstLevelPackageNames, containsADefaultPackage, tempRoots, folder.getFullPath().segmentCount()/*if external folder, this is the linked folder path*/); } else { JavaModelManager manager = JavaModelManager.getJavaModelManager();
SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) throws JavaModelException { IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(getPath()); String encoding = (entry== null) ? null : ((ClasspathEntry) entry).getSourceAttachmentEncoding(); IModule mod = getModule(); String modName = mod == null ? null : new String(mod.name()); SourceMapper mapper = new SourceMapper( sourcePath, rootPath == null ? modName : rootPath.toOSString(), getJavaProject().getOptions(true),// cannot use workspace options if external jar is 1.5 jar and workspace options are 1.4 options encoding); return mapper; } public boolean equals(Object o) {