Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-08-25 01:33:37 +0000
committermkersten2006-08-25 01:33:37 +0000
commit04c3ba72b1ee24dc875d13f32d8657b342fcdb45 (patch)
treedbc6b2bc05b2788dd7a8b760a25cb92ea6c51ff8
parentffab7bf76d01521496f3ec83e49a8b2480c393c7 (diff)
downloadorg.eclipse.mylyn.tasks-04c3ba72b1ee24dc875d13f32d8657b342fcdb45.tar.gz
org.eclipse.mylyn.tasks-04c3ba72b1ee24dc875d13f32d8657b342fcdb45.tar.xz
org.eclipse.mylyn.tasks-04c3ba72b1ee24dc875d13f32d8657b342fcdb45.zip
Completed: 155135: add support for changing ticket status in Trac rich editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=155135
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskData.java284
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java6
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java46
-rw-r--r--org.eclipse.mylyn.help.ui/doc/new.html1
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java65
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracOfflineTaskHandler.java25
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracRepositoryConnector.java17
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracTask.java12
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/ITracClient.java16
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditor.java38
12 files changed, 128 insertions, 386 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskData.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskData.java
deleted file mode 100644
index d7ecbac02..000000000
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskData.java
+++ /dev/null
@@ -1,284 +0,0 @@
-///*******************************************************************************
-// * Copyright (c) 2003 - 2006 University Of British Columbia 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:
-// * University Of British Columbia - initial API and implementation
-// *******************************************************************************/
-//package org.eclipse.mylar.internal.bugzilla.core;
-//
-//import java.io.Serializable;
-//import java.text.ParseException;
-//import java.text.SimpleDateFormat;
-//import java.util.ArrayList;
-//import java.util.Date;
-//import java.util.Iterator;
-//import java.util.List;
-//import java.util.StringTokenizer;
-//import java.util.TimeZone;
-//
-//import org.eclipse.mylar.internal.tasklist.AbstractRepositoryTaskData;
-//import org.eclipse.mylar.internal.tasklist.RepositoryOperation;
-//import org.eclipse.mylar.internal.tasklist.RepositoryTaskAttribute;
-//import org.eclipse.mylar.internal.tasklist.RepositoryTaskAttributeFactory;
-//
-///**
-// * @author Mik Kersten
-// * @author Rob Elves
-// */
-//public class BugzillaTaskData extends AbstractRepositoryTaskData implements Serializable {
-
-// private static final long serialVersionUID = 310066248657960823L;
-//
-// public static final String VAL_STATUS_VERIFIED = "VERIFIED";
-//
-// public static final String VAL_STATUS_CLOSED = "CLOSED";
-//
-// public static final String VAL_STATUS_RESOLVED = "RESOLVED";
-//
-// public static final String VAL_STATUS_NEW = "NEW";
-//
-// /** Parser for dates in the report */
-// private static SimpleDateFormat delta_ts_format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//
-// private static SimpleDateFormat creation_ts_format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-//
-// /** The bugs valid keywords */
-// protected List<String> validKeywords;
-//
-// /** The repositoryOperations that can be done on the report */
-// protected List<RepositoryOperation> repositoryOperations = new ArrayList<RepositoryOperation>();
-//
-// private static final RepositoryTaskAttributeFactory attributeFactory = new BugzillaAttributeFactory();
-//
-// /** The operation that was selected to do to the bug */
-// protected RepositoryOperation selectedOperation = null;
-//
-// /** Whether or not this bug report is saved offline. */
-// protected boolean savedOffline = false;
-//
-// protected boolean hasChanges = false;
-//
-// protected String charset = null;
-//
-// public BugzillaTaskData(int id, String repositoryURL) {
-// super(id, repositoryURL);
-// }
-//
-// /**
-// * TODO: move?
-// */
-// public static boolean isResolvedStatus(String status) {
-// if (status != null) {
-// return status.equals(VAL_STATUS_RESOLVED) || status.equals(VAL_STATUS_CLOSED)
-// || status.equals(VAL_STATUS_VERIFIED);
-// } else {
-// return false;
-// }
-// }
-//
-// public void addCC(String email) {
-// addAttributeValue(BugzillaReportElement.CC.getKeyString(), email);
-// }
-//
-// /**
-// * Add an operation to the bug
-// *
-// * @param o
-// * The operation to add
-// */
-// public void addOperation(RepositoryOperation o) {
-// repositoryOperations.add(o);
-// }
-//
-// /**
-// * Get the set of addresses in the CC list
-// *
-// * @return A <code>Set</code> of addresses in the CC list
-// */
-// public List<String> getCC() {
-// return getAttributeValues(BugzillaReportElement.CC.getKeyString());
-// }
-//
-// /**
-// * Get the date that the bug was created
-// *
-// * @return The bugs creation date
-// */
-// public Date getCreated() {
-// if (created == null) {
-// String dateString = getAttributeValue(BugzillaReportElement.CREATION_TS.getKeyString());
-// try {
-// created = creation_ts_format.parse(dateString);
-// } catch (ParseException e) {
-// // ignore
-// }
-// }
-// return created;
-// }
-//
-// /**
-// * Get the keywords for the bug
-// *
-// * @return The keywords for the bug
-// */
-// public List<String> getKeywords() {
-//
-// // get the selected keywords for the bug
-// StringTokenizer st = new StringTokenizer(getAttributeValue(BugzillaReportElement.KEYWORDS.getKeyString()), ",", false);
-// List<String> keywords = new ArrayList<String>();
-// while (st.hasMoreTokens()) {
-// String s = st.nextToken().trim();
-// keywords.add(s);
-// }
-//
-// return keywords;
-// }
-//
-// public String getLabel() {
-// return getId() + ": " + getAttributeValue(BugzillaReportElement.SHORT_DESC.getKeyString());
-// }
-//
-// public Date getLastModified(TimeZone timeZone) {
-// if (lastModified == null) {
-// String dateString = getAttributeValue(BugzillaReportElement.DELTA_TS.getKeyString());
-// try {
-// if(timeZone != null) {
-// delta_ts_format.setTimeZone(timeZone);
-// } else {
-// delta_ts_format.setTimeZone(TimeZone.getDefault());
-// }
-// lastModified = delta_ts_format.parse(dateString);
-// } catch (ParseException e) {
-// // ignore
-// }
-// }
-// return lastModified;
-// }
-//
-// /**
-// * Get an operation from the bug based on its display name
-// *
-// * @param displayText
-// * The display text for the operation
-// * @return The operation that has the display text
-// */
-// public RepositoryOperation getOperation(String displayText) {
-// Iterator<RepositoryOperation> itr = repositoryOperations.iterator();
-// while (itr.hasNext()) {
-// RepositoryOperation o = itr.next();
-// String opName = o.getOperationName();
-// opName = opName.replaceAll("</.*>", "");
-// opName = opName.replaceAll("<.*>", "");
-// if (opName.equals(displayText))
-// return o;
-// }
-// return null;
-// }
-//
-// /**
-// * Get all of the repositoryOperations that can be done to the bug
-// *
-// * @return The repositoryOperations that can be done to the bug
-// */
-// public List<RepositoryOperation> getOperations() {
-// return repositoryOperations;
-// }
-//
-// /**
-// * Get the person who reported the bug
-// *
-// * @return The person who reported the bug
-// */
-// public String getReporter() {
-// return getAttributeValue(BugzillaReportElement.REPORTER.getKeyString());
-// }
-//
-// /**
-// * Get the resolution of the bug
-// *
-// * @return The resolution of the bug
-// */
-// public String getResolution() {
-// return getAttributeValue(BugzillaReportElement.RESOLUTION.getKeyString());
-// }
-//
-// /**
-// * Get the status of the bug
-// *
-// * @return The bugs status
-// */
-// public String getStatus() {
-// return getAttributeValue(BugzillaReportElement.BUG_STATUS.getKeyString());
-// }
-//
-// /**
-// * Get the summary for the bug
-// *
-// * @return The bugs summary
-// */
-// public String getSummary() {
-// return getAttributeValue(BugzillaReportElement.SHORT_DESC.getKeyString());
-// }
-//
-// public void setSummary(String summary) {
-// setAttributeValue(BugzillaReportElement.SHORT_DESC.getKeyString(), summary);
-// }
-//
-// public String getProduct() {
-// return getAttributeValue(BugzillaReportElement.PRODUCT.getKeyString());
-// }
-//
-// public boolean isLocallyCreated() {
-// return false;
-// }
-//
-// public boolean isResolved() {
-// RepositoryTaskAttribute status = getAttribute(BugzillaReportElement.BUG_STATUS.getKeyString());
-// return status != null && isResolvedStatus(status.getValue());
-// }
-//
-// public boolean isSavedOffline() {
-// return savedOffline;
-// }
-//
-// /**
-// * Remove an address from the bugs CC list
-// *
-// * @param email
-// * the address to be removed from the CC list
-// * @return <code>true</code> if the email is in the set and it was removed
-// */
-// public void removeCC(String email) {
-// removeAttributeValue(BugzillaReportElement.CC.getKeyString(), email);
-// }
-//
-// public void setDescription(String description) {
-// // ignore, used by NewBugReport
-// // this.description = decodeStringFromCharset(description);
-// }
-//
-// public void setKeywords(List<String> keywords) {
-// this.validKeywords = keywords;
-// }
-//
-// public void setOfflineState(boolean newOfflineState) {
-// savedOffline = newOfflineState;
-// }
-//
-// public void setSelectedOperation(RepositoryOperation o) {
-// selectedOperation = o;
-// }
-//
-// public RepositoryOperation getSelectedOperation() {
-// return selectedOperation;
-// }
-//
-// @Override
-// public RepositoryTaskAttributeFactory getAttributeFactory() {
-// return attributeFactory;
-// }
-//}
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 3575c9bb3..1b43bb33b 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
@@ -162,6 +162,8 @@ public interface IBugzillaConstants {
public static final String VALUE_STATUS_ASSIGNED = "ASSIGNED";
+ public static final String VALUE_STATUS_VERIFIED = "VERIFIED";
+
public static final String VALUE_RESOLUTION_LATER = "LATER";
public static enum BUGZILLA_OPERATION {
@@ -172,10 +174,6 @@ public interface IBugzillaConstants {
UNCONFIRMED, NEW, ASSIGNED, REOPENED, RESOLVED, VERIFIED, CLOSED;
}
- public static enum BUGZILLA_REPORT_SEVERITY {
- UNCONFIRMED, NEW, ASSIGNED, REOPENED, RESOLVED, VERIFIED, CLOSED;
- }
-
public static enum BUGZILLA_RESOLUTION {
FIXED, INVALID, WONTFIX, LATER, REMIND, WORKSFORME;
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java
index 0e82e771b..41d848fee 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java
@@ -66,7 +66,7 @@ public class BugzillaTaskTest extends TestCase {
RepositoryTaskAttribute resolvedAttribute = attributeFactory.createAttribute(BugzillaReportElement.BUG_STATUS
.getKeyString());
- resolvedAttribute.setValue(RepositoryTaskData.VAL_STATUS_RESOLVED);
+ resolvedAttribute.setValue(IBugzillaConstants.VALUE_STATUS_RESOLVED);
report.addAttribute(BugzillaReportElement.BUG_STATUS.getKeyString(), resolvedAttribute);
assertNotNull(task.getCompletionDate());
assertEquals(offlineHandler
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java
index ce5933193..80a2d2b8a 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java
@@ -71,7 +71,7 @@ public class BugzillaTestUtil {
RepositoryTaskAttribute resolvedAttribute = attributeFactory.createAttribute(BugzillaReportElement.BUG_STATUS
.getKeyString());
if (completed) {
- resolvedAttribute.setValue(RepositoryTaskData.VAL_STATUS_RESOLVED);
+ resolvedAttribute.setValue(IBugzillaConstants.VALUE_STATUS_RESOLVED);
TaskComment taskComment = new TaskComment(new BugzillaAttributeFactory(), report, 1);
RepositoryTaskAttribute attribute = attributeFactory.createAttribute(BugzillaReportElement.BUG_WHEN
.getKeyString());
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java
index d9523ce67..61ca47445 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java
@@ -20,6 +20,7 @@ import org.eclipse.mylar.context.core.MylarStatusHandler;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaServerFacade;
+import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.TaskComment;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
@@ -30,7 +31,7 @@ import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
public class BugzillaTask extends AbstractRepositoryTask {
BugzillaOfflineTaskHandler offlineHandler = new BugzillaOfflineTaskHandler();
-
+
public BugzillaTask(String handle, String label, boolean newTask) {
super(handle, label, newTask);
if (newTask) {
@@ -55,10 +56,11 @@ public class BugzillaTask extends AbstractRepositoryTask {
super.setUrl(url);
}
} catch (Exception e) {
- MylarStatusHandler.fail(e, "Task initialization failed due to malformed id or URL: " + getHandleIdentifier(), false);
+ MylarStatusHandler.fail(e, "Task initialization failed due to malformed id or URL: "
+ + getHandleIdentifier(), false);
}
}
-
+
@Override
public String getDescription() {
if (this.isDownloaded() || !super.getDescription().startsWith("<")) {
@@ -86,42 +88,50 @@ public class BugzillaTask extends AbstractRepositoryTask {
}
@Override
- public boolean isCompleted() {
- if (taskData != null) {
- return taskData.isResolved();
- } else {
- return super.isCompleted();
- }
- }
-
- @Override
public String getUrl() {
// fix for bug 103537 - should login automatically, but dont want to
// show the login info in the query string
try {
- return BugzillaServerFacade.getBugUrlWithoutLogin(getRepositoryUrl(),
- Integer.parseInt(AbstractRepositoryTask.getTaskId(handle)));
+ return BugzillaServerFacade.getBugUrlWithoutLogin(getRepositoryUrl(), Integer
+ .parseInt(AbstractRepositoryTask.getTaskId(handle)));
} catch (NumberFormatException nfe) {
return super.getUrl();
}
}
@Override
+ public boolean isCompleted() {
+ if (taskData != null) {
+ if (taskData.getStatus() != null) {
+ return taskData.getStatus().equals(IBugzillaConstants.VALUE_STATUS_RESOLVED)
+ || taskData.getStatus().equals(IBugzillaConstants.VALUE_STATUS_CLOSED)
+ || taskData.getStatus().equals(IBugzillaConstants.VALUE_STATUS_VERIFIED);
+ } else {
+ return false;
+ }
+ } else {
+ return super.isCompleted();
+ }
+ }
+
+ @Override
public Date getCompletionDate() {
try {
if (taskData != null) {
- if (taskData.isResolved()) {
+ if (isCompleted()) {
+ // if (taskData.isResolved()) {
List<TaskComment> taskComments = taskData.getComments();
if (taskComments != null && !taskComments.isEmpty()) {
// TODO: fix not to be based on comment
- return offlineHandler.getDateForAttributeType(RepositoryTaskAttribute.COMMENT_DATE, (taskComments.get(taskComments.size() - 1).getCreated()));
+ return offlineHandler.getDateForAttributeType(RepositoryTaskAttribute.COMMENT_DATE,
+ (taskComments.get(taskComments.size() - 1).getCreated()));
}
}
}
} catch (Exception e) {
// ignore
e.printStackTrace();
- }
+ }
return super.getCompletionDate();
}
@@ -146,5 +156,5 @@ public class BugzillaTask extends AbstractRepositoryTask {
return super.getOwner();
}
}
-
+
}
diff --git a/org.eclipse.mylyn.help.ui/doc/new.html b/org.eclipse.mylyn.help.ui/doc/new.html
index e1d63901d..dd0ad2890 100644
--- a/org.eclipse.mylyn.help.ui/doc/new.html
+++ b/org.eclipse.mylyn.help.ui/doc/new.html
@@ -70,6 +70,7 @@ Mylar 0.3.x</a></b></li>
not worth mentioning)</li>
<li>Context attach/retrieve for Trac [verify]</li>
<li>Rich Trac editor</li>
+ <li>Hierarchical mode in Package Explorer now supported</li>
</ul>
<h2>Task List</h2>
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java
index 5741c324f..0eab892cc 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java
@@ -26,12 +26,6 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab
private static final long serialVersionUID = 2746931358107812373L;
- public static final String VAL_STATUS_VERIFIED = "VERIFIED";
-
- public static final String VAL_STATUS_CLOSED = "CLOSED";
-
- public static final String VAL_STATUS_RESOLVED = "RESOLVED";
-
public static final String VAL_STATUS_NEW = "NEW";
private String reportID;
@@ -89,27 +83,20 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab
this.repositoryURL = repositoryURL;
}
- /**
- * TODO: move?
- */
- public static boolean isResolvedStatus(String status) {
- if (status != null) {
- return status.equals(VAL_STATUS_RESOLVED) || status.equals(VAL_STATUS_CLOSED)
- || status.equals(VAL_STATUS_VERIFIED);
- } else {
- return false;
- }
- }
-
- // public void addCC(String email) {
- // addAttributeValue(RepositoryTaskAttribute.KEY_CC, email);
- // addAttributeValue(BugzillaReportElement.CC.getKeyString(), email);
- // }
+// /**
+// * TODO: move?
+// */
+// public static boolean isResolvedStatus(String status) {
+// if (status != null) {
+// return status.equals(VAL_STATUS_RESOLVED) || status.equals(VAL_STATUS_CLOSED)
+// || status.equals(VAL_STATUS_VERIFIED);
+// } else {
+// return false;
+// }
+// }
public String getLabel() {
return getSummary();
- // return getId() + ": " +
- // getAttributeValue(BugzillaReportElement.SHORT_DESC.getKeyString());
}
/**
@@ -119,8 +106,6 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab
*/
public String getResolution() {
return getAttributeValue(RepositoryTaskAttribute.RESOLUTION);
- // return
- // getAttributeValue(BugzillaReportElement.RESOLUTION.getKeyString());
}
/**
@@ -130,22 +115,12 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab
*/
public String getStatus() {
return getAttributeValue(RepositoryTaskAttribute.STATUS);
- // return
- // getAttributeValue(BugzillaReportElement.BUG_STATUS.getKeyString());
}
public String getLastModified() {
return getAttributeValue(RepositoryTaskAttribute.DATE_MODIFIED);
}
- // public void setKeywords(List<String> keywords) {
- // this.validKeywords = keywords;
- // }
-
- // public void setOfflineState(boolean newOfflineState) {
- // savedOffline = newOfflineState;
- // }
-
public void setSelectedOperation(RepositoryOperation o) {
selectedOperation = o;
}
@@ -154,11 +129,6 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab
return selectedOperation;
}
- // @Override
- // public RepositoryTaskAttributeFactory getAttributeFactory() {
- // return attributeFactory;
- // }
-
/**
* Get all of the repositoryOperations that can be done to the bug
*
@@ -227,15 +197,9 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab
return false;
}
- public boolean isResolved() {
- // RepositoryTaskAttribute status =
- // getAttribute(BugzillaReportElement.BUG_STATUS.getKeyString());
- return isResolvedStatus(getStatus());
- }
-
- // public boolean isSavedOffline() {
- // return savedOffline;
- // }
+// public boolean isResolved() {
+// return isResolvedStatus(getStatus());
+// }
/**
* Get the date that the bug was created
@@ -401,5 +365,4 @@ public class RepositoryTaskData extends AttributeContainer implements Serializab
}
}
- // public abstract RepositoryTaskAttributeFactory getAttributeFactory();
}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracOfflineTaskHandler.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracOfflineTaskHandler.java
index 540c2c6a0..87af36847 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracOfflineTaskHandler.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracOfflineTaskHandler.java
@@ -11,8 +11,11 @@
package org.eclipse.mylar.internal.trac;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -143,13 +146,23 @@ public class TracOfflineTaskHandler implements IOfflineTaskHandler {
}
String[] actions = ticket.getActions();
- for (String action : actions) {
- addOperation(repository, data, ticket, action);
+ if (actions != null) {
+ // add operations in a defined order
+ List<String> actionList = new ArrayList<String>(Arrays.asList(actions));
+ addOperation(repository, data, ticket, actionList, "leave");
+ addOperation(repository, data, ticket, actionList, "accept");
+ addOperation(repository, data, ticket, actionList, "resolve");
+ addOperation(repository, data, ticket, actionList, "reassign");
+ addOperation(repository, data, ticket, actionList, "reopen");
}
}
// TODO Reuse Labels from BugzillaServerFacade
- private static void addOperation(TaskRepository repository, RepositoryTaskData data, TracTicket ticket, String action) {
+ private static void addOperation(TaskRepository repository, RepositoryTaskData data, TracTicket ticket, List<String> actions, String action) {
+ if (!actions.remove(action)) {
+ return;
+ }
+
RepositoryOperation operation = null;
if ("leave".equals(action)) {
operation = new RepositoryOperation(action, "Leave as " + data.getStatus() + " "
@@ -164,11 +177,9 @@ public class TracOfflineTaskHandler implements IOfflineTaskHandler {
operation.addOption(resolution, resolution);
}
} else if ("reassign".equals(action)) {
- String localUser = repository.getUserName();
operation = new RepositoryOperation(action, "Reassing bug to");
- // FIXME owner?
- operation.setInputName("assign_to");
- operation.setInputValue(localUser);
+ operation.setInputName("owner");
+ operation.setInputValue(TracRepositoryConnector.getDisplayUsername(repository));
} else if ("reopen".equals(action)) {
operation = new RepositoryOperation(action, "Reopen");
}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracRepositoryConnector.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracRepositoryConnector.java
index 9b4281cd8..b966e136c 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracRepositoryConnector.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracRepositoryConnector.java
@@ -266,12 +266,8 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
* Updates fields of <code>task</code> from <code>ticket</code>.
*/
public static void updateTaskDetails(String repositoryUrl, TracTask task, TracTicket ticket, boolean notify) {
- if (ticket.isValid()) {
- String url = repositoryUrl + ITracClient.TICKET_URL + ticket.getId();
- task.setUrl(url);
- if (ticket.getValue(Key.SUMMARY) != null) {
- task.setDescription(ticket.getId() + ": " + ticket.getValue(Key.SUMMARY));
- }
+ if (ticket.getValue(Key.SUMMARY) != null) {
+ task.setDescription(ticket.getId() + ": " + ticket.getValue(Key.SUMMARY));
}
task.setCompleted(isCompleted(ticket));
task.setPriority(getPriority(ticket));
@@ -319,7 +315,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
@Override
public boolean hasRichEditor() {
- return false;
+ return true;
}
@Override
@@ -355,4 +351,11 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
return true;
}
+ public static String getDisplayUsername(TaskRepository repository) {
+ if (!repository.hasCredentials()) {
+ return ITracClient.DEFAULT_USERNAME;
+ }
+ return repository.getUserName();
+ }
+
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracTask.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracTask.java
index 750a9cae5..95b1ce1b8 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracTask.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/TracTask.java
@@ -11,6 +11,7 @@
package org.eclipse.mylar.internal.trac;
+import org.eclipse.mylar.internal.trac.core.ITracClient;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
/**
@@ -120,6 +121,17 @@ public class TracTask extends AbstractRepositoryTask {
public TracTask(String handle, String label, boolean newTask) {
super(handle, label, newTask);
+
+ setUrl(AbstractRepositoryTask.getRepositoryUrl(handle) + ITracClient.TICKET_URL + AbstractRepositoryTask.getTaskId(handle));
+ }
+
+ @Override
+ public boolean isCompleted() {
+ if (taskData != null) {
+ return Status.CLOSED.toString().toLowerCase().equals(taskData.getStatus());
+ } else {
+ return super.isCompleted();
+ }
}
@Override
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/ITracClient.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/ITracClient.java
index b7f7fdd89..2d5f03ac0 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/ITracClient.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/ITracClient.java
@@ -69,10 +69,13 @@ public interface ITracClient {
public static final String QUERY_URL = "/query?format=tab";
public static final String TICKET_URL = "/ticket/";
+
public static final String NEW_TICKET_URL = "/newticket";
public static final String TICKET_ATTACHMENT_URL = "/attachment/ticket/";
+ public static final String DEFAULT_USERNAME = "anonymous";
+
/**
* Gets ticket with <code>id</code> from repository.
*
@@ -139,16 +142,17 @@ public interface ITracClient {
void putAttachmentData(int id, String name, String description, byte[] data) throws TracException;
void createTicket(TracTicket ticket) throws TracException;
-
+
void updateTicket(TracTicket ticket, String comment) throws TracException;
-
+
/**
- * Sets a reference to the cached repository attributes.
- *
- * @param data cached repository attributes
+ * Sets a reference to the cached repository attributes.
+ *
+ * @param data
+ * cached repository attributes
*/
void setData(TracClientData data);
Set<Integer> getChangedTickets(Date since) throws TracException;
-
+
}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditor.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditor.java
index 55f22f17c..dfc07abd0 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditor.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditor.java
@@ -26,7 +26,9 @@ import org.eclipse.mylar.internal.trac.TracUiPlugin;
import org.eclipse.mylar.internal.trac.core.ITracClient;
import org.eclipse.mylar.internal.trac.core.InvalidTicketException;
import org.eclipse.mylar.internal.trac.model.TracTicket;
+import org.eclipse.mylar.internal.trac.model.TracTicket.Key;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
+import org.eclipse.mylar.tasks.core.RepositoryOperation;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
@@ -50,13 +52,7 @@ public class TracTaskEditor extends AbstractRepositoryTaskEditor {
}
@Override
- protected void addRadioButtons(Composite buttonComposite) {
- // TODO remove when operation handling has been implemented
- }
-
- @Override
public void createCustomAttributeLayout() {
-
}
@Override
@@ -170,11 +166,39 @@ public class TracTaskEditor extends AbstractRepositoryTaskEditor {
TracTicket getTracTicket() throws InvalidTicketException {
RepositoryTaskData data = getRepositoryTaskData();
+
TracTicket ticket = new TracTicket(Integer.parseInt(data.getId()));
+
List<RepositoryTaskAttribute> attributes = data.getAttributes();
for (RepositoryTaskAttribute attribute : attributes) {
- ticket.putValue(attribute.getID(), attribute.getValue());
+ if (!attribute.isReadOnly()) {
+ ticket.putValue(attribute.getID(), attribute.getValue());
+ }
+ }
+ // TODO "1" should not be hard coded here
+ if ("1".equals(data.getAttributeValue(RepositoryTaskAttribute.ADD_SELF_CC))) {
+ String cc = data.getAttributeValue(RepositoryTaskAttribute.USER_CC);
+ ticket.putBuiltinValue(Key.CC, cc + "," + repository.getUserName());
}
+
+ RepositoryOperation operation = data.getSelectedOperation();
+ String action = operation.getKnobName();
+ if (!"leave".equals(action)) {
+ if ("accept".equals(action)) {
+ ticket.putValue("status", "assigned");
+ ticket.putValue("owner", TracRepositoryConnector.getDisplayUsername(repository));
+ } else if ("resolve".equals(action)) {
+ ticket.putValue("status", "closed");
+ ticket.putValue("resolution", operation.getOptionSelection());
+ } else if ("reopen".equals(action)) {
+ ticket.putValue("status", "reopened");
+ ticket.putValue("resolution", "");
+ } else if ("reassign".equals(operation.getKnobName())) {
+ ticket.putValue("status", "new");
+ ticket.putValue("owner", operation.getInputValue());
+ }
+ }
+
return ticket;
}

Back to the top