Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2008-08-13 20:26:14 -0400
committerrelves2008-08-13 20:26:14 -0400
commitb53c3b3c93db13d22248bb4216a0e8a8862240d3 (patch)
tree3d3d2022def6ff41bd7dc1ca88931206a58e0fb9
parente5b5385094bcb4881ba77f0ca4ea7ff6178dfa32 (diff)
downloadorg.eclipse.mylyn.tasks-b53c3b3c93db13d22248bb4216a0e8a8862240d3.tar.gz
org.eclipse.mylyn.tasks-b53c3b3c93db13d22248bb4216a0e8a8862240d3.tar.xz
org.eclipse.mylyn.tasks-b53c3b3c93db13d22248bb4216a0e8a8862240d3.zip
NEW - bug 243121: validate New Task Editor fields before submission
https://bugs.eclipse.org/bugs/show_bug.cgi?id=243121
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
index db9d78563..81aac84b0 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
@@ -11,6 +11,7 @@ package org.eclipse.mylyn.internal.bugzilla.ui.editor;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
@@ -30,6 +31,7 @@ import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor;
*/
public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
+ private static final String LABEL_ERROR_SUBMIT = "Task Submit Error";
public static final String ID_PART_BUGZILLA_PLANNING = "org.eclipse.mylyn.bugzilla.ui.editors.part.planning";
public BugzillaTaskEditorPage(TaskEditor editor) {
@@ -103,4 +105,42 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
return factory;
}
+ @Override
+ public void doSubmit() {
+
+ TaskAttribute summaryAttribute = getModel().getTaskData().getRoot().getMappedAttribute(TaskAttribute.SUMMARY);
+ if (summaryAttribute != null && summaryAttribute.getValue().length() == 0) {
+ MessageDialog.openInformation(null, LABEL_ERROR_SUBMIT, "Please enter a short summary before submitting");
+ AbstractTaskEditorPart part = getPart(ID_PART_SUMMARY);
+ if (part != null) {
+ part.setFocus();
+ }
+ return;
+ }
+
+ TaskAttribute componentAttribute = getModel().getTaskData().getRoot().getMappedAttribute(
+ BugzillaAttribute.COMPONENT.getKey());
+ if (componentAttribute != null && componentAttribute.getValue().length() == 0) {
+ MessageDialog.openInformation(null, LABEL_ERROR_SUBMIT, "Please select a component before submitting");
+ AbstractTaskEditorPart part = getPart(ID_PART_ATTRIBUTES);
+ if (part != null) {
+ part.setFocus();
+ }
+ return;
+ }
+
+ TaskAttribute descriptionAttribute = getModel().getTaskData().getRoot().getMappedAttribute(
+ TaskAttribute.DESCRIPTION);
+ if (descriptionAttribute != null && descriptionAttribute.getValue().length() == 0) {
+ MessageDialog.openInformation(null, LABEL_ERROR_SUBMIT, "Please enter a description before submitting");
+ AbstractTaskEditorPart descriptionPart = getPart(ID_PART_DESCRIPTION);
+ if (descriptionPart != null) {
+ descriptionPart.setFocus();
+ }
+ return;
+ }
+
+ super.doSubmit();
+ }
+
}

Back to the top