|
Lines 32-37
Link Here
|
| 32 |
import org.eclipse.jface.viewers.StructuredSelection; |
32 |
import org.eclipse.jface.viewers.StructuredSelection; |
| 33 |
import org.eclipse.jface.viewers.TableViewer; |
33 |
import org.eclipse.jface.viewers.TableViewer; |
| 34 |
import org.eclipse.jface.window.ToolTip; |
34 |
import org.eclipse.jface.window.ToolTip; |
|
|
35 |
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonFormUtil; |
| 35 |
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; |
36 |
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; |
| 36 |
import org.eclipse.mylyn.internal.provisional.commons.ui.TableSorter; |
37 |
import org.eclipse.mylyn.internal.provisional.commons.ui.TableSorter; |
| 37 |
import org.eclipse.mylyn.internal.provisional.commons.ui.TableViewerSupport; |
38 |
import org.eclipse.mylyn.internal.provisional.commons.ui.TableViewerSupport; |
|
Lines 55-64
Link Here
|
| 55 |
import org.eclipse.swt.widgets.Menu; |
56 |
import org.eclipse.swt.widgets.Menu; |
| 56 |
import org.eclipse.swt.widgets.Table; |
57 |
import org.eclipse.swt.widgets.Table; |
| 57 |
import org.eclipse.swt.widgets.TableColumn; |
58 |
import org.eclipse.swt.widgets.TableColumn; |
|
|
59 |
import org.eclipse.swt.widgets.TableItem; |
| 58 |
import org.eclipse.ui.IWorkbenchPage; |
60 |
import org.eclipse.ui.IWorkbenchPage; |
|
|
61 |
import org.eclipse.ui.forms.IManagedForm; |
| 59 |
import org.eclipse.ui.forms.events.ExpansionAdapter; |
62 |
import org.eclipse.ui.forms.events.ExpansionAdapter; |
| 60 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
63 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
|
|
64 |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
| 61 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
65 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
|
|
66 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
| 62 |
import org.eclipse.ui.forms.widgets.Section; |
67 |
import org.eclipse.ui.forms.widgets.Section; |
| 63 |
|
68 |
|
| 64 |
/** |
69 |
/** |
|
Lines 116-127
Link Here
|
| 116 |
|
121 |
|
| 117 |
private Composite attachmentsComposite; |
122 |
private Composite attachmentsComposite; |
| 118 |
|
123 |
|
|
|
124 |
private Table attachmentsTable; |
| 125 |
|
| 119 |
public TaskEditorAttachmentPart() { |
126 |
public TaskEditorAttachmentPart() { |
| 120 |
setPartName(Messages.TaskEditorAttachmentPart_Attachments); |
127 |
setPartName(Messages.TaskEditorAttachmentPart_Attachments); |
| 121 |
} |
128 |
} |
| 122 |
|
129 |
|
| 123 |
private void createAttachmentTable(FormToolkit toolkit, final Composite attachmentsComposite) { |
130 |
private void createAttachmentTable(FormToolkit toolkit, final Composite attachmentsComposite) { |
| 124 |
Table attachmentsTable = toolkit.createTable(attachmentsComposite, SWT.MULTI | SWT.FULL_SELECTION); |
131 |
attachmentsTable = toolkit.createTable(attachmentsComposite, SWT.MULTI | SWT.FULL_SELECTION); |
| 125 |
attachmentsTable.setLinesVisible(true); |
132 |
attachmentsTable.setLinesVisible(true); |
| 126 |
attachmentsTable.setHeaderVisible(true); |
133 |
attachmentsTable.setHeaderVisible(true); |
| 127 |
attachmentsTable.setLayout(new GridLayout()); |
134 |
attachmentsTable.setLayout(new GridLayout()); |
|
Lines 311-314
Link Here
|
| 311 |
|
318 |
|
| 312 |
OpenTaskAttachmentHandler.openAttachments(page, attachments); |
319 |
OpenTaskAttachmentHandler.openAttachments(page, attachments); |
| 313 |
} |
320 |
} |
|
|
321 |
|
| 322 |
@Override |
| 323 |
public boolean setFormInput(Object input) { |
| 324 |
if (input instanceof String) { |
| 325 |
String text = (String) input; |
| 326 |
if (attachments != null) { |
| 327 |
for (TaskAttribute attachmentAttribute : attachments) { |
| 328 |
if (text.equals(attachmentAttribute.getId())) { |
| 329 |
CommonFormUtil.setExpanded((ExpandableComposite) getControl(), true); |
| 330 |
|
| 331 |
return selectReveal(attachmentAttribute); |
| 332 |
} |
| 333 |
} |
| 334 |
} |
| 335 |
} |
| 336 |
return super.setFormInput(input); |
| 337 |
} |
| 338 |
|
| 339 |
public boolean selectReveal(TaskAttribute attachmentAttribute) { |
| 340 |
if (attachmentAttribute == null || attachmentsTable == null) { |
| 341 |
return false; |
| 342 |
} |
| 343 |
TableItem[] attachments = attachmentsTable.getItems(); |
| 344 |
int index = 0; |
| 345 |
for (TableItem attachment : attachments) { |
| 346 |
Object data = attachment.getData(); |
| 347 |
if (data instanceof ITaskAttachment) { |
| 348 |
ITaskAttachment attachmentData = ((ITaskAttachment) data); |
| 349 |
if (attachmentData.getTaskAttribute().getValue().equals(attachmentAttribute.getValue())) { |
| 350 |
attachmentsTable.deselectAll(); |
| 351 |
attachmentsTable.select(index); |
| 352 |
IManagedForm mform = getManagedForm(); |
| 353 |
ScrolledForm form = mform.getForm(); |
| 354 |
EditorUtil.focusOn(form, attachmentsTable); |
| 355 |
return true; |
| 356 |
} |
| 357 |
} |
| 358 |
index++; |
| 359 |
} |
| 360 |
return false; |
| 361 |
} |
| 314 |
} |
362 |
} |