Lines 8-13
Link Here
|
8 |
|
8 |
|
9 |
package org.eclipse.mylyn.tasks.ui.editors; |
9 |
package org.eclipse.mylyn.tasks.ui.editors; |
10 |
|
10 |
|
|
|
11 |
import java.util.ArrayList; |
11 |
import java.util.Collection; |
12 |
import java.util.Collection; |
12 |
import java.util.Collections; |
13 |
import java.util.Collections; |
13 |
import java.util.Iterator; |
14 |
import java.util.Iterator; |
Lines 30-35
Link Here
|
30 |
import org.eclipse.jface.action.IToolBarManager; |
31 |
import org.eclipse.jface.action.IToolBarManager; |
31 |
import org.eclipse.jface.dialogs.IMessageProvider; |
32 |
import org.eclipse.jface.dialogs.IMessageProvider; |
32 |
import org.eclipse.jface.layout.GridDataFactory; |
33 |
import org.eclipse.jface.layout.GridDataFactory; |
|
|
34 |
import org.eclipse.jface.layout.GridLayoutFactory; |
33 |
import org.eclipse.jface.resource.JFaceResources; |
35 |
import org.eclipse.jface.resource.JFaceResources; |
34 |
import org.eclipse.jface.text.TextSelection; |
36 |
import org.eclipse.jface.text.TextSelection; |
35 |
import org.eclipse.jface.util.SafeRunnable; |
37 |
import org.eclipse.jface.util.SafeRunnable; |
Lines 63-68
Link Here
|
63 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorOutlinePage; |
65 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorOutlinePage; |
64 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPeoplePart; |
66 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPeoplePart; |
65 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart; |
67 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart; |
|
|
68 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorRepositoryPlanningPart; |
66 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorRichTextPart; |
69 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorRichTextPart; |
67 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorSummaryPart; |
70 |
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorSummaryPart; |
68 |
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal; |
71 |
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal; |
Lines 120-131
Link Here
|
120 |
import org.eclipse.ui.forms.IFormPart; |
123 |
import org.eclipse.ui.forms.IFormPart; |
121 |
import org.eclipse.ui.forms.IManagedForm; |
124 |
import org.eclipse.ui.forms.IManagedForm; |
122 |
import org.eclipse.ui.forms.editor.FormPage; |
125 |
import org.eclipse.ui.forms.editor.FormPage; |
|
|
126 |
import org.eclipse.ui.forms.events.ExpansionAdapter; |
127 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
123 |
import org.eclipse.ui.forms.events.HyperlinkAdapter; |
128 |
import org.eclipse.ui.forms.events.HyperlinkAdapter; |
124 |
import org.eclipse.ui.forms.events.HyperlinkEvent; |
129 |
import org.eclipse.ui.forms.events.HyperlinkEvent; |
125 |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
130 |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
126 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
131 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
127 |
import org.eclipse.ui.forms.widgets.Hyperlink; |
132 |
import org.eclipse.ui.forms.widgets.Hyperlink; |
128 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
133 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
|
|
134 |
import org.eclipse.ui.forms.widgets.Section; |
129 |
import org.eclipse.ui.handlers.IHandlerService; |
135 |
import org.eclipse.ui.handlers.IHandlerService; |
130 |
import org.eclipse.ui.views.contentoutline.IContentOutlinePage; |
136 |
import org.eclipse.ui.views.contentoutline.IContentOutlinePage; |
131 |
|
137 |
|
Lines 292-297
Link Here
|
292 |
|
298 |
|
293 |
public static final String ID_PART_PLANNING = "org.eclipse.mylyn.tasks.ui.editors.part.planning"; |
299 |
public static final String ID_PART_PLANNING = "org.eclipse.mylyn.tasks.ui.editors.part.planning"; |
294 |
|
300 |
|
|
|
301 |
public static final String ID_PART_REPOSITORY_PLANNING = "org.eclipse.mylyn.tasks.ui.editors.part.repositoryPlanning"; |
302 |
|
295 |
public static final String ID_PART_SUMMARY = "org.eclipse.mylyn.tasks.ui.editors.part.summary"; |
303 |
public static final String ID_PART_SUMMARY = "org.eclipse.mylyn.tasks.ui.editors.part.summary"; |
296 |
|
304 |
|
297 |
public static final String PATH_ACTIONS = "actions"; |
305 |
public static final String PATH_ACTIONS = "actions"; |
Lines 308-313
Link Here
|
308 |
|
316 |
|
309 |
public static final String PATH_PLANNING = "planning"; |
317 |
public static final String PATH_PLANNING = "planning"; |
310 |
|
318 |
|
|
|
319 |
public static final String PATH_REPOSITORY_PLANNING = "repositoryPlanning"; |
320 |
|
311 |
// private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.page"; |
321 |
// private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.page"; |
312 |
|
322 |
|
313 |
private AttributeEditorFactory attributeEditorFactory; |
323 |
private AttributeEditorFactory attributeEditorFactory; |
Lines 518-523
Link Here
|
518 |
return new TaskEditorSummaryPart(); |
528 |
return new TaskEditorSummaryPart(); |
519 |
} |
529 |
} |
520 |
}.setPath(PATH_HEADER)); |
530 |
}.setPath(PATH_HEADER)); |
|
|
531 |
descriptors.add(new TaskEditorPartDescriptor(ID_PART_PLANNING) { |
532 |
@Override |
533 |
public AbstractTaskEditorPart createPart() { |
534 |
return new TaskEditorPlanningPart(); |
535 |
} |
536 |
}.setPath(PATH_PLANNING)); |
537 |
descriptors.add(new TaskEditorPartDescriptor(ID_PART_REPOSITORY_PLANNING) { |
538 |
@Override |
539 |
public AbstractTaskEditorPart createPart() { |
540 |
return new TaskEditorRepositoryPlanningPart(); |
541 |
} |
542 |
}.setPath(PATH_PLANNING)); |
543 |
|
521 |
descriptors.add(new TaskEditorPartDescriptor(ID_PART_ATTRIBUTES) { |
544 |
descriptors.add(new TaskEditorPartDescriptor(ID_PART_ATTRIBUTES) { |
522 |
@Override |
545 |
@Override |
523 |
public AbstractTaskEditorPart createPart() { |
546 |
public AbstractTaskEditorPart createPart() { |
Lines 557-570
Link Here
|
557 |
return new TaskEditorNewCommentPart(); |
580 |
return new TaskEditorNewCommentPart(); |
558 |
} |
581 |
} |
559 |
}.setPath(PATH_COMMENTS)); |
582 |
}.setPath(PATH_COMMENTS)); |
560 |
if (taskData.isNew()) { |
|
|
561 |
descriptors.add(new TaskEditorPartDescriptor(ID_PART_PLANNING) { |
562 |
@Override |
563 |
public AbstractTaskEditorPart createPart() { |
564 |
return new TaskEditorPlanningPart(); |
565 |
} |
566 |
}.setPath(PATH_PLANNING)); |
567 |
} |
568 |
descriptors.add(new TaskEditorPartDescriptor(ID_PART_ACTIONS) { |
583 |
descriptors.add(new TaskEditorPartDescriptor(ID_PART_ACTIONS) { |
569 |
@Override |
584 |
@Override |
570 |
public AbstractTaskEditorPart createPart() { |
585 |
public AbstractTaskEditorPart createPart() { |
Lines 584-602
Link Here
|
584 |
List<TaskEditorPartDescriptor> descriptors = new LinkedList<TaskEditorPartDescriptor>(createPartDescriptors()); |
599 |
List<TaskEditorPartDescriptor> descriptors = new LinkedList<TaskEditorPartDescriptor>(createPartDescriptors()); |
585 |
// single column |
600 |
// single column |
586 |
createParts(PATH_HEADER, editorComposite, descriptors); |
601 |
createParts(PATH_HEADER, editorComposite, descriptors); |
|
|
602 |
// two column |
603 |
Composite planningComposite = toolkit.createComposite(editorComposite); |
604 |
planningComposite.setLayout(GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(2).create()); |
605 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(planningComposite); |
606 |
createParts(PATH_PLANNING, planningComposite, descriptors); |
607 |
createParts(PATH_REPOSITORY_PLANNING, planningComposite, descriptors); |
608 |
coupleSections(planningComposite); |
609 |
// single column |
587 |
createParts(PATH_ATTRIBUTES, editorComposite, descriptors); |
610 |
createParts(PATH_ATTRIBUTES, editorComposite, descriptors); |
588 |
createParts(PATH_ATTACHMENTS, editorComposite, descriptors); |
611 |
createParts(PATH_ATTACHMENTS, editorComposite, descriptors); |
589 |
createParts(PATH_COMMENTS, editorComposite, descriptors); |
612 |
createParts(PATH_COMMENTS, editorComposite, descriptors); |
590 |
createParts(PATH_PLANNING, editorComposite, descriptors); |
|
|
591 |
// two column |
613 |
// two column |
592 |
Composite bottomComposite = toolkit.createComposite(editorComposite); |
614 |
Composite bottomComposite = toolkit.createComposite(editorComposite); |
593 |
bottomComposite.setLayout(new GridLayout(2, false)); |
615 |
bottomComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); |
594 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(bottomComposite); |
616 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(bottomComposite); |
595 |
createParts(PATH_ACTIONS, bottomComposite, descriptors); |
617 |
createParts(PATH_ACTIONS, bottomComposite, descriptors); |
596 |
createParts(PATH_PEOPLE, bottomComposite, descriptors); |
618 |
createParts(PATH_PEOPLE, bottomComposite, descriptors); |
597 |
bottomComposite.pack(true); |
619 |
bottomComposite.pack(true); |
598 |
} |
620 |
} |
599 |
|
621 |
|
|
|
622 |
private void coupleSections(Composite composite) { |
623 |
final List<Section> sections = new ArrayList<Section>(); |
624 |
final boolean[] processingEvents = new boolean[1]; |
625 |
Control[] controls = composite.getChildren(); |
626 |
boolean expand = false; |
627 |
for (Control control : controls) { |
628 |
if (control instanceof Section) { |
629 |
final Section section = (Section) control; |
630 |
sections.add(section); |
631 |
expand |= section.isExpanded(); |
632 |
section.addExpansionListener(new ExpansionAdapter() { |
633 |
@Override |
634 |
public void expansionStateChanging(ExpansionEvent e) { |
635 |
if (!processingEvents[0]) { |
636 |
processingEvents[0] = true; |
637 |
for (Section otherSection : sections) { |
638 |
if (otherSection != section && otherSection.isExpanded() != e.getState()) { |
639 |
EditorUtil.toggleExpandableComposite(e.getState(), otherSection); |
640 |
} |
641 |
} |
642 |
processingEvents[0] = false; |
643 |
} |
644 |
} |
645 |
}); |
646 |
} |
647 |
} |
648 |
if (expand) { |
649 |
for (Section section : sections) { |
650 |
if (!section.isExpanded()) { |
651 |
EditorUtil.toggleExpandableComposite(true, section); |
652 |
} |
653 |
} |
654 |
} |
655 |
} |
656 |
|
600 |
private void createParts(String path, final Composite parent, Collection<TaskEditorPartDescriptor> descriptors) { |
657 |
private void createParts(String path, final Composite parent, Collection<TaskEditorPartDescriptor> descriptors) { |
601 |
for (Iterator<TaskEditorPartDescriptor> it = descriptors.iterator(); it.hasNext();) { |
658 |
for (Iterator<TaskEditorPartDescriptor> it = descriptors.iterator(); it.hasNext();) { |
602 |
final TaskEditorPartDescriptor descriptor = it.next(); |
659 |
final TaskEditorPartDescriptor descriptor = it.next(); |