Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-08-10 19:50:34 +0000
committermkersten2005-08-10 19:50:34 +0000
commit31e357a4e5f33e7d4c631fa13cf0945749eed369 (patch)
tree2aebfe3225681e801bc516a57284ac309d7d480a /org.eclipse.mylyn.tasks.ui
parent1e13c2a5f9009d847e6adb6486b37a9c20c4b522 (diff)
downloadorg.eclipse.mylyn.tasks-31e357a4e5f33e7d4c631fa13cf0945749eed369.tar.gz
org.eclipse.mylyn.tasks-31e357a4e5f33e7d4c631fa13cf0945749eed369.tar.xz
org.eclipse.mylyn.tasks-31e357a4e5f33e7d4c631fa13cf0945749eed369.zip
Fixes to date picker patch
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/DateChooserDialog.java69
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java8
3 files changed, 68 insertions, 33 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java
index 1bbf5273d..1e3b0340f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java
@@ -25,6 +25,7 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CellEditor;
@@ -47,6 +48,7 @@ import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
import org.eclipse.mylar.tasklist.RelatedLinks;
import org.eclipse.mylar.tasklist.TaskListImages;
import org.eclipse.mylar.tasklist.internal.RelativePathUtil;
+import org.eclipse.mylar.tasklist.ui.views.DateChooserDialog;
import org.eclipse.mylar.tasklist.ui.views.TaskListView;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
@@ -88,6 +90,7 @@ import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
@@ -100,6 +103,8 @@ import org.eclipse.ui.part.EditorPart;
*/
public class TaskSummaryEditor extends EditorPart {
+ private static final String DESCRIPTION_OVERVIEW = "Task Summary";
+
/**
* TODO: use workbench theme
*/
@@ -301,9 +306,9 @@ public class TaskSummaryEditor extends EditorPart {
}
try {
- createTaskSection(parent, toolkit);
- createNotesSection(parent, toolkit);
+ createOverviewSection(parent, toolkit);
createPlanningGameSection(parent, toolkit);
+ createNotesSection(parent, toolkit);
createRelatedLinksSection(parent, toolkit);
createDetailsSection(parent, toolkit);
} catch (SWTException e) {
@@ -312,9 +317,9 @@ public class TaskSummaryEditor extends EditorPart {
return null;
}
- private void createTaskSection(Composite parent, FormToolkit toolkit) {
+ private void createOverviewSection(Composite parent, FormToolkit toolkit) {
Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
- section.setText("Mylar Task Description");
+ section.setText(DESCRIPTION_OVERVIEW);
section.setLayout(new TableWrapLayout());
section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
section.addExpansionListener(new IExpansionListener() {
@@ -350,7 +355,7 @@ public class TaskSummaryEditor extends EditorPart {
}
l = toolkit.createLabel(container, "Reminder:");
l.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- Text reminderDate = toolkit.createText(container,task.getReminderDateString(true), SWT.BORDER);
+ final Text reminderDate = toolkit.createText(container,task.getReminderDateString(true), SWT.BORDER);
reminderDate.setLayoutData(layout);
td = new TableWrapData(TableWrapData.FILL_GRAB);
td.grabHorizontal = true;
@@ -363,7 +368,12 @@ public class TaskSummaryEditor extends EditorPart {
// dateSelect.setLayoutData(td);
dateSelect.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
- // TODO: open Date Chooser
+ ITask task = ((TaskEditorInput)getEditorInput()).getTask();
+ DateChooserDialog dialog = new DateChooserDialog(Workbench.getInstance().getActiveWorkbenchWindow().getShell());
+ if (dialog.open() == Dialog.OK && dialog.getReminderDate() != null) {
+ task.setReminderDate(dialog.getReminderDate().getTime());
+ reminderDate.setText(task.getReminderDateString(true));
+ }
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
@@ -413,7 +423,7 @@ public class TaskSummaryEditor extends EditorPart {
}
private void createPlanningGameSection(Composite parent, FormToolkit toolkit) {
- Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | Section.TWISTIE);
+ Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
section.setText("Planning Game");
section.setLayout(new TableWrapLayout());
section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/DateChooserDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/DateChooserDialog.java
index 8f484a14b..4d65acb07 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/DateChooserDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/DateChooserDialog.java
@@ -11,9 +11,17 @@
package org.eclipse.mylar.tasklist.ui.views;
+import java.util.Calendar;
import java.util.Date;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.mylar.tasklist.contribution.DatePicker;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
/**
@@ -21,34 +29,49 @@ import org.eclipse.swt.widgets.Shell;
*/
public class DateChooserDialog extends Dialog {
-// private DatePicker picker = null;
- private Date reminderDate = null;
-
+ private DatePicker picker = null;
+ private Calendar reminderDate = null;
+
public DateChooserDialog(Shell parentShell) {
super(parentShell);
}
-// protected Control createDialogArea(Composite parent) {
-// Composite composite = (Composite) super.createDialogArea(parent);
-// GridLayout gl = new GridLayout(1, false);
-// composite.setLayout(gl);
-// GridData data = new GridData(GridData.FILL_BOTH);
-//
-// picker = new DatePicker(composite, SWT.NONE);
-// data.heightHint = 90; // HACK
-// picker.setLayoutData(data);
-// return composite;
-// }
-//
-// protected void buttonPressed(int buttonId) {
-// if (buttonId == IDialogConstants.OK_ID) {
-// reminderDate = picker.getDate();
-// } else {
-// }
-// super.buttonPressed(buttonId);
-// }
+ public DateChooserDialog(Shell parentShell, Date reminderDate) {
+ super(parentShell);
+ this.reminderDate = Calendar.getInstance();
+ this.reminderDate.setTime(reminderDate);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ GridLayout gl = new GridLayout(1, false);
+ composite.setLayout(gl);
+ GridData data = new GridData(GridData.FILL_BOTH);
+
+ picker = new DatePicker(composite, SWT.NONE);
+// picker.setDate()
+
+ data.heightHint = 90; // HACK
+ picker.setLayoutData(data);
+ return composite;
+ }
+
+
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ reminderDate = picker.getDate();
+ } else {
+ }
+ super.buttonPressed(buttonId);
+ }
- public Date getReminderDate() {
+ public Calendar getReminderDate() {
return reminderDate;
}
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText("Select date");
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java
index e1988f469..9e1d3379d 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java
@@ -27,6 +27,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.internal.Workbench;
/**
* @author Ken Sueda
@@ -78,9 +79,10 @@ public class TaskInputDialog extends Dialog {
button.setText("Remind me");
button.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
-// DateChooserDialog dialog = new DateChooserDialog(Workbench.getInstance().getActiveWorkbenchWindow().getShell());
-// dialog.open();
-// reminderDate = dialog.getReminderDate();
+ DateChooserDialog dialog = new DateChooserDialog(Workbench.getInstance().getActiveWorkbenchWindow().getShell());
+ if (dialog.open() == Dialog.OK && dialog.getReminderDate() != null) {
+ reminderDate = dialog.getReminderDate().getTime();
+ }
}
public void widgetDefaultSelected(SelectionEvent e) {

Back to the top