Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2016-12-18 10:14:23 -0500
committerGerrit Code Review @ Eclipse.org2017-01-30 14:00:33 -0500
commiteb110be4af73ee8c70e0b101e61e8e5408dd0bb0 (patch)
tree819ad9918585180da2ef696c05c0e49e3c8c88c2
parentd2a46aff5af616b1d97e24f1702e856234ca76e7 (diff)
downloadorg.eclipse.mylyn.tasks-eb110be4af73ee8c70e0b101e61e8e5408dd0bb0.tar.gz
org.eclipse.mylyn.tasks-eb110be4af73ee8c70e0b101e61e8e5408dd0bb0.tar.xz
org.eclipse.mylyn.tasks-eb110be4af73ee8c70e0b101e61e8e5408dd0bb0.zip
234445: [upstream] show descriptions for keywords for the REST Connector
Change-Id: Id2db8d3af57b89c34840e86f11316e454b0dcbb4 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=234445
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData.txt2
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData1.txt2
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData2.txt2
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData.txt2
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData1.txt2
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData2.txt2
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java1
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConfiguration.java26
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaKeywordAttributeEditor.java29
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/Messages.java2
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/messages.properties1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java102
12 files changed, 118 insertions, 55 deletions
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData.txt
index 889e2e664..182112825 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData.txt
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData.txt
@@ -19,7 +19,7 @@ TaskAttribute[id=root,values=[],options=null,metaData=null]
TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}]
TaskAttribute[id=depends_on,values=[],options=null,metaData={task.meta.label=Depends on:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=blocks,values=[],options=null,metaData={task.meta.label=Blocks:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
- TaskAttribute[id=keywords,values=[],options={Keyword1=Keyword1, Keyword2=Keyword2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
+ TaskAttribute[id=keywords,values=[],options={Keyword1=1, Keyword2=2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}]
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData1.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData1.txt
index a396ee7b0..f13175e7d 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData1.txt
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData1.txt
@@ -19,7 +19,7 @@ TaskAttribute[id=root,values=[],options=null,metaData=null]
TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}]
TaskAttribute[id=depends_on,values=[],options=null,metaData={task.meta.label=Depends on:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=blocks,values=[],options=null,metaData={task.meta.label=Blocks:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
- TaskAttribute[id=keywords,values=[],options={Keyword1=Keyword1, Keyword2=Keyword2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
+ TaskAttribute[id=keywords,values=[],options={Keyword1=1, Keyword2=2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}]
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData2.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData2.txt
index e3ab9eca8..e82df73db 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData2.txt
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData2.txt
@@ -19,7 +19,7 @@ TaskAttribute[id=root,values=[],options=null,metaData=null]
TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}]
TaskAttribute[id=depends_on,values=[],options=null,metaData={task.meta.label=Depends on:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=blocks,values=[],options=null,metaData={task.meta.label=Blocks:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
- TaskAttribute[id=keywords,values=[],options={Keyword1=Keyword1, Keyword2=Keyword2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
+ TaskAttribute[id=keywords,values=[],options={Keyword1=1, Keyword2=2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}]
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData.txt
index 889e2e664..182112825 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData.txt
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData.txt
@@ -19,7 +19,7 @@ TaskAttribute[id=root,values=[],options=null,metaData=null]
TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}]
TaskAttribute[id=depends_on,values=[],options=null,metaData={task.meta.label=Depends on:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=blocks,values=[],options=null,metaData={task.meta.label=Blocks:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
- TaskAttribute[id=keywords,values=[],options={Keyword1=Keyword1, Keyword2=Keyword2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
+ TaskAttribute[id=keywords,values=[],options={Keyword1=1, Keyword2=2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}]
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData1.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData1.txt
index a396ee7b0..f13175e7d 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData1.txt
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData1.txt
@@ -19,7 +19,7 @@ TaskAttribute[id=root,values=[],options=null,metaData=null]
TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}]
TaskAttribute[id=depends_on,values=[],options=null,metaData={task.meta.label=Depends on:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=blocks,values=[],options=null,metaData={task.meta.label=Blocks:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
- TaskAttribute[id=keywords,values=[],options={Keyword1=Keyword1, Keyword2=Keyword2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
+ TaskAttribute[id=keywords,values=[],options={Keyword1=1, Keyword2=2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}]
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData2.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData2.txt
index e3ab9eca8..e82df73db 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData2.txt
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData2.txt
@@ -19,7 +19,7 @@ TaskAttribute[id=root,values=[],options=null,metaData=null]
TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}]
TaskAttribute[id=depends_on,values=[],options=null,metaData={task.meta.label=Depends on:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=blocks,values=[],options=null,metaData={task.meta.label=Blocks:, task.meta.type=taskDepenedency, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
- TaskAttribute[id=keywords,values=[],options={Keyword1=Keyword1, Keyword2=Keyword2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
+ TaskAttribute[id=keywords,values=[],options={Keyword1=1, Keyword2=2},metaData={task.meta.label=Keywords, task.meta.type=bugzilla.editor.keyword, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}]
TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}]
TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}]
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java
index a3fc737d0..4e11faa84 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java
@@ -200,6 +200,7 @@ public class BugzillaRestClient {
config.updateProductOptions(taskData);
config.addValidOperations(taskData);
config.updateFlags(taskData);
+ config.updateKeyword(taskData);
collector.accept(taskData);
}
} catch (RuntimeException e) {
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConfiguration.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConfiguration.java
index 85156437b..35a8bd5e2 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConfiguration.java
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConfiguration.java
@@ -191,6 +191,7 @@ public class BugzillaRestConfiguration implements Serializable {
}
}
}
+ updateKeyword(data);
}
private String getValueFromParameter(String attributeId) {
@@ -409,9 +410,8 @@ public class BugzillaRestConfiguration implements Serializable {
.createAttribute(TaskAttribute.PREFIX_OPERATION + statusTransition.name);
TaskOperation.applyTo(attribute, statusTransition.name, statusTransition.name);
if (statusTransition.name != null && statusTransition.name.equals("RESOLVED")) {
- TaskAttribute attrResolvedInput = attribute.getTaskData()
- .getRoot()
- .createAttribute("resolutionInput");
+ TaskAttribute attrResolvedInput = attribute.getTaskData().getRoot().createAttribute(
+ "resolutionInput");
attrResolvedInput.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT);
attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, "resolutionInput");
Field resolution = getFieldWithName("resolution");
@@ -426,13 +426,11 @@ public class BugzillaRestConfiguration implements Serializable {
}
attribute = bugReport.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + "duplicate");
TaskOperation.applyTo(attribute, "duplicate", "Mark as Duplicate");
- TaskAttribute attrResolvedInput = attribute.getTaskData()
- .getRoot()
- .getAttribute(BugzillaRestTaskSchema.getDefault().DUPE_OF.getKey());
+ TaskAttribute attrResolvedInput = attribute.getTaskData().getRoot().getAttribute(
+ BugzillaRestTaskSchema.getDefault().DUPE_OF.getKey());
if (attrResolvedInput == null) {
- attrResolvedInput = attribute.getTaskData()
- .getRoot()
- .createAttribute(BugzillaRestTaskSchema.getDefault().DUPE_OF.getKey());
+ attrResolvedInput = attribute.getTaskData().getRoot().createAttribute(
+ BugzillaRestTaskSchema.getDefault().DUPE_OF.getKey());
}
attrResolvedInput.getMetaData().setType(TaskAttribute.TYPE_TASK_DEPENDENCY);
attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, attrResolvedInput.getId());
@@ -551,4 +549,14 @@ public class BugzillaRestConfiguration implements Serializable {
addMissingFlagsInternal(attribute, flagTypes.getAttachment(), existingAttachmentFlags);
}
+ public void updateKeyword(TaskData taskData) {
+ TaskAttribute attributeKeywords = taskData.getRoot().getMappedAttribute(SCHEMA.KEYWORDS.getKey());
+ Field keywords = getFieldWithName("keywords");
+ FieldValues[] keywordList = keywords.getValues();
+ attributeKeywords.clearOptions();
+ for (FieldValues fieldValues : keywordList) {
+ attributeKeywords.putOption(fieldValues.getName(), fieldValues.getDescription());
+ }
+ }
+
} \ No newline at end of file
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaKeywordAttributeEditor.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaKeywordAttributeEditor.java
index fb0d37dfa..7938dc0b2 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaKeywordAttributeEditor.java
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaKeywordAttributeEditor.java
@@ -13,11 +13,16 @@ package org.eclipse.mylyn.internal.bugzilla.rest.ui;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
+import org.eclipse.mylyn.commons.workbench.InPlaceCheckBoxTreeDialog;
+import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.tasks.ui.editors.CheckboxMultiSelectAttributeEditor;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
+import org.eclipse.osgi.util.NLS;
/**
* @author Rob Elves
@@ -26,7 +31,6 @@ public class BugzillaKeywordAttributeEditor extends CheckboxMultiSelectAttribute
public BugzillaKeywordAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
super(manager, taskAttribute);
-
}
@Override
@@ -44,4 +48,27 @@ public class BugzillaKeywordAttributeEditor extends CheckboxMultiSelectAttribute
attributeChanged();
}
+ @Override
+ protected List<String> getValueList() {
+ return getValues();
+ }
+
+ @Override
+ public List<String> getValuesLabels() {
+ List<String> tmp = getTaskAttribute().getValues();
+ List<String> newStrs = new ArrayList<>(tmp);
+ return newStrs;
+ }
+
+ @Override
+ protected InPlaceCheckBoxTreeDialog createInPlaceCheckBoxTreeDialog(List<String> values) {
+ Map<String, String> validDescriptions = getTaskAttribute().getOptions();
+ LinkedHashMap<String, String> validValues = new LinkedHashMap<String, String>(validDescriptions.size());
+ for (String value : validDescriptions.keySet()) {
+ validValues.put(value, value);
+ }
+ return new InPlaceCheckBoxTreeDialog(WorkbenchUtil.getShell(), getButton(), values, validValues,
+ NLS.bind(Messages.BugzillaKeywordAttributeEditor_Select_X, getLabel()), validDescriptions);
+ }
+
} \ No newline at end of file
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/Messages.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/Messages.java
index 893caaf60..7c390a7de 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/Messages.java
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/Messages.java
@@ -16,6 +16,8 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.bugzilla.rest.ui.messages"; //$NON-NLS-1$
+ public static String BugzillaKeywordAttributeEditor_Select_X;
+
public static String BugzillaRestRepositorySettingsPage_api_key;
public static String BugzillaRestRepositorySettingsPage_Please_create_or_copy_the_API_Key_from;
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/messages.properties b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/messages.properties
index 96ec9ad82..fc03f92b4 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/messages.properties
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/messages.properties
@@ -1,3 +1,4 @@
+BugzillaKeywordAttributeEditor_Select_X=Select {0}
BugzillaRestRepositorySettingsPage_api_key=API Key
BugzillaRestRepositorySettingsPage_Please_create_or_copy_the_API_Key_from=Please create or copy the API Key from\n {0}
BugzillaRestRepositorySettingsPage_RestRepositorySetting=Bugzilla REST Repository Settings
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java
index eadfe71ba..b4f2e50fa 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Tasktop Technologies and others.
+ * Copyright (c) 2011 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,6 +35,7 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridLayout;
@@ -97,51 +98,68 @@ public class CheckboxMultiSelectAttributeEditor extends AbstractAttributeEditor
button = toolkit.createButton(composite, "", SWT.ARROW | SWT.DOWN); //$NON-NLS-1$
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.TOP).applyTo(button);
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- final List<String> values = getValues();
- Map<String, String> validValues = getAttributeMapper().getOptions(getTaskAttribute());
-
- final InPlaceCheckBoxTreeDialog selectionDialog = new InPlaceCheckBoxTreeDialog(
- WorkbenchUtil.getShell(), button, values, validValues, NLS.bind(
- Messages.CheckboxMultiSelectAttributeEditor_Select_X, getLabel()));
-
- selectionDialog.addEventListener(new IInPlaceDialogListener() {
-
- public void buttonPressed(InPlaceDialogEvent event) {
- suppressRefresh = true;
- try {
- if (event.getReturnCode() == Window.OK) {
- Set<String> newValues = selectionDialog.getSelectedValues();
- if (!new HashSet<String>(values).equals(newValues)) {
- setValues(new ArrayList<String>(newValues));
- refresh();
- }
- } else if (event.getReturnCode() == AbstractInPlaceDialog.ID_CLEAR) {
- Set<String> newValues = new HashSet<String>();
- if (!new HashSet<String>(values).equals(newValues)) {
- setValues(new ArrayList<String>(newValues));
- refresh();
- }
- }
- } finally {
- suppressRefresh = false;
- }
- }
- });
- selectionDialog.open();
- }
- });
+ button.addSelectionListener(createSelectionListener());
toolkit.adapt(valueText, false, false);
refresh();
setControl(composite);
}
}
+ protected SelectionListener createSelectionListener() {
+ return new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ final List<String> values = getValueList();
+ final InPlaceCheckBoxTreeDialog selectionDialog = createInPlaceCheckBoxTreeDialog(values);
+ addEventListener(values, selectionDialog);
+ selectionDialog.open();
+ }
+
+ };
+ }
+
+ protected List<String> getValueList() {
+ final List<String> values = getValues();
+ return values;
+ }
+
+ protected InPlaceCheckBoxTreeDialog createInPlaceCheckBoxTreeDialog(List<String> values) {
+ Map<String, String> validValues = getAttributeMapper().getOptions(getTaskAttribute());
+ final InPlaceCheckBoxTreeDialog selectionDialog = new InPlaceCheckBoxTreeDialog(WorkbenchUtil.getShell(),
+ button, values, validValues,
+ NLS.bind(Messages.CheckboxMultiSelectAttributeEditor_Select_X, getLabel()));
+ return selectionDialog;
+ }
+
+ private void addEventListener(final List<String> values, final InPlaceCheckBoxTreeDialog selectionDialog) {
+ selectionDialog.addEventListener(new IInPlaceDialogListener() {
+
+ public void buttonPressed(InPlaceDialogEvent event) {
+ suppressRefresh = true;
+ try {
+ if (event.getReturnCode() == Window.OK) {
+ Set<String> newValues = selectionDialog.getSelectedValues();
+ if (!new HashSet<String>(values).equals(newValues)) {
+ setValues(new ArrayList<String>(newValues));
+ refresh();
+ }
+ } else if (event.getReturnCode() == AbstractInPlaceDialog.ID_CLEAR) {
+ Set<String> newValues = new HashSet<String>();
+ if (!new HashSet<String>(values).equals(newValues)) {
+ setValues(new ArrayList<String>(newValues));
+ refresh();
+ }
+ }
+ } finally {
+ suppressRefresh = false;
+ }
+ }
+ });
+ }
+
/**
* Update scroll bars of the enclosing form.
- *
+ *
* @see Section#reflow()
*/
private void reflow() {
@@ -212,7 +230,8 @@ public class CheckboxMultiSelectAttributeEditor extends AbstractAttributeEditor
}
}
valueText.setText(valueString.toString());
- if (valueText != null && parent != null && parent.getParent() != null && parent.getParent().getParent() != null) {
+ if (valueText != null && parent != null && parent.getParent() != null
+ && parent.getParent().getParent() != null) {
Point size = valueText.getSize();
// subtract 1 from size for border
Point newSize = valueText.computeSize(size.x - 1, SWT.DEFAULT);
@@ -226,4 +245,9 @@ public class CheckboxMultiSelectAttributeEditor extends AbstractAttributeEditor
public boolean shouldAutoRefresh() {
return !suppressRefresh;
}
+
+ protected Button getButton() {
+ return button;
+ }
+
}

Back to the top