static UserModel getUserModel() {
return ((UserModel) Pico.getInstance().getComponentInstanceOfType(UserModel.class));
}
static CodePointer getCodePointer(Editor editor) {
CodePointer codePointer;
int selectionStart = editor.getSelectionModel().getSelectionStart();
int selectionEnd = editor.getSelectionModel().getSelectionEnd();
if (selectionStart != selectionEnd) {
LogicalPosition start = editor.offsetToLogicalPosition(selectionStart);
LogicalPosition end = editor.offsetToLogicalPosition(selectionEnd);
codePointer = new CodePointer(start.line, start.column, end.line, end.column);
}
else {
LogicalPosition pos = editor.getCaretModel().getLogicalPosition();
codePointer = new CodePointer(pos.line, pos.column);
}
return codePointer;
}