EditorAndState () { FileEditor editor = getEditorProvider().getCurrentEditor(myProject); if (editor == null) { return null; } if (!editor.isValid()) { return null; } return new EditorAndState(editor, editor.getState(FileEditorStateLevel.UNDO)); }