private void onSelectionChanged(@NotNull FileEditorManagerEvent event) { // Ignore events which don't target current editor. FileEditor oldEditor = event.getOldEditor(); FileEditor newEditor = event.getNewEditor(); if (oldEditor != this && newEditor != this) { return; } // We want to sync selected property key on selection change. if (newEditor == this) { if (oldEditor instanceof TextEditor) { setStructureViewSelectionFromPropertiesFile(((TextEditor) oldEditor).getEditor()); } } else if (newEditor instanceof TextEditor) { setPropertiesFileSelectionFromStructureView(((TextEditor) newEditor).getEditor()); } }
@Override public void selectionChanged(@NotNull FileEditorManagerEvent event) { if (ApplicationManager.getApplication().isUnitTestMode()) return; VirtualFile newFile = event.getNewFile(); fileChanged(newFile); }