editor.getCaretModel().moveToOffset(document.getLineEndOffset(line));
pressEnter(editor);
}
public static void pressEnter(Editor editor) {
EditorActionManager manager = EditorActionManager.getInstance();
EditorActionHandler enterHandler = manager.getActionHandler(IdeActions.ACTION_EDITOR_START_NEW_LINE);
DataContext dc = DataManager.getInstance().getDataContext(editor.getContentComponent());
enterHandler.execute(editor, editor.getCaretModel().getCurrentCaret(), dc);
}