Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2008-04-08 22:42:35 +0000
committerrelves2008-04-08 22:42:35 +0000
commitf502ba91800611f8de0dbd575276ce4331c89c56 (patch)
tree72adb2113c76cd6fd3221bf95f6b75bdab8f2396 /org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
parent18ef7a55c633928563ce172ac3f3418e611430bc (diff)
downloadorg.eclipse.mylyn.tasks-f502ba91800611f8de0dbd575276ce4331c89c56.tar.gz
org.eclipse.mylyn.tasks-f502ba91800611f8de0dbd575276ce4331c89c56.tar.xz
org.eclipse.mylyn.tasks-f502ba91800611f8de0dbd575276ce4331c89c56.zip
ASSIGNED - bug 175922: [patch] Support Bugzilla 3.0 custom fields
https://bugs.eclipse.org/bugs/show_bug.cgi?id=175922
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java')
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java75
1 files changed, 46 insertions, 29 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
index 10bde0d08..ddb271733 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
@@ -11,6 +11,7 @@ package org.eclipse.mylyn.internal.bugzilla.core;
import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -194,7 +195,8 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler {
try {
status = BUGZILLA_REPORT_STATUS.valueOf(bugReport.getStatus());
} catch (RuntimeException e) {
- StatusHandler.log(new Status(IStatus.INFO, BugzillaCorePlugin.PLUGIN_ID, "Unrecognized status: " + bugReport.getStatus(), e));
+ StatusHandler.log(new Status(IStatus.INFO, BugzillaCorePlugin.PLUGIN_ID, "Unrecognized status: "
+ + bugReport.getStatus(), e));
status = BUGZILLA_REPORT_STATUS.NEW;
}
switch (status) {
@@ -316,7 +318,7 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler {
@Override
public boolean initializeTaskData(TaskRepository repository, RepositoryTaskData data, IProgressMonitor monitor)
- throws CoreException {
+ throws CoreException {
if (data == null)
return false;
@@ -494,35 +496,50 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler {
throws CoreException {
String product = existingReport.getAttributeValue(BugzillaReportElement.PRODUCT.getKeyString());
for (RepositoryTaskAttribute attribute : existingReport.getAttributes()) {
- BugzillaReportElement element = BugzillaReportElement.valueOf(attribute.getId().trim().toUpperCase(
- Locale.ENGLISH));
- attribute.clearOptions();
- List<String> optionValues = BugzillaCorePlugin.getRepositoryConfiguration(taskRepository, false)
- .getOptionValues(element, product);
- if (element != BugzillaReportElement.OP_SYS && element != BugzillaReportElement.BUG_SEVERITY
- && element != BugzillaReportElement.PRIORITY && element != BugzillaReportElement.BUG_STATUS) {
- Collections.sort(optionValues);
- }
- if (element == BugzillaReportElement.TARGET_MILESTONE && optionValues.isEmpty()) {
-
- existingReport.removeAttribute(BugzillaReportElement.TARGET_MILESTONE);
- continue;
- }
- attribute.clearOptions();
- for (String option : optionValues) {
- attribute.addOption(option, option);
+ if (attribute.getId().startsWith("cf_")) {
+ attribute.clearOptions();
+ List<BugzillaCustomField> customFields = BugzillaCorePlugin.getRepositoryConfiguration(taskRepository,
+ false).getCustomFields();
+
+ for (BugzillaCustomField bugzillaCustomField : customFields) {
+ if (bugzillaCustomField.getName().equals(attribute.getId())) {
+ List<String> optionList = bugzillaCustomField.getOptions();
+ for (String option : optionList) {
+ attribute.addOption(option, option);
+ }
+ }
+ }
+ } else {
+ BugzillaReportElement element = BugzillaReportElement.valueOf(attribute.getId().trim().toUpperCase(
+ Locale.ENGLISH));
+ attribute.clearOptions();
+ List<String> optionValues = BugzillaCorePlugin.getRepositoryConfiguration(taskRepository, false)
+ .getOptionValues(element, product);
+ if (element != BugzillaReportElement.OP_SYS && element != BugzillaReportElement.BUG_SEVERITY
+ && element != BugzillaReportElement.PRIORITY && element != BugzillaReportElement.BUG_STATUS) {
+ Collections.sort(optionValues);
+ }
+ if (element == BugzillaReportElement.TARGET_MILESTONE && optionValues.isEmpty()) {
+
+ existingReport.removeAttribute(BugzillaReportElement.TARGET_MILESTONE);
+ continue;
+ }
+ attribute.clearOptions();
+ for (String option : optionValues) {
+ attribute.addOption(option, option);
+ }
+
+ // TODO: bug#162428, bug#150680 - something along the lines of...
+ // but must think about the case of multiple values selected etc.
+ // if(attribute.hasOptions()) {
+ // if(!attribute.getOptionValues().containsKey(attribute.getValue()))
+ // {
+ // // updateAttributes()
+ // }
+ // }
}
-
- // TODO: bug#162428, bug#150680 - something along the lines of...
- // but must think about the case of multiple values selected etc.
- // if(attribute.hasOptions()) {
- // if(!attribute.getOptionValues().containsKey(attribute.getValue()))
- // {
- // // updateAttributes()
- // }
- // }
}
-
+
}
}

Back to the top