acceptor.accept(
issue, "Change to regular variable reference", "Removes the '{' and '}'", null, new IModification() {
@Override
public void apply(IModificationContext context) throws Exception {
IXtextDocument doc = context.getXtextDocument();
doc.replace(
issue.getOffset(), issue.getLength(),
"$" + doc.get(issue.getOffset() + 2, issue.getLength() - 3));
}
});
// $x ? { undef => '', default => $x }
acceptor.accept(
issue, "Change to selector that makes undef empty string", "$x ? {undef => '', default => $x }", null,
new IModification() {
@Override
public void apply(IModificationContext context) throws Exception {
IXtextDocument doc = context.getXtextDocument();
String varName = "$" + doc.get(issue.getOffset() + 2, issue.getLength() - 3);
StringBuilder builder = new StringBuilder();
builder.append(varName);
builder.append(" ? {");
builder.append(" undef => '', default => ");
builder.append(varName);
builder.append("}");
doc.replace(issue.getOffset(), issue.getLength(), builder.toString());
}
});
}