use of com.intellij.openapi.command.undo.UnexpectedUndoException in project intellij-community by JetBrains.
the class CCSubtaskPlaceholderAction method performAnswerPlaceholderAction.
@Override
protected void performAnswerPlaceholderAction(@NotNull CCState state) {
Editor editor = state.getEditor();
final int offset = editor.getCaretModel().getOffset();
TaskFile taskFile = state.getTaskFile();
int subtaskIndex = state.getTaskFile().getTask().getActiveSubtaskIndex();
AnswerPlaceholder existingPlaceholder = StudyUtils.getAnswerPlaceholder(offset, taskFile.getAnswerPlaceholders());
if (existingPlaceholder == null) {
return;
}
AnswerPlaceholderSubtaskInfo info = getInfo(state, subtaskIndex, existingPlaceholder);
if (info == null) {
return;
}
EduUtils.runUndoableAction(state.getProject(), getTitle(), new BasicUndoableAction(state.getEditor().getDocument()) {
@Override
public void undo() throws UnexpectedUndoException {
undoAction(existingPlaceholder, subtaskIndex, info);
StudyUtils.drawAllAnswerPlaceholders(editor, taskFile);
}
@Override
public void redo() throws UnexpectedUndoException {
redoAction(existingPlaceholder, subtaskIndex, info);
StudyUtils.drawAllAnswerPlaceholders(editor, taskFile);
}
});
}
Aggregations