@@ -0,0 +1,1677 @@
+package imagej.updater.core.action;%0A%0Aimport imagej.updater.core.FileObject;%0Aimport imagej.updater.core.FileObject.Action;%0Aimport imagej.updater.core.FileObject.Status;%0Aimport imagej.updater.core.FilesCollection;%0Aimport imagej.updater.core.GroupAction;%0A%0Aimport java.util.Collection;%0A%0Apublic class UploadOrRemove implements GroupAction %7B%0A%0A%09private String updateSite;%0A%0A%09public UploadOrRemove(final String updateSite) %7B%0A%09%09this.updateSite = updateSite;%0A%09%7D%0A%0A%09@Override%0A%09public boolean isValid(FilesCollection files, FileObject file) %7B%0A%09%09final Status status = file.getStatus();%0A%09%09if (!updateSite.equals(file.updateSite)) %7B%0A%09%09%09if (status == Status.LOCAL_ONLY) return true;%0A%09%09%09return false;%0A%09%09%7D%0A%09%09if (!status.isValid(Action.UPLOAD) && !status.isValid(Action.REMOVE)) return false;%0A%09%09final Collection%3CString%3E sites = files.getSiteNamesToUpload();%0A%09%09return sites.size() == 0 %7C%7C sites.contains(updateSite);%0A%09%7D%0A%0A%09@Override%0A%09public void setAction(FilesCollection files, FileObject file) %7B%0A%09%09file.updateSite = updateSite;%0A%09%09file.setFirstValidAction(files, Action.UPLOAD, Action.REMOVE);%0A%09%7D%0A%0A%09@Override%0A%09public String getLabel(FilesCollection files, Iterable%3CFileObject%3E selected) %7B%0A%09%09boolean upload = false, remove = false;%0A%09%09for (final FileObject file : selected) %7B%0A%09%09%09final Status status = file.getStatus();%0A%09%09%09upload = upload %7C%7C status.isValid(Action.UPLOAD);%0A%09%09%09remove = remove %7C%7C status.isValid(Action.REMOVE);%0A%09%09%7D%0A%09%09if (!(upload %5E remove)) return %22Upload to %22 + updateSite + %22 / Mark Obsolete%22;%0A%09%09return remove ? %22Mark Obsolete (%22 + updateSite + %22)%22: (%22Upload to %22 + updateSite);%0A%09%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09return %22Upload to %22 + updateSite + %22 / Mark Obsolete%22;%0A%09%7D%0A%0A%7D%0A

introduce a group action for uploading/removing