View | Details | Raw Unified | Return to bug 226851 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java (+4 lines)
Lines 82-87 Link Here
82
			return new BooleanAttributeEditor(model, taskAttribute);
82
			return new BooleanAttributeEditor(model, taskAttribute);
83
		} else if (TaskAttribute.TYPE_DATE.equals(type)) {
83
		} else if (TaskAttribute.TYPE_DATE.equals(type)) {
84
			return new DateAttributeEditor(model, taskAttribute);
84
			return new DateAttributeEditor(model, taskAttribute);
85
		} else if (TaskAttribute.TYPE_DATETIME.equals(type)) {
86
			DateAttributeEditor editor = new DateAttributeEditor(model, taskAttribute);
87
			editor.setShowTime(true);
88
			return editor;
85
		} else if (TaskAttribute.TYPE_PERSON.equals(type)) {
89
		} else if (TaskAttribute.TYPE_PERSON.equals(type)) {
86
			return new PersonAttributeEditor(model, taskAttribute);
90
			return new PersonAttributeEditor(model, taskAttribute);
87
		} else if (TaskAttribute.TYPE_LONG_RICH_TEXT.equals(type)) {
91
		} else if (TaskAttribute.TYPE_LONG_RICH_TEXT.equals(type)) {
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
* Copyright (c) 2004, 2008 Tasktop Technologies and others.
2
 * Copyright (c) 2004, 2008 Tasktop Technologies and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 112-118 Link Here
112
		this.decorationEnabled = decorationEnabled;
112
		this.decorationEnabled = decorationEnabled;
113
	}
113
	}
114
114
115
	protected void setLayoutHint(LayoutHint layoutHint) {
115
	public void setLayoutHint(LayoutHint layoutHint) {
116
		this.layoutHint = layoutHint;
116
		this.layoutHint = layoutHint;
117
	}
117
	}
118
118
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java (+4 lines)
Lines 14-19 Link Here
14
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
14
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
15
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
15
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
16
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
16
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
17
import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
18
import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
19
import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
17
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.events.ModifyEvent;
21
import org.eclipse.swt.events.ModifyEvent;
19
import org.eclipse.swt.events.ModifyListener;
22
import org.eclipse.swt.events.ModifyListener;
Lines 30-35 Link Here
30
33
31
	public TextAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
34
	public TextAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
32
		super(manager, taskAttribute);
35
		super(manager, taskAttribute);
36
		setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.SINGLE));
33
	}
37
	}
34
38
35
	protected Text getText() {
39
	protected Text getText() {
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/DateAttributeEditor.java (-2 / +10 lines)
Lines 21-26 Link Here
21
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
21
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
22
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
22
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
23
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
23
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
24
import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
25
import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
26
import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
24
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.events.SelectionAdapter;
28
import org.eclipse.swt.events.SelectionAdapter;
26
import org.eclipse.swt.events.SelectionEvent;
29
import org.eclipse.swt.events.SelectionEvent;
Lines 45-50 Link Here
45
48
46
	public DateAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
49
	public DateAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
47
		super(manager, taskAttribute);
50
		super(manager, taskAttribute);
51
		setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.SINGLE));
48
	}
52
	}
49
53
50
	@Override
54
	@Override
Lines 64-72 Link Here
64
			layout.verticalSpacing = 2;
68
			layout.verticalSpacing = 2;
65
			layout.horizontalSpacing = 2;
69
			layout.horizontalSpacing = 2;
66
			dateWithClearComposite.setLayout(layout);
70
			dateWithClearComposite.setLayout(layout);
67
			datePicker = new DatePicker(dateWithClearComposite, SWT.FLAT, getTextValue(), false, 0);
71
			datePicker = new DatePicker(dateWithClearComposite, SWT.FLAT, getTextValue(), showTime, 0);
68
			datePicker.setFont(EditorUtil.TEXT_FONT);
72
			datePicker.setFont(EditorUtil.TEXT_FONT);
69
			datePicker.setDateFormat(EditorUtil.getDateFormat());
73
			if (!showTime) {
74
				datePicker.setDateFormat(EditorUtil.getDateFormat());
75
			} else {
76
				datePicker.setDateFormat(EditorUtil.getDateTimeFormat());
77
			}
70
			if (getValue() != null) {
78
			if (getValue() != null) {
71
				Calendar cal = Calendar.getInstance();
79
				Calendar cal = Calendar.getInstance();
72
				cal.setTime(getValue());
80
				cal.setTime(getValue());
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java (-1 / +13 lines)
Lines 17-22 Link Here
17
import org.eclipse.jface.dialogs.IMessageProvider;
17
import org.eclipse.jface.dialogs.IMessageProvider;
18
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
18
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
19
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
19
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
20
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCustomField;
20
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
21
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
21
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
22
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
22
import org.eclipse.mylyn.tasks.core.data.TaskData;
23
import org.eclipse.mylyn.tasks.core.data.TaskData;
Lines 25-30 Link Here
25
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
26
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
26
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
27
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
27
import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory;
28
import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory;
29
import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
28
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
30
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
29
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor;
31
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor;
30
32
Lines 96-102 Link Here
96
	protected AttributeEditorFactory createAttributeEditorFactory() {
98
	protected AttributeEditorFactory createAttributeEditorFactory() {
97
		AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) {
99
		AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) {
98
			@Override
100
			@Override
99
			public AbstractAttributeEditor createEditor(String type, TaskAttribute taskAttribute) {
101
			public AbstractAttributeEditor createEditor(String type, final TaskAttribute taskAttribute) {
100
				AbstractAttributeEditor editor;
102
				AbstractAttributeEditor editor;
101
				if (IBugzillaConstants.EDITOR_TYPE_KEYWORDS.equals(type)) {
103
				if (IBugzillaConstants.EDITOR_TYPE_KEYWORDS.equals(type)) {
102
					editor = new BugzillaKeywordAttributeEditor(getModel(), taskAttribute);
104
					editor = new BugzillaKeywordAttributeEditor(getModel(), taskAttribute);
Lines 111-116 Link Here
111
					}
113
					}
112
				}
114
				}
113
115
116
				if (editor != null && taskAttribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
117
					editor.setLayoutHint(new LayoutHint(editor.getLayoutHint()) {
118
119
						@Override
120
						public int getPriority() {
121
							return super.getPriority() * 10;
122
						}
123
					});
124
				}
125
114
				return editor;
126
				return editor;
115
			}
127
			}
116
		};
128
		};
(-)src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java (-1 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
* Copyright (c) 2004, 2008 Tasktop Technologies and others.
2
 * Copyright (c) 2004, 2008 Tasktop Technologies and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 184-189 Link Here
184
	public static final String TYPE_DATE = "date";
184
	public static final String TYPE_DATE = "date";
185
185
186
	/**
186
	/**
187
	 * @since 3.1
188
	 */
189
	public static final String TYPE_DATETIME = "dateTime";
190
191
	/**
187
	 * @since 3.0
192
	 * @since 3.0
188
	 */
193
	 */
189
	public static final String TYPE_INTEGER = "integer";
194
	public static final String TYPE_INTEGER = "integer";
(-).refactorings/2008/11/45/refactorings.index (+1 lines)
Added Link Here
1
1225740051259	Rename field 'TYPE_TIMESTAMP'
(-).refactorings/2008/11/45/refactorings.history (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<session version="1.0">
3
<refactoring comment="Rename field &apos;TYPE_TIMESTAMP&apos; in &apos;org.eclipse.mylyn.tasks.core.data.TaskAttribute&apos; to &apos;TYPE_DATETIME&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.core&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.tasks.core.data.TaskAttribute.TYPE_TIMESTAMP&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.tasks.core.data.TaskAttribute.TYPE_DATETIME&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field &apos;TYPE_TIMESTAMP&apos;" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;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"/>
4
</session>
(-)src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java (-5 / +49 lines)
Lines 189-195 Link Here
189
					atr.getMetaData().defaults().setLabel(desc).setReadOnly(false);
189
					atr.getMetaData().defaults().setLabel(desc).setReadOnly(false);
190
					atr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
190
					atr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
191
					atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
191
					atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
192
					atr.getMetaData().setReadOnly(true);
192
					switch (customField.getType()) {
193
					case 1: // Free Text
194
						atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
195
						break;
196
					case 2: // Drop Down
197
						atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT);
198
						break;
199
					case 3: // Multiple-Selection Box
200
						atr.getMetaData().setType(TaskAttribute.TYPE_MULTI_SELECT);
201
						break;
202
					case 4: // Large Text Box
203
						atr.getMetaData().setType(TaskAttribute.TYPE_LONG_TEXT);
204
						break;
205
					case 5: // Date/Time
206
						atr.getMetaData().setType(TaskAttribute.TYPE_DATETIME);
207
						break;
208
209
					default:
210
						List<String> options = customField.getOptions();
211
						if (options.size() > 0) {
212
							atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT);
213
						} else {
214
							atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
215
						}
216
					}
217
					atr.getMetaData().setReadOnly(false);
193
					atr.setValue(parsedText);
218
					atr.setValue(parsedText);
194
				}
219
				}
195
			} else {
220
			} else {
Lines 374-384 Link Here
374
					atr.getMetaData().defaults().setLabel(bugzillaCustomField.getDescription());
399
					atr.getMetaData().defaults().setLabel(bugzillaCustomField.getDescription());
375
					atr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
400
					atr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
376
401
377
					List<String> options = bugzillaCustomField.getOptions();
402
					switch (bugzillaCustomField.getType()) {
378
					if (options.size() > 0) {
403
					case 1: // Free Text
379
						atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT);
380
					} else {
381
						atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
404
						atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
405
						break;
406
					case 2: // Drop Down
407
						atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT);
408
						break;
409
					case 3: // Multiple-Selection Box
410
						atr.getMetaData().setType(TaskAttribute.TYPE_MULTI_SELECT);
411
						break;
412
					case 4: // Large Text Box
413
						atr.getMetaData().setType(TaskAttribute.TYPE_LONG_TEXT);
414
						break;
415
					case 5: // Date/Time
416
						atr.getMetaData().setType(TaskAttribute.TYPE_DATETIME);
417
						break;
418
419
					default:
420
						List<String> options = bugzillaCustomField.getOptions();
421
						if (options.size() > 0) {
422
							atr.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT);
423
						} else {
424
							atr.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
425
						}
382
					}
426
					}
383
					atr.getMetaData().setReadOnly(false);
427
					atr.getMetaData().setReadOnly(false);
384
				}
428
				}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java (+2 lines)
Lines 174-179 Link Here
174
174
175
	static final String TEST_BUGZILLA_31_URL = "http://mylyn.eclipse.org/bugs31";
175
	static final String TEST_BUGZILLA_31_URL = "http://mylyn.eclipse.org/bugs31";
176
176
177
	static final String TEST_BUGZILLA_32_URL = "http://mylyn.eclipse.org/bugs32";
178
177
	// Default values for keys
179
	// Default values for keys
178
180
179
	static final String[] DEFAULT_STATUS_VALUES = { "Unconfirmed", "New", "Assigned", "Reopened", "Resolved",
181
	static final String[] DEFAULT_STATUS_VALUES = { "Unconfirmed", "New", "Assigned", "Reopened", "Resolved",
(-)src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java (-1 / +19 lines)
Lines 85-90 Link Here
85
85
86
	private static final String ELEMENT_TYPE = "type";
86
	private static final String ELEMENT_TYPE = "type";
87
87
88
	private static final String ELEMENT_TYPE_DESC = "type_desc";
89
90
	private static final String ELEMENT_ENTER_BUG = "enter_bug";
91
88
	private static final String ELEMENT_REQUESTABLE = "requestable";
92
	private static final String ELEMENT_REQUESTABLE = "requestable";
89
93
90
	private static final String ELEMENT_SPECIFICALLY_REQUESTABLE = "specifically_requestable";
94
	private static final String ELEMENT_SPECIFICALLY_REQUESTABLE = "specifically_requestable";
Lines 159-164 Link Here
159
163
160
	private String currentMultiplicable;
164
	private String currentMultiplicable;
161
165
166
	private String currentTypeDesc = "";
167
168
	private String currentEnterBug = "";
169
162
	private StringBuffer characters = new StringBuffer();
170
	private StringBuffer characters = new StringBuffer();
163
171
164
	private String about;
172
	private String about;
Lines 242-247 Link Here
242
		} else if (localName.equals(ELEMENT_FIELD)) {
250
		} else if (localName.equals(ELEMENT_FIELD)) {
243
			state = state | IN_FIELD;
251
			state = state | IN_FIELD;
244
			parseResource(attributes);
252
			parseResource(attributes);
253
			currentName = "";
254
			currentDescription = "";
255
			currentType = "";
256
			currentTypeDesc = "";
257
			currentEnterBug = "";
245
		} else if (localName.equals(ELEMENT_FLAG_TYPES)) {
258
		} else if (localName.equals(ELEMENT_FLAG_TYPES)) {
246
			state = state | IN_FLAG_TYPES;
259
			state = state | IN_FLAG_TYPES;
247
		} else if (localName.equals(ELEMENT_FLAG_TYPE)) {
260
		} else if (localName.equals(ELEMENT_FLAG_TYPE)) {
Lines 366-372 Link Here
366
			state = state & ~IN_FIELDS;
379
			state = state & ~IN_FIELDS;
367
		} else if (localName.equals(ELEMENT_FIELD)) {
380
		} else if (localName.equals(ELEMENT_FIELD)) {
368
			if (currentName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
381
			if (currentName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
369
				BugzillaCustomField newField = new BugzillaCustomField(currentDescription, currentName);
382
				BugzillaCustomField newField = new BugzillaCustomField(currentDescription, currentName, currentType,
383
						currentTypeDesc, currentEnterBug);
370
				List<String> customOptionList = customOption.get(currentName);
384
				List<String> customOptionList = customOption.get(currentName);
371
				if (customOptionList != null && !customOptionList.isEmpty()) {
385
				if (customOptionList != null && !customOptionList.isEmpty()) {
372
					newField.setOptions(customOptionList);
386
					newField.setOptions(customOptionList);
Lines 378-383 Link Here
378
			currentDescription = characters.toString();
392
			currentDescription = characters.toString();
379
		} else if (localName.equals(ELEMENT_TYPE)) {
393
		} else if (localName.equals(ELEMENT_TYPE)) {
380
			currentType = characters.toString();
394
			currentType = characters.toString();
395
		} else if (localName.equals(ELEMENT_TYPE_DESC)) {
396
			currentTypeDesc = characters.toString();
397
		} else if (localName.equals(ELEMENT_ENTER_BUG)) {
398
			currentEnterBug = characters.toString();
381
		} else if (localName.equals(ELEMENT_REQUESTABLE)) {
399
		} else if (localName.equals(ELEMENT_REQUESTABLE)) {
382
			currentRequestable = characters.toString();
400
			currentRequestable = characters.toString();
383
		} else if (localName.equals(ELEMENT_SPECIFICALLY_REQUESTABLE)) {
401
		} else if (localName.equals(ELEMENT_SPECIFICALLY_REQUESTABLE)) {
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java (-1 / +1 lines)
Lines 70-76 Link Here
70
70
71
	DEADLINE("Due:", "deadline", TaskAttribute.TYPE_DATE, true, false),
71
	DEADLINE("Due:", "deadline", TaskAttribute.TYPE_DATE, true, false),
72
72
73
	DELTA_TS("Modified:", "delta_ts", TaskAttribute.TYPE_DATE, true, false),
73
	DELTA_TS("Modified:", "delta_ts", TaskAttribute.TYPE_DATETIME, true, false),
74
74
75
	DEPENDSON("Depends on (Subtasks):", "dependson", TaskAttribute.TYPE_TASK_DEPENDENCY, false, false),
75
	DEPENDSON("Depends on (Subtasks):", "dependson", TaskAttribute.TYPE_TASK_DEPENDENCY, false, false),
76
76
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java (+15 lines)
Lines 41-46 Link Here
41
41
42
	private static final String deadline_format = DATE_FORMAT_3;
42
	private static final String deadline_format = DATE_FORMAT_3;
43
43
44
	private static final String customAttribute_format = DATE_FORMAT_2;
45
44
	/**
46
	/**
45
	 * public for testing Bugzilla 2.18 uses DATE_FORMAT_1 but later versions use DATE_FORMAT_2 Using lowest common
47
	 * public for testing Bugzilla 2.18 uses DATE_FORMAT_1 but later versions use DATE_FORMAT_2 Using lowest common
46
	 * denominator DATE_FORMAT_1
48
	 * denominator DATE_FORMAT_1
Lines 100-105 Link Here
100
				parsedDate = new SimpleDateFormat(attachment_creation_ts_format).parse(dateString);
102
				parsedDate = new SimpleDateFormat(attachment_creation_ts_format).parse(dateString);
101
			} else if (attributeId.equals(BugzillaAttribute.DEADLINE.getKey())) {
103
			} else if (attributeId.equals(BugzillaAttribute.DEADLINE.getKey())) {
102
				parsedDate = new SimpleDateFormat(deadline_format).parse(dateString);
104
				parsedDate = new SimpleDateFormat(deadline_format).parse(dateString);
105
			} else if (attributeId.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
106
				parsedDate = new SimpleDateFormat(customAttribute_format).parse(dateString);
103
			}
107
			}
104
		} catch (ParseException e) {
108
		} catch (ParseException e) {
105
			return null;
109
			return null;
Lines 125-130 Link Here
125
				dateString = new SimpleDateFormat(attachment_creation_ts_format).format(date);
129
				dateString = new SimpleDateFormat(attachment_creation_ts_format).format(date);
126
			} else if (attributeId.equals(BugzillaAttribute.DEADLINE.getKey())) {
130
			} else if (attributeId.equals(BugzillaAttribute.DEADLINE.getKey())) {
127
				dateString = new SimpleDateFormat(deadline_format).format(date);
131
				dateString = new SimpleDateFormat(deadline_format).format(date);
132
			} else if (attributeId.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
133
				dateString = new SimpleDateFormat(customAttribute_format).format(date);
128
			}
134
			}
129
135
130
			if (dateString == null) {
136
			if (dateString == null) {
Lines 283-286 Link Here
283
		return super.equals(newAttribute, oldAttribute);
289
		return super.equals(newAttribute, oldAttribute);
284
	}
290
	}
285
291
292
	@Override
293
	public String getLabel(TaskAttribute taskAttribute) {
294
		if (taskAttribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
295
			return super.getLabel(taskAttribute) + ":";
296
		} else {
297
			return super.getLabel(taskAttribute);
298
		}
299
	}
300
286
}
301
}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java (-1 / +53 lines)
Lines 144-150 Link Here
144
				updateAttribute(data, BugzillaAttribute.SHORT_DESC);
144
				updateAttribute(data, BugzillaAttribute.SHORT_DESC);
145
			}
145
			}
146
		},
146
		},
147
		VERSION_CURRENT(4.5f) {
147
		VERSION_4_5(4.5f) {
148
			@Override
149
			void migrate(TaskRepository repository, TaskData data) {
150
				// migrate custom attributes
151
				for (TaskAttribute attribute : data.getRoot().getAttributes().values()) {
152
					if (attribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
153
						RepositoryConfiguration configuration = BugzillaCorePlugin.getRepositoryConfiguration(repository.getRepositoryUrl());
154
155
						BugzillaCustomField customField = null;
156
						String actName = attribute.getId();
157
						for (BugzillaCustomField bugzillaCustomField : configuration.getCustomFields()) {
158
							if (actName.equals(bugzillaCustomField.getName())) {
159
								customField = bugzillaCustomField;
160
								break;
161
							}
162
						}
163
						if (customField != null) {
164
							String desc = customField.getDescription();
165
							attribute.getMetaData().defaults().setLabel(desc).setReadOnly(false);
166
							attribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
167
							attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
168
							switch (customField.getType()) {
169
							case 1: // Free Text
170
								attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
171
								break;
172
							case 2: // Drop Down
173
								attribute.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT);
174
								break;
175
							case 3: // Multiple-Selection Box
176
								attribute.getMetaData().setType(TaskAttribute.TYPE_MULTI_SELECT);
177
								break;
178
							case 4: // Large Text Box
179
								attribute.getMetaData().setType(TaskAttribute.TYPE_LONG_TEXT);
180
								break;
181
							case 5: // Date/Time
182
								attribute.getMetaData().setType(TaskAttribute.TYPE_DATETIME);
183
								break;
184
185
							default:
186
								List<String> options = customField.getOptions();
187
								if (options.size() > 0) {
188
									attribute.getMetaData().setType(TaskAttribute.TYPE_SINGLE_SELECT);
189
								} else {
190
									attribute.getMetaData().setType(TaskAttribute.TYPE_SHORT_TEXT);
191
								}
192
							}
193
							attribute.getMetaData().setReadOnly(false);
194
						}
195
					}
196
				}
197
			}
198
		},
199
		VERSION_CURRENT(4.6f) {
148
			@Override
200
			@Override
149
			void migrate(TaskRepository repository, TaskData data) {
201
			void migrate(TaskRepository repository, TaskData data) {
150
				data.setVersion(TaskDataVersion.VERSION_CURRENT.toString());
202
				data.setVersion(TaskDataVersion.VERSION_CURRENT.toString());
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java (-2 / +43 lines)
Lines 23-29 Link Here
23
 */
23
 */
24
public class BugzillaCustomField implements Serializable {
24
public class BugzillaCustomField implements Serializable {
25
25
26
	private static final long serialVersionUID = 5703683576871326128L;
26
	// old version	private static final long serialVersionUID = 5703683576871326128L;
27
	private static final long serialVersionUID = 7273310489883205486L;
27
28
28
	public static final String CUSTOM_FIELD_PREFIX = "cf_";
29
	public static final String CUSTOM_FIELD_PREFIX = "cf_";
29
30
Lines 33-41 Link Here
33
34
34
	private List<String> options = new ArrayList<String>();
35
	private List<String> options = new ArrayList<String>();
35
36
36
	public BugzillaCustomField(String description, String name) {
37
	final private int type;
38
39
	final private String typeDesc;
40
41
	final private boolean enterBug;
42
43
	public BugzillaCustomField(String description, String name, String type, String typeDesc, String enterBug) {
37
		this.description = description;
44
		this.description = description;
38
		this.name = name;
45
		this.name = name;
46
47
		this.type = parseInt(type);
48
		this.typeDesc = typeDesc;
49
		this.enterBug = "1".equals(enterBug);
50
	}
51
52
	private int parseInt(String type) {
53
		try {
54
			return Integer.parseInt(type);
55
		} catch (NumberFormatException e) {
56
			return -1;
57
		}
39
	}
58
	}
40
59
41
	public String getName() {
60
	public String getName() {
Lines 57-60 Link Here
57
	public void addOption(String option) {
76
	public void addOption(String option) {
58
		this.options.add(option);
77
		this.options.add(option);
59
	}
78
	}
79
80
	/*
81
	* @since 3.0.2
82
	*/
83
	public int getType() {
84
		return type;
85
	}
86
87
	/*
88
	* @since 3.0.2
89
	*/
90
	public String getTypeDesc() {
91
		return typeDesc;
92
	}
93
94
	/*
95
	* @since 3.0.2
96
	*/
97
	public boolean isEnterBug() {
98
		return enterBug;
99
	}
100
60
}
101
}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java (-2 / +7 lines)
Lines 982-989 Link Here
982
			if (a.getId().equals(BugzillaAttribute.GROUP.getKey()) && a.getValue().length() > 0) {
982
			if (a.getId().equals(BugzillaAttribute.GROUP.getKey()) && a.getValue().length() > 0) {
983
				groupSecurityEnabled = true;
983
				groupSecurityEnabled = true;
984
			}
984
			}
985
985
			if (a.getMetaData().getType().equals(TaskAttribute.TYPE_MULTI_SELECT)) {
986
			if (a.getId() != null && a.getId().compareTo("") != 0) {
986
				List<String> values = a.getValues();
987
				int i = 0;
988
				for (String string : values) {
989
					fields.put(a.getId() + i++, new NameValuePair(a.getId(), string != null ? string : ""));
990
				}
991
			} else if (a.getId() != null && a.getId().compareTo("") != 0) {
987
				String value = a.getValue();
992
				String value = a.getValue();
988
				if (a.getId().equals(BugzillaAttribute.DELTA_TS.getKey())) {
993
				if (a.getId().equals(BugzillaAttribute.DELTA_TS.getKey())) {
989
					value = stripTimeZone(value);
994
					value = stripTimeZone(value);

Return to bug 226851