View | Details | Raw Unified | Return to bug 191726 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java (-2 / +7 lines)
Lines 242-253 Link Here
242
		if (values != null && values.length() > 0) {
242
		if (values != null && values.length() > 0) {
243
			for (String bugNumber : values.split(",")) {
243
			for (String bugNumber : values.split(",")) {
244
				final String bugId = bugNumber.trim();
244
				final String bugId = bugNumber.trim();
245
				Hyperlink hyperlink = getManagedForm().getToolkit().createHyperlink(hyperlinksComposite, bugId,
245
				StrikethroughHyperlink hyperlink = new StrikethroughHyperlink(hyperlinksComposite, SWT.NONE
246
						SWT.NONE);
246
						| getManagedForm().getToolkit().getOrientation());
247
				hyperlink.setText(bugId);
248
				getManagedForm().getToolkit().adapt(hyperlink, true, true);
249
				getManagedForm().getToolkit().getHyperlinkGroup().add(hyperlink);
250
247
				final AbstractTask task = TasksUiPlugin.getTaskListManager().getTaskList().getTask(repository.getUrl(),
251
				final AbstractTask task = TasksUiPlugin.getTaskListManager().getTaskList().getTask(repository.getUrl(),
248
						bugId);
252
						bugId);
249
				if (task != null) {
253
				if (task != null) {
250
					hyperlink.setToolTipText(task.getSummary());
254
					hyperlink.setToolTipText(task.getSummary());
255
					hyperlink.setStrikethrough(task.isCompleted());
251
				}
256
				}
252
				hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
257
				hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
253
					@Override
258
					@Override
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/editor/StrikethroughHyperlink.java (+56 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.bugzilla.ui.editor;
10
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.graphics.GC;
13
import org.eclipse.swt.graphics.Point;
14
import org.eclipse.swt.graphics.Rectangle;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.ui.forms.widgets.Hyperlink;
17
18
19
/**
20
 * Compleded Tasks should been shown strikethrough
21
 * @author Frank Becker
22
 * @since 2.3
23
 */
24
public class StrikethroughHyperlink extends Hyperlink {
25
26
	private boolean strikethrough;
27
	
28
	public StrikethroughHyperlink(Composite parent, int style) {
29
		super(parent, style);
30
		strikethrough = false;
31
	}
32
33
	public boolean isStrikethrough() {
34
		return strikethrough;
35
	}
36
37
	public void setStrikethrough(boolean strikethrough) {
38
		this.strikethrough = strikethrough;
39
	}
40
41
	@Override
42
	protected void paintText(GC gc, Rectangle bounds) {
43
		super.paintText(gc, bounds);
44
45
		if (strikethrough) {
46
			Point totalSize = computeTextSize(SWT.DEFAULT, SWT.DEFAULT);
47
			int textWidth = Math.min(bounds.width, totalSize.x);
48
			int textHeight = totalSize.y;
49
50
//			int descent = gc.getFontMetrics().getDescent();
51
			int lineY = bounds.y + (textHeight / 2); // - descent + 1;
52
			gc.drawLine(bounds.x, lineY, bounds.x + textWidth, lineY);
53
		}
54
	}
55
56
}

Return to bug 191726