Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-11-21 21:43:07 +0000
committerfbecker2010-11-21 21:43:07 +0000
commit503180afe15643389bb7d96cd284cf5a9e5266d6 (patch)
tree2a2ba7a849dfffbbf53dc0cd995ccc60d0eac307
parentd276c444cf4642740fd7e52a6e8c81ec6568fa5d (diff)
downloadorg.eclipse.mylyn.tasks-503180afe15643389bb7d96cd284cf5a9e5266d6.tar.gz
org.eclipse.mylyn.tasks-503180afe15643389bb7d96cd284cf5a9e5266d6.tar.xz
org.eclipse.mylyn.tasks-503180afe15643389bb7d96cd284cf5a9e5266d6.zip
ASSIGNED - bug 329164: Bugzilla 4.0 - New Default Status Workflow
https://bugs.eclipse.org/bugs/show_bug.cgi?id=329164
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java142
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java12
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java11
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java166
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java327
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java22
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java13
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java25
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/testdata/descriptor/Bugzilla_3.6.3/Custom_WorkflowTransition.txt14
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/testdata/descriptor/Bugzilla_3.6.3/Custom_Workflow_and_StatusTransition.txt14
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java24
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskOperation.java21
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionPart.java29
18 files changed, 731 insertions, 112 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
index 4b76763c6..2505c0545 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
@@ -226,7 +226,7 @@ public class BugzillaClient {
CustomTransitionManager validTransitions = new CustomTransitionManager();
String transitionsFileName = configParameters.get(IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE);
- if (transitionsFileName != null && !transitionsFileName.equals("")) {
+ if (transitionsFileName != null && !transitionsFileName.equals("")) { //$NON-NLS-1$
if (!validTransitions.parse(transitionsFileName)) {
throw new CoreException(new Status(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN,
"Invalide Transition File Content")); //$NON-NLS-1$
@@ -452,10 +452,8 @@ public class BugzillaClient {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, getCharacterEncoding()));
HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null);
- String body = ""; //$NON-NLS-1$
try {
for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) {
- body += token.toString();
if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.TD
&& !((HtmlTag) (token.getValue())).isEndTag()) {
HtmlTag ta = ((HtmlTag) token.getValue());
@@ -612,7 +610,6 @@ public class BugzillaClient {
for (BugzillaAttribute element : reportElements1) {
BugzillaTaskDataHandler.createAttribute(existingReport, element);
}
- String useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE);
BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.TARGET_MILESTONE,
IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE, taskRepository, existingReport, true);
for (BugzillaAttribute element : reportElements2) {
@@ -1192,6 +1189,13 @@ public class BugzillaClient {
private NameValuePair[] getPairsForNew(TaskData taskData) {
Map<String, NameValuePair> fields = new HashMap<String, NameValuePair>();
+ BugzillaVersion bugzillaVersion = null;
+ if (repositoryConfiguration != null) {
+ bugzillaVersion = repositoryConfiguration.getInstallVersion();
+ } else {
+ bugzillaVersion = BugzillaVersion.MIN_VERSION;
+ }
+
// go through all of the attributes and add them to
// the bug post
Collection<TaskAttribute> attributes = new ArrayList<TaskAttribute>(taskData.getRoot().getAttributes().values());
@@ -1205,6 +1209,16 @@ public class BugzillaClient {
continue;
}
String id = a.getId();
+ if (id.equals(BugzillaAttribute.BUG_STATUS.getKey())
+ && bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) >= 0) {
+ TaskAttribute attributeOperation = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ value = attributeOperation.getValue().toUpperCase();
+ if (!"{START}".equals(value)) { //$NON-NLS-1$
+ fields.put(id, new NameValuePair(id, value != null ? value : "")); //$NON-NLS-1$
+ } else {
+ continue;
+ }
+ }
if (id.equals(BugzillaAttribute.NEWCC.getKey())) {
TaskAttribute b = taskData.getRoot().createAttribute(BugzillaAttribute.CC.getKey());
b.getMetaData()
@@ -1239,13 +1253,6 @@ public class BugzillaClient {
TaskAttribute descAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.DESCRIPTION);
if (descAttribute != null && !descAttribute.getValue().equals("")) { //$NON-NLS-1$
- BugzillaVersion bugzillaVersion = null;
- if (repositoryConfiguration != null) {
- bugzillaVersion = repositoryConfiguration.getInstallVersion();
- } else {
- bugzillaVersion = BugzillaVersion.MIN_VERSION;
- }
-
if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_2_18) == 0) {
fields.put(KEY_COMMENT,
new NameValuePair(KEY_COMMENT, formatTextToLineWrap(descAttribute.getValue(), true)));
@@ -1458,67 +1465,64 @@ public class BugzillaClient {
} else {
String inputAttributeId = originalOperation.getMetaData().getValue(
TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID);
- if (originalOperation == null) {
- fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue()));
- } else {
- String selOp = attributeOperation.getValue().toUpperCase();
- if (selOp.equals("NONE")) { //$NON-NLS-1$
- selOp = attributeStatus.getValue();
- }
- if (selOp.equals("ACCEPT")) { //$NON-NLS-1$
- selOp = "ASSIGNED"; //$NON-NLS-1$
- }
- if (selOp.equals("RESOLVE")) { //$NON-NLS-1$
+ String selOp = attributeOperation.getValue().toUpperCase();
+ if (selOp.equals("NONE")) { //$NON-NLS-1$
+ selOp = attributeStatus.getValue();
+ }
+ if (selOp.equals("ACCEPT")) { //$NON-NLS-1$
+ selOp = "ASSIGNED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("RESOLVE")) { //$NON-NLS-1$
+ selOp = "RESOLVED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("VERIFY")) { //$NON-NLS-1$
+ selOp = "VERIFIED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("CLOSE")) { //$NON-NLS-1$
+ selOp = "CLOSED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("REOPEN")) { //$NON-NLS-1$
+ selOp = "REOPENED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("MARKNEW")) { //$NON-NLS-1$
+ selOp = "NEW"; //$NON-NLS-1$
+ }
+ if (selOp.equals("DUPLICATE")) { //$NON-NLS-1$
+ if (repositoryConfiguration != null) {
+ selOp = repositoryConfiguration.getDuplicateStatus();
+ } else {
selOp = "RESOLVED"; //$NON-NLS-1$
}
- if (selOp.equals("VERIFY")) { //$NON-NLS-1$
- selOp = "VERIFIED"; //$NON-NLS-1$
- }
- if (selOp.equals("CLOSE")) { //$NON-NLS-1$
- selOp = "CLOSED"; //$NON-NLS-1$
- }
- if (selOp.equals("REOPEN")) { //$NON-NLS-1$
- selOp = "REOPENED"; //$NON-NLS-1$
- }
- if (selOp.equals("MARKNEW")) { //$NON-NLS-1$
- selOp = "NEW"; //$NON-NLS-1$
- }
- if (selOp.equals("DUPLICATE")) { //$NON-NLS-1$
- if (repositoryConfiguration != null) {
- selOp = repositoryConfiguration.getDuplicateStatus();
- } else {
- selOp = "RESOLVED"; //$NON-NLS-1$
- }
- String knob = BugzillaAttribute.RESOLUTION.getKey();
- fields.put(knob, new NameValuePair(knob, "DUPLICATE")); //$NON-NLS-1$
- }
+ String knob = BugzillaAttribute.RESOLUTION.getKey();
+ fields.put(knob, new NameValuePair(knob, "DUPLICATE")); //$NON-NLS-1$
+ }
- fields.put(fieldName, new NameValuePair(fieldName, selOp));
- if (inputAttributeId != null && !inputAttributeId.equals("")) { //$NON-NLS-1$
- TaskAttribute inputAttribute = attributeOperation.getTaskData()
- .getRoot()
- .getAttribute(inputAttributeId);
- if (inputAttribute != null) {
- if (inputAttribute.getOptions().size() > 0) {
- String sel = inputAttribute.getValue();
- String knob = inputAttribute.getId();
- if (knob.equals(BugzillaOperation.resolve.getInputId())) {
- knob = BugzillaAttribute.RESOLUTION.getKey();
- }
- fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel)));
- } else {
- String sel = inputAttribute.getValue();
- String knob = attributeOperation.getValue();
- if (knob.equals(BugzillaOperation.duplicate.toString())) {
- knob = inputAttributeId;
- }
- if (knob.equals(BugzillaOperation.reassign.toString())) {
- knob = BugzillaAttribute.ASSIGNED_TO.getKey();
- }
- fields.put(knob, new NameValuePair(knob, sel));
+ fields.put(fieldName, new NameValuePair(fieldName, selOp));
+ if (inputAttributeId != null && !inputAttributeId.equals("")) { //$NON-NLS-1$
+ TaskAttribute inputAttribute = attributeOperation.getTaskData()
+ .getRoot()
+ .getAttribute(inputAttributeId);
+ if (inputAttribute != null) {
+ if (inputAttribute.getOptions().size() > 0) {
+ String sel = inputAttribute.getValue();
+ String knob = inputAttribute.getId();
+ if (knob.equals(BugzillaOperation.resolve.getInputId())) {
+ knob = BugzillaAttribute.RESOLUTION.getKey();
}
+ fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel)));
+ } else {
+ String sel = inputAttribute.getValue();
+ String knob = attributeOperation.getValue();
+ if (knob.equals(BugzillaOperation.duplicate.toString())) {
+ knob = inputAttributeId;
+ }
+ if (knob.equals(BugzillaOperation.reassign.toString())) {
+ knob = BugzillaAttribute.ASSIGNED_TO.getKey();
+ }
+ fields.put(knob, new NameValuePair(knob, sel));
}
}
+
}
}
}
@@ -1796,7 +1800,7 @@ public class BugzillaClient {
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
IBugzillaConstants.REPOSITORY_STATUS_SUSPICIOUS_ACTION,
- repositoryUrl.toString(), "unknown reason because Bugzilla < 4.0 was used"));
+ repositoryUrl.toString(), "unknown reason because Bugzilla < 4.0 was used")); //$NON-NLS-1$
}
}
@@ -1829,8 +1833,8 @@ public class BugzillaClient {
String result = title.trim();
if (result.length() == 0) {
- if (body.contains("Bugzilla/Bug.pm line")) {
- result = "Bugzilla/Bug.pm line";
+ if (body.contains("Bugzilla/Bug.pm line")) { //$NON-NLS-1$
+ result = "Bugzilla/Bug.pm line"; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java
index 5ee58d4d0..bec49d635 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java
@@ -55,6 +55,18 @@ public class BugzillaOperation extends AbstractBugzillaOperation {
public static final BugzillaOperation reassignbycomponent = new BugzillaOperation(
Messages.BugzillaOperation_Reassign_to_default_assignee, "reassignbycomponent"); //$NON-NLS-1$
+ // Bugzilla 4.0
+ public static final BugzillaOperation unconfirmed = new BugzillaOperation("unconfirm", "unconfirmed"); //$NON-NLS-1$
+
+ public static final BugzillaOperation confirmed = new BugzillaOperation("confirm", "confirmed"); //$NON-NLS-1$
+
+ public static final BugzillaOperation in_progress = new BugzillaOperation("in progress", "in_progress"); //$NON-NLS-1$
+
+ public static final BugzillaOperation verify_with_resolution = new BugzillaOperation(
+ "verify", "resolutionInput", TaskAttribute.TYPE_SINGLE_SELECT, "verify"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ public static final BugzillaOperation new_default = new BugzillaOperation("default", "{Start}"); //$NON-NLS-1$
+
private final String value;
BugzillaOperation(String label) {
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 77613b526..8a55ac06e 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
@@ -474,7 +474,16 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler {
attributeStatus.putOption(option, option);
}
- attributeStatus.setValue(repositoryConfiguration.getStartStatus());
+ BugzillaVersion bugzillaVersion = repositoryConfiguration.getInstallVersion();
+ if (bugzillaVersion == null) {
+ bugzillaVersion = BugzillaVersion.MIN_VERSION;
+ }
+ if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
+ attributeStatus.setValue(repositoryConfiguration.getStartStatus());
+ } else {
+ attributeStatus.setValue(IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0.START.toString());
+ repositoryConfiguration.addValidOperations(taskData);
+ }
createAttribute(taskData, BugzillaAttribute.SHORT_DESC);
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
index a98c501ed..0f05bb931 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
@@ -38,7 +38,9 @@ public class BugzillaVersion implements Comparable<BugzillaVersion>, Serializabl
public final static BugzillaVersion BUGZILLA_3_6 = new BugzillaVersion("3.6"); //$NON-NLS-1$
- public final static BugzillaVersion MAX_VERSION = new BugzillaVersion("3.6"); //$NON-NLS-1$
+ public final static BugzillaVersion BUGZILLA_4_0 = new BugzillaVersion("4.0"); //$NON-NLS-1$
+
+ public final static BugzillaVersion MAX_VERSION = BUGZILLA_4_0;
private final int major;
@@ -57,6 +59,7 @@ public class BugzillaVersion implements Comparable<BugzillaVersion>, Serializabl
rc = false;
plus = false;
} else {
+ version = version.toUpperCase();
rc = version.contains("RC"); //$NON-NLS-1$
plus = version.contains("+"); //$NON-NLS-1$
if (plus) {
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 370342620..379be9610 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
@@ -212,6 +212,10 @@ public interface IBugzillaConstants {
UNCONFIRMED, NEW, ASSIGNED, REOPENED, RESOLVED, VERIFIED, CLOSED, SCHEDULED;
}
+ public static enum BUGZILLA_REPORT_STATUS_4_0 {
+ START, UNCONFIRMED, CONFIRMED, IN_PROGRESS, RESOLVED, VERIFIED;
+ }
+
public static enum BUGZILLA_RESOLUTION_2_0 {
FIXED, INVALID, WONTFIX, LATER, REMIND, WORKSFORME;
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
index 2b64d7bb7..971a02d67 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
@@ -25,6 +25,7 @@ import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_REPORT_STATUS;
+import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0;
import org.eclipse.mylyn.internal.bugzilla.core.service.BugzillaXmlRpcClient;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;
@@ -261,6 +262,15 @@ public class RepositoryConfiguration implements Serializable {
}
}
+ public void addUnconfirmedAllowed(String product, Boolean unconfirmedAllowed) {
+ ProductEntry entry = products.get(product);
+ if (entry == null) {
+ entry = new ProductEntry(product);
+ products.put(product, entry);
+ }
+ entry.setUnconfirmedAllowed(unconfirmedAllowed);
+ }
+
/**
* Container for product information: name, components.
*/
@@ -279,6 +289,8 @@ public class RepositoryConfiguration implements Serializable {
String defaultMilestone = null;
+ Boolean unconfirmedAllowed = false;
+
ProductEntry(String name) {
this.productName = name;
}
@@ -318,6 +330,14 @@ public class RepositoryConfiguration implements Serializable {
public void setDefaultMilestone(String defaultMilestone) {
this.defaultMilestone = defaultMilestone;
}
+
+ public Boolean getUnconfirmedAllowed() {
+ return unconfirmedAllowed;
+ }
+
+ public void setUnconfirmedAllowed(Boolean unconfirmedAllowed) {
+ this.unconfirmedAllowed = unconfirmedAllowed;
+ }
}
public List<String> getOpenStatusValues() {
@@ -374,7 +394,9 @@ public class RepositoryConfiguration implements Serializable {
validTransitions = new CustomTransitionManager();
}
if (xmlClient == null) {
- validTransitions.parse(fileName);
+ if (!validTransitions.parse(fileName)) {
+ validTransitions = null;
+ }
} else {
validTransitions.parse(monitor, xmlClient);
}
@@ -626,6 +648,104 @@ public class RepositoryConfiguration implements Serializable {
}
public void addValidOperations(TaskData bugReport) {
+ BugzillaVersion bugzillaVersion = getInstallVersion();
+ if (bugzillaVersion == null) {
+ bugzillaVersion = BugzillaVersion.MIN_VERSION;
+ }
+ if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
+ addValidOperationsBefore4(bugReport);
+ } else {
+ addValidOperationsAfter4(bugReport);
+ }
+ }
+
+ public void addValidOperationsAfter4(TaskData bugReport) {
+ TaskAttribute attributeStatus = bugReport.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ BUGZILLA_REPORT_STATUS_4_0 status = BUGZILLA_REPORT_STATUS_4_0.UNCONFIRMED;
+ if (attributeStatus != null) {
+ try {
+ status = BUGZILLA_REPORT_STATUS_4_0.valueOf(attributeStatus.getValue());
+ } catch (RuntimeException e) {
+ status = BUGZILLA_REPORT_STATUS_4_0.UNCONFIRMED;
+ }
+ }
+ if (validTransitions != null && attributeStatus != null && validTransitions.isValid()) {
+ //Handle custom operations. Currently only tuned for transitions based on default status names
+ addOperation(bugReport, BugzillaOperation.none);
+ for (AbstractBugzillaOperation b : validTransitions.getValidTransitions(attributeStatus.getValue())) {
+ //Special case: the CLOSED status needs a Resolution input.
+ //This happens automatically if current status is RESOLVED, else we need to supply one
+ if (b.toString().equals(BugzillaOperation.close.toString())) {
+ if (attributeStatus.getValue().equals("RESOLVED") && b.getInputId() != null) { //$NON-NLS-1$
+ //Do not add close with resolution operation if status is RESOLVED
+ continue;
+ } else if (!attributeStatus.getValue().equals("RESOLVED") && b.getInputId() == null) { //$NON-NLS-1$
+ //Do not add normal 'close' operation if status is not currently RESOLVED
+ continue;
+ }
+ }
+ addOperation(bugReport, b);
+ }
+ } else {
+ TaskAttribute everConfirmed = bugReport.getRoot().getAttribute(BugzillaAttribute.EVERCONFIRMED.getKey());
+ TaskAttribute product = bugReport.getRoot().getMappedAttribute(TaskAttribute.PRODUCT);
+ Boolean unconfirmedAllowed = products.get(product.getValue()).getUnconfirmedAllowed();
+
+ switch (status) {
+ case START:
+ addOperation(bugReport, BugzillaOperation.new_default);
+ addOperation(bugReport, BugzillaOperation.unconfirmed);
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ addOperation(bugReport, BugzillaOperation.in_progress);
+ TaskAttribute unconfirmedAttribute = bugReport.getRoot().getAttribute(
+ TaskAttribute.PREFIX_OPERATION + BugzillaOperation.unconfirmed.toString());
+ unconfirmedAttribute.getMetaData().putValue(TaskAttribute.META_UNCONFIRMED_ALLOWED,
+ unconfirmedAllowed.toString());
+ TaskAttribute operationAttribute = bugReport.getRoot().getAttribute(TaskAttribute.OPERATION);
+ TaskOperation.applyTo(operationAttribute, BugzillaOperation.new_default.toString(),
+ IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0.START.toString());
+ break;
+ case UNCONFIRMED:
+ addOperation(bugReport, BugzillaOperation.none);
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ addOperation(bugReport, BugzillaOperation.in_progress);
+ addOperation(bugReport, BugzillaOperation.resolve);
+ break;
+ case CONFIRMED:
+ addOperation(bugReport, BugzillaOperation.none);
+ addOperation(bugReport, BugzillaOperation.in_progress);
+ addOperation(bugReport, BugzillaOperation.resolve);
+ break;
+ case IN_PROGRESS:
+ addOperation(bugReport, BugzillaOperation.none);
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ addOperation(bugReport, BugzillaOperation.resolve);
+ break;
+ case RESOLVED:
+ addOperation(bugReport, BugzillaOperation.none);
+ if (everConfirmed == null && unconfirmedAllowed) {
+ addOperation(bugReport, BugzillaOperation.unconfirmed);
+ } else {
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ }
+ addOperation(bugReport, BugzillaOperation.verify_with_resolution);
+ break;
+ case VERIFIED:
+ addOperation(bugReport, BugzillaOperation.none);
+ if (everConfirmed == null && unconfirmedAllowed) {
+ addOperation(bugReport, BugzillaOperation.unconfirmed);
+ } else {
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ }
+ addOperation(bugReport, BugzillaOperation.resolve);
+ break;
+ }
+ addOperation(bugReport, BugzillaOperation.duplicate);
+ }
+
+ }
+
+ public void addValidOperationsBefore4(TaskData bugReport) {
TaskAttribute attributeStatus = bugReport.getRoot().getMappedAttribute(TaskAttribute.STATUS);
BUGZILLA_REPORT_STATUS status = BUGZILLA_REPORT_STATUS.NEW;
@@ -816,6 +936,23 @@ public class RepositoryConfiguration implements Serializable {
if (getResolutions().size() > 0) {
attrResolvedInput.setValue(getResolutions().get(0));
}
+ } else if (op.toString().equals(BugzillaOperation.verify_with_resolution.toString()) && op.getInputId() != null) {
+ TaskAttribute attributeResolution = bugReport.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION);
+ String oldResolutionValue = attributeResolution.getValue();
+ attribute = bugReport.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + op.toString());
+ TaskOperation.applyTo(attribute, op.toString(), op.getLabel());
+ TaskAttribute attrResolvedInput = attribute.getTaskData().getRoot().createAttribute(op.getInputId());
+ attrResolvedInput.getMetaData().setType(op.getInputType());
+ attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, op.getInputId());
+ for (String resolution : getResolutions()) {
+ // DUPLICATE and MOVED have special meanings so do not show as resolution
+ if (resolution.compareTo("DUPLICATE") != 0 && resolution.compareTo("MOVED") != 0) { //$NON-NLS-1$ //$NON-NLS-2$
+ attrResolvedInput.putOption(resolution, resolution);
+ }
+ }
+ if (getResolutions().size() > 0) {
+ attrResolvedInput.setValue(oldResolutionValue);
+ }
} else if (op.toString() == BugzillaOperation.duplicate.toString()) {
attribute = bugReport.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + op.toString());
@@ -828,9 +965,17 @@ public class RepositoryConfiguration implements Serializable {
attrInput.getMetaData().defaults().setReadOnly(false).setType(op.getInputType());
attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, op.getInputId());
}
+ } else if (op.toString() == BugzillaOperation.new_default.toString()) {
+ attribute = bugReport.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + op.toString());
+ TaskOperation.applyTo(attribute, op.toString(), op.getLabel(), "Let Bugzilla set the Status"); //$NON-NLS-1$
} else {
attribute = bugReport.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + op.toString());
- TaskOperation.applyTo(attribute, op.toString(), op.getLabel());
+ if (bugReport.isNew()) {
+ TaskOperation.applyTo(attribute, op.toString(), op.getLabel(),
+ "if you are not shure if you allowed to set this state\nplease use the default for submitting new tasks!"); //$NON-NLS-1$
+ } else {
+ TaskOperation.applyTo(attribute, op.toString(), op.getLabel(), ""); //$NON-NLS-1$
+ }
if (op.getInputId() != null) {
TaskAttribute attrInput = bugReport.getRoot().createAttribute(op.getInputId());
attrInput.getMetaData().defaults().setReadOnly(false).setType(op.getInputType());
@@ -970,11 +1115,15 @@ public class RepositoryConfiguration implements Serializable {
}
public String getDuplicateStatus() {
- return validTransitions.getDuplicateStatus();
+ return validTransitions == null ? "RESOLVED" : validTransitions.getDuplicateStatus(); //$NON-NLS-1$
}
public String getStartStatus() {
- return (validTransitions == null) ? "NEW" : validTransitions.getStartStatus(); //$NON-NLS-1$
+ if (validTransitions == null) {
+ return version.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0 ? "NEW" : "CONFIRMED"; //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ return validTransitions.getStartStatus();
+ }
}
public String getDefaultMilestones(String product) {
@@ -986,6 +1135,15 @@ public class RepositoryConfiguration implements Serializable {
}
}
+ public Boolean getUnconfirmedAllowed(String product) {
+ ProductEntry entry = products.get(product);
+ if (entry != null) {
+ return entry.getUnconfirmedAllowed();
+ } else {
+ return null;
+ }
+ }
+
public void setDefaultMilestone(String product, String defaultMilestone) {
ProductEntry entry = products.get(product);
if (entry == null) {
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java
index 50191adfe..ed2a2be95 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java
@@ -103,6 +103,8 @@ public class SaxConfigurationContentHandler extends DefaultHandler {
private static final String ELEMENT_MULTIPLICABLE = "multiplicable"; //$NON-NLS-1$
+ private static final String ELEMENT_ALLOWS_UNCONFIRMED = "allows_unconfirmed"; //$NON-NLS-1$
+
private static final int EXPECTING_ROOT = 0;
private static final int IN_INSTALL_VERSION = 1 << 1;
@@ -441,6 +443,10 @@ public class SaxConfigurationContentHandler extends DefaultHandler {
currentSpecifically_requestable = characters.toString();
} else if (localName.equals(ELEMENT_MULTIPLICABLE)) {
currentMultiplicable = characters.toString();
+ } else if (localName.equals(ELEMENT_ALLOWS_UNCONFIRMED)) {
+ String value = characters.toString();
+ Boolean boolValue = value.equals("0") ? false : true; //$NON-NLS-1$
+ configuration.addUnconfirmedAllowed(currentProduct, boolValue);
} else if (localName.equals(ELEMENT_FLAG_TYPES)) {
state = state & ~IN_FLAG_TYPES;
} else if (localName.equals(ELEMENT_FLAG_TYPE)) {
@@ -518,8 +524,6 @@ public class SaxConfigurationContentHandler extends DefaultHandler {
flagComponentList.put(currentComponent, flagsForComponent);
}
flagsForComponent.add(compURI.replace("flags.cgi?id=", "flag.cgi?id=")); //$NON-NLS-1$ //$NON-NLS-2$
- int i = 0;
- i++;
}
}
break;
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java
index 2df941d0e..8e0f3f64a 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java
@@ -87,8 +87,8 @@ public class AllBugzillaTests {
// Only run these tests on > 3.2 repositories
if (!fixture.getBugzillaVersion().isSmallerOrEquals(BugzillaVersion.BUGZILLA_3_2)) {
if (fixture != BugzillaFixture.BUGS_HEAD) {
- fixture.add(BugzillaRepositoryConnectorTest.class);
}
+ fixture.add(BugzillaRepositoryConnectorTest.class);
fixture.add(BugzillaAttachmentHandlerTest.class);
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
index 6531bc7a8..743029340 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
@@ -331,25 +331,330 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
// submit(task, taskData, null);
// }
- /*
- * Test for the following State transformation
- * NEW -> ASSIGNED -> RESOLVED DUPLICATE -> VERIFIED -> CLOSED -> REOPENED -> RESOLVED FIXED
- *
- */
-
// FIXME
// public void testStdWorkflow222() throws Exception {
// init222();
// doStdWorkflow("101");
// }
//
- public void testStdWorkflow32() throws Exception {
- if (BugzillaFixture.current() != BugzillaFixture.BUGS_3_6_CUSTOM_WF) {
- doStdWorkflow("3");
+ public void testStdWorkflow() throws Exception {
+ if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
+ if (BugzillaFixture.current() != BugzillaFixture.BUGS_3_6_CUSTOM_WF) {
+ doStdWorkflow32("3");
+ }
+ } else {
+ doStdWorkflow40_1("3");
+ doStdWorkflow40_2("3");
}
+
+ }
+
+ private void doStdWorkflow40_1(String dupBugID) throws Exception {
+ final TaskMapping taskMappingInit = new TaskMapping() {
+
+ @Override
+ public String getProduct() {
+ return "TestProduct";
+ }
+ };
+ final TaskMapping taskMappingSelect = new TaskMapping() {
+ @Override
+ public String getComponent() {
+ return "TestComponent";
+ }
+
+ @Override
+ public String getSummary() {
+ return "test the std workflow";
+ }
+
+ @Override
+ public String getDescription() {
+ return "The Description of the std workflow task";
+ }
+
+ };
+
+ final TaskData[] taskDataNew = new TaskData[1];
+ // create Task
+ taskDataNew[0] = TasksUiInternal.createTaskData(repository, taskMappingInit, taskMappingSelect, null);
+ ITask taskNew = TasksUiUtil.createOutgoingNewTask(taskDataNew[0].getConnectorKind(),
+ taskDataNew[0].getRepositoryUrl());
+
+ ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(taskNew, taskDataNew[0]);
+ Set<TaskAttribute> changed = new HashSet<TaskAttribute>();
+ workingCopy.save(changed, null);
+
+ RepositoryResponse response = BugzillaFixture.current().submitTask(taskDataNew[0], client);//connector.getTaskDataHandler().postTaskData(repository, taskDataNew[0], changed,
+ //new NullProgressMonitor());
+ ((AbstractTask) taskNew).setSubmitting(true);
+
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_CREATED.toString(), response.getReposonseKind().toString());
+ String taskId = response.getTaskId();
+
+ // change Status from CONFIRMED -> IN_PROGRESS
+ ITask task = generateLocalTaskAndDownload(taskId);
+ assertNotNull(task);
+ TaskDataModel model = createModel(task);
+ TaskData taskData = model.getTaskData();
+ assertNotNull(taskData);
+ TaskAttribute statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ assertEquals("CONFIRMED", statusAttribute.getValue());
+ TaskAttribute selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.in_progress.toString(),
+ BugzillaOperation.in_progress.getLabel());
+ model.attributeChanged(selectedOperationAttribute);
+ changed.clear();
+ changed.add(selectedOperationAttribute);
+ workingCopy.save(changed, null);
+ response = BugzillaFixture.current().submitTask(taskData, client);
+ assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString());
+
+ // change Status from IN_PROGRESS -> RESOLVED DUPLICATE
+ task = generateLocalTaskAndDownload(taskId);
+ assertNotNull(task);
+ model = createModel(task);
+ taskData = model.getTaskData();
+ assertNotNull(taskData);
+ statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ assertEquals("IN_PROGRESS", statusAttribute.getValue());
+ selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.duplicate.toString(),
+ BugzillaOperation.duplicate.getLabel());
+ TaskAttribute duplicateAttribute = taskData.getRoot().getAttribute("dup_id");
+ duplicateAttribute.setValue(dupBugID);
+ model.attributeChanged(selectedOperationAttribute);
+ model.attributeChanged(duplicateAttribute);
+ changed.clear();
+ changed.add(selectedOperationAttribute);
+ changed.add(duplicateAttribute);
+ workingCopy.save(changed, null);
+ response = BugzillaFixture.current().submitTask(taskData, client);
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString());
+
+ // change Status from RESOLVED DUPLICATE -> VERIFIED
+ task = generateLocalTaskAndDownload(taskId);
+ assertNotNull(task);
+ model = createModel(task);
+ taskData = model.getTaskData();
+ assertNotNull(taskData);
+ statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ assertEquals("RESOLVED", statusAttribute.getValue());
+ TaskAttribute resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION);
+ assertEquals("DUPLICATE", resolution.getValue());
+ selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.verify.toString(),
+ BugzillaOperation.verify.getLabel());
+ model.attributeChanged(selectedOperationAttribute);
+ changed.clear();
+ changed.add(selectedOperationAttribute);
+ workingCopy.save(changed, null);
+ response = BugzillaFixture.current().submitTask(taskData, client);
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString());
+
+ // change Status from VERIFIED -> CONFIRMED
+ task = generateLocalTaskAndDownload(taskId);
+ assertNotNull(task);
+ model = createModel(task);
+ taskData = model.getTaskData();
+ assertNotNull(taskData);
+ statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ assertEquals("VERIFIED", statusAttribute.getValue());
+ selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.confirmed.toString(),
+ BugzillaOperation.confirmed.getLabel());
+ model.attributeChanged(selectedOperationAttribute);
+ changed.clear();
+ changed.add(selectedOperationAttribute);
+ workingCopy.save(changed, null);
+ response = BugzillaFixture.current().submitTask(taskData, client);
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString());
+
+ // change Status from CONFIRMED -> RESOLVED FIXED
+ task = generateLocalTaskAndDownload(taskId);
+ assertNotNull(task);
+ model = createModel(task);
+ taskData = model.getTaskData();
+ assertNotNull(taskData);
+ statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ assertEquals("CONFIRMED", statusAttribute.getValue());
+ selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.resolve.toString(),
+ BugzillaOperation.resolve.getLabel());
+ resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION);
+ resolution.setValue("FIXED");
+ model.attributeChanged(selectedOperationAttribute);
+ changed.clear();
+ changed.add(selectedOperationAttribute);
+ workingCopy.save(changed, null);
+ response = BugzillaFixture.current().submitTask(taskData, client);
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString());
+
+ task = generateLocalTaskAndDownload(taskId);
+ assertNotNull(task);
+ model = createModel(task);
+ taskData = model.getTaskData();
+ assertNotNull(taskData);
+ statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ assertEquals("RESOLVED", statusAttribute.getValue());
+ resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION);
+ assertEquals("FIXED", resolution.getValue());
}
- private void doStdWorkflow(String DupBugID) throws Exception {
+ private void doStdWorkflow40_2(String dupBugID) throws Exception {
+ final TaskMapping taskMappingInit = new TaskMapping() {
+
+ @Override
+ public String getProduct() {
+ return "Scratch";
+ }
+ };
+ final TaskMapping taskMappingSelect = new TaskMapping() {
+ @Override
+ public String getComponent() {
+ return "Component 1";
+ }
+
+ @Override
+ public String getSummary() {
+ return "test the std workflow for Scratch";
+ }
+
+ @Override
+ public String getDescription() {
+ return "The Description of the std workflow task";
+ }
+
+ };
+
+ final TaskData[] taskDataNew = new TaskData[1];
+ // create Task
+ taskDataNew[0] = TasksUiInternal.createTaskData(repository, taskMappingInit, taskMappingSelect, null);
+ ITask taskNew = TasksUiUtil.createOutgoingNewTask(taskDataNew[0].getConnectorKind(),
+ taskDataNew[0].getRepositoryUrl());
+
+ ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(taskNew, taskDataNew[0]);
+ TaskAttribute selectedOperationAttribute = taskDataNew[0].getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.unconfirmed.toString(),
+ BugzillaOperation.unconfirmed.getLabel());
+ Set<TaskAttribute> changed = new HashSet<TaskAttribute>();
+ changed.add(selectedOperationAttribute);
+ workingCopy.save(changed, null);
+
+ RepositoryResponse response = BugzillaFixture.current().submitTask(taskDataNew[0], client);//connector.getTaskDataHandler().postTaskData(repository, taskDataNew[0], changed,
+ //new NullProgressMonitor());
+ ((AbstractTask) taskNew).setSubmitting(true);
+
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_CREATED.toString(), response.getReposonseKind().toString());
+ String taskId = response.getTaskId();
+
+ // change Status from UNCONFIRMED -> RESOLVED DUPLICATE
+ ITask task = generateLocalTaskAndDownload(taskId);
+ assertNotNull(task);
+ TaskDataModel model = createModel(task);
+ TaskData taskData = model.getTaskData();
+ assertNotNull(taskData);
+ TaskAttribute statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ assertEquals("UNCONFIRMED", statusAttribute.getValue());
+ selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.duplicate.toString(),
+ BugzillaOperation.duplicate.getLabel());
+ TaskAttribute duplicateAttribute = taskData.getRoot().getAttribute("dup_id");
+ duplicateAttribute.setValue(dupBugID);
+ model.attributeChanged(selectedOperationAttribute);
+ model.attributeChanged(duplicateAttribute);
+ changed.clear();
+ changed.add(selectedOperationAttribute);
+ changed.add(duplicateAttribute);
+ workingCopy.save(changed, null);
+ response = BugzillaFixture.current().submitTask(taskData, client);
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString());
+
+// // change Status from RESOLVED DUPLICATE -> VERIFIED
+// task = generateLocalTaskAndDownload(taskId);
+// assertNotNull(task);
+// model = createModel(task);
+// taskData = model.getTaskData();
+// assertNotNull(taskData);
+// statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+// assertEquals("RESOLVED", statusAttribute.getValue());
+// TaskAttribute resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION);
+// assertEquals("DUPLICATE", resolution.getValue());
+// selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+// TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.verify.toString(),
+// BugzillaOperation.verify.getLabel());
+// model.attributeChanged(selectedOperationAttribute);
+// changed.clear();
+// changed.add(selectedOperationAttribute);
+// workingCopy.save(changed, null);
+// response = BugzillaFixture.current().submitTask(taskData, client);
+// assertNotNull(response);
+// assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString());
+//
+// // change Status from VERIFIED -> CONFIRMED
+// task = generateLocalTaskAndDownload(taskId);
+// assertNotNull(task);
+// model = createModel(task);
+// taskData = model.getTaskData();
+// assertNotNull(taskData);
+// statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+// assertEquals("VERIFIED", statusAttribute.getValue());
+// selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+// TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.confirmed.toString(),
+// BugzillaOperation.confirmed.getLabel());
+// model.attributeChanged(selectedOperationAttribute);
+// changed.clear();
+// changed.add(selectedOperationAttribute);
+// workingCopy.save(changed, null);
+// response = BugzillaFixture.current().submitTask(taskData, client);
+// assertNotNull(response);
+// assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString());
+//
+// // change Status from CONFIRMED -> RESOLVED FIXED
+// task = generateLocalTaskAndDownload(taskId);
+// assertNotNull(task);
+// model = createModel(task);
+// taskData = model.getTaskData();
+// assertNotNull(taskData);
+// statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+// assertEquals("CONFIRMED", statusAttribute.getValue());
+// selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+// TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.resolve.toString(),
+// BugzillaOperation.resolve.getLabel());
+// resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION);
+// resolution.setValue("FIXED");
+// model.attributeChanged(selectedOperationAttribute);
+// changed.clear();
+// changed.add(selectedOperationAttribute);
+// workingCopy.save(changed, null);
+// response = BugzillaFixture.current().submitTask(taskData, client);
+// assertNotNull(response);
+// assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString());
+//
+// task = generateLocalTaskAndDownload(taskId);
+// assertNotNull(task);
+// model = createModel(task);
+// taskData = model.getTaskData();
+// assertNotNull(taskData);
+// statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+// assertEquals("RESOLVED", statusAttribute.getValue());
+// resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION);
+// assertEquals("FIXED", resolution.getValue());
+ }
+
+ /*
+ * Test for the following State transformation
+ * NEW -> ASSIGNED -> RESOLVED DUPLICATE -> VERIFIED -> CLOSED -> REOPENED -> RESOLVED FIXED
+ *
+ */
+ private void doStdWorkflow32(String dupBugID) throws Exception {
final TaskMapping taskMappingInit = new TaskMapping() {
@Override
@@ -431,7 +736,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
TaskOperation.applyTo(selectedOperationAttribute, BugzillaOperation.duplicate.toString(),
BugzillaOperation.duplicate.getLabel());
TaskAttribute duplicateAttribute = taskData.getRoot().getAttribute("dup_id");
- duplicateAttribute.setValue(DupBugID);
+ duplicateAttribute.setValue(dupBugID);
model.attributeChanged(selectedOperationAttribute);
model.attributeChanged(duplicateAttribute);
changed.clear();
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java
index dd0ae7854..f97904a87 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java
@@ -27,6 +27,7 @@ import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeMapper;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryLocation;
@@ -58,15 +59,24 @@ public class BugzillaClientTest extends TestCase {
RepositoryConfiguration config = client.getRepositoryConfiguration();
assertNotNull(config);
assertEquals(BugzillaFixture.current().getVersion(), config.getInstallVersion().toString());
- assertEquals(7, config.getStatusValues().size());
+ if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
+ assertEquals(7, config.getStatusValues().size());
+ } else {
+ assertEquals(5, config.getStatusValues().size());
+ }
assertEquals(8, config.getResolutions().size());
assertEquals(8, config.getPlatforms().size());
assertEquals(36, config.getOSs().size());
assertEquals(5, config.getPriorities().size());
assertEquals(7, config.getSeverities().size());
assertEquals(3, config.getProducts().size());
- assertEquals(4, config.getOpenStatusValues().size());
- assertEquals(3, config.getClosedStatusValues().size());
+ if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
+ assertEquals(4, config.getOpenStatusValues().size());
+ assertEquals(3, config.getClosedStatusValues().size());
+ } else {
+ assertEquals(3, config.getOpenStatusValues().size());
+ assertEquals(2, config.getClosedStatusValues().size());
+ }
assertEquals(2, config.getKeywords().size());
assertEquals(2, config.getComponents("ManualTest").size());
assertEquals(4, config.getVersions("ManualTest").size());
@@ -170,7 +180,11 @@ public class BugzillaClientTest extends TestCase {
String bugid = response.getTaskId();
RepositoryQuery query = new RepositoryQuery(BugzillaFixture.current().getConnectorKind(), "123");
query.setRepositoryUrl(BugzillaFixture.current().getRepositoryUrl());
- query.setUrl("?long_desc_type=allwordssubstr&long_desc=" + timestamp + "&bug_status=NEW&");
+ if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
+ query.setUrl("?long_desc_type=allwordssubstr&long_desc=" + timestamp + "&bug_status=NEW&");
+ } else {
+ query.setUrl("?long_desc_type=allwordssubstr&long_desc=" + timestamp + "&bug_status=CONFIRMED&");
+ }
final Set<TaskData> returnedData = new HashSet<TaskData>();
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java
index 42a2766b2..42d003d4c 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java
@@ -218,13 +218,14 @@ public class BugzillaRepositoryConnectorStandaloneTest extends TestCase {
String priority = "P1";
String severity = "trivial";
String email = "tests%40mylyn.eclipse.org";
- String queryUrlString = repository.getRepositoryUrl()
- + "/buglist.cgi?priority="
- + priority
+ String bug_status = BugzillaFixture.current()
+ .getBugzillaVersion()
+ .compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0 ? "&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"
+ : "&bug_status=UNCONFIRMED&bug_status=CONFIRMED";
+ String queryUrlString = repository.getRepositoryUrl() + "/buglist.cgi?priority=" + priority
+ "&emailassigned_to1=1&query_format=advanced&emailreporter1=1&field0-0-0=bug_status&bug_severity="
- + severity
- + "&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&type0-0-1=equals&value0-0-1=tests%40mylyn.eclipse.org&email1="
- + email + "&type0-0-0=notequals&field0-0-1=reporter&value0-0-0=UNCONFIRMED&emailtype1=exact";
+ + severity + bug_status + "&type0-0-1=equals&value0-0-1=tests%40mylyn.eclipse.org&email1=" + email
+ + "&type0-0-0=notequals&field0-0-1=reporter&value0-0-0=UNCONFIRMED&emailtype1=exact";
// make sure initial task is not P1/trivial
assertFalse(taskData.getRoot()
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java
index df79c7940..e9c704e11 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java
@@ -71,6 +71,8 @@ public class BugzillaFixture extends TestFixture {
public static final String TEST_BUGZILLA_36_URL = getServerUrl("bugs36");
+ public static final String TEST_BUGZILLA_40_URL = getServerUrl("bugs40");
+
public static final String TEST_BUGZILLA_HEAD_URL = getServerUrl("bugshead");
public static final String TEST_BUGZILLA_LATEST_URL = TEST_BUGZILLA_36_URL;
@@ -92,33 +94,36 @@ public class BugzillaFixture extends TestFixture {
"3.0.11", "");
public static BugzillaFixture BUGS_3_2 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_32_URL, //
- "3.2.8", "");
+ "3.2.9", "");
public static BugzillaFixture BUGS_3_4 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_34_URL, //
- "3.4.8", "");
+ "3.4.9", "");
public static BugzillaFixture BUGS_3_6 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL, //
- "3.6.2", "");
+ "3.6.3", "");
public static BugzillaFixture BUGS_3_6_CUSTOM_WF = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL
- + "-custom-wf", "3.6.2", "Custom Workflow");
+ + "-custom-wf", "3.6.3", "Custom Workflow");
public static BugzillaFixture BUGS_3_6_CUSTOM_WF_AND_STATUS = new BugzillaFixture(
- BugzillaFixture.TEST_BUGZILLA_36_URL + "-custom-wf-and-status", "3.6.2", "Custom Workflow and Status");
+ BugzillaFixture.TEST_BUGZILLA_36_URL + "-custom-wf-and-status", "3.6.3", "Custom Workflow and Status");
public static BugzillaFixture BUGS_3_6_XML_RPC_DISABLED = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL
- + "-xml-rpc-disabled", "3.6.2", "XML-RPC disabled");
+ + "-xml-rpc-disabled", "3.6.3", "XML-RPC disabled");
+
+ public static BugzillaFixture BUGS_4_0 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_40_URL, //
+ "4.0RC1+", "");
public static BugzillaFixture BUGS_HEAD = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_HEAD_URL, //
"4.1", "");
- public static BugzillaFixture DEFAULT = BUGS_3_6;
+ public static BugzillaFixture DEFAULT = BUGS_4_0;
public static final BugzillaFixture[] ALL = new BugzillaFixture[] { BUGS_2_22, BUGS_3_0, BUGS_3_2, BUGS_3_4,
- BUGS_3_6, BUGS_HEAD };
+ BUGS_3_6, BUGS_4_0, BUGS_HEAD };
- public static final BugzillaFixture[] ONLY_3_6_SPECIFIC = new BugzillaFixture[] { BUGS_3_6,
- BUGS_3_6_XML_RPC_DISABLED, BUGS_3_6_CUSTOM_WF, BUGS_3_6_CUSTOM_WF_AND_STATUS };
+ public static final BugzillaFixture[] ONLY_3_6_SPECIFIC = new BugzillaFixture[] { /*BUGS_3_6,
+ BUGS_3_6_XML_RPC_DISABLED, BUGS_3_6_CUSTOM_WF, BUGS_3_6_CUSTOM_WF_AND_STATUS*/};
private final String version;
diff --git a/org.eclipse.mylyn.bugzilla.tests/testdata/descriptor/Bugzilla_3.6.3/Custom_WorkflowTransition.txt b/org.eclipse.mylyn.bugzilla.tests/testdata/descriptor/Bugzilla_3.6.3/Custom_WorkflowTransition.txt
new file mode 100644
index 000000000..bdbd77b37
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.tests/testdata/descriptor/Bugzilla_3.6.3/Custom_WorkflowTransition.txt
@@ -0,0 +1,14 @@
+CustomStatusNames=true
+DuplicateStatus=CLOSED
+ClosedCustomStatus=POST
+<transitions>
+name :UNCONFIRMED:, can_change_to :NEW,ASSIGNED,RESOLVED,MODIFIED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :NEW:, can_change_to :ASSIGNED,RESOLVED,MODIFIED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :ASSIGNED:, can_change_to :MODIFIED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :MODIFIED:, can_change_to :NEW,ASSIGNED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :ON_DEV:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :ON_QA:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_DEV,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :RELEASE_PENDING:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_DEV,ON_QA,VERIFIED,POST,CLOSED:
+name :VERIFIED:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_DEV,ON_QA,RELEASE_PENDING,POST,CLOSED:
+name :POST:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,CLOSED:
+name :CLOSED:, can_change_to :ASSIGNED,VERIFIED:
diff --git a/org.eclipse.mylyn.bugzilla.tests/testdata/descriptor/Bugzilla_3.6.3/Custom_Workflow_and_StatusTransition.txt b/org.eclipse.mylyn.bugzilla.tests/testdata/descriptor/Bugzilla_3.6.3/Custom_Workflow_and_StatusTransition.txt
new file mode 100644
index 000000000..bdbd77b37
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.tests/testdata/descriptor/Bugzilla_3.6.3/Custom_Workflow_and_StatusTransition.txt
@@ -0,0 +1,14 @@
+CustomStatusNames=true
+DuplicateStatus=CLOSED
+ClosedCustomStatus=POST
+<transitions>
+name :UNCONFIRMED:, can_change_to :NEW,ASSIGNED,RESOLVED,MODIFIED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :NEW:, can_change_to :ASSIGNED,RESOLVED,MODIFIED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :ASSIGNED:, can_change_to :MODIFIED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :MODIFIED:, can_change_to :NEW,ASSIGNED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :ON_DEV:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_QA,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :ON_QA:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_DEV,VERIFIED,RELEASE_PENDING,POST,CLOSED:
+name :RELEASE_PENDING:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_DEV,ON_QA,VERIFIED,POST,CLOSED:
+name :VERIFIED:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_DEV,ON_QA,RELEASE_PENDING,POST,CLOSED:
+name :POST:, can_change_to :NEW,ASSIGNED,MODIFIED,ON_DEV,ON_QA,VERIFIED,RELEASE_PENDING,CLOSED:
+name :CLOSED:, can_change_to :ASSIGNED,VERIFIED:
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 d0f95fe45..eef4fe257 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
@@ -25,13 +25,16 @@ import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCustomField;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaOperation;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryResponse;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration;
import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil;
+import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionPart;
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
@@ -398,7 +401,26 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
attributeDefaultAssignee.setValue("1"); //$NON-NLS-1$
refresh(attributeDefaultAssignee);
}
-
+ if (taskAttribute.getTaskData().isNew()) {
+ BugzillaVersion bugzillaVersion = repositoryConfiguration.getInstallVersion();
+ if (bugzillaVersion == null) {
+ bugzillaVersion = BugzillaVersion.MIN_VERSION;
+ }
+ if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) >= 0) {
+ AbstractTaskEditorPart part = getPart(ID_PART_ACTIONS);
+ Boolean unconfirmedAllowed = repositoryConfiguration.getUnconfirmedAllowed(taskAttribute.getValue());
+ TaskAttribute unconfirmedAttribute = taskAttribute.getTaskData()
+ .getRoot()
+ .getAttribute(
+ TaskAttribute.PREFIX_OPERATION + BugzillaOperation.unconfirmed.toString());
+ unconfirmedAttribute.getMetaData().putValue(TaskAttribute.META_UNCONFIRMED_ALLOWED,
+ unconfirmedAllowed.toString());
+ if (part != null) {
+ TaskEditorActionPart actionPart = (TaskEditorActionPart) part;
+ actionPart.refreshOperations(true);
+ }
+ }
+ }
/*
* add confirm_product_change to avoid verification page on submit
*/
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
index 262763fc7..1cac00d1f 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
@@ -125,6 +125,10 @@ public final class TaskAttribute {
public static final String META_READ_ONLY = "task.meta.readOnly"; //$NON-NLS-1$
+ public static final String META_UNCONFIRMED_ALLOWED = "task.meta.unconfirmedAllowed"; //$NON-NLS-1$
+
+ public static final String META_TOOL_TIP = "task.meta.toolTip"; //$NON-NLS-1$
+
public static final String NEW_ATTACHMENT = "task.common.new.attachment"; //$NON-NLS-1$
// XXX merge with USER_CC
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskOperation.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskOperation.java
index e44d8262d..961427d55 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskOperation.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskOperation.java
@@ -24,8 +24,18 @@ public class TaskOperation {
* @since 3.0
*/
public static void applyTo(TaskAttribute taskAttribute, String operationId, String label) {
+ applyTo(taskAttribute, operationId, label, null);
+ }
+
+ /**
+ * @since 3.5
+ */
+ public static void applyTo(TaskAttribute taskAttribute, String operationId, String label, String toolTip) {
TaskData taskData = taskAttribute.getTaskData();
taskData.getAttributeMapper().setValue(taskAttribute, operationId);
+ if (toolTip != null) {
+ taskAttribute.getMetaData().defaults().putValue(TaskAttribute.META_TOOL_TIP, toolTip);
+ }
taskAttribute.getMetaData().defaults().setType(TaskAttribute.TYPE_OPERATION).setLabel(label);
}
@@ -39,6 +49,7 @@ public class TaskOperation {
taskData.getTaskId(), taskAttribute.getValue());
operation.setLabel(taskAttribute.getMetaData().getLabel());
operation.setTaskAttribute(taskAttribute);
+ operation.setTooltip(taskAttribute.getMetaData().getValue(TaskAttribute.META_TOOL_TIP));
return operation;
}
@@ -54,6 +65,8 @@ public class TaskOperation {
private final String taskId;
+ private String tooltip;
+
/**
* @since 3.0
*/
@@ -159,4 +172,12 @@ public class TaskOperation {
this.taskAttribute = taskAttribute;
}
+ public String getTooltip() {
+ return tooltip;
+ }
+
+ public void setTooltip(String tooltip) {
+ this.tooltip = tooltip;
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionPart.java
index 30752792a..b30a47ea2 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionPart.java
@@ -246,8 +246,10 @@ public class TaskEditorActionPart extends AbstractTaskEditorPart {
}
});
- GridDataFactory.fillDefaults().hint(DEFAULT_FIELD_WIDTH, SWT.DEFAULT).span(3, SWT.DEFAULT).applyTo(
- categoryChooser);
+ GridDataFactory.fillDefaults()
+ .hint(DEFAULT_FIELD_WIDTH, SWT.DEFAULT)
+ .span(3, SWT.DEFAULT)
+ .applyTo(categoryChooser);
}
public AbstractTaskCategory getCategory() {
@@ -378,6 +380,16 @@ public class TaskEditorActionPart extends AbstractTaskEditorPart {
Button button = toolkit.createButton(buttonComposite, operation.getLabel(), SWT.RADIO);
button.setFont(TEXT_FONT);
button.setData(KEY_OPERATION, operation);
+ String unconfirmedAllowed = operation.getTaskAttribute()
+ .getMetaData()
+ .getValue(TaskAttribute.META_UNCONFIRMED_ALLOWED);
+ if (unconfirmedAllowed != null) {
+ button.setEnabled(unconfirmedAllowed.compareTo("true") == 0); //$NON-NLS-1$
+ } else {
+ button.setEnabled(true);
+ }
+ button.setToolTipText(operation.getTooltip());
+
GridData radioData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
TaskAttribute associatedAttribute = getTaskData().getAttributeMapper().getAssoctiatedAttribute(
operation);
@@ -453,4 +465,17 @@ public class TaskEditorActionPart extends AbstractTaskEditorPart {
}
}
+ public void refreshOperations(boolean show) {
+ for (Button button : operationButtons) {
+ TaskOperation taskOperation = (TaskOperation) button.getData(KEY_OPERATION);
+ String unconfirmedAllowed = taskOperation.getTaskAttribute()
+ .getMetaData()
+ .getValue(TaskAttribute.META_UNCONFIRMED_ALLOWED);
+ if (unconfirmedAllowed != null) {
+ button.setEnabled(unconfirmedAllowed.compareTo("true") == 0); //$NON-NLS-1$
+ } else {
+ button.setEnabled(true);
+ }
+ }
+ }
}

Back to the top