private static void reinitBreadcrumbsComponent( @NotNull final FileEditorManager fileEditorManager, @NotNull VirtualFile file) { if (isSuitable(fileEditorManager.getProject(), file)) { FileEditor[] fileEditors = fileEditorManager.getAllEditors(file); for (final FileEditor fileEditor : fileEditors) { if (fileEditor instanceof TextEditor) { Editor editor = ((TextEditor) fileEditor).getEditor(); if (BreadcrumbsXmlWrapper.getBreadcrumbsComponent(editor) != null) { continue; } final BreadcrumbsXmlWrapper wrapper = new BreadcrumbsXmlWrapper(editor); final JComponent c = wrapper.getComponent(); fileEditorManager.addTopComponent(fileEditor, c); Disposer.register( fileEditor, new Disposable() { @Override public void dispose() { disposeWrapper(fileEditorManager, fileEditor, wrapper); } }); } } } else { removeBreadcrumbs(fileEditorManager, file); } }
private static void updateModifiedProperty(@NotNull VirtualFile file) { for (Project project : ProjectManager.getInstance().getOpenProjects()) { FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); for (FileEditor editor : fileEditorManager.getAllEditors(file)) { if (editor instanceof TextEditorImpl) { ((TextEditorImpl) editor).updateModifiedProperty(); } } } }
private static void removeBreadcrumbs( @NotNull FileEditorManager fileEditorManager, @NotNull VirtualFile file) { final FileEditor[] fileEditors = fileEditorManager.getAllEditors(file); for (FileEditor fileEditor : fileEditors) { if (fileEditor instanceof TextEditor) { Editor editor = ((TextEditor) fileEditor).getEditor(); BreadcrumbsXmlWrapper wrapper = BreadcrumbsXmlWrapper.getBreadcrumbsComponent(editor); if (wrapper != null) { disposeWrapper(fileEditorManager, fileEditor, wrapper); } } } }