|
Lines 1088-1093
Link Here
|
| 1088 |
toolkit.paintBordersFor(summaryComposite); |
1088 |
toolkit.paintBordersFor(summaryComposite); |
| 1089 |
} |
1089 |
} |
| 1090 |
|
1090 |
|
|
|
1091 |
protected boolean supportsAttachmentDelete() { |
| 1092 |
return false; |
| 1093 |
} |
| 1094 |
|
| 1095 |
protected void deleteAttachment(RepositoryAttachment attachment) { |
| 1096 |
|
| 1097 |
} |
| 1098 |
|
| 1091 |
protected void createAttachmentLayout(Composite composite) { |
1099 |
protected void createAttachmentLayout(Composite composite) { |
| 1092 |
|
1100 |
|
| 1093 |
// TODO: expand to show new attachments |
1101 |
// TODO: expand to show new attachments |
|
Lines 1098-1104
Link Here
|
| 1098 |
attachmentsComposite.setLayout(new GridLayout(1, false)); |
1106 |
attachmentsComposite.setLayout(new GridLayout(1, false)); |
| 1099 |
attachmentsComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
1107 |
attachmentsComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 1100 |
section.setClient(attachmentsComposite); |
1108 |
section.setClient(attachmentsComposite); |
| 1101 |
|
1109 |
|
| 1102 |
if (taskData.getAttachments().size() > 0) { |
1110 |
if (taskData.getAttachments().size() > 0) { |
| 1103 |
|
1111 |
|
| 1104 |
attachmentsTable = toolkit.createTable(attachmentsComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); |
1112 |
attachmentsTable = toolkit.createTable(attachmentsComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); |
|
Lines 1325-1332
Link Here
|
| 1325 |
registerDropListener(label); |
1333 |
registerDropListener(label); |
| 1326 |
} |
1334 |
} |
| 1327 |
|
1335 |
|
|
|
1336 |
final Composite attachmentControlsComposite = toolkit.createComposite(attachmentsComposite); |
| 1337 |
attachmentControlsComposite.setLayout(new GridLayout(2, false)); |
| 1338 |
attachmentControlsComposite.setLayoutData(new GridData(GridData.BEGINNING)); |
| 1339 |
|
| 1328 |
/* Launch a NewAttachemntWizard */ |
1340 |
/* Launch a NewAttachemntWizard */ |
| 1329 |
Button addAttachmentButton = toolkit.createButton(attachmentsComposite, "Attach File...", SWT.PUSH); |
1341 |
Button addAttachmentButton = toolkit.createButton(attachmentControlsComposite, "Attach File...", SWT.PUSH); |
| 1330 |
|
1342 |
|
| 1331 |
ITask task = TasksUiPlugin.getTaskListManager().getTaskList().getTask(repository.getUrl(), taskData.getId()); |
1343 |
ITask task = TasksUiPlugin.getTaskListManager().getTaskList().getTask(repository.getUrl(), taskData.getId()); |
| 1332 |
if (task == null) { |
1344 |
if (task == null) { |
|
Lines 1359-1367
Link Here
|
| 1359 |
} |
1371 |
} |
| 1360 |
}); |
1372 |
}); |
| 1361 |
|
1373 |
|
|
|
1374 |
Button deleteAttachmentButton = null; |
| 1375 |
if (supportsAttachmentDelete()) { |
| 1376 |
deleteAttachmentButton = toolkit.createButton(attachmentControlsComposite, "Delete Attachment...", SWT.PUSH); |
| 1377 |
|
| 1378 |
deleteAttachmentButton.addSelectionListener(new SelectionListener() { |
| 1379 |
public void widgetDefaultSelected(SelectionEvent e) { |
| 1380 |
// ignore |
| 1381 |
} |
| 1382 |
|
| 1383 |
public void widgetSelected(SelectionEvent e) { |
| 1384 |
ITask task = TasksUiPlugin.getTaskListManager().getTaskList().getTask(repository.getUrl(), |
| 1385 |
taskData.getId()); |
| 1386 |
if (task == null || !(task instanceof AbstractRepositoryTask)) { |
| 1387 |
// Should not happen |
| 1388 |
return; |
| 1389 |
} |
| 1390 |
if (AbstractRepositoryTaskEditor.this.isDirty |
| 1391 |
|| ((AbstractRepositoryTask) task).getSyncState().equals(RepositoryTaskSyncState.OUTGOING)) { |
| 1392 |
MessageDialog.openInformation(attachmentsComposite.getShell(), |
| 1393 |
"Task not synchronized or dirty editor", |
| 1394 |
"Commit edits or synchronize task before deleting attachments."); |
| 1395 |
return; |
| 1396 |
} else { |
| 1397 |
if (attachmentsTableViewer.getSelection() != null) { |
| 1398 |
RepositoryAttachment attachment = |
| 1399 |
(RepositoryAttachment) (((StructuredSelection) attachmentsTableViewer.getSelection()).getFirstElement()); |
| 1400 |
deleteAttachment(attachment); |
| 1401 |
} |
| 1402 |
} |
| 1403 |
} |
| 1404 |
}); |
| 1405 |
|
| 1406 |
} |
| 1362 |
registerDropListener(section); |
1407 |
registerDropListener(section); |
| 1363 |
registerDropListener(attachmentsComposite); |
1408 |
registerDropListener(attachmentsComposite); |
| 1364 |
registerDropListener(addAttachmentButton); |
1409 |
registerDropListener(addAttachmentButton); |
|
|
1410 |
if (supportsAttachmentDelete()) { |
| 1411 |
registerDropListener(deleteAttachmentButton); |
| 1412 |
} |
| 1365 |
} |
1413 |
} |
| 1366 |
|
1414 |
|
| 1367 |
private void registerDropListener(final Control control) { |
1415 |
private void registerDropListener(final Control control) { |
|
Lines 1697-1702
Link Here
|
| 1697 |
} |
1745 |
} |
| 1698 |
} |
1746 |
} |
| 1699 |
|
1747 |
|
|
|
1748 |
protected boolean supportsCommentDelete() { |
| 1749 |
return false; |
| 1750 |
} |
| 1751 |
|
| 1752 |
protected void deleteComment(TaskComment comment) { |
| 1753 |
|
| 1754 |
} |
| 1755 |
|
| 1700 |
protected void createCommentLayout(Composite composite) { |
1756 |
protected void createCommentLayout(Composite composite) { |
| 1701 |
commentsSection = createSection(composite, getSectionLabel(SECTION_NAME.COMMENTS_SECTION)); |
1757 |
commentsSection = createSection(composite, getSectionLabel(SECTION_NAME.COMMENTS_SECTION)); |
| 1702 |
commentsSection.setText(commentsSection.getText() + " (" + taskData.getComments().size() + ")"); |
1758 |
commentsSection.setText(commentsSection.getText() + " (" + taskData.getComments().size() + ")"); |
|
Lines 1784-1789
Link Here
|
| 1784 |
// code for outline |
1840 |
// code for outline |
| 1785 |
commentStyleText.add(styledText); |
1841 |
commentStyleText.add(styledText); |
| 1786 |
textHash.put(taskComment, styledText); |
1842 |
textHash.put(taskComment, styledText); |
|
|
1843 |
|
| 1844 |
if (supportsCommentDelete()) { |
| 1845 |
Button deleteButton = toolkit.createButton(ecComposite, null, SWT.PUSH); |
| 1846 |
deleteButton.setImage(TasksUiImages.getImage(TasksUiImages.COMMENT_DELETE)); |
| 1847 |
deleteButton.setToolTipText("Remove comment above."); |
| 1848 |
deleteButton.addListener(SWT.Selection, new Listener() { |
| 1849 |
public void handleEvent(Event e) { |
| 1850 |
deleteComment(taskComment); |
| 1851 |
} |
| 1852 |
}); |
| 1853 |
} |
| 1787 |
} |
1854 |
} |
| 1788 |
if (foundNew) { |
1855 |
if (foundNew) { |
| 1789 |
commentsSection.setExpanded(true); |
1856 |
commentsSection.setExpanded(true); |
|
Lines 2633-2639
Link Here
|
| 2633 |
} |
2700 |
} |
| 2634 |
} else { |
2701 |
} else { |
| 2635 |
modifiedTask = (AbstractRepositoryTask) TasksUiPlugin.getTaskListManager().getTaskList() |
2702 |
modifiedTask = (AbstractRepositoryTask) TasksUiPlugin.getTaskListManager().getTaskList() |
| 2636 |
.getTask(repository.getUrl(), taskData.getId()); |
2703 |
.getTask(repository.getUrl(), taskId); |
| 2637 |
} |
2704 |
} |
| 2638 |
|
2705 |
|
| 2639 |
// Synchronization accounting... |
2706 |
// Synchronization accounting... |