// Refresh when a Resource has been renamed, if it exists in the active package
  public void onResourceRenamed(@Observes final ResourceRenamedEvent event) {
    if (!getView().isVisible()) {
      return;
    }
    final Path sourcePath = event.getPath();
    final Path destinationPath = event.getDestinationPath();

    boolean refresh = false;
    if (Utils.isInFolderItem(activeFolderItem, sourcePath)) {
      refresh = true;
    } else if (Utils.isInFolderItem(activeFolderItem, destinationPath)) {
      refresh = true;
    }

    if (refresh) {
      explorerService
          .call(
              new RemoteCallback<FolderListing>() {
                @Override
                public void callback(final FolderListing folderListing) {
                  getView().setItems(folderListing);
                }
              },
              new DefaultErrorCallback())
          .getFolderListing(
              activeOrganizationalUnit,
              activeRepository,
              activeProject,
              activeFolderItem,
              getActiveOptions());
    }
  }
Exemplo n.º 2
0
 void onResourceRenamed(@Observes final ResourceRenamedEvent renamedEvent) {
   if (path != null && path.equals(renamedEvent.getPath())) {
     path = renamedEvent.getDestinationPath();
     if (sessionInfo.getId().equals(renamedEvent.getSessionInfo().getId())) {
       executeRenameCommands();
     } else {
       executeConcurrentRenameCommand(
           renamedEvent.getPath(),
           renamedEvent.getDestinationPath(),
           renamedEvent.getSessionInfo().getId(),
           renamedEvent.getSessionInfo().getIdentity());
     }
   }
 }