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

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentHyperlink.java (-2 / +73 lines)
Lines 17-24 Link Here
17
import org.eclipse.jface.text.IRegion;
17
import org.eclipse.jface.text.IRegion;
18
import org.eclipse.jface.text.hyperlink.IHyperlink;
18
import org.eclipse.jface.text.hyperlink.IHyperlink;
19
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
19
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
20
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonFormUtil;
21
import org.eclipse.mylyn.internal.tasks.core.TaskAttachment;
22
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
23
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
24
import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
25
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorAttachmentPart;
20
import org.eclipse.mylyn.tasks.core.TaskRepository;
26
import org.eclipse.mylyn.tasks.core.TaskRepository;
21
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
27
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
28
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
29
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
30
import org.eclipse.swt.widgets.Composite;
31
import org.eclipse.swt.widgets.Control;
32
import org.eclipse.swt.widgets.TableItem;
33
import org.eclipse.ui.IEditorPart;
34
import org.eclipse.ui.IWorkbenchPage;
35
import org.eclipse.ui.IWorkbenchWindow;
36
import org.eclipse.ui.PlatformUI;
37
import org.eclipse.ui.forms.IManagedForm;
38
import org.eclipse.ui.forms.widgets.ExpandableComposite;
39
import org.eclipse.ui.forms.widgets.ScrolledForm;
40
import org.eclipse.ui.forms.widgets.Section;
22
41
23
/**
42
/**
24
 * @since 3.2
43
 * @since 3.2
Lines 51-58 Link Here
51
		return null;
70
		return null;
52
	}
71
	}
53
72
73
	@SuppressWarnings("restriction")
54
	public void open() {
74
	public void open() {
55
		String url = repository.getUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentId;
75
		if (TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
56
		TasksUiUtil.openUrl(url);
76
				ITasksUiPreferenceConstants.ATTACHMENT_LINK_TO_BROWSER)) {
77
			String url = repository.getUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentId;
78
			TasksUiUtil.openUrl(url);
79
		} else {
80
			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
81
			if (window != null) {
82
				IWorkbenchPage page = window.getActivePage();
83
				if (page != null) {
84
					IEditorPart editor = page.getActiveEditor();
85
					if (editor != null && editor instanceof TaskEditor) {
86
						TaskEditor te = ((TaskEditor) editor);
87
						Object sp = te.getSelectedPage();
88
						if (sp != null && sp instanceof AbstractTaskEditorPage) {
89
							AbstractTaskEditorPage aat = ((AbstractTaskEditorPage) sp);
90
							TaskEditorAttachmentPart actionPart = (TaskEditorAttachmentPart) aat.getPart(AbstractTaskEditorPage.ID_PART_ATTACHMENTS);
91
							if (actionPart != null && actionPart.getControl() instanceof ExpandableComposite) {
92
								CommonFormUtil.setExpanded((ExpandableComposite) actionPart.getControl(), true);
93
								if (actionPart.getControl() instanceof Section) {
94
									Control client = actionPart.getControl();
95
									if (client instanceof Composite) {
96
										for (Control control : ((Composite) client).getChildren()) {
97
											if (control instanceof Composite) {
98
												for (Control control1 : ((Composite) control).getChildren()) {
99
													if (control1 instanceof org.eclipse.swt.widgets.Table) {
100
														org.eclipse.swt.widgets.Table attachmentTable = ((org.eclipse.swt.widgets.Table) control1);
101
														TableItem[] attachments = attachmentTable.getItems();
102
														int index = 0;
103
														for (TableItem attachment : attachments) {
104
															TaskAttachment attachmentData = ((TaskAttachment) attachment.getData());
105
															if (attachmentData.getTaskAttribute().getValue().equals(
106
																	attachmentId)) {
107
																attachmentTable.deselectAll();
108
																attachmentTable.select(index);
109
																IManagedForm mform = actionPart.getManagedForm();
110
																ScrolledForm form = mform.getForm();
111
																EditorUtil.focusOn(form, attachmentTable, 30);
112
																break;
113
															}
114
															index++;
115
														}
116
													}
117
												}
118
											}
119
										}
120
									}
121
								}
122
							}
123
						}
124
					}
125
				}
126
			}
127
		}
57
	}
128
	}
58
}
129
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java (+2 lines)
Lines 83-88 Link Here
83
83
84
	public static final String TASK_LIST_TOOL_TIPS_ENABLED = "org.eclipse.mylyn.tasks.ui.task.list.tool.tip"; //$NON-NLS-1$
84
	public static final String TASK_LIST_TOOL_TIPS_ENABLED = "org.eclipse.mylyn.tasks.ui.task.list.tool.tip"; //$NON-NLS-1$
85
85
86
	public static final String ATTACHMENT_LINK_TO_BROWSER = "org.eclipse.mylyn.tasks.ui.task.editor.attachment.link.browser"; //$NON-NLS-1$
87
86
	// NOTE: legacy name, do not change
88
	// NOTE: legacy name, do not change
87
	public static final String PREF_DATA_DIR = "org.eclipse.mylyn.data.dir"; //$NON-NLS-1$
89
	public static final String PREF_DATA_DIR = "org.eclipse.mylyn.data.dir"; //$NON-NLS-1$
88
90
(-)src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java (-2 / +3 lines)
Lines 69-76 Link Here
69
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
69
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
70
import org.eclipse.mylyn.internal.tasks.core.TaskList;
70
import org.eclipse.mylyn.internal.tasks.core.TaskList;
71
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta;
71
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta;
72
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
73
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
72
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
73
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
74
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
74
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
75
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataStore;
75
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataStore;
76
import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
76
import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
Lines 85-96 Link Here
85
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
85
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
86
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
86
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
87
import org.eclipse.mylyn.tasks.core.ITask;
87
import org.eclipse.mylyn.tasks.core.ITask;
88
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
88
import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
89
import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
89
import org.eclipse.mylyn.tasks.core.ITaskContainer;
90
import org.eclipse.mylyn.tasks.core.ITaskContainer;
90
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
91
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
91
import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
92
import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
92
import org.eclipse.mylyn.tasks.core.TaskRepository;
93
import org.eclipse.mylyn.tasks.core.TaskRepository;
93
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
94
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
94
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
95
import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
95
import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
96
import org.eclipse.mylyn.tasks.ui.TasksUi;
96
import org.eclipse.mylyn.tasks.ui.TasksUi;
Lines 894-899 Link Here
894
894
895
		store.setDefault(ITasksUiPreferenceConstants.AUTO_EXPAND_TASK_LIST, true);
895
		store.setDefault(ITasksUiPreferenceConstants.AUTO_EXPAND_TASK_LIST, true);
896
		store.setDefault(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED, true);
896
		store.setDefault(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED, true);
897
		store.setDefault(ITasksUiPreferenceConstants.ATTACHMENT_LINK_TO_BROWSER, true);
897
	}
898
	}
898
899
899
	public static TaskActivityManager getTaskActivityManager() {
900
	public static TaskActivityManager getTaskActivityManager() {
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java (-5 / +9 lines)
Lines 148-159 Link Here
148
	}
148
	}
149
149
150
	/**
150
	/**
151
	 * Scroll to a specified piece of text
151
	 * Scroll to a specified control
152
	 * 
152
	 * 
153
	 * @param form
154
	 *            The ScrolledForm we want to set the new Origin
153
	 * @param control
155
	 * @param control
154
	 *            The StyledText to scroll to
156
	 *            Control that should be visible
157
	 * @param topSpace
158
	 *            Space on top of the Control
155
	 */
159
	 */
156
	private static void focusOn(ScrolledForm form, Control control) {
160
	public static void focusOn(ScrolledForm form, Control control, int topSpace) {
157
		int pos = 0;
161
		int pos = 0;
158
		control.setEnabled(true);
162
		control.setEnabled(true);
159
		control.setFocus();
163
		control.setFocus();
Lines 163-169 Link Here
163
			control = control.getParent();
167
			control = control.getParent();
164
		}
168
		}
165
169
166
		pos = pos - 60; // form.getOrigin().y;
170
		pos = pos - topSpace;
167
		if (!form.getBody().isDisposed()) {
171
		if (!form.getBody().isDisposed()) {
168
			form.setOrigin(0, pos);
172
			form.setOrigin(0, pos);
169
		}
173
		}
Lines 277-283 Link Here
277
				}
281
				}
278
				comp = comp.getParent();
282
				comp = comp.getParent();
279
			}
283
			}
280
			focusOn(form, control);
284
			focusOn(form, control, 60);
281
		}
285
		}
282
		return true;
286
		return true;
283
	}
287
	}
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java (+2 lines)
Lines 153-158 Link Here
153
153
154
	public static String TaskEditorNewCommentPart_New_Comment;
154
	public static String TaskEditorNewCommentPart_New_Comment;
155
155
156
	public static String TaskEditorOutlineNode_Attachments;
157
156
	public static String TaskEditorOutlineNode_Comments;
158
	public static String TaskEditorOutlineNode_Comments;
157
159
158
	public static String TaskEditorOutlineNode_Description;
160
	public static String TaskEditorOutlineNode_Description;
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java (+45 lines)
Lines 17-23 Link Here
17
17
18
import org.eclipse.core.runtime.Assert;
18
import org.eclipse.core.runtime.Assert;
19
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
19
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
20
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
20
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
21
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
22
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
21
import org.eclipse.mylyn.tasks.core.ITaskComment;
23
import org.eclipse.mylyn.tasks.core.ITaskComment;
22
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
24
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
23
import org.eclipse.mylyn.tasks.core.data.TaskData;
25
import org.eclipse.mylyn.tasks.core.data.TaskData;
Lines 28-33 Link Here
28
 * @author Steffen Pingel
30
 * @author Steffen Pingel
29
 */
31
 */
30
public class TaskEditorOutlineNode {
32
public class TaskEditorOutlineNode {
33
	public static final String LABEL_ATTACHMENTS = Messages.TaskEditorOutlineNode_Attachments;
31
34
32
	public static final String LABEL_COMMENTS = Messages.TaskEditorOutlineNode_Comments;
35
	public static final String LABEL_COMMENTS = Messages.TaskEditorOutlineNode_Comments;
33
36
Lines 69-74 Link Here
69
				node.setTaskComment(taskComment);
72
				node.setTaskComment(taskComment);
70
				return node;
73
				return node;
71
			}
74
			}
75
		}
76
		if (TaskAttribute.TYPE_ATTACHMENT.equals(type)) {
77
			ITaskAttachment taskAttachment = TasksUiPlugin.getRepositoryModel().createTaskAttachment(taskAttribute);
78
			if (taskAttachment != null) {
79
				taskAttribute.getTaskData().getAttributeMapper().updateTaskAttachment(taskAttachment, taskAttribute);
80
				StringBuilder sb = new StringBuilder();
81
				sb.append(taskAttribute.getTaskData().getAttributeMapper().getValueLabel(taskAttribute));
82
				sb.append(": "); //$NON-NLS-1$
83
				if (AttachmentUtil.isContext(taskAttachment)) {
84
					sb.append(Messages.AttachmentTableLabelProvider_Task_Context);
85
				} else if (taskAttachment.isPatch()) {
86
					sb.append(Messages.AttachmentTableLabelProvider_Patch);
87
				} else {
88
					sb.append(taskAttachment.getFileName());
89
				}
90
				TaskEditorOutlineNode node = new TaskEditorOutlineNode(sb.toString(), taskAttribute);
91
				node.setTaskAttachment(taskAttachment);
92
				return node;
93
			}
94
72
		} else {
95
		} else {
73
			String label = taskAttribute.getTaskData().getAttributeMapper().getValueLabel(taskAttribute);
96
			String label = taskAttribute.getTaskData().getAttributeMapper().getValueLabel(taskAttribute);
74
			return new TaskEditorOutlineNode(label, taskAttribute);
97
			return new TaskEditorOutlineNode(label, taskAttribute);
Lines 82-87 Link Here
82
			rootNode = new TaskEditorOutlineNode(Messages.TaskEditorOutlineNode_Task_ + taskData.getTaskId());
105
			rootNode = new TaskEditorOutlineNode(Messages.TaskEditorOutlineNode_Task_ + taskData.getTaskId());
83
		}
106
		}
84
		addNode(rootNode, taskData, TaskAttribute.DESCRIPTION, LABEL_DESCRIPTION);
107
		addNode(rootNode, taskData, TaskAttribute.DESCRIPTION, LABEL_DESCRIPTION);
108
		List<TaskAttribute> attachments = taskData.getAttributeMapper().getAttributesByType(taskData,
109
				TaskAttribute.TYPE_ATTACHMENT);
110
		if (attachments.size() > 0) {
111
			TaskEditorOutlineNode attachmentNode = new TaskEditorOutlineNode(LABEL_ATTACHMENTS);
112
			rootNode.addChild(attachmentNode);
113
			for (TaskAttribute attachmentAttribute : attachments) {
114
				TaskEditorOutlineNode node = createNode(attachmentAttribute);
115
				if (node != null) {
116
					attachmentNode.addChild(node);
117
				}
118
			}
119
		}
85
		List<TaskAttribute> comments = taskData.getAttributeMapper().getAttributesByType(taskData,
120
		List<TaskAttribute> comments = taskData.getAttributeMapper().getAttributesByType(taskData,
86
				TaskAttribute.TYPE_COMMENT);
121
				TaskAttribute.TYPE_COMMENT);
87
		if (comments.size() > 0) {
122
		if (comments.size() > 0) {
Lines 118-123 Link Here
118
153
119
	private ITaskComment taskComment;
154
	private ITaskComment taskComment;
120
155
156
	private ITaskAttachment taskAttachment;
157
121
	public TaskEditorOutlineNode(String label) {
158
	public TaskEditorOutlineNode(String label) {
122
		this(label, null);
159
		this(label, null);
123
	}
160
	}
Lines 183-186 Link Here
183
		return getLabel();
220
		return getLabel();
184
	}
221
	}
185
222
223
	public ITaskAttachment getTaskAttachment() {
224
		return taskAttachment;
225
	}
226
227
	public void setTaskAttachment(ITaskAttachment taskAttachment) {
228
		this.taskAttachment = taskAttachment;
229
	}
230
186
}
231
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlinePage.java (+28 lines)
Lines 16-27 Link Here
16
import org.eclipse.jface.viewers.TreeViewer;
16
import org.eclipse.jface.viewers.TreeViewer;
17
import org.eclipse.jface.viewers.Viewer;
17
import org.eclipse.jface.viewers.Viewer;
18
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
18
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
19
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
19
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
20
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
21
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
20
import org.eclipse.mylyn.tasks.core.TaskRepository;
22
import org.eclipse.mylyn.tasks.core.TaskRepository;
21
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
23
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
22
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
24
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
23
import org.eclipse.swt.graphics.Image;
25
import org.eclipse.swt.graphics.Image;
24
import org.eclipse.swt.widgets.Composite;
26
import org.eclipse.swt.widgets.Composite;
27
import org.eclipse.ui.ISharedImages;
28
import org.eclipse.ui.internal.WorkbenchImages;
25
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
29
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
26
30
27
/**
31
/**
Lines 92-97 Link Here
92
96
93
	private TreeViewer viewer;
97
	private TreeViewer viewer;
94
98
99
	private static final String[] IMAGE_EXTENSIONS = { "jpg", "gif", "png", "tiff", "tif", "bmp" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
100
95
	public TaskEditorOutlinePage() {
101
	public TaskEditorOutlinePage() {
96
	}
102
	}
97
103
Lines 132-137 Link Here
132
						} else {
138
						} else {
133
							return CommonImages.getImage(CommonImages.PERSON);
139
							return CommonImages.getImage(CommonImages.PERSON);
134
						}
140
						}
141
					} else if (node.getTaskAttachment() != null) {
142
						ITaskAttachment attachment = node.getTaskAttachment();
143
						if (AttachmentUtil.isContext(attachment)) {
144
							return CommonImages.getImage(TasksUiImages.CONTEXT_TRANSFER);
145
						} else if (attachment.isPatch()) {
146
							return CommonImages.getImage(TasksUiImages.TASK_ATTACHMENT_PATCH);
147
						} else {
148
							String filename = attachment.getFileName();
149
							if (filename != null) {
150
								int dotIndex = filename.lastIndexOf('.');
151
								if (dotIndex != -1) {
152
									String fileType = filename.substring(dotIndex + 1);
153
									for (String element2 : IMAGE_EXTENSIONS) {
154
										if (element2.equalsIgnoreCase(fileType)) {
155
											return CommonImages.getImage(CommonImages.IMAGE_FILE);
156
										}
157
									}
158
								}
159
							}
160
							return WorkbenchImages.getImage(ISharedImages.IMG_OBJ_FILE);
161
						}
162
135
					} else {
163
					} else {
136
						return CommonImages.getImage(TasksUiImages.TASK);
164
						return CommonImages.getImage(TasksUiImages.TASK);
137
					}
165
					}
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties (+1 lines)
Lines 85-90 Link Here
85
TaskEditorDescriptionPart_Search=Search
85
TaskEditorDescriptionPart_Search=Search
86
86
87
TaskEditorNewCommentPart_New_Comment=New Comment
87
TaskEditorNewCommentPart_New_Comment=New Comment
88
TaskEditorOutlineNode_Attachments=Attachments
88
TaskEditorOutlineNode_Comments=Comments
89
TaskEditorOutlineNode_Comments=Comments
89
TaskEditorOutlineNode_Description=Description
90
TaskEditorOutlineNode_Description=Description
90
TaskEditorOutlineNode_New_Comment=New Comment
91
TaskEditorOutlineNode_New_Comment=New Comment
(-)src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java (+6 lines)
Lines 63-68 Link Here
63
63
64
	public static String TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists;
64
	public static String TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists;
65
65
66
	public static String TasksUiPreferencePage_Attachment_Link_Target_Browser;
67
68
	public static String TasksUiPreferencePage_Attachment_Link_Target_Description;
69
70
	public static String TasksUiPreferencePage_Attachment_Link_Target_Editor;
71
66
	public static String TasksUiPreferencePage_highlight_current_line;
72
	public static String TasksUiPreferencePage_highlight_current_line;
67
73
68
	public static String TasksUiPreferencePage_Rich_Editor__Recommended_;
74
	public static String TasksUiPreferencePage_Rich_Editor__Recommended_;
(-)src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java (+33 lines)
Lines 109-114 Link Here
109
109
110
	private Button taskListTooltipEnabledButton;
110
	private Button taskListTooltipEnabledButton;
111
111
112
	private Button attachmentHyperLinkUseURLButton;
113
114
	private Button attachmentHyperLinkUseTableButton;
115
112
	public TasksUiPreferencePage() {
116
	public TasksUiPreferencePage() {
113
		super();
117
		super();
114
		setPreferenceStore(TasksUiPlugin.getDefault().getPreferenceStore());
118
		setPreferenceStore(TasksUiPlugin.getDefault().getPreferenceStore());
Lines 128-133 Link Here
128
		createTaskEditorGroup(container);
132
		createTaskEditorGroup(container);
129
		createTaskActivityGroup(container);
133
		createTaskActivityGroup(container);
130
		Composite advanced = createAdvancedSection(container);
134
		Composite advanced = createAdvancedSection(container);
135
		createTaskEditorSettings(advanced);
131
		createTaskDataControl(advanced);
136
		createTaskDataControl(advanced);
132
137
133
		if (getContainer() instanceof IWorkbenchPreferenceContainer) {
138
		if (getContainer() instanceof IWorkbenchPreferenceContainer) {
Lines 247-252 Link Here
247
				return false;
252
				return false;
248
			}
253
			}
249
		}
254
		}
255
		getPreferenceStore().setValue(ITasksUiPreferenceConstants.ATTACHMENT_LINK_TO_BROWSER,
256
				attachmentHyperLinkUseURLButton.getSelection());
250
257
251
		return true;
258
		return true;
252
	}
259
	}
Lines 289-294 Link Here
289
		activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean(
296
		activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean(
290
				MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED));
297
				MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED));
291
298
299
		attachmentHyperLinkUseURLButton.setSelection(getPreferenceStore().getBoolean(
300
				ITasksUiPreferenceConstants.ATTACHMENT_LINK_TO_BROWSER));
301
		attachmentHyperLinkUseTableButton.setSelection(!getPreferenceStore().getBoolean(
302
				ITasksUiPreferenceConstants.ATTACHMENT_LINK_TO_BROWSER));
292
		return true;
303
		return true;
293
	}
304
	}
294
305
Lines 331-336 Link Here
331
342
332
		activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getDefaultBoolean(
343
		activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getDefaultBoolean(
333
				MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED));
344
				MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED));
345
		attachmentHyperLinkUseURLButton.setSelection(getPreferenceStore().getDefaultBoolean(
346
				ITasksUiPreferenceConstants.ATTACHMENT_LINK_TO_BROWSER));
347
		attachmentHyperLinkUseTableButton.setSelection(!getPreferenceStore().getDefaultBoolean(
348
				ITasksUiPreferenceConstants.ATTACHMENT_LINK_TO_BROWSER));
334
349
335
		updateRefreshGroupEnablements();
350
		updateRefreshGroupEnablements();
336
	}
351
	}
Lines 618-621 Link Here
618
		}
633
		}
619
		super.dispose();
634
		super.dispose();
620
	}
635
	}
636
637
	private void createTaskEditorSettings(Composite parent) {
638
		Group container = new Group(parent, SWT.SHADOW_ETCHED_IN);
639
		container.setLayout(new GridLayout(2, false));
640
		container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
641
642
		container.setText(Messages.TasksUiPreferencePage_Attachment_Link_Target_Description);
643
		attachmentHyperLinkUseURLButton = new Button(container, SWT.RADIO);
644
		attachmentHyperLinkUseURLButton.setText(Messages.TasksUiPreferencePage_Attachment_Link_Target_Browser);
645
		attachmentHyperLinkUseURLButton.setSelection(getPreferenceStore().getBoolean(
646
				ITasksUiPreferenceConstants.ATTACHMENT_LINK_TO_BROWSER));
647
648
		attachmentHyperLinkUseTableButton = new Button(container, SWT.RADIO);
649
		attachmentHyperLinkUseTableButton.setText(Messages.TasksUiPreferencePage_Attachment_Link_Target_Editor);
650
		attachmentHyperLinkUseTableButton.setSelection(!getPreferenceStore().getBoolean(
651
				ITasksUiPreferenceConstants.ATTACHMENT_LINK_TO_BROWSER));
652
	}
653
621
}
654
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties (+3 lines)
Lines 27-32 Link Here
27
TasksUiPreferencePage_minutes=minutes
27
TasksUiPreferencePage_minutes=minutes
28
TasksUiPreferencePage_minutes_of_inactivity=minutes of inactivity.
28
TasksUiPreferencePage_minutes_of_inactivity=minutes of inactivity.
29
TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists=A new empty Task List will be created in the chosen directory if one does not already exists. Your previous directory and its contents will not be deleted.\n\nProceed?
29
TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists=A new empty Task List will be created in the chosen directory if one does not already exists. Your previous directory and its contents will not be deleted.\n\nProceed?
30
TasksUiPreferencePage_Attachment_Link_Target_Browser=Browser
31
TasksUiPreferencePage_Attachment_Link_Target_Description=Attachment Hyperlink target for attachments
32
TasksUiPreferencePage_Attachment_Link_Target_Editor=Section in TaskEditor
30
TasksUiPreferencePage_highlight_current_line=Highlight current line
33
TasksUiPreferencePage_highlight_current_line=Highlight current line
31
TasksUiPreferencePage_Rich_Editor__Recommended_=Rich Editor (Recommended)
34
TasksUiPreferencePage_Rich_Editor__Recommended_=Rich Editor (Recommended)
32
TasksUiPreferencePage_Scheduling=Scheduling
35
TasksUiPreferencePage_Scheduling=Scheduling
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java (-2 / +37 lines)
Lines 54-59 Link Here
54
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
54
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
55
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
55
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
56
import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
56
import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
57
import org.eclipse.mylyn.internal.tasks.core.TaskAttachment;
57
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
58
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
58
import org.eclipse.mylyn.internal.tasks.core.data.ITaskDataManagerListener;
59
import org.eclipse.mylyn.internal.tasks.core.data.ITaskDataManagerListener;
59
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManagerEvent;
60
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManagerEvent;
Lines 88-96 Link Here
88
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
89
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
89
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
90
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
90
import org.eclipse.mylyn.tasks.core.ITask;
91
import org.eclipse.mylyn.tasks.core.ITask;
92
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
91
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
93
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
92
import org.eclipse.mylyn.tasks.core.TaskRepository;
94
import org.eclipse.mylyn.tasks.core.TaskRepository;
93
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
94
import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
95
import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
95
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
96
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
96
import org.eclipse.mylyn.tasks.core.data.TaskData;
97
import org.eclipse.mylyn.tasks.core.data.TaskData;
Lines 123-128 Link Here
123
import org.eclipse.swt.widgets.Listener;
124
import org.eclipse.swt.widgets.Listener;
124
import org.eclipse.swt.widgets.Menu;
125
import org.eclipse.swt.widgets.Menu;
125
import org.eclipse.swt.widgets.ScrollBar;
126
import org.eclipse.swt.widgets.ScrollBar;
127
import org.eclipse.swt.widgets.TableItem;
126
import org.eclipse.ui.IEditorInput;
128
import org.eclipse.ui.IEditorInput;
127
import org.eclipse.ui.IEditorSite;
129
import org.eclipse.ui.IEditorSite;
128
import org.eclipse.ui.PlatformUI;
130
import org.eclipse.ui.PlatformUI;
Lines 1053-1060 Link Here
1053
											}
1055
											}
1054
										}
1056
										}
1055
									}
1057
									}
1058
									EditorUtil.reveal(form, attribute.getId());
1059
								} else if (TaskAttribute.TYPE_ATTACHMENT.equals(attribute.getMetaData().getType())) {
1060
									AbstractTaskEditorPart actionPart = getPart(ID_PART_ATTACHMENTS);
1061
									if (actionPart != null && actionPart.getControl() instanceof ExpandableComposite) {
1062
										CommonFormUtil.setExpanded((ExpandableComposite) actionPart.getControl(), true);
1063
										if (actionPart.getControl() instanceof Section) {
1064
											Control client = actionPart.getControl();
1065
											if (client instanceof Composite) {
1066
												for (Control control : ((Composite) client).getChildren()) {
1067
													if (control instanceof Composite) {
1068
														for (Control control1 : ((Composite) control).getChildren()) {
1069
															if (control1 instanceof org.eclipse.swt.widgets.Table) {
1070
																org.eclipse.swt.widgets.Table attachmentTable = ((org.eclipse.swt.widgets.Table) control1);
1071
																TableItem[] attachments = attachmentTable.getItems();
1072
																int index = 0;
1073
																for (TableItem attachment : attachments) {
1074
																	TaskAttachment attachmentData = ((TaskAttachment) attachment.getData());
1075
																	if (attachmentData.getTaskAttribute() == attribute) {
1076
																		attachmentTable.deselectAll();
1077
																		attachmentTable.select(index);
1078
																		IManagedForm mform = actionPart.getManagedForm();
1079
																		ScrolledForm form = mform.getForm();
1080
																		EditorUtil.focusOn(form, attachmentTable, 30);
1081
																		break;
1082
																	}
1083
																	index++;
1084
																}
1085
															}
1086
														}
1087
													}
1088
												}
1089
											}
1090
										}
1091
									}
1056
								}
1092
								}
1057
								EditorUtil.reveal(form, attribute.getId());
1058
							} else {
1093
							} else {
1059
								EditorUtil.reveal(form, node.getLabel());
1094
								EditorUtil.reveal(form, node.getLabel());
1060
							}
1095
							}

Return to bug 199283