import java.util.HashMap;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import net.sourceforge.phpdt.core.*;
+import net.sourceforge.phpdt.core.IBuffer;
import net.sourceforge.phpdt.core.IJavaElement;
+import net.sourceforge.phpdt.core.ILocalVariable;
+import net.sourceforge.phpdt.core.IOpenable;
+import net.sourceforge.phpdt.core.ISourceRange;
+import net.sourceforge.phpdt.core.ISourceReference;
import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.Signature;
import net.sourceforge.phpdt.core.WorkingCopyOwner;
import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
import net.sourceforge.phpdt.internal.core.util.Util;
+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;
}
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;
}
/*
* @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);
}
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();
}
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;
}
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) {