X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/LocalVariable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/LocalVariable.java index 63312b5..40e31ec 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/LocalVariable.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/LocalVariable.java @@ -28,22 +28,18 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; - public class LocalVariable extends JavaElement implements ILocalVariable { public int declarationSourceStart, declarationSourceEnd; + public int nameStart, nameEnd; + String typeSignature; - - public LocalVariable( - JavaElement parent, - String name, - int declarationSourceStart, - int declarationSourceEnd, - int nameStart, - int nameEnd, - String typeSignature) { - + + public LocalVariable(JavaElement parent, String name, + int declarationSourceStart, int declarationSourceEnd, + int nameStart, int nameEnd, String typeSignature) { + super(parent, name); this.declarationSourceStart = declarationSourceStart; this.declarationSourceEnd = declarationSourceEnd; @@ -62,28 +58,30 @@ public class LocalVariable extends JavaElement implements ILocalVariable { } public boolean equals(Object o) { - if (!(o instanceof LocalVariable)) return false; - LocalVariable other = (LocalVariable)o; - return - this.declarationSourceStart == other.declarationSourceStart - && this.declarationSourceEnd == other.declarationSourceEnd - && this.nameStart == other.nameStart - && this.nameEnd == other.nameEnd - && super.equals(o); - } - + if (!(o instanceof LocalVariable)) + return false; + LocalVariable other = (LocalVariable) o; + return this.declarationSourceStart == other.declarationSourceStart + && this.declarationSourceEnd == other.declarationSourceEnd + && this.nameStart == other.nameStart + && this.nameEnd == other.nameEnd && super.equals(o); + } + public boolean exists() { - return this.parent.exists(); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=46192 + return this.parent.exists(); // see + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=46192 } - protected void generateInfos(Object info, HashMap newElements, IProgressMonitor pm) { + protected void generateInfos(Object info, HashMap newElements, + IProgressMonitor pm) { // a local variable has no info } - public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) { + public IJavaElement getHandleFromMemento(String token, + MementoTokenizer memento, WorkingCopyOwner owner) { switch (token.charAt(0)) { - case JEM_COUNT: - return getHandleUpdatingCountFromMemento(memento, owner); + case JEM_COUNT: + return getHandleUpdatingCountFromMemento(memento, owner); } return this; } @@ -91,8 +89,9 @@ public class LocalVariable extends JavaElement implements ILocalVariable { /* * @see JavaElement#getHandleMemento() */ - public String getHandleMemento(){ - StringBuffer buff= new StringBuffer(((JavaElement)getParent()).getHandleMemento()); + public String getHandleMemento() { + StringBuffer buff = new StringBuffer(((JavaElement) getParent()) + .getHandleMemento()); buff.append(getHandleMementoDelimiter()); buff.append(this.name); buff.append(JEM_COUNT); @@ -125,9 +124,10 @@ public class LocalVariable extends JavaElement implements ILocalVariable { } public ISourceRange getNameRange() { - return new SourceRange(this.nameStart, this.nameEnd-this.nameStart+1); + return new SourceRange(this.nameStart, this.nameEnd - this.nameStart + + 1); } - + public IPath getPath() { return this.parent.getPath(); } @@ -148,23 +148,24 @@ public class LocalVariable extends JavaElement implements ILocalVariable { ISourceRange range = getSourceRange(); int offset = range.getOffset(); int length = range.getLength(); - if (offset == -1 || length == 0 ) { + if (offset == -1 || length == 0) { return null; } try { return buffer.getText(offset, length); - } catch(RuntimeException e) { + } catch (RuntimeException e) { return null; } } - + /** * @see ISourceReference */ public ISourceRange getSourceRange() { - return new SourceRange(this.declarationSourceStart, this.declarationSourceEnd-this.declarationSourceStart+1); + return new SourceRange(this.declarationSourceStart, + this.declarationSourceEnd - this.declarationSourceStart + 1); } - + public String getTypeSignature() { return this.typeSignature; } @@ -176,11 +177,11 @@ public class LocalVariable extends JavaElement implements ILocalVariable { public int hashCode() { return Util.combineHashCodes(this.parent.hashCode(), this.nameStart); } - + public boolean isStructureKnown() throws JavaModelException { - return true; - } - + return true; + } + protected void toStringInfo(int tab, StringBuffer buffer, Object info) { buffer.append(this.tabString(tab)); if (info != NO_INFO) {