* org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
* Object)
*/
@Override
public Object[] getChildren(Object parentElement) {
BodyDeclaration element = (BodyDeclaration) parentElement;
ArrayList<MethodDeclaration> methods = new ArrayList<MethodDeclaration>();
if (element.getNodeType() == ASTNode.TYPE_DECLARATION) {
for (MethodDeclaration method : ((TypeDeclaration) element)
.getMethods()) {
// Copy properties from class to methods
Set<?> properties = element.properties().keySet();
for (String property : (String[]) properties
.toArray(new String[element.properties().size()])) {
method.setProperty(property, element.getProperty(property));
}
// Set a unique identifier (required for DND)
String sign = "" + method.getReturnType2() + method.getName();
for (Object p : method.parameters()) {
sign += p.toString();
}
// Replace the copied parent's URI from above with a new URI
// extended with the signature of the child and a mark
method.setProperty(ResultProperty.URI.name(),
method.getProperty(ResultProperty.URI.name())
+ CodeConjurer.URI_DELIMITER + sign);
methods.add(method);
}
return methods.toArray();
}
if (element.getNodeType() == ASTNode.ENUM_DECLARATION) {
for (Object declaration : ((EnumDeclaration) element)
.bodyDeclarations()) {
if (declaration instanceof MethodDeclaration) {
MethodDeclaration method = (MethodDeclaration) declaration;
// Copy properties from class to methods
Set<?> properties = element.properties().keySet();
for (String property : (String[]) properties
.toArray(new String[element.properties().size()])) {
method.setProperty(property,
element.getProperty(property));
}
// Set a unique identifier (required for DND)
String sign = "" + method.getReturnType2()
+ method.getName();
for (Object p : method.parameters()) {