switch (selection) {
case -1:
// no selection
break;
case 0: {// String
BasicInfoEditor bie = new BasicInfoEditor(MainWindow.getInstance()) {
@Override
public void validate(String value)
throws BasicInfoEditor.ValidationException {
validateAndInsertStringInfo(value);
}
};
bie.invoke("Insert String Constant", "");
break;
}
case 1: {// int
BasicInfoEditor bie = new BasicInfoEditor(MainWindow.getInstance()) {
@Override
public void validate(String value)
throws BasicInfoEditor.ValidationException {
validateAndInsertIntegerInfo(value);
}
};
bie.invoke("Insert Integer Constant", "");
break;
}
case 2: {// long
BasicInfoEditor bie = new BasicInfoEditor(MainWindow.getInstance()) {
@Override
public void validate(String value)
throws BasicInfoEditor.ValidationException {
validateAndInsertLongInfo(value);
}
};
bie.invoke("Insert Integer Constant", "");
break;
}
case 3: {// float
BasicInfoEditor bie = new BasicInfoEditor(MainWindow.getInstance()) {
@Override
public void validate(String value)
throws BasicInfoEditor.ValidationException {
validateAndInsertFloatInfo(value);
}
};
bie.invoke("Insert Integer Constant", "");
break;
}
case 4: {// double
BasicInfoEditor bie = new BasicInfoEditor(MainWindow.getInstance()) {
@Override
public void validate(String value)
throws BasicInfoEditor.ValidationException {
validateAndInsertDoubleInfo(value);
}
};
bie.invoke("Insert Integer Constant", "");
break;
}
default:
// TODO: insert field, method
throw new RuntimeException("To be implemented");