diff options
author | Frank Becker | 2016-05-16 19:14:21 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-05-20 17:50:02 +0000 |
commit | 62e422daf603e288762f08075f3abf4617e16b15 (patch) | |
tree | 5d77904c760ee21d5e56600953493af4e575e9d5 /connector-bugzilla-rest | |
parent | b9a7552f5892b88fb40727c55db62c63864fbd68 (diff) | |
download | org.eclipse.mylyn.tasks-62e422daf603e288762f08075f3abf4617e16b15.tar.gz org.eclipse.mylyn.tasks-62e422daf603e288762f08075f3abf4617e16b15.tar.xz org.eclipse.mylyn.tasks-62e422daf603e288762f08075f3abf4617e16b15.zip |
490542: REST Connector: add support for "Reassign to default assignee"
(rebased version of patch set#1)
Change-Id: I6a3aff1ebb230d76db7fdb2064a6b13def360245
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=490542
Diffstat (limited to 'connector-bugzilla-rest')
6 files changed, 79 insertions, 1 deletions
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/internal/bugzilla/rest/core/tests/BugzillaRestClientTest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/internal/bugzilla/rest/core/tests/BugzillaRestClientTest.java index 0667cb2a7..8d3dbc95e 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/internal/bugzilla/rest/core/tests/BugzillaRestClientTest.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/internal/bugzilla/rest/core/tests/BugzillaRestClientTest.java @@ -488,6 +488,7 @@ public class BugzillaRestClientTest { taskDataGet.getRoot().removeAttribute("addCC"); taskDataGet.getRoot().removeAttribute("removeCC"); taskDataGet.getRoot().removeAttribute(BugzillaRestTaskSchema.getDefault().RESET_QA_CONTACT.getKey()); + taskDataGet.getRoot().removeAttribute(BugzillaRestTaskSchema.getDefault().RESET_ASSIGNED_TO.getKey()); // attributes for operations taskDataGet.getRoot().removeAttribute("task.common.operation-CONFIRMED"); 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 8c4cc4e5a..49c3f7842 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 @@ -122,7 +122,8 @@ public class BugzillaRestConfiguration implements Serializable { || key.equals(BugzillaRestTaskSchema.getDefault().NEW_COMMENT.getKey()) || key.equals(BugzillaRestTaskSchema.getDefault().DUPE_OF.getKey()) || key.equals(TaskAttribute.OPERATION) - || key.equals(BugzillaRestTaskSchema.getDefault().DATE_MODIFICATION.getKey())) { + || key.equals(BugzillaRestTaskSchema.getDefault().DATE_MODIFICATION.getKey()) + || key.equals(BugzillaRestTaskSchema.getDefault().RESET_ASSIGNED_TO.getKey())) { continue; } TaskAttribute attribute = data.getRoot().getAttribute(key); diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestPutUpdateTask.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestPutUpdateTask.java index fd35cb387..4dbd1af02 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestPutUpdateTask.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestPutUpdateTask.java @@ -80,6 +80,7 @@ public class BugzillaRestPutUpdateTask extends BugzillaRestAuthenticatedPutReque .add(BugzillaRestTaskSchema.getDefault().DEPENDS_ON.getKey()) .add(BugzillaRestTaskSchema.getDefault().KEYWORDS.getKey()) .add(BugzillaRestTaskSchema.getDefault().RESET_QA_CONTACT.getKey()) + .add(BugzillaRestTaskSchema.getDefault().RESET_ASSIGNED_TO.getKey()) .build(); class TaskAttributeTypeAdapter extends TypeAdapter<OldAttributes> { diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java index 677bd131e..470a347d7 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java @@ -151,6 +151,9 @@ public class BugzillaRestTaskSchema extends AbstractTaskSchema { public final Field RESET_QA_CONTACT = createField("reset_qa_contact", "Reset QA Contact to default", TaskAttribute.TYPE_BOOLEAN, Flag.PEOPLE); + public final Field RESET_ASSIGNED_TO = createField("reset_assigned_to", "Reassign to default assignee", + TaskAttribute.TYPE_BOOLEAN, Flag.PEOPLE); + @Override public void initialize(TaskData taskData) { for (Field field : getFields()) { diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestTaskEditorPage.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestTaskEditorPage.java index dbc4c844f..1898d36fa 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestTaskEditorPage.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestTaskEditorPage.java @@ -11,13 +11,17 @@ package org.eclipse.mylyn.internal.bugzilla.rest.ui; +import java.util.Set; + import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestCore; import org.eclipse.mylyn.internal.bugzilla.rest.core.IBugzillaRestConstants; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage; +import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart; import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory; import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; +import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor; public class BugzillaRestTaskEditorPage extends AbstractTaskEditorPage { @@ -51,4 +55,25 @@ public class BugzillaRestTaskEditorPage extends AbstractTaskEditorPage { return factory; } + @Override + protected Set<TaskEditorPartDescriptor> createPartDescriptors() { + Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors(); + // remove unnecessary default editor parts + for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) { + if (taskEditorPartDescriptor.getId().equals(ID_PART_PEOPLE)) { + descriptors.remove(taskEditorPartDescriptor); + break; + } + } + // Add the updated Bugzilla people part + descriptors.add(new TaskEditorPartDescriptor(ID_PART_PEOPLE) { + @Override + public AbstractTaskEditorPart createPart() { + return new BugzillaRestTaskEditorPeoplePart(); + } + }.setPath(PATH_PEOPLE)); + + return descriptors; + } + } diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestTaskEditorPeoplePart.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestTaskEditorPeoplePart.java new file mode 100644 index 000000000..08b628225 --- /dev/null +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.ui/src/org/eclipse/mylyn/internal/bugzilla/rest/ui/BugzillaRestTaskEditorPeoplePart.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.internal.bugzilla.rest.ui; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestTaskSchema; +import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPeoplePart; +import org.eclipse.mylyn.tasks.core.data.TaskAttribute; +import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData; + +public class BugzillaRestTaskEditorPeoplePart extends TaskEditorPeoplePart { + + @Override + protected Collection<TaskAttribute> getAttributes() { + Map<String, TaskAttribute> allAttributes = getTaskData().getRoot().getAttributes(); + List<TaskAttribute> attributes = new ArrayList<TaskAttribute>(allAttributes.size()); + attributes.add(getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_ASSIGNED)); + attributes.add(getTaskData().getRoot() + .getMappedAttribute(BugzillaRestTaskSchema.getDefault().RESET_ASSIGNED_TO.getKey())); + attributes.add(getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_REPORTER)); + attributes.add(getTaskData().getRoot().getMappedAttribute(TaskAttribute.ADD_SELF_CC)); + attributes.add(getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_CC)); + for (TaskAttribute attribute : allAttributes.values()) { + TaskAttributeMetaData properties = attribute.getMetaData(); + if (TaskAttribute.KIND_PEOPLE.equals(properties.getKind())) { + if (!attributes.contains(attribute)) { + attributes.add(attribute); + } + } + } + return attributes; + } + +} |