|
Lines 16-21
Link Here
|
| 16 |
import org.eclipse.jface.text.IDocument; |
16 |
import org.eclipse.jface.text.IDocument; |
| 17 |
import org.eclipse.jface.text.TextAttribute; |
17 |
import org.eclipse.jface.text.TextAttribute; |
| 18 |
import org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter; |
18 |
import org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter; |
|
|
19 |
import org.eclipse.jface.text.hyperlink.IHyperlink; |
| 19 |
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; |
20 |
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; |
| 20 |
import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter; |
21 |
import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter; |
| 21 |
import org.eclipse.jface.text.presentation.IPresentationReconciler; |
22 |
import org.eclipse.jface.text.presentation.IPresentationReconciler; |
|
Lines 35-43
Link Here
|
| 35 |
import org.eclipse.jface.text.source.ISourceViewer; |
36 |
import org.eclipse.jface.text.source.ISourceViewer; |
| 36 |
import org.eclipse.jface.text.source.SourceViewerConfiguration; |
37 |
import org.eclipse.jface.text.source.SourceViewerConfiguration; |
| 37 |
import org.eclipse.mylyn.internal.tasks.ui.TaskListColorsAndFonts; |
38 |
import org.eclipse.mylyn.internal.tasks.ui.TaskListColorsAndFonts; |
|
|
39 |
import org.eclipse.mylyn.tasks.core.AbstractTask; |
| 40 |
import org.eclipse.mylyn.tasks.core.TaskList; |
| 41 |
import org.eclipse.mylyn.tasks.ui.TaskHyperlink; |
| 38 |
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; |
42 |
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; |
| 39 |
import org.eclipse.swt.SWT; |
43 |
import org.eclipse.swt.SWT; |
| 40 |
import org.eclipse.swt.graphics.RGB; |
44 |
import org.eclipse.swt.graphics.RGB; |
|
|
45 |
import org.eclipse.swt.widgets.Control; |
| 41 |
|
46 |
|
| 42 |
/** |
47 |
/** |
| 43 |
* @author Rob Elves |
48 |
* @author Rob Elves |
|
Lines 95-102
Link Here
|
| 95 |
} |
100 |
} |
| 96 |
|
101 |
|
| 97 |
@Override |
102 |
@Override |
| 98 |
public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer) { |
103 |
public IHyperlinkPresenter getHyperlinkPresenter(final ISourceViewer sourceViewer) { |
| 99 |
return new DefaultHyperlinkPresenter(new RGB(0, 0, 200)); |
104 |
return new DefaultHyperlinkPresenter(new RGB(0, 0, 200)) { |
|
|
105 |
@Override |
| 106 |
public void showHyperlinks(IHyperlink[] hyperlinks) { |
| 107 |
super.showHyperlinks(hyperlinks); |
| 108 |
|
| 109 |
if (hyperlinks != null && hyperlinks.length > 0 && hyperlinks[0] instanceof TaskHyperlink) { |
| 110 |
TaskHyperlink hyperlink = (TaskHyperlink) hyperlinks[0]; |
| 111 |
|
| 112 |
TaskList taskList = TasksUiPlugin.getTaskListManager().getTaskList(); |
| 113 |
String repositoryUrl = hyperlink.getRepository().getUrl(); |
| 114 |
|
| 115 |
AbstractTask task = taskList.getTask(repositoryUrl, hyperlink.getTaskId()); |
| 116 |
if (task == null) { |
| 117 |
task = taskList.getTaskByKey(repositoryUrl, hyperlink.getTaskId()); |
| 118 |
} |
| 119 |
|
| 120 |
if (task != null) { |
| 121 |
Control cursorControl = sourceViewer.getTextWidget().getDisplay().getCursorControl(); |
| 122 |
if (task.getTaskKey() == null) { |
| 123 |
cursorControl.setToolTipText(task.getSummary()); |
| 124 |
} else { |
| 125 |
cursorControl.setToolTipText(task.getTaskKey() + ": " + task.getSummary()); |
| 126 |
} |
| 127 |
} |
| 128 |
} |
| 129 |
} |
| 130 |
|
| 131 |
@Override |
| 132 |
public void hideHyperlinks() { |
| 133 |
Control cursorControl = sourceViewer.getTextWidget().getDisplay().getCursorControl(); |
| 134 |
cursorControl.setToolTipText(null); |
| 135 |
|
| 136 |
super.hideHyperlinks(); |
| 137 |
} |
| 138 |
|
| 139 |
public void uninstall() { |
| 140 |
// ignore |
| 141 |
super.uninstall(); |
| 142 |
} |
| 143 |
}; |
| 100 |
} |
144 |
} |
| 101 |
|
145 |
|
| 102 |
@Override |
146 |
@Override |