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

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java (+88 lines)
Lines 24-31 Link Here
24
import org.eclipse.jface.layout.GridLayoutFactory;
24
import org.eclipse.jface.layout.GridLayoutFactory;
25
import org.eclipse.jface.viewers.ILabelProvider;
25
import org.eclipse.jface.viewers.ILabelProvider;
26
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
26
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
27
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCustomField;
27
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement;
28
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement;
28
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
29
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
30
import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration;
29
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_OPERATION;
31
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_OPERATION;
30
import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin;
32
import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin;
31
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
33
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
Lines 39-44 Link Here
39
import org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor;
41
import org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor;
40
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
42
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
41
import org.eclipse.swt.SWT;
43
import org.eclipse.swt.SWT;
44
import org.eclipse.swt.custom.CCombo;
42
import org.eclipse.swt.events.ModifyEvent;
45
import org.eclipse.swt.events.ModifyEvent;
43
import org.eclipse.swt.events.ModifyListener;
46
import org.eclipse.swt.events.ModifyListener;
44
import org.eclipse.swt.events.SelectionAdapter;
47
import org.eclipse.swt.events.SelectionAdapter;
Lines 76-81 Link Here
76
79
77
	private static final String LABEL_TIME_TRACKING = "Bugzilla Time Tracking";
80
	private static final String LABEL_TIME_TRACKING = "Bugzilla Time Tracking";
78
81
82
	private static final String LABEL_CUSTOM_FIELD = "Custom Fields";
83
	
79
	protected Text keywordsText;
84
	protected Text keywordsText;
80
85
81
	protected Text estimateText;
86
	protected Text estimateText;
Lines 207-212 Link Here
207
		if (taskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKeyString()) != null)
212
		if (taskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKeyString()) != null)
208
			addBugzillaTimeTracker(getManagedForm().getToolkit(), composite);
213
			addBugzillaTimeTracker(getManagedForm().getToolkit(), composite);
209
214
215
		try {
216
			RepositoryConfiguration configuration = BugzillaCorePlugin.getRepositoryConfiguration(this.repository,
217
					false);
218
			if (configuration != null) {
219
				List<BugzillaCustomField> customFields = configuration.getCustomFields();
220
				if (!customFields.isEmpty()) {
221
					Section cfSection = getManagedForm().getToolkit().createSection(composite,
222
							ExpandableComposite.SHORT_TITLE_BAR);
223
					cfSection.setText(LABEL_CUSTOM_FIELD);
224
					GridLayout gl = new GridLayout();
225
					GridData gd = new GridData(SWT.FILL, SWT.NONE, false, false);
226
					gd.horizontalSpan = 4;
227
					cfSection.setLayout(gl);
228
					cfSection.setLayoutData(gd);
229
230
					Composite cfComposite = getManagedForm().getToolkit().createComposite(cfSection);
231
					gl = new GridLayout(4, false);
232
					cfComposite.setLayout(gl);
233
					gd = new GridData();
234
					gd.horizontalSpan = 5;
235
					cfComposite.setLayoutData(gd);
236
					for (BugzillaCustomField bugzillaCustomField : customFields) {
237
						List<String> optionList = bugzillaCustomField.getOptions();
238
						attribute = this.taskData.getAttribute(bugzillaCustomField.getName());
239
						if (attribute == null) {
240
							RepositoryTaskAttribute newattribute = new RepositoryTaskAttribute(
241
									bugzillaCustomField.getName(), bugzillaCustomField.getDescription(), false);
242
							newattribute.setReadOnly(false);
243
							this.taskData.addAttribute(bugzillaCustomField.getName(), newattribute);
244
						}
245
						final RepositoryTaskAttribute cfattribute = this.taskData.getAttribute(bugzillaCustomField.getName());
246
						Label label = createLabel(cfComposite, cfattribute);
247
						GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
248
						if (optionList != null && !optionList.isEmpty()) {
249
							GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
250
							data.horizontalSpan = 1;
251
							final CCombo attributeCombo = new CCombo(cfComposite, SWT.FLAT | SWT.READ_ONLY);
252
							getManagedForm().getToolkit().adapt(attributeCombo, true, true);
253
							attributeCombo.setFont(TEXT_FONT);
254
							attributeCombo.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
255
							if (hasChanged(cfattribute)) {
256
								attributeCombo.setBackground(getColorIncoming());
257
							}
258
							attributeCombo.setLayoutData(data);
259
260
							for (String val : optionList) {
261
								if (val != null) {
262
									attributeCombo.add(val);
263
								}
264
							}
265
							String value = cfattribute.getValue();
266
							if (value == null) {
267
								value = "";
268
							}
269
							if (attributeCombo.indexOf(value) != -1) {
270
								attributeCombo.select(attributeCombo.indexOf(value));
271
							}
272
							attributeCombo.clearSelection();
273
							attributeCombo.addSelectionListener(new SelectionAdapter() {
274
								@Override
275
								public void widgetSelected(SelectionEvent event) {
276
									if (attributeCombo.getSelectionIndex() > -1) {
277
										String sel = attributeCombo.getItem(attributeCombo.getSelectionIndex());
278
										cfattribute.setValue(sel);
279
										attributeChanged(cfattribute);
280
										attributeCombo.clearSelection();
281
									}
282
								}
283
							});
284
						} else {
285
							Text cfField = createTextField(cfComposite, cfattribute, SWT.FLAT);
286
							GridDataFactory.fillDefaults().hint(135, SWT.DEFAULT).applyTo(cfField);
287
						}
288
					}
289
290
					getManagedForm().getToolkit().paintBordersFor(cfComposite);
291
					cfSection.setClient(cfComposite);
292
				}
293
			}
294
		} catch (CoreException e) {
295
			// ignore
296
		}
297
210
	}
298
	}
211
299
212
	private boolean hasCustomAttributeChanges() {
300
	private boolean hasCustomAttributeChanges() {
(-)src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java (-1 / +24 lines)
Lines 54-64 Link Here
54
54
55
	private AbstractAttributeFactory attributeFactory;
55
	private AbstractAttributeFactory attributeFactory;
56
56
57
	private List<BugzillaCustomField> customFields;
58
	
57
	//private int retrieved = 1;
59
	//private int retrieved = 1;
58
60
59
	public SaxMultiBugReportContentHandler(AbstractAttributeFactory factory, Map<String, RepositoryTaskData> taskDataMap) {
61
	public SaxMultiBugReportContentHandler(AbstractAttributeFactory factory, Map<String, RepositoryTaskData> taskDataMap, List<BugzillaCustomField> customFields) {
60
		this.attributeFactory = factory;
62
		this.attributeFactory = factory;
61
		this.taskDataMap = taskDataMap;
63
		this.taskDataMap = taskDataMap;
64
		this.customFields = customFields;
62
	}
65
	}
63
66
64
	public boolean errorOccurred() {
67
	public boolean errorOccurred() {
Lines 86-91 Link Here
86
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
89
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
87
		characters = new StringBuffer();
90
		characters = new StringBuffer();
88
		BugzillaReportElement tag = BugzillaReportElement.UNKNOWN;
91
		BugzillaReportElement tag = BugzillaReportElement.UNKNOWN;
92
				if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX))
93
						return;
89
		try {
94
		try {
90
			tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase(Locale.ENGLISH));
95
			tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase(Locale.ENGLISH));
91
		} catch (RuntimeException e) {
96
		} catch (RuntimeException e) {
Lines 163-168 Link Here
163
168
164
		String parsedText = characters.toString();
169
		String parsedText = characters.toString();
165
170
171
		if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
172
			RepositoryTaskAttribute attribute = repositoryTaskData.getAttribute(localName);
173
			if (attribute == null) {
174
				String desc = "???";
175
				for (BugzillaCustomField bugzillaCustomField : customFields) {
176
					if (localName.equals(bugzillaCustomField.getName())) {
177
						desc = bugzillaCustomField.getDescription();
178
					}
179
				}
180
				RepositoryTaskAttribute newattribute = new RepositoryTaskAttribute(localName, desc, true);
181
				newattribute.setReadOnly(false);
182
				newattribute.setValue(parsedText);
183
				repositoryTaskData.addAttribute(localName, newattribute);
184
			} else {
185
				attribute.addValue(parsedText);
186
			}
187
		}
188
166
		BugzillaReportElement tag = BugzillaReportElement.UNKNOWN;
189
		BugzillaReportElement tag = BugzillaReportElement.UNKNOWN;
167
		try {
190
		try {
168
			tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase(Locale.ENGLISH));
191
			tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase(Locale.ENGLISH));
(-)src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java (-2 / +3 lines)
Lines 10-15 Link Here
10
10
11
import java.io.IOException;
11
import java.io.IOException;
12
import java.io.InputStream;
12
import java.io.InputStream;
13
import java.util.List;
13
import java.util.Locale;
14
import java.util.Locale;
14
import java.util.Map;
15
import java.util.Map;
15
16
Lines 31-40 Link Here
31
32
32
	private static BugzillaAttributeFactory bugzillaAttributeFactory = new BugzillaAttributeFactory();
33
	private static BugzillaAttributeFactory bugzillaAttributeFactory = new BugzillaAttributeFactory();
33
34
34
	public void populateReport(Map<String, RepositoryTaskData> bugMap) throws IOException, CoreException {
35
	public void populateReport(Map<String, RepositoryTaskData> bugMap, List<BugzillaCustomField> customFields) throws IOException, CoreException {
35
36
36
		SaxMultiBugReportContentHandler contentHandler = new SaxMultiBugReportContentHandler(bugzillaAttributeFactory,
37
		SaxMultiBugReportContentHandler contentHandler = new SaxMultiBugReportContentHandler(bugzillaAttributeFactory,
37
				bugMap);
38
				bugMap, customFields);
38
		collectResults(contentHandler, false);
39
		collectResults(contentHandler, false);
39
40
40
		if (contentHandler.errorOccurred()) {
41
		if (contentHandler.errorOccurred()) {
(-)src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java (+61 lines)
Lines 56-61 Link Here
56
56
57
	private static final String ELEMENT_PRODUCTS = "products";
57
	private static final String ELEMENT_PRODUCTS = "products";
58
58
59
	private static final String ELEMENT_DESCRIPTION = "description";
60
61
	private static final String ELEMENT_FIELDS = "fields";
62
63
	private static final String ELEMENT_FIELD = "field";
64
59
	private static final String ELEMENT_SEVERITY = "severity";
65
	private static final String ELEMENT_SEVERITY = "severity";
60
66
61
	private static final String ELEMENT_PRIORITY = "priority";
67
	private static final String ELEMENT_PRIORITY = "priority";
Lines 112-120 Link Here
112
118
113
	private static final int IN_STATUS_CLOSED = 1 << 20;
119
	private static final int IN_STATUS_CLOSED = 1 << 20;
114
120
121
	private static final int IN_FIELDS = 1 << 21;
122
123
	private static final int IN_FIELD = 1 << 22;
124
125
	private static final int IN_CUSTOM_OPTION = 1 << 23;
126
115
	private int state = EXPECTING_ROOT;
127
	private int state = EXPECTING_ROOT;
116
128
117
	private String currentProduct = "";
129
	private String currentProduct = "";
130
	
131
	private String currentName = "";
118
132
119
	private StringBuffer characters = new StringBuffer();
133
	private StringBuffer characters = new StringBuffer();
120
134
Lines 134-139 Link Here
134
148
135
	private Map<String, String> milestoneNames = new HashMap<String, String>();
149
	private Map<String, String> milestoneNames = new HashMap<String, String>();
136
150
151
	private Map<String, List<String>> customOption = new HashMap<String, List<String>>();
152
153
	private String currentCustomOptionName = "";
154
137
	public RepositoryConfiguration getConfiguration() {
155
	public RepositoryConfiguration getConfiguration() {
138
		return configuration;
156
		return configuration;
139
	}
157
	}
Lines 190-195 Link Here
190
			state = state | IN_RESOLUTION;
208
			state = state | IN_RESOLUTION;
191
		} else if (localName.equals(ELEMENT_KEYWORD)) {
209
		} else if (localName.equals(ELEMENT_KEYWORD)) {
192
			state = state | IN_KEYWORD;
210
			state = state | IN_KEYWORD;
211
		} else if (localName.equals(ELEMENT_FIELDS)) {
212
			state = state | IN_FIELDS;
213
		} else if (localName.equals(ELEMENT_FIELD)) {
214
			state = state | IN_FIELD;
215
			parseResource(attributes);
216
		} else if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
217
			state = state | IN_CUSTOM_OPTION;
218
			currentCustomOptionName = localName;
193
		}
219
		}
194
	}
220
	}
195
221
Lines 224-229 Link Here
224
				configuration.addPriority(characters.toString());
250
				configuration.addPriority(characters.toString());
225
			} else if (state == (IN_SEVERITY)) {
251
			} else if (state == (IN_SEVERITY)) {
226
				configuration.addSeverity(characters.toString());
252
				configuration.addSeverity(characters.toString());
253
			} else if (state == (IN_CUSTOM_OPTION)) {
254
				// Option for CutstomFields
255
				if (currentCustomOptionName != null) {
256
					if (characters.length() > 0) {
257
						List<String> customOptionList = customOption.get(currentCustomOptionName);
258
						if (customOptionList == null) {
259
							customOptionList = new ArrayList<String>();
260
							customOption.put(currentCustomOptionName, customOptionList);
261
						}
262
						customOptionList.add(characters.toString());
263
					}
264
				}
227
			}
265
			}
228
		} else if (localName.equals(ELEMENT_PLATFORM)) {
266
		} else if (localName.equals(ELEMENT_PLATFORM)) {
229
			state = state & ~IN_PLATFORM;
267
			state = state & ~IN_PLATFORM;
Lines 264-269 Link Here
264
						milestoneNames.put(about, characters.toString());
302
						milestoneNames.put(about, characters.toString());
265
					}
303
					}
266
				}
304
				}
305
			} else if (state == (IN_FIELDS | IN_LI | IN_FIELD)) {
306
				// FIELDS NAME
307
				currentName = characters.toString();
267
			}
308
			}
268
		} else if (localName.equals(ELEMENT_COMPONENTS)) {
309
		} else if (localName.equals(ELEMENT_COMPONENTS)) {
269
			state = state & ~IN_COMPONENTS;
310
			state = state & ~IN_COMPONENTS;
Lines 286-291 Link Here
286
			state = state & ~IN_RESOLUTION;
327
			state = state & ~IN_RESOLUTION;
287
		} else if (localName.equals(ELEMENT_KEYWORD)) {
328
		} else if (localName.equals(ELEMENT_KEYWORD)) {
288
			state = state & ~IN_KEYWORD;
329
			state = state & ~IN_KEYWORD;
330
		} else if (localName.equals(ELEMENT_FIELDS)) {
331
			state = state & ~IN_FIELDS;
332
		} else if (localName.equals(ELEMENT_FIELD)) {
333
			state = state & ~IN_FIELD;
334
		} else if (localName.equals(ELEMENT_DESCRIPTION)) {
335
			if (currentName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
336
				BugzillaCustomField newField = new BugzillaCustomField(characters.toString(), currentName);
337
				List<String> customOptionList = customOption.get(currentName);
338
				if (customOptionList != null && !customOptionList.isEmpty())
339
					newField.setOptions(customOptionList);
340
				configuration.addCustomField(newField);
341
			}
342
		} else if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
343
			state = state & ~IN_CUSTOM_OPTION;
344
			currentCustomOptionName = "";
289
		}
345
		}
290
	}
346
	}
291
347
Lines 347-352 Link Here
347
				about = attributes.getValue(ATTRIBUTE_RDF_ABOUT);
403
				about = attributes.getValue(ATTRIBUTE_RDF_ABOUT);
348
			}
404
			}
349
			break;
405
			break;
406
		case IN_FIELDS | IN_LI | IN_FIELD:
407
			if (attributes != null) {
408
				about = attributes.getValue(ATTRIBUTE_RDF_ABOUT);
409
			}
410
			break;
350
411
351
		}
412
		}
352
	}
413
	}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java (-2 / +4 lines)
Lines 12-17 Link Here
12
import java.util.HashMap;
12
import java.util.HashMap;
13
import java.util.Map;
13
import java.util.Map;
14
14
15
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.mylyn.tasks.core.ITaskRepositoryListener;
16
import org.eclipse.mylyn.tasks.core.ITaskRepositoryListener;
16
import org.eclipse.mylyn.tasks.core.TaskRepository;
17
import org.eclipse.mylyn.tasks.core.TaskRepository;
17
18
Lines 26-32 Link Here
26
	public BugzillaClientManager() {
27
	public BugzillaClientManager() {
27
	}
28
	}
28
29
29
	public synchronized BugzillaClient getClient(TaskRepository taskRepository) throws MalformedURLException {
30
	public synchronized BugzillaClient getClient(TaskRepository taskRepository) throws MalformedURLException, CoreException {
30
		BugzillaClient client = clientByUrl.get(taskRepository.getUrl());
31
		BugzillaClient client = clientByUrl.get(taskRepository.getUrl());
31
		if (client == null) {
32
		if (client == null) {
32
33
Lines 43-49 Link Here
43
					taskRepository.getPassword(), htUser, htPass, taskRepository.getProxy(),
44
					taskRepository.getPassword(), htUser, htPass, taskRepository.getProxy(),
44
					taskRepository.getCharacterEncoding(), taskRepository.getProperties(), languageSettings);
45
					taskRepository.getCharacterEncoding(), taskRepository.getProperties(), languageSettings);
45
			clientByUrl.put(taskRepository.getUrl(), client);
46
			clientByUrl.put(taskRepository.getUrl(), client);
46
		}
47
			client.setRepositoryConfiguration(BugzillaCorePlugin.getRepositoryConfiguration(taskRepository, false));
48
			}
47
		return client;
49
		return client;
48
	}
50
	}
49
51
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java (-5 / +12 lines)
Lines 155-160 Link Here
155
155
156
	private BugzillaLanguageSettings bugzillaLanguageSettings;
156
	private BugzillaLanguageSettings bugzillaLanguageSettings;
157
157
158
	private RepositoryConfiguration repositoryConfiguration;
159
	
158
	public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass,
160
	public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass,
159
			String characterEncoding) {
161
			String characterEncoding) {
160
		this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>(),
162
		this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>(),
Lines 637-646 Link Here
637
						RepositoryConfigurationFactory configFactory = new RepositoryConfigurationFactory(stream,
639
						RepositoryConfigurationFactory configFactory = new RepositoryConfigurationFactory(stream,
638
								characterEncoding);
640
								characterEncoding);
639
641
640
						RepositoryConfiguration configuration = configFactory.getConfiguration();
642
						repositoryConfiguration = configFactory.getConfiguration();
641
						if (configuration != null) {
643
						if (repositoryConfiguration != null) {
642
							configuration.setRepositoryUrl(repositoryUrl.toString());
644
							repositoryConfiguration.setRepositoryUrl(repositoryUrl.toString());
643
							return configuration;
645
							return repositoryConfiguration;
644
						}
646
						}
645
					}
647
					}
646
				}
648
				}
Lines 1218-1230 Link Here
1218
				}
1220
				}
1219
				
1221
				
1220
				boolean parseable = false;
1222
				boolean parseable = false;
1223
				List<BugzillaCustomField> customFields = repositoryConfiguration.getCustomFields();
1221
				if (method.getResponseHeader("Content-Type") != null) {
1224
				if (method.getResponseHeader("Content-Type") != null) {
1222
					Header responseTypeHeader = method.getResponseHeader("Content-Type");
1225
					Header responseTypeHeader = method.getResponseHeader("Content-Type");
1223
					for (String type : VALID_CONFIG_CONTENT_TYPES) {
1226
					for (String type : VALID_CONFIG_CONTENT_TYPES) {
1224
						if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) {
1227
						if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) {
1225
							MultiBugReportFactory factory = new MultiBugReportFactory(
1228
							MultiBugReportFactory factory = new MultiBugReportFactory(
1226
									method.getResponseBodyAsUnzippedStream(), characterEncoding);
1229
									method.getResponseBodyAsUnzippedStream(), characterEncoding);
1227
							factory.populateReport(taskDataMap);
1230
							factory.populateReport(taskDataMap, customFields);
1228
							taskIds.removeAll(idsToRetrieve);
1231
							taskIds.removeAll(idsToRetrieve);
1229
							parseable = true;
1232
							parseable = true;
1230
							break;
1233
							break;
Lines 1342-1345 Link Here
1342
						+ " failed. Please verify connection and authentication information."));
1345
						+ " failed. Please verify connection and authentication information."));
1343
	}
1346
	}
1344
1347
1348
	public void setRepositoryConfiguration(RepositoryConfiguration repositoryConfiguration) {
1349
		this.repositoryConfiguration = repositoryConfiguration;
1350
	}
1351
1345
}
1352
}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java (-1 / +14 lines)
Lines 22-28 Link Here
22
 */
22
 */
23
public class RepositoryConfiguration implements Serializable {
23
public class RepositoryConfiguration implements Serializable {
24
24
25
	private static final long serialVersionUID = -3623617786905114255L;
25
	private static final long serialVersionUID = -482656956042521023L;
26
26
27
	private static final String VERSION_UNKNOWN = "unknown";
27
	private static final String VERSION_UNKNOWN = "unknown";
28
28
Lines 54-59 Link Here
54
54
55
	private List<String> milestones = new ArrayList<String>();
55
	private List<String> milestones = new ArrayList<String>();
56
56
57
	private List<BugzillaCustomField> customFields = new ArrayList<BugzillaCustomField>();
58
	
57
	private String version = VERSION_UNKNOWN;
59
	private String version = VERSION_UNKNOWN;
58
60
59
	public RepositoryConfiguration() {
61
	public RepositoryConfiguration() {
Lines 379-382 Link Here
379
		}
381
		}
380
	}
382
	}
381
383
384
	/**
385
	 * Adds a field to the configuration.
386
	 */
387
	public void addCustomField(BugzillaCustomField newField) {
388
		customFields.add(newField);
389
	}
390
391
	public List<BugzillaCustomField> getCustomFields() {
392
		return customFields;
393
	}
394
382
}
395
}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java (+57 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.bugzilla.core;
10
11
import java.io.Serializable;
12
import java.util.ArrayList;
13
import java.util.List;
14
15
/**
16
 * Class describing a custom Fields for a given Bugzilla installation.
17
 * 
18
 * @author Frank Becker
19
 * @since 2.3
20
 */
21
public class BugzillaCustomField implements Serializable {
22
23
	private static final long serialVersionUID = 5703683576871326128L;
24
25
	public static final String CUSTOM_FIELD_PREFIX = "cf_";
26
27
	private String name;
28
29
	private String description;
30
31
	private List<String> options = new ArrayList<String>();
32
33
	public BugzillaCustomField(String description, String name) {
34
		this.description = description;
35
		this.name = name;
36
	}
37
38
	public String getName() {
39
		return name;
40
	}
41
42
	public String getDescription() {
43
		return description;
44
	}
45
46
	public List<String> getOptions() {
47
		return options;
48
	}
49
50
	public void setOptions(List<String> options) {
51
		this.options = options;
52
	}
53
54
	public void addOption(String option) {
55
		this.options.add(option);
56
	}
57
}

Return to bug 175922