((UploadProgress) su).setVisible(false); ((UploadProgress) su).dispose();
((UploadProgress) su).done();
		void runTask() {			ArrayList pictures = g.getAllUploadablePictures();			su.startProgress(StatusUpdate.LEVEL_UPLOAD_PROGRESS, 0, pictures.size(), GRI18n.getString(MODULE, "upPic"), false);			if (su instanceof UploadProgress) {				((UploadProgress) su).setCancelListener(new ActionListener() {					public void actionPerformed(ActionEvent e) {						((UploadProgress) su).updateProgressStatus(StatusUpdate.LEVEL_UPLOAD_PROGRESS, GRI18n.getString(MODULE, "upStop"));						((UploadProgress) su).setUndetermined(StatusUpdate.LEVEL_UPLOAD_PROGRESS, true);						interrupt();						long startTime = System.currentTimeMillis();						while (!terminated && System.currentTimeMillis() < startTime + 10000) {							try {								Thread.sleep(1000);							} catch (InterruptedException e1) {							}						}						if (!terminated) {							Log.log(Log.LEVEL_ERROR, "Thread would not terminate properly: killing it");							thread.stop();							// since we killed the thread, it's not going to clean up after itself							cleanUp();						}						((UploadProgress) su).setVisible(false);						((UploadProgress) su).dispose();					}				});			}			// upload each file, one at a time			boolean allGood = true;			int uploadedCount = 0;			Iterator iter = pictures.iterator();			while (iter.hasNext() /*&& allGood*/ && !interrupt) {				Picture p = (Picture) iter.next();				Object[] params = {p.toString(), new Integer((uploadedCount + 1)), new Integer(pictures.size())};				su.updateProgressStatus(StatusUpdate.LEVEL_UPLOAD_PROGRESS, GRI18n.getString(MODULE, "upStatus", params));				allGood = uploadPicture(p, p);				su.updateProgressValue(StatusUpdate.LEVEL_UPLOAD_PROGRESS, ++uploadedCount);				if (allGood) {					p.getParentAlbum().removePicture(p);				}			}			if (allGood) {				su.stopProgress(StatusUpdate.LEVEL_UPLOAD_PROGRESS, GRI18n.getString(MODULE, "upComplete"));				if (su instanceof UploadProgress) {					if (((UploadProgress) su).isShutdown()) {						GalleryRemote._().getCore().shutdown(true);					}				}				g.setDirty(false);				GalleryRemote._().getCore().flushMemory();			} else {				su.stopProgress(StatusUpdate.LEVEL_UPLOAD_PROGRESS, GRI18n.getString(MODULE, "upFailed"));			}		}