parentNode = parentNode.getParent();
if (parentNode instanceof VariableDeclarationStatement) {
VariableDeclarationStatement varDeclStmt = (VariableDeclarationStatement) parentNode;
Type varDeclType = varDeclStmt.getType();
if (varDeclType instanceof SimpleType) {
SimpleType sType = (SimpleType) varDeclType;
parentNode = parentNode.getParent();
if (parentNode instanceof Block) {
Block block = (Block) parentNode;
try {
if (viewer.getDocument().getChar(block.getStartPosition()) != '{') {
parentNode = parentNode.getParent();
if (parentNode instanceof MethodDeclaration) {
MethodDeclaration methodDecl = (MethodDeclaration) parentNode;
return getProposals(methodDecl, sType.getName()
.getFullyQualifiedName(), invocationOffset,
varDeclStmt, javaContext);
}
}
}
catch (BadLocationException e) {
StatusHandler.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
.getMessage(), e));
}
}
}
}
}
// cursor is at the start of a param type
else if (parentNode instanceof SimpleType) {
SimpleType sType = (SimpleType) parentNode;
parentNode = sType.getParent();
if (parentNode instanceof SingleVariableDeclaration) {
SingleVariableDeclaration varDecl = (SingleVariableDeclaration) parentNode;
parentNode = varDecl.getParent();
if (parentNode instanceof MethodDeclaration) {
MethodDeclaration methodDecl = (MethodDeclaration) parentNode;
return getProposals(methodDecl, sType.getName().getFullyQualifiedName(),
invocationOffset, sType, javaContext);
}
}
}
}