how to get the Editor from PsiElement?
hi ahh
i want the editor instance which is active now
DataManager didnot give but NULL
so i tried the following
Document document = PsiDocumentManager.getInstance(getElement().getProject()).getDocument(getElement().getContainingFile());
Editor editor= EditorFactory.getInstance().getEditors(document,getElement().getProject())[0];
but the editor array is 0 length and the document is not writable
by the way ,this is not accessed from an action so dataContext is not an option ;and obtaining it through DataManager result in nulls
thanks
Please sign in to leave a comment.
Hello joe,
j> i want the editor instance which is active now
FileEditorManager.getInstance().getSelectedTextEditor()
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
and if there is no selected text ?is it works also?
Hello joe,
j> and if there is no selected text ?is it works also?
It's not "get editor for selected text", it's "get text editor which is selected".
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
ok,i may need some english lessons :) thanks
Since 201 the
seems to be the easiest solution to obtain Editor (require EDT)