void () { myContentManager.addContentManagerListener(this); ProjectManager.getInstance().addProjectManagerListener(myProject, this); Disposer.register(myContent, () -> { myContentManager.removeContentManagerListener(this); ProjectManager.getInstance().removeProjectManagerListener(myProject, this); }); }