ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
JSLibraryManager libraryManager = JSLibraryManager.getInstance(project);
LibraryTable libraryTable = libraryManager.getLibraryTable(ScriptingLibraryModel.LibraryLevel.GLOBAL);
libraryTable.addListener(new MyLibraryChangeWatcher());
}
});
}
private static void libraryChanged() {