Listening to add and remove of a Content Root.

Hi All,

Can I have a listener that get invoked when a content root is added or removed for a module?

Thanks
Devang Shah

4 comments

Hello Devang,

Can I have a listener that get invoked when a content root is added or
removed for a module?


ProjectRootManager.getInstance(project).addModuleRootListener()

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Hi,

How can I know whether the content root has been added or removed?

Also what is the importance of 'isCausedByFileTypesChange' function.

Thanks
Devang Shah

0

Hello Devang,

How can I know whether the content root has been added or removed?


This information is not provided through an event listener. You should keep
track of old state of content roots by yourself if you're interested in such
level of granularity.

Note that one rootsChanged() event can represent multiple changes done by
the user (content root additions and removals, module additions and removals,
library configuration changes etc.)

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

How can I get the name of the content root changed? or is it that it will just update that some content root belonging to some module has changed?

0

Please sign in to leave a comment.