summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2012-01-05 18:48:08 (EST)
committerSteffen Pingel2012-01-05 18:48:08 (EST)
commit73b95b9d13eb50f2f0cc11399eea06a58d2ba7c5 (patch)
treee658349b70830407fe7eb8fcff56b9faa50ab9be
parent433dbd6f528bec4ff2c42146e625f61d44744491 (diff)
downloadorg.eclipse.mylyn.tasks-73b95b9d13eb50f2f0cc11399eea06a58d2ba7c5.zip
org.eclipse.mylyn.tasks-73b95b9d13eb50f2f0cc11399eea06a58d2ba7c5.tar.gz
org.eclipse.mylyn.tasks-73b95b9d13eb50f2f0cc11399eea06a58d2ba7c5.tar.bz2
NEW - bug 349510: [patch] add maximize button to private notes section
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349510
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java25
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java7
3 files changed, 32 insertions, 7 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java
index 85a830f..615f6ef 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.TextEvent;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -80,6 +81,7 @@ import org.eclipse.ui.forms.widgets.Section;
/**
* @author Shawn Minto
+ * @author Sam Davis
*/
public class PlanningPart extends AbstractLocalEditorPart {
@@ -202,6 +204,8 @@ public class PlanningPart extends AbstractLocalEditorPart {
private Label scheduledLabel;
+ private Composite layoutControl;
+
public PlanningPart(int sectionStyle) {
super(sectionStyle, Messages.PersonalPart_Personal_Planning);
this.activeTimeEnabled = true;
@@ -299,24 +303,29 @@ public class PlanningPart extends AbstractLocalEditorPart {
private void expandSection(FormToolkit toolkit, Section section) {
sectionClient = toolkit.createComposite(section);
+ GridLayoutFactory.fillDefaults().applyTo(sectionClient);
+
+ // create nested composite with GridData to enable resizing behavior of maximize action
+ layoutControl = toolkit.createComposite(sectionClient);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(layoutControl);
GridLayout layout = EditorUtil.createSectionClientLayout();
layout.numColumns = (needsDueDate) ? 6 : 4;
- sectionClient.setLayout(layout);
+ layoutControl.setLayout(layout);
- createScheduledDatePicker(toolkit, sectionClient);
+ createScheduledDatePicker(toolkit, layoutControl);
// disable due date picker if it's a repository due date
if (needsDueDate) {
- createDueDatePicker(toolkit, sectionClient);
+ createDueDatePicker(toolkit, layoutControl);
}
- createEstimatedTime(toolkit, sectionClient);
+ createEstimatedTime(toolkit, layoutControl);
if (needsNotes()) {
- createNotesArea(toolkit, sectionClient, layout.numColumns);
+ createNotesArea(toolkit, layoutControl, layout.numColumns);
}
- createActiveTime(toolkit, sectionClient, layout.numColumns);
+ createActiveTime(toolkit, layoutControl, layout.numColumns);
toolkit.paintBordersFor(sectionClient);
section.setClient(sectionClient);
@@ -744,4 +753,8 @@ public class PlanningPart extends AbstractLocalEditorPart {
return noteEditor;
}
+ public Control getLayoutControl() {
+ return layoutControl;
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java
index ccfafa4..fcac945 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java
@@ -20,6 +20,7 @@ import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -54,6 +55,7 @@ public class TaskEditorPlanningPart extends AbstractTaskEditorPart {
NotesAction notesAction = new NotesAction();
notesAction.setEnabled(needsNotes());
toolBarManager.add(notesAction);
+ toolBarManager.add(getMaximizePartAction());
}
};
}
@@ -79,6 +81,11 @@ public class TaskEditorPlanningPart extends AbstractTaskEditorPart {
}
@Override
+ protected Control getLayoutControl() {
+ return part.getLayoutControl();
+ }
+
+ @Override
public void commit(boolean onSave) {
super.commit(onSave);
part.commit(onSave);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java
index 57316ba..48053af 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java
@@ -213,11 +213,13 @@ public abstract class AbstractTaskEditorPart extends AbstractFormPart {
@Override
public void run() {
+ if (getControl() instanceof Section && !((Section) getControl()).isExpanded()) {
+ CommonFormUtil.setExpanded((Section) getControl(), true);
+ }
Control control = getLayoutControl();
if (control == null || !(control.getLayoutData() instanceof GridData)) {
return;
}
-
GridData gd = (GridData) control.getLayoutData();
// initialize originalHeight on first invocation
@@ -238,6 +240,9 @@ public abstract class AbstractTaskEditorPart extends AbstractFormPart {
}
gd.heightHint = heightHint;
gd.minimumHeight = heightHint;
+ if (gd.widthHint == -1) {
+ gd.widthHint = 300;// needs to be set or else heightHint is ignored
+ }
getTaskEditorPage().reflow();
CommonFormUtil.ensureVisible(control);