|
Lines 122-127
Link Here
|
| 122 |
/** |
122 |
/** |
| 123 |
* @author Mik Kersten |
123 |
* @author Mik Kersten |
| 124 |
* @author Rob Elves |
124 |
* @author Rob Elves |
|
|
125 |
* @author Jeff Pound (Attachment work) |
| 125 |
*/ |
126 |
*/ |
| 126 |
public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { |
127 |
public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { |
| 127 |
|
128 |
|
|
Lines 314-321
Link Here
|
| 314 |
|
315 |
|
| 315 |
} |
316 |
} |
| 316 |
|
317 |
|
| 317 |
private static final class AttachmentTableLabelProvider extends DecoratingLabelProvider implements ITableColorProvider, |
318 |
private static final class AttachmentTableLabelProvider extends DecoratingLabelProvider implements |
| 318 |
ITableLabelProvider { |
319 |
ITableColorProvider, ITableLabelProvider { |
| 319 |
|
320 |
|
| 320 |
public AttachmentTableLabelProvider(ILabelProvider provider, ILabelDecorator decorator) { |
321 |
public AttachmentTableLabelProvider(ILabelProvider provider, ILabelDecorator decorator) { |
| 321 |
super(provider, decorator); |
322 |
super(provider, decorator); |
|
Lines 437-454
Link Here
|
| 437 |
return addCommentsTextBox.getText(); |
438 |
return addCommentsTextBox.getText(); |
| 438 |
} |
439 |
} |
| 439 |
|
440 |
|
| 440 |
// /** |
441 |
// /** |
| 441 |
// * @return Any currently selected text. |
442 |
// * @return Any currently selected text. |
| 442 |
// */ |
443 |
// */ |
| 443 |
// protected StyledText getCurrentText() { |
444 |
// protected StyledText getCurrentText() { |
| 444 |
// return currentSelectedText; |
445 |
// return currentSelectedText; |
| 445 |
// } |
446 |
// } |
| 446 |
|
447 |
|
| 447 |
|
|
|
| 448 |
protected void createFormContent(final IManagedForm managedForm) { |
448 |
protected void createFormContent(final IManagedForm managedForm) { |
| 449 |
super.createFormContent(managedForm); |
449 |
super.createFormContent(managedForm); |
| 450 |
form = managedForm.getForm(); |
450 |
form = managedForm.getForm(); |
| 451 |
toolkit = managedForm.getToolkit(); |
451 |
toolkit = managedForm.getToolkit(); |
| 452 |
if (getRepositoryTaskData() == null) { |
452 |
if (getRepositoryTaskData() == null) { |
| 453 |
Composite composite = new Composite(form.getBody(), SWT.NULL); |
453 |
Composite composite = new Composite(form.getBody(), SWT.NULL); |
| 454 |
composite.setLayout(new GridLayout()); |
454 |
composite.setLayout(new GridLayout()); |
|
Lines 461-467
Link Here
|
| 461 |
editorComposite = form.getBody(); |
461 |
editorComposite = form.getBody(); |
| 462 |
editorComposite.setLayout(new GridLayout()); |
462 |
editorComposite.setLayout(new GridLayout()); |
| 463 |
editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
463 |
editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 464 |
///createContextMenu(editorComposite); |
464 |
// /createContextMenu(editorComposite); |
| 465 |
|
465 |
|
| 466 |
createReportHeaderLayout(editorComposite); |
466 |
createReportHeaderLayout(editorComposite); |
| 467 |
Composite attribComp = createAttributeLayout(editorComposite); |
467 |
Composite attribComp = createAttributeLayout(editorComposite); |
|
Lines 477-516
Link Here
|
| 477 |
getSite().getPage().addSelectionListener(selectionListener); |
477 |
getSite().getPage().addSelectionListener(selectionListener); |
| 478 |
getSite().setSelectionProvider(selectionProvider); |
478 |
getSite().setSelectionProvider(selectionProvider); |
| 479 |
} |
479 |
} |
| 480 |
|
480 |
|
| 481 |
// @Override |
481 |
// @Override |
| 482 |
// public void createPartControl(Composite parent) { |
482 |
// public void createPartControl(Composite parent) { |
| 483 |
// if (getRepositoryTaskData() == null) { |
483 |
// if (getRepositoryTaskData() == null) { |
| 484 |
// Composite composite = new Composite(parent, SWT.NULL); |
484 |
// Composite composite = new Composite(parent, SWT.NULL); |
| 485 |
// composite.setLayout(new GridLayout()); |
485 |
// composite.setLayout(new GridLayout()); |
| 486 |
// Label noBugLabel = new Label(composite, SWT.NULL); |
486 |
// Label noBugLabel = new Label(composite, SWT.NULL); |
| 487 |
// noBugLabel.setText("Could not download task data, possibly due to timeout or connectivity problem.\n" |
487 |
// noBugLabel.setText("Could not download task data, possibly due to timeout |
| 488 |
// + "Please check connection and try again."); |
488 |
// or connectivity problem.\n" |
| 489 |
// return; |
489 |
// + "Please check connection and try again."); |
| 490 |
// } |
490 |
// return; |
| 491 |
// |
491 |
// } |
| 492 |
// toolkit = new FormToolkit(parent.getDisplay()); |
492 |
// |
| 493 |
// form = toolkit.createScrolledForm(parent); |
493 |
// toolkit = new FormToolkit(parent.getDisplay()); |
| 494 |
// |
494 |
// form = toolkit.createScrolledForm(parent); |
| 495 |
// editorComposite = form.getBody(); |
495 |
// |
| 496 |
// editorComposite.setLayout(new GridLayout()); |
496 |
// editorComposite = form.getBody(); |
| 497 |
// editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
497 |
// editorComposite.setLayout(new GridLayout()); |
| 498 |
// createContextMenu(editorComposite); |
498 |
// editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 499 |
// |
499 |
// createContextMenu(editorComposite); |
| 500 |
// createReportHeaderLayout(editorComposite); |
500 |
// |
| 501 |
// Composite attribComp = createAttributeLayout(editorComposite); |
501 |
// createReportHeaderLayout(editorComposite); |
| 502 |
// createCustomAttributeLayout(attribComp); |
502 |
// Composite attribComp = createAttributeLayout(editorComposite); |
| 503 |
// createDescriptionLayout(editorComposite); |
503 |
// createCustomAttributeLayout(attribComp); |
| 504 |
// createAttachmentLayout(editorComposite); |
504 |
// createDescriptionLayout(editorComposite); |
| 505 |
// createCommentLayout(editorComposite, form); |
505 |
// createAttachmentLayout(editorComposite); |
| 506 |
// createActionsLayout(editorComposite); |
506 |
// createCommentLayout(editorComposite, form); |
| 507 |
// |
507 |
// createActionsLayout(editorComposite); |
| 508 |
// // editorComposite.setMenu(contextMenuManager.createContextMenu(editorComposite)); |
508 |
// |
| 509 |
// |
509 |
// // |
| 510 |
// form.reflow(true); |
510 |
// editorComposite.setMenu(contextMenuManager.createContextMenu(editorComposite)); |
| 511 |
// getSite().getPage().addSelectionListener(selectionListener); |
511 |
// |
| 512 |
// getSite().setSelectionProvider(selectionProvider); |
512 |
// form.reflow(true); |
| 513 |
// } |
513 |
// getSite().getPage().addSelectionListener(selectionListener); |
|
|
514 |
// getSite().setSelectionProvider(selectionProvider); |
| 515 |
// } |
| 514 |
|
516 |
|
| 515 |
/** |
517 |
/** |
| 516 |
* By default puts task number, date opened and date modified in header |
518 |
* By default puts task number, date opened and date modified in header |
|
Lines 656-691
Link Here
|
| 656 |
|
658 |
|
| 657 |
public abstract void createCustomAttributeLayout(); |
659 |
public abstract void createCustomAttributeLayout(); |
| 658 |
|
660 |
|
| 659 |
// protected void createContextMenu(final Composite comp) { |
661 |
// protected void createContextMenu(final Composite comp) { |
| 660 |
// contextMenuManager = new MenuManager(CONTEXT_MENU_ID); |
662 |
// contextMenuManager = new MenuManager(CONTEXT_MENU_ID); |
| 661 |
// contextMenuManager.setRemoveAllWhenShown(true); |
663 |
// contextMenuManager.setRemoveAllWhenShown(true); |
| 662 |
// contextMenuManager.addMenuListener(new IMenuListener() { |
664 |
// contextMenuManager.addMenuListener(new IMenuListener() { |
| 663 |
// public void menuAboutToShow(IMenuManager manager) { |
665 |
// public void menuAboutToShow(IMenuManager manager) { |
| 664 |
// manager.add(cutAction); |
666 |
// manager.add(cutAction); |
| 665 |
// manager.add(copyAction); |
667 |
// manager.add(copyAction); |
| 666 |
// manager.add(pasteAction); |
668 |
// manager.add(pasteAction); |
| 667 |
//// Clipboard clipboard = new Clipboard(comp.getDisplay()); |
669 |
// // Clipboard clipboard = new Clipboard(comp.getDisplay()); |
| 668 |
//// TextTransfer textTransfer = TextTransfer.getInstance(); |
670 |
// // TextTransfer textTransfer = TextTransfer.getInstance(); |
| 669 |
//// String textData = (String) clipboard.getContents(textTransfer); |
671 |
// // String textData = (String) clipboard.getContents(textTransfer); |
| 670 |
//// if (textData != null) { |
672 |
// // if (textData != null) { |
| 671 |
//// pasteAction.setEnabled(true); |
673 |
// // pasteAction.setEnabled(true); |
| 672 |
//// } else { |
674 |
// // } else { |
| 673 |
//// pasteAction.setEnabled(false); |
675 |
// // pasteAction.setEnabled(false); |
| 674 |
//// } |
676 |
// // } |
| 675 |
// |
677 |
// |
| 676 |
// if (currentSelectedText == null || currentSelectedText.getSelectionText().length() == 0) { |
678 |
// if (currentSelectedText == null || |
| 677 |
// copyAction.setEnabled(false); |
679 |
// currentSelectedText.getSelectionText().length() == 0) { |
| 678 |
// } else { |
680 |
// copyAction.setEnabled(false); |
| 679 |
// copyAction.setEnabled(true); |
681 |
// } else { |
| 680 |
// } |
682 |
// copyAction.setEnabled(true); |
| 681 |
// // manager.add(revealAllAction); |
683 |
// } |
| 682 |
// manager.add(new Separator()); |
684 |
// // manager.add(revealAllAction); |
| 683 |
// manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); |
685 |
// manager.add(new Separator()); |
| 684 |
// } |
686 |
// manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); |
| 685 |
// }); |
687 |
// } |
| 686 |
// // getSite().registerContextMenu(CONTEXT_MENU_ID, contextMenuManager, |
688 |
// }); |
| 687 |
// // getSite().getSelectionProvider()); |
689 |
// // getSite().registerContextMenu(CONTEXT_MENU_ID, contextMenuManager, |
| 688 |
// } |
690 |
// // getSite().getSelectionProvider()); |
|
|
691 |
// } |
| 689 |
|
692 |
|
| 690 |
/** |
693 |
/** |
| 691 |
* Adds a text field to display and edit the bug's summary. |
694 |
* Adds a text field to display and edit the bug's summary. |
|
Lines 928-933
Link Here
|
| 928 |
final LocalAttachment att = naw.getAttachment(); |
931 |
final LocalAttachment att = naw.getAttachment(); |
| 929 |
att.setReport(getRepositoryTaskData()); |
932 |
att.setReport(getRepositoryTaskData()); |
| 930 |
getRepositoryTaskData().setNewAttachment(att); |
933 |
getRepositoryTaskData().setNewAttachment(att); |
|
|
934 |
setAttachContext(att.isPatch()); |
| 931 |
|
935 |
|
| 932 |
// TODO: Add row to table |
936 |
// TODO: Add row to table |
| 933 |
// RepositoryTaskData data = getRepositoryTaskData(); |
937 |
// RepositoryTaskData data = getRepositoryTaskData(); |
|
Lines 1006-1013
Link Here
|
| 1006 |
GridData sectionCompositeData = new GridData(GridData.FILL_HORIZONTAL); |
1010 |
GridData sectionCompositeData = new GridData(GridData.FILL_HORIZONTAL); |
| 1007 |
sectionComposite.setLayoutData(sectionCompositeData); |
1011 |
sectionComposite.setLayoutData(sectionCompositeData); |
| 1008 |
|
1012 |
|
| 1009 |
TextViewer viewer = addRepositoryTextViewer(repository, sectionComposite, getRepositoryTaskData().getDescription(), |
1013 |
TextViewer viewer = addRepositoryTextViewer(repository, sectionComposite, getRepositoryTaskData() |
| 1010 |
SWT.MULTI | SWT.WRAP); |
1014 |
.getDescription(), SWT.MULTI | SWT.WRAP); |
| 1011 |
final StyledText styledText = viewer.getTextWidget(); |
1015 |
final StyledText styledText = viewer.getTextWidget(); |
| 1012 |
styledText.addListener(SWT.FocusIn, new DescriptionListener()); |
1016 |
styledText.addListener(SWT.FocusIn, new DescriptionListener()); |
| 1013 |
styledText.setLayout(new GridLayout()); |
1017 |
styledText.setLayout(new GridLayout()); |
|
Lines 1103-1109
Link Here
|
| 1103 |
ecComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
1107 |
ecComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 1104 |
expandableComposite.setClient(ecComposite); |
1108 |
expandableComposite.setClient(ecComposite); |
| 1105 |
|
1109 |
|
| 1106 |
TextViewer viewer = addRepositoryTextViewer(repository, ecComposite, taskComment.getText(), SWT.MULTI | SWT.WRAP); |
1110 |
TextViewer viewer = addRepositoryTextViewer(repository, ecComposite, taskComment.getText(), SWT.MULTI |
|
|
1111 |
| SWT.WRAP); |
| 1107 |
styledText = viewer.getTextWidget(); |
1112 |
styledText = viewer.getTextWidget(); |
| 1108 |
GridDataFactory.fillDefaults().hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo(styledText); |
1113 |
GridDataFactory.fillDefaults().hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo(styledText); |
| 1109 |
|
1114 |
|
|
Lines 1250-1256
Link Here
|
| 1250 |
*/ |
1255 |
*/ |
| 1251 |
protected abstract String getTitleString(); |
1256 |
protected abstract String getTitleString(); |
| 1252 |
|
1257 |
|
| 1253 |
|
|
|
| 1254 |
/** |
1258 |
/** |
| 1255 |
* This refreshes the text in the title label of the info area (it contains |
1259 |
* This refreshes the text in the title label of the info area (it contains |
| 1256 |
* elements which can change). |
1260 |
* elements which can change). |
|
Lines 1366-1388
Link Here
|
| 1366 |
form.setFocus(); |
1370 |
form.setFocus(); |
| 1367 |
} |
1371 |
} |
| 1368 |
|
1372 |
|
| 1369 |
// /** |
1373 |
// /** |
| 1370 |
// * Updates the dirty status of this editor page. The dirty status is true if |
1374 |
// * Updates the dirty status of this editor page. The dirty status is true |
| 1371 |
// * the bug report has been modified but not saved. The title of the editor |
1375 |
// if |
| 1372 |
// * is also updated to reflect the status. |
1376 |
// * the bug report has been modified but not saved. The title of the editor |
| 1373 |
// * |
1377 |
// * is also updated to reflect the status. |
| 1374 |
// * @param newDirtyStatus |
1378 |
// * |
| 1375 |
// * is true when the bug report has been modified but not saved |
1379 |
// * @param newDirtyStatus |
| 1376 |
// */ |
1380 |
// * is true when the bug report has been modified but not saved |
| 1377 |
// public void changeDirtyStatus(boolean newDirtyStatus) { |
1381 |
// */ |
| 1378 |
// isDirty = newDirtyStatus; |
1382 |
// public void changeDirtyStatus(boolean newDirtyStatus) { |
| 1379 |
//// if (parentEditor == null) { |
1383 |
// isDirty = newDirtyStatus; |
| 1380 |
//// firePropertyChange(PROP_DIRTY); |
1384 |
// // if (parentEditor == null) { |
| 1381 |
//// } else { |
1385 |
// // firePropertyChange(PROP_DIRTY); |
| 1382 |
//// parentEditor.markDirty(); |
1386 |
// // } else { |
| 1383 |
//// } |
1387 |
// // parentEditor.markDirty(); |
| 1384 |
// getManagedForm().dirtyStateChanged(); |
1388 |
// // } |
| 1385 |
// } |
1389 |
// getManagedForm().dirtyStateChanged(); |
|
|
1390 |
// } |
| 1386 |
|
1391 |
|
| 1387 |
/** |
1392 |
/** |
| 1388 |
* Updates the title of the editor to reflect dirty status. If the bug |
1393 |
* Updates the title of the editor to reflect dirty status. If the bug |
|
Lines 1511-1517
Link Here
|
| 1511 |
|
1516 |
|
| 1512 |
protected StyledText addCommentsTextBox = null; |
1517 |
protected StyledText addCommentsTextBox = null; |
| 1513 |
|
1518 |
|
| 1514 |
// protected Text descriptionTextBox = null; |
1519 |
// protected Text descriptionTextBox = null; |
| 1515 |
protected TextViewer newDescriptionTextViewer = null; |
1520 |
protected TextViewer newDescriptionTextViewer = null; |
| 1516 |
|
1521 |
|
| 1517 |
// private FormText previousText = null; |
1522 |
// private FormText previousText = null; |
|
Lines 1662-1667
Link Here
|
| 1662 |
return isDisposed; |
1667 |
return isDisposed; |
| 1663 |
} |
1668 |
} |
| 1664 |
|
1669 |
|
|
|
1670 |
// The implementation of the attach context UI is connector dependant. |
| 1671 |
protected boolean getAttachContext() { |
| 1672 |
return false; |
| 1673 |
} |
| 1674 |
|
| 1675 |
// The implementation of the attach context UI is connector dependant. |
| 1676 |
// this method is called when a user attaches a patch to the task |
| 1677 |
protected void setAttachContext(boolean attachContext) { |
| 1678 |
|
| 1679 |
} |
| 1680 |
|
| 1665 |
public void close() { |
1681 |
public void close() { |
| 1666 |
Display activeDisplay = getSite().getShell().getDisplay(); |
1682 |
Display activeDisplay = getSite().getShell().getDisplay(); |
| 1667 |
activeDisplay.asyncExec(new Runnable() { |
1683 |
activeDisplay.asyncExec(new Runnable() { |
|
Lines 1720-1726
Link Here
|
| 1720 |
public void setDescriptionText(String text) { |
1736 |
public void setDescriptionText(String text) { |
| 1721 |
this.newDescriptionTextViewer.setDocument(new Document(text)); |
1737 |
this.newDescriptionTextViewer.setDocument(new Document(text)); |
| 1722 |
} |
1738 |
} |
| 1723 |
|
1739 |
|
| 1724 |
// private class DisplayableLocalAttachment extends RepositoryAttachment { |
1740 |
// private class DisplayableLocalAttachment extends RepositoryAttachment { |
| 1725 |
// private static final long serialVersionUID = 900218036143022422L; |
1741 |
// private static final long serialVersionUID = 900218036143022422L; |
| 1726 |
// |
1742 |
// |