* There might be several same events for a resource change (either from filesystem or when IDE clears and reloads
* a class multiple time on rebuild). Use command scheduler to group same events into single invocation.
*/
private void registerResourceListener(final PluginAnnotation<T> pluginAnnotation, final WatchEventDTO watchEventDTO,
final ClassLoader classLoader, URI uri) throws IOException {
pluginManager.getWatcher().addEventListener(classLoader, uri, new WatchEventListener() {
@Override
public void onEvent(WatchFileEvent event) {
if (event.isFile()) {
Command command = new WatchEventCommand(pluginAnnotation, event, classLoader);
pluginManager.getScheduler().scheduleCommand(command, watchEventDTO.getTimeout());