void onResourceBatchEvent(@Observes final ResourceBatchChangesEvent batchEvent) { if (path != null && batchEvent.containPath(path)) { if (sessionInfo.getId().equals(batchEvent.getSessionInfo().getId())) { for (final ResourceChange change : batchEvent.getChanges(path)) { switch (change.getType()) { case COPY: executeCopyCommands(); break; case DELETE: executeDeleteCommands(); break; case RENAME: path = ((ResourceRenamed) change).getDestinationPath(); executeRenameCommands(); break; case UPDATE: executeUpdateCommands(); break; } } } else { for (final ResourceChange change : batchEvent.getChanges(path)) { switch (change.getType()) { case COPY: executeConcurrentCopyCommand( path, ((ResourceCopied) change).getDestinationPath(), batchEvent.getSessionInfo().getId(), batchEvent.getSessionInfo().getIdentity()); break; case DELETE: executeConcurrentDeleteCommand( path, batchEvent.getSessionInfo().getId(), batchEvent.getSessionInfo().getIdentity()); break; case RENAME: path = ((ResourceRenamed) change).getDestinationPath(); executeConcurrentRenameCommand( path, ((ResourceRenamed) change).getDestinationPath(), batchEvent.getSessionInfo().getId(), batchEvent.getSessionInfo().getIdentity()); break; case UPDATE: executeConcurrentUpdateCommand( path, batchEvent.getSessionInfo().getId(), batchEvent.getSessionInfo().getIdentity()); break; } } } } }
// Refresh when a batch Resource change has occurred. Simply refresh everything. public void onBatchResourceChanges( @Observes final ResourceBatchChangesEvent resourceBatchChangesEvent) { if (!getView().isVisible()) { return; } boolean projectChange = false; for (final Path path : resourceBatchChangesEvent.getBatch().keySet()) { if (path.getFileName().equals("pom.xml")) { projectChange = true; break; } } if (!projectChange) { refresh(false); } }