[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.dltk] FieldDeclaration not included in Outline view

I investigated this and discovered that:
a)    FieldDeclaration was/is intended to be converted to a SourceField 
model element.
b)    That conversion does not take place in the existing DLTK code or in 
the Python example code (it may happen for other languages).

To fix this, I made these changes to my subclass of 
SourceElementRequestVisitor

1)    Added:
a)
public boolean visit(FieldDeclaration field) throws Exception {
this.fNodes.push(field);
ISourceElementRequestor.FieldInfo fi = new 
ISourceElementRequestor.FieldInfo();
fi.name = field.getName();
fi.modifiers = field.getModifiers();
fi.nameSourceStart = field.getNameStart();
fi.nameSourceEnd = field.getNameEnd() - 1;
fi.declarationStart = field.sourceStart();
this.fRequestor.enterField(fi);
return true;
}

b)
public boolean endvisit(FieldDeclaration field) throws Exception {
this.fRequestor.exitField(field.sourceEnd());
this.fNodes.pop();
return true;
}

2) Modified:

public boolean visit(Statement statement) throws Exception {
boolean retValue = true;
if (statement instanceof FieldDeclaration) {
    retValue = visit((FieldDeclaration)statement);
}
return retValue;
}

3) Modified:

public boolean endvisit(Statement s) throws Exception {
boolean retVal = true;
if (s instanceof FieldDeclaration) {
retVal = endvisit((FieldDeclaration)s);
}
return retVal;
}

Chuck