How to prevent the move from the invalid FileEditorProvider?
For the java class, there is an additional FileEditorProvider (Properties) when you switch to the tab `Text`, the value is committed (to PsiClass) and validated from the FileEditorProvider (Properties) tab and in case of an error you need to stay on this tab (Properties).
Now the value is committed in the method com.intellij.openapi.fileEditor.FileEditor#deselectNotify
请先登录再写评论。
There's no API for that.
This can probably be implemented after getting a reference to corresponding JBTabs instance (using getTabAt(index).setEnabled(false) or setSelectionChangeHandler). But that instance is not exposed by EditorComposite. I'll add corresponding method to EditorComposite, but it will be available only in 'master' branch of IntelliJ platform (to be released as 2018.3 version).
YouTrack ticket, for reference - https://youtrack.jetbrains.com/issue/IDEA-195486.
Thanks, Dmitry Batrak.
How can I get a reference to a specific EditorComposite from com.intellij.openapi.fileEditor.FileEditor or com.intellij.openapi.fileEditor.FileEditorProvider?
Something like this?
I don't think you'll be able to implement your logic in 'deselectNotify' - it's called when tab switching is already decided. You'll need to do that earlier.
FileEditorManager.getCurrentWindow and EditorWindow.findFileComposite or EditorWindow.getSelectedEditor can help you to get to EditorComposite instance.
Thanks!