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 91973 Details for
Bug 221965
show timespent value in jira task editor attributes section
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]
fix
clipboard.txt (text/plain), 13.26 KB, created by
Eugene Kuleshov
on 2008-03-08 15:20:37 EST
(
hide
)
Description:
fix
Filename:
MIME Type:
Creator:
Eugene Kuleshov
Created:
2008-03-08 15:20:37 EST
Size:
13.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.jira.ui >Index: src/org/eclipse/mylyn/internal/jira/ui/JiraAttribute.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/JiraAttribute.java,v >retrieving revision 1.10 >diff -u -r1.10 JiraAttribute.java >--- src/org/eclipse/mylyn/internal/jira/ui/JiraAttribute.java 14 Dec 2007 01:21:51 -0000 1.10 >+++ src/org/eclipse/mylyn/internal/jira/ui/JiraAttribute.java 8 Mar 2008 20:18:10 -0000 >@@ -17,33 +17,48 @@ > public enum JiraAttribute { > ISSUE_KEY(RepositoryTaskAttribute.TASK_KEY, JiraFieldType.TEXTFIELD, "Issue ID:"), > >- SUMMARY(RepositoryTaskAttribute.SUMMARY, JiraFieldType.TEXTFIELD, "Summary:", true, false, "summary"), DESCRIPTION( >- RepositoryTaskAttribute.DESCRIPTION, JiraFieldType.TEXTFIELD, "Description:", true, false, "description"), STATUS( >- RepositoryTaskAttribute.STATUS, JiraFieldType.SELECT, "Status:"), RESOLUTION( >- RepositoryTaskAttribute.RESOLUTION, JiraFieldType.SELECT, "Resolution:", true, false, "resolution"), >+ SUMMARY(RepositoryTaskAttribute.SUMMARY, JiraFieldType.TEXTFIELD, "Summary:", true, false, "summary"), > >- DATE_CREATION(RepositoryTaskAttribute.DATE_CREATION, JiraFieldType.TEXTFIELD, "Created:"), DATE_MODIFIED( >- RepositoryTaskAttribute.DATE_MODIFIED, JiraFieldType.TEXTFIELD, "Modified:"), >+ DESCRIPTION(RepositoryTaskAttribute.DESCRIPTION, JiraFieldType.TEXTFIELD, "Description:", true, false, >+ "description"), >+ >+ STATUS(RepositoryTaskAttribute.STATUS, JiraFieldType.SELECT, "Status:"), >+ >+ RESOLUTION(RepositoryTaskAttribute.RESOLUTION, JiraFieldType.SELECT, "Resolution:", true, false, "resolution"), >+ >+ DATE_CREATION(RepositoryTaskAttribute.DATE_CREATION, JiraFieldType.TEXTFIELD, "Created:"), >+ >+ DATE_MODIFIED(RepositoryTaskAttribute.DATE_MODIFIED, JiraFieldType.TEXTFIELD, "Modified:"), > > USER_ASSIGNED(RepositoryTaskAttribute.USER_ASSIGNED, JiraFieldType.USERPICKER, "Assigned to:", true, false, >- "assignee"), USER_REPORTER(RepositoryTaskAttribute.USER_REPORTER, JiraFieldType.USERPICKER, "Reported by:"), >+ "assignee"), >+ >+ USER_REPORTER(RepositoryTaskAttribute.USER_REPORTER, JiraFieldType.USERPICKER, "Reported by:"), >+ >+ PRODUCT(RepositoryTaskAttribute.PRODUCT, JiraFieldType.PROJECT, "Project:", false, true), >+ >+ PRIORITY(RepositoryTaskAttribute.PRIORITY, JiraFieldType.SELECT, "Priority:", false, false, "priority"), > >- PRODUCT(RepositoryTaskAttribute.PRODUCT, JiraFieldType.PROJECT, "Project:", false, true), PRIORITY( >- RepositoryTaskAttribute.PRIORITY, JiraFieldType.SELECT, "Priority:", false, false, "priority"), >+ TYPE(JiraAttributeFactory.ATTRIBUTE_TYPE, JiraFieldType.SELECT, "Type:", false, false, "issuetype"), > >- TYPE(JiraAttributeFactory.ATTRIBUTE_TYPE, JiraFieldType.SELECT, "Type:", false, false, "issuetype"), PARENT_KEY( >- JiraAttributeFactory.ATTRIBUTE_ISSUE_PARENT_KEY, JiraFieldType.ISSUELINK, "Parent:", false, true), >+ PARENT_KEY(JiraAttributeFactory.ATTRIBUTE_ISSUE_PARENT_KEY, JiraFieldType.ISSUELINK, "Parent:", false, true), > > PARENT_ID(JiraAttributeFactory.ATTRIBUTE_ISSUE_PARENT_ID, JiraFieldType.ISSUELINK, "Parent ID:", true, true), > > COMPONENTS(JiraAttributeFactory.ATTRIBUTE_COMPONENTS, JiraFieldType.MULTISELECT, "Components:", false, false, >- "components"), AFFECTSVERSIONS(JiraAttributeFactory.ATTRIBUTE_AFFECTSVERSIONS, JiraFieldType.MULTISELECT, >- "Affects Versions:", false, false, "versions"), FIXVERSIONS(JiraAttributeFactory.ATTRIBUTE_FIXVERSIONS, >- JiraFieldType.MULTISELECT, "Fix Versions:", false, false, "fixVersions"), >+ "components"), >+ >+ AFFECTSVERSIONS(JiraAttributeFactory.ATTRIBUTE_AFFECTSVERSIONS, JiraFieldType.MULTISELECT, "Affects Versions:", >+ false, false, "versions"), >+ >+ FIXVERSIONS(JiraAttributeFactory.ATTRIBUTE_FIXVERSIONS, JiraFieldType.MULTISELECT, "Fix Versions:", false, false, >+ "fixVersions"), > > ESTIMATE(JiraAttributeFactory.ATTRIBUTE_ESTIMATE, JiraFieldType.TEXTFIELD, "Estimate:", false, false, > "timetracking"), > >+ ACTUAL(JiraAttributeFactory.ATTRIBUTE_ACTUAL, JiraFieldType.TEXTFIELD, "Time Spent:", false, true, "timespent"), >+ > DUE(JiraAttributeFactory.ATTRIBUTE_DUE_DATE, JiraFieldType.TEXTFIELD, "Due Date:", true, false, "duedate"), > > ENVIRONMENT(JiraAttributeFactory.ATTRIBUTE_ENVIRONMENT, JiraFieldType.TEXTAREA, "Environment:", false, false, >@@ -51,12 +66,15 @@ > > COMMENT_NEW(RepositoryTaskAttribute.COMMENT_NEW, JiraFieldType.TEXTAREA, "New Comment:", true, false, "comment"), > >- COMMENT_AUTHOR(RepositoryTaskAttribute.COMMENT_AUTHOR, JiraFieldType.TEXTAREA, "Author:"), COMMENT_TEXT( >- RepositoryTaskAttribute.COMMENT_TEXT, JiraFieldType.TEXTAREA, "Comment:"), COMMENT_DATE( >- RepositoryTaskAttribute.COMMENT_DATE, JiraFieldType.TEXTAREA, "Date:"), >+ COMMENT_AUTHOR(RepositoryTaskAttribute.COMMENT_AUTHOR, JiraFieldType.TEXTAREA, "Author:"), >+ >+ COMMENT_TEXT(RepositoryTaskAttribute.COMMENT_TEXT, JiraFieldType.TEXTAREA, "Comment:"), >+ >+ COMMENT_DATE(RepositoryTaskAttribute.COMMENT_DATE, JiraFieldType.TEXTAREA, "Date:"), >+ >+ SUBTASK_IDS(JiraAttributeFactory.ATTRIBUTE_SUBTASK_IDS, JiraFieldType.TEXTFIELD, "Subtask ids:", true, true), > >- SUBTASK_IDS(JiraAttributeFactory.ATTRIBUTE_SUBTASK_IDS, JiraFieldType.TEXTFIELD, "Subtask ids:", true, true), SUBTASK_KEYS( >- JiraAttributeFactory.ATTRIBUTE_SUBTASK_KEYS, JiraFieldType.ISSUELINKS, "Subtasks:", false, true), >+ SUBTASK_KEYS(JiraAttributeFactory.ATTRIBUTE_SUBTASK_KEYS, JiraFieldType.ISSUELINKS, "Subtasks:", false, true), > > SECURITY_LEVEL(JiraAttributeFactory.ATTRIBUTE_SECURITY_LEVEL, JiraFieldType.SELECT, "Security Level:", false, true), > >Index: src/org/eclipse/mylyn/internal/jira/ui/JiraTaskDataHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/JiraTaskDataHandler.java,v >retrieving revision 1.100 >diff -u -r1.100 JiraTaskDataHandler.java >--- src/org/eclipse/mylyn/internal/jira/ui/JiraTaskDataHandler.java 4 Mar 2008 06:52:09 -0000 1.100 >+++ src/org/eclipse/mylyn/internal/jira/ui/JiraTaskDataHandler.java 8 Mar 2008 20:18:10 -0000 >@@ -195,6 +195,8 @@ > fixVersions.addOption(version.getName(), version.getId()); > } > >+ addAttribute(data, JiraAttributeFactory.ATTRIBUTE_ACTUAL); >+ > RepositoryTaskAttribute environment = addAttribute(data, JiraAttributeFactory.ATTRIBUTE_ENVIRONMENT); > environment.putMetaDataValue(JiraAttributeFactory.TYPE_KEY, JiraFieldType.TEXTAREA.getKey()); > >@@ -305,6 +307,9 @@ > > data.setAttributeValue(JiraAttributeFactory.ATTRIBUTE_ESTIMATE, Long.toString(jiraIssue.getEstimate() / 60)); > >+ JiraTimeFormat f = new JiraTimeFormat(); >+ data.setAttributeValue(JiraAttributeFactory.ATTRIBUTE_ACTUAL, f.format(jiraIssue.getActual())); >+ > if (jiraIssue.getDue() != null) { > data.setAttributeValue(JiraAttributeFactory.ATTRIBUTE_DUE_DATE, JiraUtils.dateToString(jiraIssue.getDue())); > } else { >Index: src/org/eclipse/mylyn/internal/jira/ui/JiraAttributeFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/JiraAttributeFactory.java,v >retrieving revision 1.31 >diff -u -r1.31 JiraAttributeFactory.java >--- src/org/eclipse/mylyn/internal/jira/ui/JiraAttributeFactory.java 1 Mar 2008 21:38:24 -0000 1.31 >+++ src/org/eclipse/mylyn/internal/jira/ui/JiraAttributeFactory.java 8 Mar 2008 20:18:10 -0000 >@@ -42,6 +42,8 @@ > > public static final String ATTRIBUTE_ESTIMATE = "attribute.jira.estimate"; > >+ public static final String ATTRIBUTE_ACTUAL = "attribute.jira.actual"; >+ > public static final String ATTRIBUTE_DUE_DATE = "attribute.jira.due"; > > public static final String ATTRIBUTE_SUBTASK_IDS = "attribute.jira.subtask_ids"; >Index: src/org/eclipse/mylyn/internal/jira/ui/JiraTimeFormat.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/jira/ui/JiraTimeFormat.java >diff -N src/org/eclipse/mylyn/internal/jira/ui/JiraTimeFormat.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/jira/ui/JiraTimeFormat.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,86 @@ >+/******************************************************************************* >+ * 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.jira.ui; >+ >+import java.text.FieldPosition; >+import java.text.Format; >+import java.text.ParsePosition; >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; >+ >+/** >+ * JIRA time format to convert Long value in seconds to JIRA time format: >+ * >+ * <blockquote> The format of this is '*w *d *h *m' (representing weeks, days, hours and minutes - where * can be any >+ * number) Examples: 4d, 5h 30m, 60m and 3w. Note: Your current conversion rates are 1w = 7d and 1d = 24h </blockquote> >+ * >+ * @author Eugene Kuleshov >+ */ >+public class JiraTimeFormat extends Format { >+ >+ private static final long serialVersionUID = 1L; >+ >+ /** >+ * A simplified conversion from seconds to '*h *m' format >+ * >+ * @param a >+ * Long seconds value to format >+ */ >+ @Override >+ public StringBuffer format(Object obj, StringBuffer sb, FieldPosition pos) { >+ if (obj instanceof Long) { >+ format(sb, (Long) obj); >+ } else if (obj instanceof Integer) { >+ format(sb, (Integer) obj); >+ } >+ return sb; >+ } >+ >+ private void format(StringBuffer sb, long seconds) { >+ long hours = seconds / (60 * 60); >+ if (hours > 0) { >+ sb.append(Long.toString(hours)).append('h'); >+ } >+ long minutes = (seconds % (60 * 60)) / 60; >+ if (minutes > 0) { >+ if (sb.length() > 0) { >+ sb.append(' '); >+ } >+ sb.append(Long.toString(minutes)).append('m'); >+ } else if (sb.length() == 0) { >+ sb.append("0m"); >+ } >+ } >+ >+ @Override >+ public Object parseObject(String source, ParsePosition pos) { >+ Pattern pattern = Pattern.compile("(\\d+w)?\\s?(\\d+d)?\\s?(\\d+h)?\\s?(\\d+m)?"); >+ Matcher matcher = pattern.matcher(source); >+ long value = 0; >+ if (matcher.find()) { >+ for (int i = 1; i <= matcher.groupCount(); i++) { >+ String group = matcher.group(i); >+ if (group != null) { >+ if (group.endsWith("m")) { >+ value += Long.parseLong(group.substring(0, group.length() - 1)) * 60; >+ } else if (group.endsWith("h")) { >+ value += Long.parseLong(group.substring(0, group.length() - 1)) * 60 * 60; >+ } else if (group.endsWith("d")) { >+ value += Long.parseLong(group.substring(0, group.length() - 1)) * 60 * 60 * 24; >+ } else if (group.endsWith("w")) { >+ value += Long.parseLong(group.substring(0, group.length() - 1)) * 60 * 60 * 24 * 7; >+ } >+ } >+ } >+ } >+ pos.setIndex(source.length() + 1); >+ return Long.valueOf(value); >+ } >+ >+} >#P org.eclipse.mylyn.jira.tests >Index: src/org/eclipse/mylyn/internal/jira/ui/JiraTimeFormatTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/jira/ui/JiraTimeFormatTest.java >diff -N src/org/eclipse/mylyn/internal/jira/ui/JiraTimeFormatTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/jira/ui/JiraTimeFormatTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,44 @@ >+/******************************************************************************* >+ * 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.jira.ui; >+ >+import junit.framework.TestCase; >+ >+/** >+ * @author Eugene Kuleshov >+ */ >+public class JiraTimeFormatTest extends TestCase { >+ >+ public void testFormat() { >+ JiraTimeFormat f = new JiraTimeFormat(); >+ >+ assertEquals("0m", f.format(1)); >+ assertEquals("1m", f.format(60)); >+ assertEquals("30m", f.format(60 * 30)); >+ assertEquals("1h", f.format(60 * 60)); >+ assertEquals("1h 30m", f.format(60 * 90)); >+ } >+ >+ public void testParse() throws Exception { >+ JiraTimeFormat f = new JiraTimeFormat(); >+ >+ assertEquals(0L, f.parseObject("")); >+ assertEquals(0L, f.parseObject("0m")); >+ assertEquals(60L, f.parseObject("1m")); >+ assertEquals(60L * 30, f.parseObject("30m")); >+ assertEquals(60L * 60, f.parseObject("60m")); >+ assertEquals(60L * 60, f.parseObject("1h")); >+ assertEquals(60L * 90, f.parseObject("1h 30m")); >+ assertEquals(60L * 60 * 25, f.parseObject("1d 1h")); >+ assertEquals(60L * 60 * 25 + 60, f.parseObject("1d 1h 1m")); >+ assertEquals(60L * 60 * 24 * 7, f.parseObject("1w")); >+ assertEquals(60L * (60 * 24 * 7 + 60 * 24 + 61), f.parseObject("1w 1d 1h 1m")); >+ } >+ >+}
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 221965
: 91973 |
91974
|
94479