Search in sources :

Example 11 with FileEditorManagerEvent

use of com.intellij.openapi.fileEditor.FileEditorManagerEvent in project intellij-plugins by StepicOrg.

the class StudyBasePluginConfigurator method getFileEditorManagerListener.

@NotNull
@Override
public FileEditorManagerListener getFileEditorManagerListener(@NotNull Project project) {
    return new FileEditorManagerAdapter() {

        @Override
        public void selectionChanged(@NotNull FileEditorManagerEvent event) {
            VirtualFile file = event.getNewFile();
            if (file == null) {
                return;
            }
            StudyNode stepNode = StudyUtils.getStudyNode(project, file);
            if (stepNode != null) {
                StepikProjectManager.setSelected(project, stepNode);
            }
        }
    };
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileEditorManagerAdapter(com.intellij.openapi.fileEditor.FileEditorManagerAdapter) FileEditorManagerEvent(com.intellij.openapi.fileEditor.FileEditorManagerEvent) NotNull(org.jetbrains.annotations.NotNull) StudyNode(org.stepik.core.courseFormat.StudyNode) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

FileEditorManagerEvent (com.intellij.openapi.fileEditor.FileEditorManagerEvent)11 FileEditorManagerListener (com.intellij.openapi.fileEditor.FileEditorManagerListener)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)3 NotNull (org.jetbrains.annotations.NotNull)3 FileEditorManagerAdapter (com.intellij.openapi.fileEditor.FileEditorManagerAdapter)2 MessageBusConnection (com.intellij.util.messages.MessageBusConnection)2 Test (org.junit.Test)2 Disposable (com.intellij.openapi.Disposable)1 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1 SelectionModel (com.intellij.openapi.editor.SelectionModel)1 EditorEventMulticasterEx (com.intellij.openapi.editor.ex.EditorEventMulticasterEx)1 FocusChangeListener (com.intellij.openapi.editor.ex.FocusChangeListener)1 FileEditor (com.intellij.openapi.fileEditor.FileEditor)1 TextRange (com.intellij.openapi.util.TextRange)1 IdeFrame (com.intellij.openapi.wm.IdeFrame)1 StatusBar (com.intellij.openapi.wm.StatusBar)1 StatusBarWidget (com.intellij.openapi.wm.StatusBarWidget)1 LineSeparatorPanel (com.intellij.openapi.wm.impl.status.LineSeparatorPanel)1