@Override public boolean equals(Object o) { if (!(o instanceof TypeParameter)) return false; return super.equals(o); }
/** * @see IJavaElement */ @Override public IResource getUnderlyingResource() throws JavaModelException { if (!exists()) throw newNotPresentException(); return getParent().getUnderlyingResource(); } /**
/** * @see IMember */ @Override public ICompilationUnit getCompilationUnit() { return (ICompilationUnit) getAncestor(COMPILATION_UNIT); } /**
/** * Elements within compilation units and class files have no * corresponding resource. * * @see IJavaElement */ public IResource getCorrespondingResource() throws JavaModelException { if (!exists()) throw newNotPresentException(); return null; } /*
for (int i = children.size()-1; i >= 0; i--) { SourceRefElement child = (SourceRefElement)children.get(i); switch (child.getElementType()) { case IJavaElement.PACKAGE_DECLARATION: currentElement = ((ICompilationUnit)currentElement).getPackageDeclaration(child.getElementName()); break; case IJavaElement.IMPORT_CONTAINER: break; case IJavaElement.IMPORT_DECLARATION: currentElement = ((IImportContainer)currentElement).getImport(child.getElementName()); break; case IJavaElement.TYPE: switch (currentElement.getElementType()) { case IJavaElement.COMPILATION_UNIT: currentElement = ((ICompilationUnit)currentElement).getType(child.getElementName()); break; case IJavaElement.TYPE: currentElement = ((IType)currentElement).getType(child.getElementName()); break; case IJavaElement.FIELD: case IJavaElement.INITIALIZER: case IJavaElement.METHOD: currentElement = ((IMember)currentElement).getType(child.getElementName(), child.occurrenceCount); break; break; case IJavaElement.FIELD: currentElement = ((IType)currentElement).getField(child.getElementName());
public ISourceRange getSourceRange() throws JavaModelException { SourceMapper mapper= getSourceMapper(); if (mapper != null) { // 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.getSourceRange(this); } } return super.getSourceRange(); }
/** * @see ISourceReference */ public String getSource() throws JavaModelException { IOpenable openable = getOpenableParent(); IBuffer buffer = openable.getBuffer(); if (buffer == null) { return null; } ISourceRange range = getSourceRange(); int offset = range.getOffset(); int length = range.getLength(); if (offset == -1 || length == 0 ) { return null; } try { return buffer.getText(offset, length); } catch(RuntimeException e) { return null; } } /**
public IAnnotation[] getAnnotations() throws JavaModelException { AnnotatableInfo info = (AnnotatableInfo) getElementInfo(); return info.annotations; } /**
public ASTNode search() throws JavaModelException { ISourceRange range = null; if (this.element instanceof IMember && !(this.element instanceof IInitializer) && !(this.element instanceof LambdaMethod) && !(this.element instanceof org.eclipse.jdt.internal.core.LambdaExpression)) range = ((IMember) this.element).getNameRange(); else if (this.element instanceof ITypeParameter || this.element instanceof ILocalVariable) range = this.element.getNameRange(); else range = this.element.getSourceRange(); this.rangeStart = range.getOffset(); this.rangeLength = range.getLength(); this.ast.accept(this); return this.foundNode; }
public IJavaElement getHandleUpdatingCountFromMemento(MementoTokenizer memento, WorkingCopyOwner owner) { if (!memento.hasMoreTokens()) return this; this.occurrenceCount = Integer.parseInt(memento.nextToken()); if (!memento.hasMoreTokens()) return this; String token = memento.nextToken(); return getHandleFromMemento(token, memento, owner); } /*
/** * @see IParent */ @Override public boolean hasChildren() throws JavaModelException { return getChildren().length > 0; } /**
public IAnnotation getAnnotation(String annotationName) { for (int i = 0, length = this.annotations.length; i < length; i++) { IAnnotation annotation = this.annotations[i]; if (annotation.getElementName().equals(annotationName)) return annotation; } return super.getAnnotation(annotationName); }
/** * Elements within compilation units and class files have no * corresponding resource. * * @see IJavaElement */ public IResource getCorrespondingResource() throws JavaModelException { if (!exists()) throw newNotPresentException(); return null; } /*
for (int i = children.size()-1; i >= 0; i--) { SourceRefElement child = (SourceRefElement)children.get(i); switch (child.getElementType()) { case IJavaElement.PACKAGE_DECLARATION: currentElement = ((ICompilationUnit)currentElement).getPackageDeclaration(child.getElementName()); break; case IJavaElement.IMPORT_CONTAINER: break; case IJavaElement.IMPORT_DECLARATION: currentElement = ((IImportContainer)currentElement).getImport(child.getElementName()); break; case IJavaElement.TYPE: switch (currentElement.getElementType()) { case IJavaElement.COMPILATION_UNIT: currentElement = ((ICompilationUnit)currentElement).getType(child.getElementName()); break; case IJavaElement.TYPE: currentElement = ((IType)currentElement).getType(child.getElementName()); break; case IJavaElement.FIELD: case IJavaElement.INITIALIZER: case IJavaElement.METHOD: currentElement = ((IMember)currentElement).getType(child.getElementName(), child.occurrenceCount); break; break; case IJavaElement.FIELD: currentElement = ((IType)currentElement).getField(child.getElementName());
public ISourceRange getSourceRange() throws JavaModelException { SourceMapper mapper= getSourceMapper(); if (mapper != null) { // 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.getSourceRange(this); } } return super.getSourceRange(); }
/** * @see ISourceReference */ public String getSource() throws JavaModelException { IOpenable openable = getOpenableParent(); IBuffer buffer = openable.getBuffer(); if (buffer == null) { return null; } ISourceRange range = getSourceRange(); int offset = range.getOffset(); int length = range.getLength(); if (offset == -1 || length == 0 ) { return null; } try { return buffer.getText(offset, length); } catch(RuntimeException e) { return null; } } /**
public IAnnotation[] getAnnotations() throws JavaModelException { AnnotatableInfo info = (AnnotatableInfo) getElementInfo(); return info.annotations; } /**
public ASTNode search() throws JavaModelException { ISourceRange range = null; if (this.element instanceof IMember && !(this.element instanceof IInitializer) && !(this.element instanceof LambdaMethod) && !(this.element instanceof org.eclipse.jdt.internal.core.LambdaExpression)) range = ((IMember) this.element).getNameRange(); else if (this.element instanceof ITypeParameter || this.element instanceof ILocalVariable) range = this.element.getNameRange(); else range = this.element.getSourceRange(); this.rangeStart = range.getOffset(); this.rangeLength = range.getLength(); this.ast.accept(this); return this.foundNode; }
public IJavaElement getHandleUpdatingCountFromMemento(MementoTokenizer memento, WorkingCopyOwner owner) { if (!memento.hasMoreTokens()) return this; this.occurrenceCount = Integer.parseInt(memento.nextToken()); if (!memento.hasMoreTokens()) return this; String token = memento.nextToken(); return getHandleFromMemento(token, memento, owner); } /*
/** * @see IParent */ public boolean hasChildren() throws JavaModelException { return getChildren().length > 0; } /**