Avoiding deprecated methods for IDEA 7.03

Hello,
I've got a problem while avoiding the deprecated methods:
all that I see is a message: Subscribe to {@link com.intellij.AppTopics#FILE_DOCUMENT_SYNC} on any level bus.
Following the link I have such class:
public class ProjectTopics {
public static final Topic PROJECT_ROOTS = new Topic("project root changes", ModuleRootListener.class); public static final Topic MODULES = new Topic("modules added or removed from project", ModuleListener.class); public static final Topic FILE_EDITOR_MANAGER = new Topic("file editor events", FileEditorManagerListener.class); public static final Topic LOGICAL_ROOTS = new Topic]]>("logical root changes", LogicalRootsManager.LogicalRootListener.class);
}

So if I have
com.intellij.openapi.roots.ProjectRootManager.getInstance(project).addModuleRootListener(moduleRootListener) which is deprecated
then what should I use instead?

Thanks

3 comments
Comment actions Permalink

here is how I listen now to project roots change, this should be quite similar to what you're looking for


myMessageBusConnection = getProject().getMessageBus().connect();
myMessageBusConnection.subscribe(ProjectTopics.PROJECT_ROOTS, myListener);

0
Comment actions Permalink

Thank you, Thibaut

and one more thing: if I have for e.g. removeModuleRootListener(which is also deprecated) then there is no method like unsubscribe or smth. like that.... so should I use smth. like msbusConnection.disconnect();?

0
Comment actions Permalink

not sure if it is the recommended way, but it is what i'm doing in my deactivate().

IIRC this is how it's done in the Jetbrains subversion plugin

0

Please sign in to leave a comment.