View | Details | Raw Unified | Return to bug 349510 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java (-8 / +28 lines)
Lines 18-23 Link Here
18
import org.eclipse.jface.action.ToolBarManager;
18
import org.eclipse.jface.action.ToolBarManager;
19
import org.eclipse.jface.dialogs.MessageDialog;
19
import org.eclipse.jface.dialogs.MessageDialog;
20
import org.eclipse.jface.layout.GridDataFactory;
20
import org.eclipse.jface.layout.GridDataFactory;
21
import org.eclipse.jface.layout.GridLayoutFactory;
21
import org.eclipse.jface.text.ITextListener;
22
import org.eclipse.jface.text.ITextListener;
22
import org.eclipse.jface.text.TextEvent;
23
import org.eclipse.jface.text.TextEvent;
23
import org.eclipse.jface.util.IPropertyChangeListener;
24
import org.eclipse.jface.util.IPropertyChangeListener;
Lines 63-69 Link Here
63
import org.eclipse.swt.widgets.Composite;
64
import org.eclipse.swt.widgets.Composite;
64
import org.eclipse.swt.widgets.Control;
65
import org.eclipse.swt.widgets.Control;
65
import org.eclipse.swt.widgets.Display;
66
import org.eclipse.swt.widgets.Display;
67
import org.eclipse.swt.widgets.Event;
66
import org.eclipse.swt.widgets.Label;
68
import org.eclipse.swt.widgets.Label;
69
import org.eclipse.swt.widgets.Listener;
67
import org.eclipse.swt.widgets.Spinner;
70
import org.eclipse.swt.widgets.Spinner;
68
import org.eclipse.swt.widgets.Text;
71
import org.eclipse.swt.widgets.Text;
69
import org.eclipse.ui.PlatformUI;
72
import org.eclipse.ui.PlatformUI;
Lines 202-207 Link Here
202
205
203
	private Label scheduledLabel;
206
	private Label scheduledLabel;
204
207
208
	private Composite layoutControl;
209
205
	public PlanningPart(int sectionStyle) {
210
	public PlanningPart(int sectionStyle) {
206
		super(sectionStyle, Messages.PersonalPart_Personal_Planning);
211
		super(sectionStyle, Messages.PersonalPart_Personal_Planning);
207
		this.activeTimeEnabled = true;
212
		this.activeTimeEnabled = true;
Lines 275-289 Link Here
275
		if (section.isExpanded()) {
280
		if (section.isExpanded()) {
276
			expandSection(toolkit, section);
281
			expandSection(toolkit, section);
277
		} else {
282
		} else {
278
			section.addExpansionListener(new ExpansionAdapter() {
283
			final ExpansionAdapter expansionAdapter = new ExpansionAdapter() {
279
				@Override
284
				@Override
280
				public void expansionStateChanged(ExpansionEvent event) {
285
				public void expansionStateChanged(ExpansionEvent e) {
281
					if (sectionClient == null) {
286
					if (sectionClient == null) {
282
						expandSection(toolkit, section);
287
						expandSection(toolkit, section);
283
						if (page instanceof AbstractTaskEditorPage) {
288
						if (page instanceof AbstractTaskEditorPage) {
284
							((AbstractTaskEditorPage) page).reflow();
289
							((AbstractTaskEditorPage) page).reflow();
285
						}
290
						}
286
					}
291
					}
292
293
				}
294
			};
295
			section.addExpansionListener(expansionAdapter);
296
			/// provide an SWT listener so that it can be triggered programatically when maximizing the section
297
			section.addListener(SWT.Expand, new Listener() {
298
				public void handleEvent(Event event) {
299
					expansionAdapter.expansionStateChanged(null);
287
				}
300
				}
288
			});
301
			});
289
		}
302
		}
Lines 299-322 Link Here
299
312
300
	private void expandSection(FormToolkit toolkit, Section section) {
313
	private void expandSection(FormToolkit toolkit, Section section) {
301
		sectionClient = toolkit.createComposite(section);
314
		sectionClient = toolkit.createComposite(section);
315
		GridLayoutFactory.fillDefaults().applyTo(sectionClient);
316
		layoutControl = toolkit.createComposite(sectionClient);
317
		GridDataFactory.fillDefaults().grab(true, true).applyTo(layoutControl);
302
		GridLayout layout = EditorUtil.createSectionClientLayout();
318
		GridLayout layout = EditorUtil.createSectionClientLayout();
303
		layout.numColumns = (needsDueDate) ? 6 : 4;
319
		layout.numColumns = (needsDueDate) ? 6 : 4;
304
		sectionClient.setLayout(layout);
320
		layoutControl.setLayout(layout);
305
321
306
		createScheduledDatePicker(toolkit, sectionClient);
322
		createScheduledDatePicker(toolkit, layoutControl);
307
323
308
		// disable due date picker if it's a repository due date
324
		// disable due date picker if it's a repository due date
309
		if (needsDueDate) {
325
		if (needsDueDate) {
310
			createDueDatePicker(toolkit, sectionClient);
326
			createDueDatePicker(toolkit, layoutControl);
311
		}
327
		}
312
328
313
		createEstimatedTime(toolkit, sectionClient);
329
		createEstimatedTime(toolkit, layoutControl);
314
330
315
		if (needsNotes()) {
331
		if (needsNotes()) {
316
			createNotesArea(toolkit, sectionClient, layout.numColumns);
332
			createNotesArea(toolkit, layoutControl, layout.numColumns);
317
		}
333
		}
318
334
319
		createActiveTime(toolkit, sectionClient, layout.numColumns);
335
		createActiveTime(toolkit, layoutControl, layout.numColumns);
320
336
321
		toolkit.paintBordersFor(sectionClient);
337
		toolkit.paintBordersFor(sectionClient);
322
		section.setClient(sectionClient);
338
		section.setClient(sectionClient);
Lines 744-747 Link Here
744
		return noteEditor;
760
		return noteEditor;
745
	}
761
	}
746
762
763
	public Control getLayoutControl() {
764
		return layoutControl;
765
	}
766
747
}
767
}
(-)a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java (+7 lines)
Lines 20-25 Link Here
20
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
20
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
21
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
21
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
22
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.Control;
23
import org.eclipse.ui.forms.widgets.ExpandableComposite;
24
import org.eclipse.ui.forms.widgets.ExpandableComposite;
24
import org.eclipse.ui.forms.widgets.FormToolkit;
25
import org.eclipse.ui.forms.widgets.FormToolkit;
25
26
Lines 54-59 Link Here
54
				NotesAction notesAction = new NotesAction();
55
				NotesAction notesAction = new NotesAction();
55
				notesAction.setEnabled(needsNotes());
56
				notesAction.setEnabled(needsNotes());
56
				toolBarManager.add(notesAction);
57
				toolBarManager.add(notesAction);
58
				toolBarManager.add(getMaximizePartAction());
57
			}
59
			}
58
		};
60
		};
59
	}
61
	}
Lines 79-84 Link Here
79
	}
81
	}
80
82
81
	@Override
83
	@Override
84
	protected Control getLayoutControl() {
85
		return part.getLayoutControl();
86
	}
87
88
	@Override
82
	public void commit(boolean onSave) {
89
	public void commit(boolean onSave) {
83
		super.commit(onSave);
90
		super.commit(onSave);
84
		part.commit(onSave);
91
		part.commit(onSave);
(-)a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java (-1 / +8 lines)
Lines 28-33 Link Here
28
import org.eclipse.swt.layout.RowLayout;
28
import org.eclipse.swt.layout.RowLayout;
29
import org.eclipse.swt.widgets.Composite;
29
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.swt.widgets.Control;
30
import org.eclipse.swt.widgets.Control;
31
import org.eclipse.swt.widgets.Event;
31
import org.eclipse.ui.forms.AbstractFormPart;
32
import org.eclipse.ui.forms.AbstractFormPart;
32
import org.eclipse.ui.forms.widgets.ExpandableComposite;
33
import org.eclipse.ui.forms.widgets.ExpandableComposite;
33
import org.eclipse.ui.forms.widgets.FormToolkit;
34
import org.eclipse.ui.forms.widgets.FormToolkit;
Lines 213-223 Link Here
213
214
214
		@Override
215
		@Override
215
		public void run() {
216
		public void run() {
217
			if (getControl() instanceof Section && !((Section) getControl()).isExpanded()) {
218
				((Section) getControl()).setExpanded(true);
219
				((Section) getControl()).notifyListeners(SWT.Expand, new Event());
220
			}
216
			Control control = getLayoutControl();
221
			Control control = getLayoutControl();
217
			if (control == null || !(control.getLayoutData() instanceof GridData)) {
222
			if (control == null || !(control.getLayoutData() instanceof GridData)) {
218
				return;
223
				return;
219
			}
224
			}
220
221
			GridData gd = (GridData) control.getLayoutData();
225
			GridData gd = (GridData) control.getLayoutData();
222
226
223
			// initialize originalHeight on first invocation
227
			// initialize originalHeight on first invocation
Lines 238-243 Link Here
238
			}
242
			}
239
			gd.heightHint = heightHint;
243
			gd.heightHint = heightHint;
240
			gd.minimumHeight = heightHint;
244
			gd.minimumHeight = heightHint;
245
			if (gd.widthHint == -1) {
246
				gd.widthHint = 300;// needs to be set or else heightHint is ignored
247
			}
241
248
242
			getTaskEditorPage().reflow();
249
			getTaskEditorPage().reflow();
243
			CommonFormUtil.ensureVisible(control);
250
			CommonFormUtil.ensureVisible(control);

Return to bug 349510