Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0b3e32c22b8a160a5597e6d3c2c2f41a21fd360e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*******************************************************************************
 * Copyright (c) 2004, 2010 Tasktop Technologies and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Tasktop Technologies - initial API and implementation
 *     Frank Becker - improvements
 *******************************************************************************/

package org.eclipse.mylyn.internal.tasks.ui;

import org.eclipse.mylyn.internal.provisional.commons.ui.CommonColors;
import org.eclipse.mylyn.internal.provisional.commons.ui.ScalingHyperlink;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;

/**
 * @author Mik Kersten
 * @author Steffen Pingel
 * @author Frank Becker
 */
public class TaskScalingHyperlink extends ScalingHyperlink {

	private ITask task;

	public TaskScalingHyperlink(Composite parent, int style) {
		super(parent, style);
		setForeground(CommonColors.HYPERLINK_WIDGET);
		addMouseTrackListener(MOUSE_TRACK_LISTENER);
	}

	public ITask getTask() {
		return task;
	}

	public void setTask(ITask task) {
		this.task = task;
		if (task != null) {
			if ((getStyle() & SWT.SHORT) != 0) {
				setText(task.getTaskKey());
				setToolTipText(task.getTaskKey() + ": " + task.getSummary()); //$NON-NLS-1$
				setStrikeThrough(task.isCompleted());
			} else {
				setText(task.getSummary());
				setToolTipText(""); //$NON-NLS-1$
				setStrikeThrough(false);
			}
		} else {
			setText(""); //$NON-NLS-1$
			setToolTipText(""); //$NON-NLS-1$
			setStrikeThrough(false);
		}
		setUnderlined(false);
	}

}

Back to the top