### Eclipse Workspace Patch 1.0 #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 4 Nov 2008 06:19:56 -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 4 Nov 2008 06:19:56 -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/TextAttributeEditor.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java,v retrieving revision 1.14 diff -u -r1.14 TextAttributeEditor.java --- src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java 12 Sep 2008 04:19:25 -0000 1.14 +++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java 4 Nov 2008 06:19:56 -0000 @@ -14,6 +14,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.ModifyEvent; import org.eclipse.swt.events.ModifyListener; @@ -30,6 +33,7 @@ public TextAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) { super(manager, taskAttribute); + setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.SINGLE)); } protected Text getText() { 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 4 Nov 2008 06:19:56 -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; @@ -45,6 +48,7 @@ public DateAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) { super(manager, taskAttribute); + setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.SINGLE)); } @Override @@ -64,9 +68,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 4 Nov 2008 06:19:57 -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,16 @@ } } + if (editor != null && taskAttribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { + editor.setLayoutHint(new LayoutHint(editor.getLayoutHint()) { + + @Override + public int getPriority() { + return super.getPriority() * 10; + } + }); + } + return editor; } }; #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 4 Nov 2008 06:19:58 -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 @@ + + + + #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 4 Nov 2008 06:19:59 -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 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 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 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 4 Nov 2008 06:19:59 -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 4 Nov 2008 06:19:59 -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 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 4 Nov 2008 06:19:58 -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 4 Nov 2008 06:19:58 -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 4 Nov 2008 06:19:59 -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 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 4 Nov 2008 06:19:59 -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,27 @@ private List options = new ArrayList(); - public BugzillaCustomField(String description, String name) { + final private int type; + + final private String typeDesc; + + final private boolean enterBug; + + public BugzillaCustomField(String description, String name, String type, String typeDesc, String enterBug) { this.description = description; this.name = name; + + this.type = parseInt(type); + this.typeDesc = typeDesc; + this.enterBug = "1".equals(enterBug); + } + + private int parseInt(String type) { + try { + return Integer.parseInt(type); + } catch (NumberFormatException e) { + return -1; + } } public String getName() { @@ -57,4 +76,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 4 Nov 2008 06:19:59 -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 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);