Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 132029 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/update/internal/ui/wizards/TargetPage.java (+20 lines)
Lines 250-255 Link Here
250
		File file = new File(site.getSite().getURL().getFile());
250
		File file = new File(site.getSite().getURL().getFile());
251
		long available = LocalSystemInfo.getFreeSpace(file);
251
		long available = LocalSystemInfo.getFreeSpace(file);
252
		long required = computeRequiredSizeFor(site);
252
		long required = computeRequiredSizeFor(site);
253
		//add the download size to space required to do operation since all plugins and nonplugin data will be downloaded first
254
		required += computeDownloadSizeFor(site); 
253
		if (required <= 0)
255
		if (required <= 0)
254
			requiredSpaceLabel.setText(UpdateUIMessages.InstallWizard_TargetPage_unknownSize); 
256
			requiredSpaceLabel.setText(UpdateUIMessages.InstallWizard_TargetPage_unknownSize); 
255
		else
257
		else
Lines 261-266 Link Here
261
		else
263
		else
262
			availableSpaceLabel.setText(
264
			availableSpaceLabel.setText(
263
				NLS.bind(UpdateUIMessages.InstallWizard_TargetPage_size, "" + available)); //$NON-NLS-1$
265
				NLS.bind(UpdateUIMessages.InstallWizard_TargetPage_size, "" + available)); //$NON-NLS-1$
266
		if(required > available){
267
			this.setPageComplete(false);
268
			//TODO: set error message: "...not enough space..."
269
		}else
270
			this.setPageComplete(true);
264
	}
271
	}
265
272
266
	private long computeRequiredSizeFor(IConfiguredSite site) {
273
	private long computeRequiredSizeFor(IConfiguredSite site) {
Lines 275-280 Link Here
275
		}
282
		}
276
		return totalSize;
283
		return totalSize;
277
	}
284
	}
285
	
286
	private long computeDownloadSizeFor(IConfiguredSite site) {
287
		long totalSize = 0;
288
		for (int i = 0; i < jobs.length; i++) {
289
			if (site.equals(jobs[i].getTargetSite())) {
290
				long jobSize = site.getSite().getDownloadSizeFor(jobs[i].getFeature());
291
				if (jobSize == -1)
292
					return -1;
293
				totalSize += jobSize;
294
			}
295
		}
296
		return totalSize;
297
	}
278
298
279
	private void pageChanged() {
299
	private void pageChanged() {
280
		boolean empty = false;
300
		boolean empty = false;

Return to bug 132029