Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 106546 Details for
Bug 223173
Action list not correct when using custom workflow with trac 0.11
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for Trac connector
clipboard.txt (text/plain), 10.43 KB, created by
Steffen Pingel
on 2008-07-04 01:56:54 EDT
(
hide
)
Description:
patch for Trac connector
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2008-07-04 01:56:54 EDT
Size:
10.43 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.trac.core >Index: src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java,v >retrieving revision 1.12 >diff -u -r1.12 TracTicket.java >--- src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java 13 Jun 2008 10:33:41 -0000 1.12 >+++ src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java 4 Jul 2008 05:56:18 -0000 >@@ -81,7 +81,7 @@ > > private List<TracAttachment> attachments; > >- private String[] actions; >+ private TracAction[] actions; > > private String[] resolutions; > >@@ -203,11 +203,11 @@ > return (attachments != null) ? attachments.toArray(new TracAttachment[0]) : null; > } > >- public void setActions(String[] actions) { >+ public void setActions(TracAction[] actions) { > this.actions = actions; > } > >- public String[] getActions() { >+ public TracAction[] getActions() { > return actions; > } > >Index: src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java,v >retrieving revision 1.57 >diff -u -r1.57 TracTaskDataHandler.java >--- src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java 1 Jul 2008 18:34:11 -0000 1.57 >+++ src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java 4 Jul 2008 05:56:18 -0000 >@@ -9,7 +9,6 @@ > package org.eclipse.mylyn.internal.trac.core; > > import java.util.ArrayList; >-import java.util.Arrays; > import java.util.Collection; > import java.util.Date; > import java.util.HashSet; >@@ -25,6 +24,7 @@ > import org.eclipse.mylyn.commons.net.Policy; > import org.eclipse.mylyn.internal.trac.core.client.ITracClient; > import org.eclipse.mylyn.internal.trac.core.client.InvalidTicketException; >+import org.eclipse.mylyn.internal.trac.core.model.TracAction; > import org.eclipse.mylyn.internal.trac.core.model.TracAttachment; > import org.eclipse.mylyn.internal.trac.core.model.TracComment; > import org.eclipse.mylyn.internal.trac.core.model.TracTicket; >@@ -201,41 +201,35 @@ > } > } > >- String[] actions = ticket.getActions(); >+ TracAction[] actions = ticket.getActions(); > 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, "reopen"); >+ for (TracAction action : actions) { >+ addOperation(repository, data, ticket, action); >+ } > } > > return changedAttributes; > } > >- private static void addOperation(TaskRepository repository, TaskData data, TracTicket ticket, List<String> actions, >- String action) { >- if (!actions.remove(action)) { >- return; >- } >- >- String label = null; >- if ("leave".equals(action)) { >- // TODO provide better label for Leave action >- //label = "Leave as " + data.getStatus() + " " + data.getResolution(); >- label = "Leave"; >- } else if ("accept".equals(action)) { >- label = "Accept"; >- } else if ("resolve".equals(action)) { >- label = "Resolve as"; >- } else if ("reopen".equals(action)) { >- label = "Reopen"; >+ private static void addOperation(TaskRepository repository, TaskData data, TracTicket ticket, TracAction action) { >+ String label = action.getName(); >+ if (label == null) { >+ if ("leave".equals(action)) { >+ // TODO provide better label for Leave action >+ //label = "Leave as " + data.getStatus() + " " + data.getResolution(); >+ label = "Leave"; >+ } else if ("accept".equals(action)) { >+ label = "Accept"; >+ } else if ("resolve".equals(action)) { >+ label = "Resolve as"; >+ } else if ("reopen".equals(action)) { >+ label = "Reopen"; >+ } > } >- > if (label != null) { > TaskAttribute attribute = data.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + action); >- TaskOperation.applyTo(attribute, action, label); >+ TaskOperation.applyTo(attribute, action.getId(), label); > if ("resolve".equals(action)) { > attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, > TracAttribute.RESOLUTION.getTracKey()); >Index: src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java,v >retrieving revision 1.2 >diff -u -r1.2 TracXmlRpcClient.java >--- src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java 22 Jun 2008 07:54:05 -0000 1.2 >+++ src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java 4 Jul 2008 05:56:18 -0000 >@@ -43,6 +43,7 @@ > import org.eclipse.mylyn.commons.net.UnsupportedRequestException; > import org.eclipse.mylyn.commons.net.WebUtil; > import org.eclipse.mylyn.internal.trac.core.TracCorePlugin; >+import org.eclipse.mylyn.internal.trac.core.model.TracAction; > import org.eclipse.mylyn.internal.trac.core.model.TracAttachment; > import org.eclipse.mylyn.internal.trac.core.model.TracComment; > import org.eclipse.mylyn.internal.trac.core.model.TracComponent; >@@ -362,7 +363,7 @@ > ticket.addAttachment(parseAttachment((Object[]) item)); > } > >- String[] actions = getActions(id, monitor); >+ TracAction[] actions = getActions(id, monitor); > ticket.setActions(actions); > > updateAttributes(new NullProgressMonitor(), false); >@@ -738,13 +739,26 @@ > return result; > } > >- public String[] getActions(int id, IProgressMonitor monitor) throws TracException { >- Object[] actions = (Object[]) call(monitor, "ticket.getAvailableActions", id); >- String[] result = new String[actions.length]; >- for (int i = 0; i < result.length; i++) { >- result[i] = (String) actions[i]; >+ public TracAction[] getActions(int id, IProgressMonitor monitor) throws TracException { >+ if (isAPIVersionOrHigher(1, 0, 1, monitor)) { >+ Object[] actions = (Object[]) call(monitor, "ticket.getAvailableActions2", id); >+ TracAction[] result = new TracAction[actions.length]; >+ for (int i = 0; i < result.length; i++) { >+ Object[] entry = (Object[]) actions[i]; >+ TracAction action = new TracAction((String) entry[1]); >+ action.setName((String) entry[2]); >+ action.setHint((String) entry[3]); >+ result[i] = action; >+ } >+ return result; >+ } else { >+ Object[] actions = (Object[]) call(monitor, "ticket.getAvailableActions", id); >+ TracAction[] result = new TracAction[actions.length]; >+ for (int i = 0; i < result.length; i++) { >+ result[i] = new TracAction((String) actions[i]); >+ } >+ return result; > } >- return result; > } > > public Date getTicketLastChanged(Integer id, IProgressMonitor monitor) throws TracException { >@@ -913,19 +927,19 @@ > * This implementation uses the wiki.putAttachmentEx() call, which provides a richer functionality specific to Trac. > * > * @param pageName >- * the name of the Wiki page >+ * the name of the Wiki page > * @param fileName >- * the name of the file to be attached >+ * the name of the file to be attached > * @param description >- * the description of the attachment >+ * the description of the attachment > * @param in >- * An InputStream of the content of the attachment >+ * An InputStream of the content of the attachment > * @param replace >- * whether to overwrite an existing attachment with the same filename >+ * whether to overwrite an existing attachment with the same filename > * @return The (possibly transformed) filename of the attachment. If <code>replace</code> is <code>true</code>, the >- * returned name is always the same as the argument <code>fileName</code>; if <code>replace</code> is >- * <code>false</code> and an attachment with name <code>fileName</code> already exists, a number is appended to the >- * file name (before suffix) and the generated filename of the attachment is returned. >+ * returned name is always the same as the argument <code>fileName</code>; if <code>replace</code> is >+ * <code>false</code> and an attachment with name <code>fileName</code> already exists, a number is appended >+ * to the file name (before suffix) and the generated filename of the attachment is returned. > * @throws TracException > */ > public String putWikiPageAttachmentData(String pageName, String fileName, String description, InputStream in, >Index: src/org/eclipse/mylyn/internal/trac/core/model/TracAction.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/trac/core/model/TracAction.java >diff -N src/org/eclipse/mylyn/internal/trac/core/model/TracAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/trac/core/model/TracAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,72 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers 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 >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.trac.core.model; >+ >+import java.util.Map; >+ >+/** >+ * @author Steffen Pingel >+ */ >+public class TracAction { >+ >+ private Map<String, String> fields; >+ >+ private String hint; >+ >+ private String id; >+ >+ private String name; >+ >+ private String value; >+ >+ public TracAction(String id) { >+ this.id = id; >+ } >+ >+ public Map<String, String> getFields() { >+ return fields; >+ } >+ >+ public String getHint() { >+ return hint; >+ } >+ >+ public String getId() { >+ return id; >+ } >+ >+ public String getName() { >+ return name; >+ } >+ >+ public String getValue() { >+ return value; >+ } >+ >+ public void setFields(Map<String, String> fields) { >+ this.fields = fields; >+ } >+ >+ public void setHint(String hint) { >+ this.hint = hint; >+ } >+ >+ public void setId(String id) { >+ this.id = id; >+ } >+ >+ public void setName(String name) { >+ this.name = name; >+ } >+ >+ public void setValue(String value) { >+ this.value = value; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 223173
:
106544
| 106546 |
139095
|
139103