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 116886 Details for
Bug 226851
support custom attributes in the new bugzilla task editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated patch
custom.patch (text/plain), 33.67 KB, created by
Robert Elves
on 2008-11-03 18:27:51 EST
(
hide
)
Description:
Updated patch
Filename:
MIME Type:
Creator:
Robert Elves
Created:
2008-11-03 18:27:51 EST
Size:
33.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.tests >Index: src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java,v >retrieving revision 1.39 >diff -u -r1.39 AllBugzillaTests.java >--- src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java 2 Oct 2008 01:36:13 -0000 1.39 >+++ src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java 3 Nov 2008 23:26:26 -0000 >@@ -42,6 +42,7 @@ > suite.addTestSuite(BugzillaProductParserTest.class); > suite.addTestSuite(BugzillaSearchDialogTest.class); > suite.addTestSuite(BugzillaTaskHistoryTest.class); >+ suite.addTestSuite(BugzillaRepository32Test.class); > // $JUnit-END$ > return suite; > } >Index: src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java,v >retrieving revision 1.62 >diff -u -r1.62 AbstractBugzillaTest.java >--- src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java 7 Oct 2008 05:09:55 -0000 1.62 >+++ src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java 3 Nov 2008 23:26:26 -0000 >@@ -80,6 +80,10 @@ > manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath()); > } > >+ protected void init32() { >+ init(IBugzillaConstants.TEST_BUGZILLA_32_URL); >+ } >+ > protected void init31() { > init(IBugzillaConstants.TEST_BUGZILLA_31_URL); > } >Index: src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepository32Test.java >=================================================================== >RCS file: src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepository32Test.java >diff -N src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepository32Test.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepository32Test.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,143 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2008 Tasktop Technologies and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Tasktop Technologies - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.bugzilla.tests; >+ >+import java.text.SimpleDateFormat; >+import java.util.ArrayList; >+import java.util.HashSet; >+import java.util.List; >+import java.util.Set; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.mylyn.commons.net.AuthenticationCredentials; >+import org.eclipse.mylyn.commons.net.AuthenticationType; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; >+import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal; >+import org.eclipse.mylyn.tasks.core.ITask; >+import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState; >+import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >+import org.eclipse.mylyn.tasks.core.data.TaskData; >+import org.eclipse.mylyn.tasks.core.data.TaskMapper; >+ >+/** >+ * @author Frank Becker >+ */ >+public class BugzillaRepository32Test extends AbstractBugzillaTest { >+ >+ public void testCustomAttributes() throws Exception { >+ init32(); >+ String taskNumber = "1"; >+ ITask task = generateLocalTaskAndDownload(taskNumber); >+ assertNotNull(task); >+ TaskData taskData = TasksUiPlugin.getTaskDataManager().getTaskData(task); >+ assertNotNull(taskData); >+ TaskMapper mapper = new TaskMapper(taskData); >+ assertEquals(SynchronizationState.SYNCHRONIZED, task.getSynchronizationState()); >+ assertEquals(taskNumber, taskData.getTaskId()); >+ >+ SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); >+ assertEquals(format1.parse("2008-10-04 15:01"), mapper.getCreationDate()); >+ >+ AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY); >+ assertNotNull("credentials are null", credentials); >+ assertNotNull("Repositor User not set", credentials.getUserName()); >+ assertNotNull("no password for Repository", credentials.getPassword()); >+ >+ TaskAttribute colorAttribute = mapper.getTaskData().getRoot().getAttribute("cf_colors"); >+ assertNotNull("TaskAttribute Color did not exists", colorAttribute); >+ List<String> theColors = colorAttribute.getValues(); >+ assertNotNull(theColors); >+ assertFalse("no colors set", theColors.isEmpty()); >+ >+ boolean red = false; >+ boolean green = false; >+ boolean yellow = false; >+ boolean blue = false; >+ >+ for (Object element : theColors) { >+ String string = (String) element; >+ >+ if (!red && string.compareTo("Red") == 0) { >+ red = true; >+ } else if (!green && string.compareTo("Green") == 0) { >+ green = true; >+ } else if (!yellow && string.compareTo("Yellow") == 0) { >+ yellow = true; >+ } else if (!blue && string.compareTo("Blue") == 0) { >+ blue = true; >+ } >+ } >+ changeCollorAndSubmit(task, taskData, colorAttribute, red, green, yellow, blue); >+ assertEquals(SynchronizationState.SYNCHRONIZED, task.getSynchronizationState()); >+ TasksUiInternal.synchronizeTask(connector, task, true, null); >+ TasksUiPlugin.getTaskDataManager().setTaskRead(task, true); >+// task = generateLocalTaskAndDownload(taskNumber); >+ assertNotNull(task); >+ taskData = TasksUiPlugin.getTaskDataManager().getTaskData(task); >+ assertNotNull(taskData); >+ mapper = new TaskMapper(taskData); >+ assertEquals(SynchronizationState.SYNCHRONIZED, task.getSynchronizationState()); >+ >+ colorAttribute = mapper.getTaskData().getRoot().getAttribute("cf_colors"); >+ assertNotNull("TaskAttribute Color did not exists", colorAttribute); >+ theColors = colorAttribute.getValues(); >+ assertNotNull(theColors); >+ assertFalse("no colors set", theColors.isEmpty()); >+ boolean red_new = false; >+ boolean green_new = false; >+ boolean yellow_new = false; >+ boolean blue_new = false; >+ >+ for (Object element : theColors) { >+ String string = (String) element; >+ >+ if (!red_new && string.compareTo("Red") == 0) { >+ red_new = true; >+ } else if (!green_new && string.compareTo("Green") == 0) { >+ green_new = true; >+ } else if (!yellow_new && string.compareTo("Yellow") == 0) { >+ yellow_new = true; >+ } else if (!blue_new && string.compareTo("Blue") == 0) { >+ blue_new = true; >+ } >+ } >+ assertTrue("wrong change", >+ (!red && green && !yellow && !blue && red_new && green_new && !yellow_new && !blue_new) >+ || (red && green && !yellow && !blue && !red_new && green_new && !yellow_new && !blue_new)); >+ changeCollorAndSubmit(task, taskData, colorAttribute, red_new, green_new, yellow_new, blue_new); >+ assertEquals(SynchronizationState.SYNCHRONIZED, task.getSynchronizationState()); >+ >+ } >+ >+ private void changeCollorAndSubmit(ITask task, TaskData taskData, TaskAttribute colorAttribute, boolean red, >+ boolean green, boolean yellow, boolean blue) throws CoreException { >+ if (!red && green && !yellow && !blue) { >+ List<String> newValue = new ArrayList<String>(2); >+ newValue.add("Red"); >+ newValue.add("Green"); >+ colorAttribute.setValues(newValue); >+ Set<TaskAttribute> changed = new HashSet<TaskAttribute>(); >+ changed.add(colorAttribute); >+ // Submit changes >+ submit(task, taskData, changed); >+ } else if (red && green && !yellow && !blue) { >+ List<String> newValue = new ArrayList<String>(2); >+ newValue.add("Green"); >+ colorAttribute.setValues(newValue); >+ Set<TaskAttribute> changed = new HashSet<TaskAttribute>(); >+ changed.add(colorAttribute); >+ // Submit changes >+ submit(task, taskData, changed); >+ } >+ >+ } >+} >#P org.eclipse.mylyn.bugzilla.core >Index: src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java,v >retrieving revision 1.37 >diff -u -r1.37 SaxMultiBugReportContentHandler.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java 12 Sep 2008 04:17:45 -0000 1.37 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java 3 Nov 2008 23:26:29 -0000 >@@ -189,7 +189,32 @@ > atr.getMetaData().defaults().setLabel(desc).setReadOnly(false); > atr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT); > atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); >- atr.getMetaData().setReadOnly(true); >+ switch (customField.getType()) { >+ case 1: // Free Text >+ atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); >+ break; >+ case 2: // Drop Down >+ atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); >+ break; >+ case 3: // Multiple-Selection Box >+ atr.getMetaData().setType(TaskAttribute.TYPE_MULTI_SELECT); >+ break; >+ case 4: // Large Text Box >+ atr.getMetaData().setType(TaskAttribute.TYPE_LONG_TEXT); >+ break; >+ case 5: // Date/Time >+ atr.getMetaData().setType(TaskAttribute.TYPE_DATETIME); >+ break; >+ >+ default: >+ List<String> options = customField.getOptions(); >+ if (options.size() > 0) { >+ atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); >+ } else { >+ atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); >+ } >+ } >+ atr.getMetaData().setReadOnly(false); > atr.setValue(parsedText); > } > } else { >@@ -374,11 +399,30 @@ > atr.getMetaData().defaults().setLabel(bugzillaCustomField.getDescription()); > atr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT); > >- List<String> options = bugzillaCustomField.getOptions(); >- if (options.size() > 0) { >- atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); >- } else { >+ switch (bugzillaCustomField.getType()) { >+ case 1: // Free Text > atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); >+ break; >+ case 2: // Drop Down >+ atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); >+ break; >+ case 3: // Multiple-Selection Box >+ atr.getMetaData().setType(TaskAttribute.TYPE_MULTI_SELECT); >+ break; >+ case 4: // Large Text Box >+ atr.getMetaData().setType(TaskAttribute.TYPE_LONG_TEXT); >+ break; >+ case 5: // Date/Time >+ atr.getMetaData().setType(TaskAttribute.TYPE_DATETIME); >+ break; >+ >+ default: >+ List<String> options = bugzillaCustomField.getOptions(); >+ if (options.size() > 0) { >+ atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); >+ } else { >+ atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); >+ } > } > atr.getMetaData().setReadOnly(false); > } >Index: src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java,v >retrieving revision 1.70 >diff -u -r1.70 IBugzillaConstants.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 12 Sep 2008 04:17:45 -0000 1.70 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 3 Nov 2008 23:26:29 -0000 >@@ -174,6 +174,8 @@ > > static final String TEST_BUGZILLA_31_URL = "http://mylyn.eclipse.org/bugs31"; > >+ static final String TEST_BUGZILLA_32_URL = "http://mylyn.eclipse.org/bugs32"; >+ > // Default values for keys > > static final String[] DEFAULT_STATUS_VALUES = { "Unconfirmed", "New", "Assigned", "Reopened", "Resolved", >Index: src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java,v >retrieving revision 1.12 >diff -u -r1.12 SaxConfigurationContentHandler.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java 12 Sep 2008 04:17:45 -0000 1.12 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java 3 Nov 2008 23:26:29 -0000 >@@ -85,6 +85,10 @@ > > private static final String ELEMENT_TYPE = "type"; > >+ private static final String ELEMENT_TYPE_DESC = "type_desc"; >+ >+ private static final String ELEMENT_ENTER_BUG = "enter_bug"; >+ > private static final String ELEMENT_REQUESTABLE = "requestable"; > > private static final String ELEMENT_SPECIFICALLY_REQUESTABLE = "specifically_requestable"; >@@ -159,6 +163,10 @@ > > private String currentMultiplicable; > >+ private String currentTypeDesc = ""; >+ >+ private String currentEnterBug = ""; >+ > private StringBuffer characters = new StringBuffer(); > > private String about; >@@ -242,6 +250,11 @@ > } else if (localName.equals(ELEMENT_FIELD)) { > state = state | IN_FIELD; > parseResource(attributes); >+ currentName = ""; >+ currentDescription = ""; >+ currentType = ""; >+ currentTypeDesc = ""; >+ currentEnterBug = ""; > } else if (localName.equals(ELEMENT_FLAG_TYPES)) { > state = state | IN_FLAG_TYPES; > } else if (localName.equals(ELEMENT_FLAG_TYPE)) { >@@ -366,7 +379,8 @@ > state = state & ~IN_FIELDS; > } else if (localName.equals(ELEMENT_FIELD)) { > if (currentName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { >- BugzillaCustomField newField = new BugzillaCustomField(currentDescription, currentName); >+ BugzillaCustomField newField = new BugzillaCustomField(currentDescription, currentName, currentType, >+ currentTypeDesc, currentEnterBug); > List<String> customOptionList = customOption.get(currentName); > if (customOptionList != null && !customOptionList.isEmpty()) { > newField.setOptions(customOptionList); >@@ -378,6 +392,10 @@ > currentDescription = characters.toString(); > } else if (localName.equals(ELEMENT_TYPE)) { > currentType = characters.toString(); >+ } else if (localName.equals(ELEMENT_TYPE_DESC)) { >+ currentTypeDesc = characters.toString(); >+ } else if (localName.equals(ELEMENT_ENTER_BUG)) { >+ currentEnterBug = characters.toString(); > } else if (localName.equals(ELEMENT_REQUESTABLE)) { > currentRequestable = characters.toString(); > } else if (localName.equals(ELEMENT_SPECIFICALLY_REQUESTABLE)) { >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java,v >retrieving revision 1.7 >diff -u -r1.7 BugzillaAttribute.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java 12 Sep 2008 04:17:45 -0000 1.7 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java 3 Nov 2008 23:26:28 -0000 >@@ -70,7 +70,7 @@ > > DEADLINE("Due:", "deadline", TaskAttribute.TYPE_DATE, true, false), > >- DELTA_TS("Modified:", "delta_ts", TaskAttribute.TYPE_DATE, true, false), >+ DELTA_TS("Modified:", "delta_ts", TaskAttribute.TYPE_DATETIME, true, false), > > DEPENDSON("Depends on (Subtasks):", "dependson", TaskAttribute.TYPE_TASK_DEPENDENCY, false, false), > >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java,v >retrieving revision 1.15 >diff -u -r1.15 BugzillaAttributeMapper.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java 4 Oct 2008 01:28:49 -0000 1.15 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java 3 Nov 2008 23:26:28 -0000 >@@ -41,6 +41,8 @@ > > private static final String deadline_format = DATE_FORMAT_3; > >+ private static final String customAttribute_format = DATE_FORMAT_2; >+ > /** > * public for testing Bugzilla 2.18 uses DATE_FORMAT_1 but later versions use DATE_FORMAT_2 Using lowest common > * denominator DATE_FORMAT_1 >@@ -100,6 +102,8 @@ > parsedDate = new SimpleDateFormat(attachment_creation_ts_format).parse(dateString); > } else if (attributeId.equals(BugzillaAttribute.DEADLINE.getKey())) { > parsedDate = new SimpleDateFormat(deadline_format).parse(dateString); >+ } else if (attributeId.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { >+ parsedDate = new SimpleDateFormat(customAttribute_format).parse(dateString); > } > } catch (ParseException e) { > return null; >@@ -125,6 +129,8 @@ > dateString = new SimpleDateFormat(attachment_creation_ts_format).format(date); > } else if (attributeId.equals(BugzillaAttribute.DEADLINE.getKey())) { > dateString = new SimpleDateFormat(deadline_format).format(date); >+ } else if (attributeId.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { >+ dateString = new SimpleDateFormat(customAttribute_format).format(date); > } > > if (dateString == null) { >@@ -283,4 +289,13 @@ > return super.equals(newAttribute, oldAttribute); > } > >+ @Override >+ public String getLabel(TaskAttribute taskAttribute) { >+ if (taskAttribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { >+ return super.getLabel(taskAttribute) + ":"; >+ } else { >+ return super.getLabel(taskAttribute); >+ } >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java,v >retrieving revision 1.78 >diff -u -r1.78 BugzillaTaskDataHandler.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java 25 Sep 2008 17:12:46 -0000 1.78 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java 3 Nov 2008 23:26:29 -0000 >@@ -144,7 +144,59 @@ > updateAttribute(data, BugzillaAttribute.SHORT_DESC); > } > }, >- VERSION_CURRENT(4.5f) { >+ VERSION_4_5(4.5f) { >+ @Override >+ void migrate(TaskRepository repository, TaskData data) { >+ // migrate custom attributes >+ for (TaskAttribute attribute : data.getRoot().getAttributes().values()) { >+ if (attribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { >+ RepositoryConfiguration configuration = BugzillaCorePlugin.getRepositoryConfiguration(repository.getRepositoryUrl()); >+ >+ BugzillaCustomField customField = null; >+ String actName = attribute.getId(); >+ for (BugzillaCustomField bugzillaCustomField : configuration.getCustomFields()) { >+ if (actName.equals(bugzillaCustomField.getName())) { >+ customField = bugzillaCustomField; >+ break; >+ } >+ } >+ if (customField != null) { >+ String desc = customField.getDescription(); >+ attribute.getMetaData().defaults().setLabel(desc).setReadOnly(false); >+ attribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT); >+ attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); >+ switch (customField.getType()) { >+ case 1: // Free Text >+ attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); >+ break; >+ case 2: // Drop Down >+ attribute.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); >+ break; >+ case 3: // Multiple-Selection Box >+ attribute.getMetaData().setType(TaskAttribute.TYPE_MULTI_SELECT); >+ break; >+ case 4: // Large Text Box >+ attribute.getMetaData().setType(TaskAttribute.TYPE_LONG_TEXT); >+ break; >+ case 5: // Date/Time >+ attribute.getMetaData().setType(TaskAttribute.TYPE_DATETIME); >+ break; >+ >+ default: >+ List<String> options = customField.getOptions(); >+ if (options.size() > 0) { >+ attribute.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT); >+ } else { >+ attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT); >+ } >+ } >+ attribute.getMetaData().setReadOnly(false); >+ } >+ } >+ } >+ } >+ }, >+ VERSION_CURRENT(4.6f) { > @Override > void migrate(TaskRepository repository, TaskData data) { > data.setVersion(TaskDataVersion.VERSION_CURRENT.toString()); >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java,v >retrieving revision 1.4 >diff -u -r1.4 BugzillaCustomField.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java 13 Sep 2008 03:27:57 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java 3 Nov 2008 23:26:29 -0000 >@@ -23,7 +23,8 @@ > */ > public class BugzillaCustomField implements Serializable { > >- private static final long serialVersionUID = 5703683576871326128L; >+ // old version private static final long serialVersionUID = 5703683576871326128L; >+ private static final long serialVersionUID = 7273310489883205486L; > > public static final String CUSTOM_FIELD_PREFIX = "cf_"; > >@@ -33,9 +34,25 @@ > > private List<String> options = new ArrayList<String>(); > >- public BugzillaCustomField(String description, String name) { >+ private int type = -1; >+ >+ private String typeDesc = null; >+ >+ private boolean enterBug = false; >+ >+ public BugzillaCustomField(String description, String name, String type, String typeDesc, String enterBug) { > this.description = description; > this.name = name; >+ >+ if (type != null && !type.equals("")) { >+ this.type = Integer.parseInt(type); >+ } >+ if (typeDesc != null && !typeDesc.equals("")) { >+ this.typeDesc = typeDesc; >+ } >+ if (enterBug != null && !enterBug.equals("")) { >+ this.enterBug = enterBug.equals("1"); >+ } > } > > public String getName() { >@@ -57,4 +74,26 @@ > public void addOption(String option) { > this.options.add(option); > } >+ >+ /* >+ * @since 3.0.2 >+ */ >+ public int getType() { >+ return type; >+ } >+ >+ /* >+ * @since 3.0.2 >+ */ >+ public String getTypeDesc() { >+ return typeDesc; >+ } >+ >+ /* >+ * @since 3.0.2 >+ */ >+ public boolean isEnterBug() { >+ return enterBug; >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java,v >retrieving revision 1.158 >diff -u -r1.158 BugzillaClient.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 3 Oct 2008 17:59:43 -0000 1.158 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 3 Nov 2008 23:26:29 -0000 >@@ -982,8 +982,13 @@ > if (a.getId().equals(BugzillaAttribute.GROUP.getKey()) && a.getValue().length() > 0) { > groupSecurityEnabled = true; > } >- >- if (a.getId() != null && a.getId().compareTo("") != 0) { >+ if (a.getMetaData().getType().equals(TaskAttribute.TYPE_MULTI_SELECT)) { >+ List<String> values = a.getValues(); >+ int i = 0; >+ for (String string : values) { >+ fields.put(a.getId() + i++, new NameValuePair(a.getId(), string != null ? string : "")); >+ } >+ } else if (a.getId() != null && a.getId().compareTo("") != 0) { > String value = a.getValue(); > if (a.getId().equals(BugzillaAttribute.DELTA_TS.getKey())) { > value = stripTimeZone(value); >#P org.eclipse.mylyn.tasks.core >Index: src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java,v >retrieving revision 1.29 >diff -u -r1.29 TaskAttribute.java >--- src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java 12 Sep 2008 04:21:36 -0000 1.29 >+++ src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java 3 Nov 2008 23:26:31 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >-* Copyright (c) 2004, 2008 Tasktop Technologies and others. >+ * Copyright (c) 2004, 2008 Tasktop Technologies and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -184,6 +184,11 @@ > public static final String TYPE_DATE = "date"; > > /** >+ * @since 3.1 >+ */ >+ public static final String TYPE_DATETIME = "dateTime"; >+ >+ /** > * @since 3.0 > */ > public static final String TYPE_INTEGER = "integer"; >Index: .refactorings/2008/11/45/refactorings.index >=================================================================== >RCS file: .refactorings/2008/11/45/refactorings.index >diff -N .refactorings/2008/11/45/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2008/11/45/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1 @@ >+1225740051259 Rename field 'TYPE_TIMESTAMP' >Index: .refactorings/2008/11/45/refactorings.history >=================================================================== >RCS file: .refactorings/2008/11/45/refactorings.history >diff -N .refactorings/2008/11/45/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2008/11/45/refactorings.history 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<session version="1.0"> >+<refactoring comment="Rename field 'TYPE_TIMESTAMP' in 'org.eclipse.mylyn.tasks.core.data.TaskAttribute' to 'TYPE_DATETIME'
- Original project: 'org.eclipse.mylyn.tasks.core'
- Original element: 'org.eclipse.mylyn.tasks.core.data.TaskAttribute.TYPE_TIMESTAMP'
- Renamed element: 'org.eclipse.mylyn.tasks.core.data.TaskAttribute.TYPE_DATETIME'
- Update references to refactored element
- Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field 'TYPE_TIMESTAMP'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src<org.eclipse.mylyn.tasks.core.data{TaskAttribute.java[TaskAttribute^TYPE_TIMESTAMP" name="TYPE_DATETIME" references="true" setter="false" stamp="1225740051259" textual="false" version="1.0"/> >+</session> >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java,v >retrieving revision 1.10 >diff -u -r1.10 AttributeEditorFactory.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java 17 Oct 2008 05:38:21 -0000 1.10 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java 3 Nov 2008 23:26:33 -0000 >@@ -82,6 +82,10 @@ > return new BooleanAttributeEditor(model, taskAttribute); > } else if (TaskAttribute.TYPE_DATE.equals(type)) { > return new DateAttributeEditor(model, taskAttribute); >+ } else if (TaskAttribute.TYPE_DATETIME.equals(type)) { >+ DateAttributeEditor editor = new DateAttributeEditor(model, taskAttribute); >+ editor.setShowTime(true); >+ return editor; > } else if (TaskAttribute.TYPE_PERSON.equals(type)) { > return new PersonAttributeEditor(model, taskAttribute); > } else if (TaskAttribute.TYPE_LONG_RICH_TEXT.equals(type)) { >Index: src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java,v >retrieving revision 1.8 >diff -u -r1.8 AbstractAttributeEditor.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java 12 Sep 2008 04:19:26 -0000 1.8 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java 3 Nov 2008 23:26:33 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >-* Copyright (c) 2004, 2008 Tasktop Technologies and others. >+ * Copyright (c) 2004, 2008 Tasktop Technologies and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -112,7 +112,7 @@ > this.decorationEnabled = decorationEnabled; > } > >- protected void setLayoutHint(LayoutHint layoutHint) { >+ public void setLayoutHint(LayoutHint layoutHint) { > this.layoutHint = layoutHint; > } > >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/DateAttributeEditor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/DateAttributeEditor.java,v >retrieving revision 1.25 >diff -u -r1.25 DateAttributeEditor.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/DateAttributeEditor.java 4 Oct 2008 00:02:49 -0000 1.25 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/DateAttributeEditor.java 3 Nov 2008 23:26:33 -0000 >@@ -21,6 +21,9 @@ > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; > import org.eclipse.mylyn.tasks.core.data.TaskDataModel; > import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; >+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint; >+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan; >+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; >@@ -64,9 +67,13 @@ > layout.verticalSpacing = 2; > layout.horizontalSpacing = 2; > dateWithClearComposite.setLayout(layout); >- datePicker = new DatePicker(dateWithClearComposite, SWT.FLAT, getTextValue(), false, 0); >+ datePicker = new DatePicker(dateWithClearComposite, SWT.FLAT, getTextValue(), showTime, 0); > datePicker.setFont(EditorUtil.TEXT_FONT); >- datePicker.setDateFormat(EditorUtil.getDateFormat()); >+ if (!showTime) { >+ datePicker.setDateFormat(EditorUtil.getDateFormat()); >+ } else { >+ datePicker.setDateFormat(EditorUtil.getDateTimeFormat()); >+ } > if (getValue() != null) { > Calendar cal = Calendar.getInstance(); > cal.setTime(getValue()); >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java,v >retrieving revision 1.16 >diff -u -r1.16 BugzillaTaskEditorPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java 17 Oct 2008 03:22:21 -0000 1.16 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java 3 Nov 2008 23:26:35 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.jface.dialogs.IMessageProvider; > 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.IBugzillaConstants; > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; > import org.eclipse.mylyn.tasks.core.data.TaskData; >@@ -25,6 +26,7 @@ > import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage; > import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart; > import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory; >+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint; > import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; > import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor; > >@@ -96,7 +98,7 @@ > protected AttributeEditorFactory createAttributeEditorFactory() { > AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) { > @Override >- public AbstractAttributeEditor createEditor(String type, TaskAttribute taskAttribute) { >+ public AbstractAttributeEditor createEditor(String type, final TaskAttribute taskAttribute) { > AbstractAttributeEditor editor; > if (IBugzillaConstants.EDITOR_TYPE_KEYWORDS.equals(type)) { > editor = new BugzillaKeywordAttributeEditor(getModel(), taskAttribute); >@@ -111,6 +113,21 @@ > } > } > >+ if (editor != null && taskAttribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { >+ LayoutHint.RowSpan row = editor.getLayoutHint() != null ? editor.getLayoutHint().rowSpan >+ : LayoutHint.RowSpan.SINGLE; >+ LayoutHint.ColumnSpan column = editor.getLayoutHint() != null ? editor.getLayoutHint().columnSpan >+ : LayoutHint.ColumnSpan.SINGLE; >+ >+ editor.setLayoutHint(new LayoutHint(row, column) { >+ >+ @Override >+ public int getPriority() { >+ return super.getPriority() * 10; >+ } >+ }); >+ } >+ > return editor; > } > };
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 226851
:
96757
|
96758
|
97520
|
97521
|
112252
|
112253
|
112257
|
112258
|
116247
|
116248
|
116568
|
116569
|
116701
|
116702
| 116886 |
116902