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

Return to bug 194070