Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2009-03-12 19:02:51 -0400
committerrelves2009-03-12 19:02:51 -0400
commit48f530e5bb819f59ba975d317c5979f4f590cef3 (patch)
tree0a3e5feb202626684efb127f4c8c87ce43a5573c
parent21279fe0ee994f55b9ecd1e6860836066b56aa55 (diff)
downloadorg.eclipse.mylyn.tasks-48f530e5bb819f59ba975d317c5979f4f590cef3.tar.gz
org.eclipse.mylyn.tasks-48f530e5bb819f59ba975d317c5979f4f590cef3.tar.xz
org.eclipse.mylyn.tasks-48f530e5bb819f59ba975d317c5979f4f590cef3.zip
NEW - bug 268408: automatically select the last used Product when no selection is present
https://bugs.eclipse.org/bugs/show_bug.cgi?id=268408
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java10
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java12
3 files changed, 21 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
index 0544d44cb..3794b4dd5 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
@@ -266,4 +266,6 @@ public interface IBugzillaConstants {
public static final String TAG_BUGZILLA_CUSTOM_QUERY = "BugzillaCustomQuery"; //$NON-NLS-1$
public static final String CONTENT_ENCODING_GZIP = "gzip"; //$NON-NLS-1$
+
+ public static final String LAST_PRODUCT_SELECTION = "last.selection.product"; //$NON-NLS-1$
}
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 c4a888a88..56a855f55 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
@@ -167,7 +167,6 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
@Override
public void doSubmit() {
-
TaskAttribute summaryAttribute = getModel().getTaskData().getRoot().getMappedAttribute(TaskAttribute.SUMMARY);
if (summaryAttribute != null && summaryAttribute.getValue().length() == 0) {
getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Please_enter_a_short_summary_before_submitting,
@@ -204,6 +203,15 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
return;
}
+ if (getModel().getTaskData().isNew()) {
+ TaskAttribute productAttribute = getModel().getTaskData().getRoot().getMappedAttribute(
+ TaskAttribute.PRODUCT);
+ if (productAttribute != null && productAttribute.getValue().length() > 0) {
+ getModel().getTaskRepository().setProperty(IBugzillaConstants.LAST_PRODUCT_SELECTION,
+ productAttribute.getValue());
+ }
+ }
+
// Force the most recent known good token onto the outgoing task data to ensure submit
// bug#263318
TaskAttribute attrToken = getModel().getTaskData().getRoot().getAttribute(BugzillaAttribute.TOKEN.getKey());
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java
index 492586434..1b8e28212 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java
@@ -20,6 +20,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
+import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
@@ -66,8 +67,15 @@ public class NewBugzillaTaskWizard extends NewTaskWizard implements INewWizard {
}
}
}
- if (selection == null) {
- return null;
+ if (selection == null || selection.isEmpty()) {
+ final String lastSelection = getTaskRepository().getProperty(IBugzillaConstants.LAST_PRODUCT_SELECTION);
+ return new TaskMapping() {
+ @Override
+ public String getProduct() {
+ return lastSelection;
+ }
+ };
+
}
final ArrayList<String> products = new ArrayList<String>();

Back to the top