// check for existing invocation
{
final Expression expression = getExpression(javaInfo);
if (expression != null) {
if (source != null) {
ExecutionUtils.run(javaInfo, new RunnableEx() {
public void run() throws Exception {
editor.replaceExpression(expression, source);
}
});
} else {
ExecutionUtils.run(javaInfo, new RunnableEx() {
public void run() throws Exception {
editor.removeEnclosingStatement(expression);
}
});
}
return true;
}
}
// add new invocation
if (source != null) {
ExecutionUtils.run(javaInfo, new RunnableEx() {
public void run() throws Exception {
if (javaInfo.getAssociation() instanceof InvocationAssociation) {
StatementTarget target = getTarget(javaInfo);
String arguments = TemplateUtils.format("{0}, {1}", javaInfo, source);
m_panel.addMethodInvocation(target, m_methodSignature, arguments);