public void contentsLoaded(final ConnectionHandler connectionHandler) {
new SimpleLaterInvocator() {
@Override
public void execute() {
if (!project.isDisposed()) {
FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
FileConnectionMappingManager connectionMappingManager = FileConnectionMappingManager.getInstance(project);
VirtualFile[] openFiles = fileEditorManager.getOpenFiles();
for (VirtualFile openFile : openFiles) {
ConnectionHandler activeConnection = connectionMappingManager.getActiveConnection(openFile);
if (activeConnection == connectionHandler) {
FileEditor[] fileEditors = fileEditorManager.getEditors(openFile);
for (FileEditor fileEditor : fileEditors) {
Editor editor = null;
if (fileEditor instanceof TextEditor) {
TextEditor textEditor = (TextEditor) fileEditor;
editor = textEditor.getEditor();