Search in sources :

Example 1 with FileEditorManagerAdapter

use of com.intellij.openapi.fileEditor.FileEditorManagerAdapter 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

FileEditorManagerAdapter (com.intellij.openapi.fileEditor.FileEditorManagerAdapter)1 FileEditorManagerEvent (com.intellij.openapi.fileEditor.FileEditorManagerEvent)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 NotNull (org.jetbrains.annotations.NotNull)1 StudyNode (org.stepik.core.courseFormat.StudyNode)1