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 194070 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java (-38 / +39 lines)
Lines 15-20 Link Here
15
package org.eclipse.mylyn.internal.tasks.ui.views;
15
package org.eclipse.mylyn.internal.tasks.ui.views;
16
16
17
import java.text.DateFormat;
17
import java.text.DateFormat;
18
import java.text.SimpleDateFormat;
18
import java.util.Calendar;
19
import java.util.Calendar;
19
import java.util.Date;
20
import java.util.Date;
20
21
Lines 116-122 Link Here
116
			return sb.toString();
117
			return sb.toString();
117
		} else if (element instanceof AbstractTask) {
118
		} else if (element instanceof AbstractTask) {
118
			AbstractTask task = (AbstractTask) element;
119
			AbstractTask task = (AbstractTask) element;
119
			StringBuilder sb = new StringBuilder();
120
			StringBuilder sb = new StringBuilder();			
120
			sb.append(TasksUiPlugin.getConnectorUi(task.getConnectorKind()).getTaskKindLabel(task));
121
			sb.append(TasksUiPlugin.getConnectorUi(task.getConnectorKind()).getTaskKindLabel(task));
121
			String key = task.getTaskKey();
122
			String key = task.getTaskKey();
122
			if (key != null) {
123
			if (key != null) {
Lines 155-164 Link Here
155
			Date date = task.getScheduledForDate();
156
			Date date = task.getScheduledForDate();
156
			if (date != null) {
157
			if (date != null) {
157
				sb.append("Scheduled for: ");
158
				sb.append("Scheduled for: ");
159
				sb.append(new SimpleDateFormat("E").format(date)).append(", ");
158
				sb.append(DateFormat.getDateInstance(DateFormat.LONG).format(date));
160
				sb.append(DateFormat.getDateInstance(DateFormat.LONG).format(date));
159
				sb.append(" (");
161
				sb.append(" (").append(DateFormat.getTimeInstance(DateFormat.SHORT).format(date)).append(")\n");
160
				sb.append(DateFormat.getTimeInstance(DateFormat.SHORT).format(date));
161
				sb.append(")\n");
162
			}
162
			}
163
163
164
			long elapsed = TasksUiPlugin.getTaskListManager().getElapsedTime(task);
164
			long elapsed = TasksUiPlugin.getTaskListManager().getElapsedTime(task);
Lines 203-209 Link Here
203
			AbstractRepositoryQuery query = (AbstractRepositoryQuery) element;
203
			AbstractRepositoryQuery query = (AbstractRepositoryQuery) element;
204
			status = query.getSynchronizationStatus();
204
			status = query.getSynchronizationStatus();
205
		}
205
		}
206
206
		
207
		if (status != null) {
207
		if (status != null) {
208
			StringBuilder sb = new StringBuilder();
208
			StringBuilder sb = new StringBuilder();
209
			sb.append(status.getMessage());
209
			sb.append(status.getMessage());
Lines 211-218 Link Here
211
				sb.append(" Please synchronize manually for full error message.");
211
				sb.append(" Please synchronize manually for full error message.");
212
			}
212
			}
213
			return sb.toString();
213
			return sb.toString();
214
		}
214
		} 
215
215
		
216
		return null;
216
		return null;
217
	}
217
	}
218
218
Lines 229-235 Link Here
229
			}
229
			}
230
		}
230
		}
231
231
232
		String text = "Completed " + completed + " of " + total;
232
		String text = "Open: " + (total - completed) + "  Completed: " + completed + "  Total: " + total;
233
		return new ProgressData(completed, total, text);
233
		return new ProgressData(completed, total, text);
234
	}
234
	}
235
235
Lines 312-324 Link Here
312
					Tree w = (Tree) widget;
312
					Tree w = (Tree) widget;
313
					widget = w.getItem(widgetPosition);
313
					widget = w.getItem(widgetPosition);
314
				}
314
				}
315
315
				
316
				if (widget == null) {
316
				if (widget == null) {
317
					hideTooltip();
317
					hideTooltip();
318
					tipWidget = null;
318
					tipWidget = null;
319
					return;
319
					return;
320
				}
320
				}
321
321
				
322
				if (widget == tipWidget) {
322
				if (widget == tipWidget) {
323
					// already displaying tooltip
323
					// already displaying tooltip
324
					return;
324
					return;
Lines 391-397 Link Here
391
		tipShell = new Shell(parent.getDisplay(), SWT.TOOL | SWT.NO_FOCUS | SWT.MODELESS | SWT.ON_TOP);
391
		tipShell = new Shell(parent.getDisplay(), SWT.TOOL | SWT.NO_FOCUS | SWT.MODELESS | SWT.ON_TOP);
392
		GridLayout gridLayout = new GridLayout();
392
		GridLayout gridLayout = new GridLayout();
393
		gridLayout.numColumns = 2;
393
		gridLayout.numColumns = 2;
394
		gridLayout.marginWidth = 2;
394
		gridLayout.marginWidth = 5;
395
		gridLayout.marginHeight = 2;
395
		gridLayout.marginHeight = 2;
396
		tipShell.setLayout(gridLayout);
396
		tipShell.setLayout(gridLayout);
397
		tipShell.setBackground(tipShell.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
397
		tipShell.setBackground(tipShell.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
Lines 403-413 Link Here
403
			addIconAndLabel(tipShell, null, detailsText);
403
			addIconAndLabel(tipShell, null, detailsText);
404
		}
404
		}
405
405
406
		String statusText = getStatusText(element);
407
		if (statusText != null) {
408
			addIconAndLabel(tipShell, TasksUiImages.getImage(TasksUiImages.WARNING), statusText);
409
		}
410
411
		String synchText = getSynchText(element);
406
		String synchText = getSynchText(element);
412
		if (synchText != null) {
407
		if (synchText != null) {
413
			addIconAndLabel(tipShell, TasksUiImages.getImage(TasksUiImages.REPOSITORY_SYNCHRONIZE), synchText);
408
			addIconAndLabel(tipShell, TasksUiImages.getImage(TasksUiImages.REPOSITORY_SYNCHRONIZE), synchText);
Lines 425-447 Link Here
425
420
426
		ProgressData progress = getProgressData(element);
421
		ProgressData progress = getProgressData(element);
427
		if (progress != null) {
422
		if (progress != null) {
428
			addLabel(tipShell, progress.text);
423
			addIconAndLabel(tipShell, null, progress.text);
429
424
425
			// label height need to be set to 0 to remove gap below the progress bar 
426
			Label label = new Label(tipShell, SWT.NONE);
427
			GridData labelGridData = new GridData(SWT.FILL, SWT.TOP, true, false);
428
			labelGridData.heightHint = 0;
429
			label.setLayoutData(labelGridData);
430
			
430
			Composite progressComposite = new Composite(tipShell, SWT.NONE);
431
			Composite progressComposite = new Composite(tipShell, SWT.NONE);
431
			GridLayout progressLayout = new GridLayout(1, false);
432
			GridLayout progressLayout = new GridLayout(1, false);
432
			progressLayout.marginWidth = 2;
433
			progressLayout.marginWidth = 0;
433
			progressLayout.marginHeight = 0;
434
			progressLayout.marginHeight = 0;
434
			progressLayout.marginBottom = 2;
435
			progressLayout.horizontalSpacing = 0;
436
			progressLayout.verticalSpacing = 0;
437
			progressComposite.setLayout(progressLayout);
435
			progressComposite.setLayout(progressLayout);
438
			progressComposite.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 4, 1));
436
			progressComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
439
437
440
			WorkweekProgressBar taskProgressBar = new WorkweekProgressBar(progressComposite);
438
			WorkweekProgressBar taskProgressBar = new WorkweekProgressBar(progressComposite);
441
			taskProgressBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
439
			taskProgressBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
442
			taskProgressBar.reset(progress.completed, progress.total);
440
			taskProgressBar.reset(progress.completed, progress.total);
441
442
			// do we really need custom canvas? code below renders the same
443
//			IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
444
//			Color color = themeManager.getCurrentTheme().getColorRegistry().get(
445
//					TaskListColorsAndFonts.THEME_COLOR_TASK_TODAY_COMPLETED);
446
//			ProgressBar bar = new ProgressBar(tipShell, SWT.SMOOTH);
447
//			bar.setForeground(color);
448
//			bar.setSelection((int) (100d * progress.completed / progress.total));
449
//			GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
450
//			gridData.heightHint = 5;
451
//			bar.setLayoutData(gridData);
443
		}
452
		}
444
453
454
		String statusText = getStatusText(element);
455
		if (statusText != null) {
456
			addIconAndLabel(tipShell, TasksUiImages.getImage(TasksUiImages.WARNING), statusText);
457
		}
458
		
445
		tipShell.pack();
459
		tipShell.pack();
446
		setHoverLocation(tipShell, location);
460
		setHoverLocation(tipShell, location);
447
		tipShell.setVisible(true);
461
		tipShell.setVisible(true);
Lines 457-473 Link Here
457
		return null;
471
		return null;
458
	}
472
	}
459
473
460
	private void addLabel(Shell parent, String text) {
461
		Label textLabel = new Label(parent, SWT.NONE);
462
		textLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
463
		textLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
464
		textLabel.setAlignment(SWT.CENTER);
465
		GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
466
		gd.horizontalSpan = 2;
467
		textLabel.setLayoutData(gd);
468
		textLabel.setText(removeTrailingNewline(text));
469
	}
470
471
	private String removeTrailingNewline(String text) {
474
	private String removeTrailingNewline(String text) {
472
		if (text.endsWith("\n")) {
475
		if (text.endsWith("\n")) {
473
			return text.substring(0, text.length() - 1);
476
			return text.substring(0, text.length() - 1);
Lines 479-493 Link Here
479
		Label imageLabel = new Label(parent, SWT.NONE);
482
		Label imageLabel = new Label(parent, SWT.NONE);
480
		imageLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
483
		imageLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
481
		imageLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
484
		imageLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
482
		GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
485
		imageLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
483
		imageLabel.setLayoutData(gd);
484
		imageLabel.setImage(image);
486
		imageLabel.setImage(image);
485
487
486
		Label textLabel = new Label(parent, SWT.NONE);
488
		Label textLabel = new Label(parent, SWT.NONE);
487
		textLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
489
		textLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
488
		textLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
490
		textLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
489
		gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
491
		textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
490
		textLabel.setLayoutData(gd);
491
		textLabel.setText(removeTrailingNewline(text));
492
		textLabel.setText(removeTrailingNewline(text));
492
	}
493
	}

Return to bug 194070