### Eclipse Workspace Patch 1.0 #P org.eclipse.mylyn.bugzilla.ui Index: src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java,v retrieving revision 1.87 diff -u -r1.87 BugzillaTaskEditor.java --- src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java 15 Jan 2008 22:09:14 -0000 1.87 +++ src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java 18 Jan 2008 21:16:36 -0000 @@ -21,6 +21,7 @@ import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; +import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCustomField; import org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement; import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_OPERATION; @@ -36,6 +37,7 @@ import org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor; import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; @@ -73,6 +75,8 @@ private static final String LABEL_TIME_TRACKING = "Bugzilla Time Tracking"; + private static final String LABEL_CUSTOM_FIELD = "Custom Fields"; + protected Text keywordsText; protected Text estimateText; @@ -200,6 +204,83 @@ if (taskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKeyString()) != null) addBugzillaTimeTracker(getManagedForm().getToolkit(), composite); + try { + List customFields = BugzillaCorePlugin.getRepositoryConfiguration(this.repository, + false).getCustomFields(); + if (!customFields.isEmpty()) { + Section cfSection = getManagedForm().getToolkit().createSection(composite, ExpandableComposite.SHORT_TITLE_BAR); + cfSection.setText(LABEL_CUSTOM_FIELD); + GridLayout gl = new GridLayout(); + GridData gd = new GridData(SWT.FILL, SWT.NONE, false, false); + gd.horizontalSpan = 4; + cfSection.setLayout(gl); + cfSection.setLayoutData(gd); + + Composite cfComposite = getManagedForm().getToolkit().createComposite(cfSection); + gl = new GridLayout(4, false); + cfComposite.setLayout(gl); + gd = new GridData(); + gd.horizontalSpan = 5; + cfComposite.setLayoutData(gd); + for (BugzillaCustomField bugzillaCustomField : customFields) { + List optionList = bugzillaCustomField.getOptions(); + attribute = this.taskData.getAttribute(bugzillaCustomField.getName()); + if (attribute == null) { + RepositoryTaskAttribute newattribute = new RepositoryTaskAttribute( + bugzillaCustomField.getName(), bugzillaCustomField.getDescription(), false); + newattribute.setReadOnly(false); + this.taskData.addAttribute(bugzillaCustomField.getName(), newattribute); + } + final RepositoryTaskAttribute cfattribute = this.taskData.getAttribute(bugzillaCustomField.getName()); + Label label = createLabel(cfComposite, cfattribute); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + if (optionList != null && !optionList.isEmpty()) { + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + data.horizontalSpan = 1; + final CCombo attributeCombo = new CCombo(cfComposite, SWT.FLAT | SWT.READ_ONLY); + getManagedForm().getToolkit().adapt(attributeCombo, true, true); + attributeCombo.setFont(TEXT_FONT); + attributeCombo.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); + if (hasChanged(cfattribute)) { + attributeCombo.setBackground(getColorIncoming()); + } + attributeCombo.setLayoutData(data); + + for (String val : optionList) { + if (val != null) { + attributeCombo.add(val); + } + } + String value = cfattribute.getValue(); + if (value == null) { + value = ""; + } + if (attributeCombo.indexOf(value) != -1) { + attributeCombo.select(attributeCombo.indexOf(value)); + } + attributeCombo.clearSelection(); + attributeCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + if (attributeCombo.getSelectionIndex() > -1) { + String sel = attributeCombo.getItem(attributeCombo.getSelectionIndex()); + cfattribute.setValue(sel); + attributeChanged(cfattribute); + attributeCombo.clearSelection(); + } + } + }); + } else { + Text cfField = createTextField(cfComposite, cfattribute, SWT.FLAT); + GridDataFactory.fillDefaults().hint(135, SWT.DEFAULT).applyTo(cfField); + } + } + getManagedForm().getToolkit().paintBordersFor(cfComposite); + cfSection.setClient(cfComposite); + } + } catch (CoreException e) { + e.printStackTrace(); + } } private boolean hasCustomAttributeChanges() { @@ -692,9 +773,9 @@ if (haveRealName) { textField.setText(textField.getText() + " <" + taskData.getAttributeValue(BugzillaReportElement.QA_CONTACT.getKeyString()) + ">"); - } + } } - + super.addSelfToCC(composite); } #P org.eclipse.mylyn.bugzilla.core Index: src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java,v retrieving revision 1.8 diff -u -r1.8 RepositoryConfiguration.java --- src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java 26 Jun 2007 01:16:07 -0000 1.8 +++ src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java 18 Jan 2008 21:16:45 -0000 @@ -22,7 +22,7 @@ */ public class RepositoryConfiguration implements Serializable { - private static final long serialVersionUID = -3623617786905114255L; + private static final long serialVersionUID = -482656956042521023L; private static final String VERSION_UNKNOWN = "unknown"; @@ -54,6 +54,8 @@ private List milestones = new ArrayList(); + private List customFields = new ArrayList(); + private String version = VERSION_UNKNOWN; public RepositoryConfiguration() { @@ -379,4 +381,15 @@ } } + /** + * Adds a field to the configuration. + */ + public void addCustomField(BugzillaCustomField newField) { + customFields.add(newField); + } + + public List getCustomFields() { + return customFields; + } + } 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.9 diff -u -r1.9 SaxMultiBugReportContentHandler.java --- src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java 8 Oct 2007 05:11:03 -0000 1.9 +++ src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java 18 Jan 2008 21:16:47 -0000 @@ -9,6 +9,7 @@ package org.eclipse.mylyn.internal.bugzilla.core; import java.util.HashMap; +import java.util.List; import java.util.Locale; import java.util.Map; @@ -51,11 +52,15 @@ private AbstractAttributeFactory attributeFactory; + private List customFields; + //private int retrieved = 1; - public SaxMultiBugReportContentHandler(AbstractAttributeFactory factory, Map taskDataMap) { + public SaxMultiBugReportContentHandler(AbstractAttributeFactory factory, + Map taskDataMap, List customFields) { this.attributeFactory = factory; this.taskDataMap = taskDataMap; + this.customFields = customFields; } public boolean errorOccurred() { @@ -83,6 +88,8 @@ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { characters = new StringBuffer(); BugzillaReportElement tag = BugzillaReportElement.UNKNOWN; + if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) + return; try { tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase(Locale.ENGLISH)); } catch (RuntimeException e) { @@ -158,7 +165,23 @@ public void endElement(String uri, String localName, String qName) throws SAXException { String parsedText = HtmlStreamTokenizer.unescape(characters.toString()); - + if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { + RepositoryTaskAttribute attribute = repositoryTaskData.getAttribute(localName); + if (attribute == null) { + String desc = "???"; + for (BugzillaCustomField bugzillaCustomField : customFields) { + if (localName.equals(bugzillaCustomField.getName())) { + desc = bugzillaCustomField.getDescription(); + } + } + RepositoryTaskAttribute newattribute = new RepositoryTaskAttribute(localName, desc, true); + newattribute.setReadOnly(false); + newattribute.setValue(parsedText); + repositoryTaskData.addAttribute(localName, newattribute); + } else { + attribute.addValue(parsedText); + } + } BugzillaReportElement tag = BugzillaReportElement.UNKNOWN; try { tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase(Locale.ENGLISH)); Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java,v retrieving revision 1.11 diff -u -r1.11 BugzillaClientManager.java --- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java 5 Dec 2007 02:57:16 -0000 1.11 +++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java 18 Jan 2008 21:16:43 -0000 @@ -12,6 +12,7 @@ import java.util.HashMap; import java.util.Map; +import org.eclipse.core.runtime.CoreException; import org.eclipse.mylyn.tasks.core.ITaskRepositoryListener; import org.eclipse.mylyn.tasks.core.TaskRepository; @@ -26,7 +27,7 @@ public BugzillaClientManager() { } - public synchronized BugzillaClient getClient(TaskRepository taskRepository) throws MalformedURLException { + public synchronized BugzillaClient getClient(TaskRepository taskRepository) throws MalformedURLException, CoreException { BugzillaClient client = clientByUrl.get(taskRepository.getUrl()); if (client == null) { @@ -43,6 +44,7 @@ taskRepository.getPassword(), htUser, htPass, taskRepository.getProxy(), taskRepository.getCharacterEncoding(), taskRepository.getProperties(), languageSettings); clientByUrl.put(taskRepository.getUrl(), client); + client.setRepositoryConfiguration(BugzillaCorePlugin.getRepositoryConfiguration(taskRepository, false)); } return client; } Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java,v retrieving revision 1.94 diff -u -r1.94 BugzillaRepositoryConnector.java --- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 13 Jan 2008 20:36:42 -0000 1.94 +++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 18 Jan 2008 21:16:44 -0000 @@ -282,7 +282,7 @@ public boolean markStaleTasks(TaskRepository repository, Set tasks, IProgressMonitor monitor) throws CoreException { try { - + monitor.beginTask("Checking for changed tasks", IProgressMonitor.UNKNOWN); if (repository.getSynchronizationTimeStamp() == null) { @@ -313,16 +313,15 @@ String newurlQueryString = URLEncoder.encode(task.getTaskId() + ",", repository.getCharacterEncoding()); urlQueryString += newurlQueryString; } - + queryForChanged(repository, changedTasks, urlQueryString); - + for (AbstractTask task : tasks) { if (changedTasks.contains(task)) { task.setStale(true); } } - // FIXME check if new tasks were added //return changedTasks.isEmpty(); return true; @@ -335,7 +334,7 @@ monitor.done(); } } - + private void queryForChanged(final TaskRepository repository, Set changedTasks, String urlQueryString) throws UnsupportedEncodingException, CoreException { QueryHitCollector collector = new QueryHitCollector(new ITaskFactory() { @@ -476,8 +475,11 @@ throws CoreException { String product = existingReport.getAttributeValue(BugzillaReportElement.PRODUCT.getKeyString()); for (RepositoryTaskAttribute attribute : existingReport.getAttributes()) { - BugzillaReportElement element = BugzillaReportElement.valueOf(attribute.getId().trim().toUpperCase( - Locale.ENGLISH)); + String attribID = attribute.getId(); + if (attribID.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { + continue; + } + BugzillaReportElement element = BugzillaReportElement.valueOf(attribID.trim().toUpperCase(Locale.ENGLISH)); attribute.clearOptions(); List optionValues = BugzillaCorePlugin.getRepositoryConfiguration(taskRepository, false) .getOptionValues(element, product); Index: src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java,v retrieving revision 1.6 diff -u -r1.6 MultiBugReportFactory.java --- src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java 26 Jun 2007 01:16:07 -0000 1.6 +++ src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java 18 Jan 2008 21:16:45 -0000 @@ -10,6 +10,7 @@ import java.io.IOException; import java.io.InputStream; +import java.util.List; import java.util.Locale; import java.util.Map; @@ -31,10 +32,10 @@ private static BugzillaAttributeFactory bugzillaAttributeFactory = new BugzillaAttributeFactory(); - public void populateReport(Map bugMap) throws IOException, CoreException { + public void populateReport(Map bugMap, List customFields) throws IOException, CoreException { SaxMultiBugReportContentHandler contentHandler = new SaxMultiBugReportContentHandler(bugzillaAttributeFactory, - bugMap); + bugMap, customFields); collectResults(contentHandler, false); if (contentHandler.errorOccurred()) { 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.109 diff -u -r1.109 BugzillaClient.java --- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 13 Jan 2008 20:36:42 -0000 1.109 +++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 18 Jan 2008 21:16:43 -0000 @@ -154,6 +154,8 @@ private boolean lastModifiedSupported = true; private BugzillaLanguageSettings bugzillaLanguageSettings; + + private RepositoryConfiguration repositoryConfiguration; public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, String characterEncoding) { @@ -427,7 +429,8 @@ } } - public RepositoryTaskData getTaskData(int id) throws IOException, CoreException { + public RepositoryTaskData getTaskData(int id) throws IOException, + CoreException { final String idString = String.valueOf(id); Set data = new HashSet(); data.add(idString); @@ -474,32 +477,33 @@ GzipPostMethod postMethod = null; try { - + String queryUrl = query.getUrl(); int start = queryUrl.indexOf('?'); - + List pairs = new ArrayList(); - if(start != -1) { + if (start != -1) { queryUrl = queryUrl.substring(start + 1); String[] result = queryUrl.split("&"); - if(result.length > 0) { + if (result.length > 0) { for (String string : result) { String[] nameValue = string.split("="); - if(nameValue.length == 1) { + if (nameValue.length == 1) { pairs.add(new NameValuePair(nameValue[0].trim(), "")); - } else if(nameValue.length == 2 && nameValue[0] != null && nameValue[1] != null) { - pairs.add(new NameValuePair(nameValue[0].trim(), URLDecoder.decode(nameValue[1].trim(), characterEncoding))); + } else if (nameValue.length == 2 && nameValue[0] != null && nameValue[1] != null) { + pairs.add(new NameValuePair(nameValue[0].trim(), URLDecoder.decode(nameValue[1].trim(), + characterEncoding))); } } } } - + NameValuePair ctypePair = new NameValuePair("ctype", "rdf"); // Test that we don't specify content type twice. - if(!pairs.contains(ctypePair)) { + if (!pairs.contains(ctypePair)) { pairs.add(ctypePair); } - + postMethod = postFormData(IBugzillaConstants.URL_BUGLIST, pairs.toArray(new NameValuePair[pairs.size()])); //System.err.println(postMethod.getResponseBodyAsString()); if (postMethod.getResponseHeader("Content-Type") != null) { @@ -513,7 +517,7 @@ } } } - + parseHtmlError(new BufferedReader(new InputStreamReader(postMethod.getResponseBodyAsUnzippedStream(), characterEncoding))); } finally { @@ -637,10 +641,10 @@ RepositoryConfigurationFactory configFactory = new RepositoryConfigurationFactory(stream, characterEncoding); - RepositoryConfiguration configuration = configFactory.getConfiguration(); - if (configuration != null) { - configuration.setRepositoryUrl(repositoryUrl.toString()); - return configuration; + repositoryConfiguration = configFactory.getConfiguration(); + if (repositoryConfiguration != null) { + repositoryConfiguration.setRepositoryUrl(repositoryUrl.toString()); + return repositoryConfiguration; } } } @@ -1180,13 +1184,12 @@ return null; } - public Map getTaskData(Set taskIds) throws IOException, CoreException { + public Map getTaskData(Set taskIds) + throws IOException, CoreException { GzipPostMethod method = null; HashMap taskDataMap = new HashMap(); while (taskIds.size() > 0) { - try { - Set idsToRetrieve = new HashSet(); Iterator itr = taskIds.iterator(); for (int x = 0; itr.hasNext() && x < MAX_RETRIEVED_PER_QUERY; x++) { @@ -1216,15 +1219,16 @@ if (method == null) { throw new IOException("Could not post form, client returned null method."); } - + boolean parseable = false; + List customFields = repositoryConfiguration.getCustomFields(); if (method.getResponseHeader("Content-Type") != null) { Header responseTypeHeader = method.getResponseHeader("Content-Type"); for (String type : VALID_CONFIG_CONTENT_TYPES) { if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) { MultiBugReportFactory factory = new MultiBugReportFactory( method.getResponseBodyAsUnzippedStream(), characterEncoding); - factory.populateReport(taskDataMap); + factory.populateReport(taskDataMap, customFields); taskIds.removeAll(idsToRetrieve); parseable = true; break; @@ -1237,7 +1241,7 @@ characterEncoding))); break; } - + } finally { if (method != null) { method.releaseConnection(); @@ -1342,4 +1346,9 @@ + " failed. Please verify connection and authentication information.")); } + + public void setRepositoryConfiguration(RepositoryConfiguration repositoryConfiguration) { + this.repositoryConfiguration = repositoryConfiguration; + } + } 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.7 diff -u -r1.7 SaxConfigurationContentHandler.java --- src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java 26 Jun 2007 01:16:07 -0000 1.7 +++ src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java 18 Jan 2008 21:16:47 -0000 @@ -56,6 +56,12 @@ private static final String ELEMENT_PRODUCTS = "products"; + private static final String ELEMENT_DESCRIPTION = "description"; + + private static final String ELEMENT_FIELDS = "fields"; + + private static final String ELEMENT_FIELD = "field"; + private static final String ELEMENT_SEVERITY = "severity"; private static final String ELEMENT_PRIORITY = "priority"; @@ -112,10 +118,18 @@ private static final int IN_STATUS_CLOSED = 1 << 20; + private static final int IN_FIELDS = 1 << 21; + + private static final int IN_FIELD = 1 << 22; + + private static final int IN_CUSTOM_OPTION = 1 << 22; + private int state = EXPECTING_ROOT; private String currentProduct = ""; + private String currentName = ""; + private StringBuffer characters = new StringBuffer(); private String about; @@ -134,6 +148,10 @@ private Map milestoneNames = new HashMap(); + private Map> customOption = new HashMap>(); + + private String currentCustomOptionName = ""; + public RepositoryConfiguration getConfiguration() { return configuration; } @@ -190,6 +208,14 @@ state = state | IN_RESOLUTION; } else if (localName.equals(ELEMENT_KEYWORD)) { state = state | IN_KEYWORD; + } else if (localName.equals(ELEMENT_FIELDS)) { + state = state | IN_FIELDS; + } else if (localName.equals(ELEMENT_FIELD)) { + state = state | IN_FIELD; + parseResource(attributes); + } else if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { + state = state | IN_CUSTOM_OPTION; + currentCustomOptionName = localName; } } @@ -224,6 +250,18 @@ configuration.addPriority(characters.toString()); } else if (state == (IN_SEVERITY)) { configuration.addSeverity(characters.toString()); + } else if (state == (IN_CUSTOM_OPTION)) { + // Option for CutstomFields + if (currentCustomOptionName != null) { + if (characters.length() > 0) { + List customOptionList = customOption.get(currentCustomOptionName); + if (customOptionList == null) { + customOptionList = new ArrayList(); + customOption.put(currentCustomOptionName, customOptionList); + } + customOptionList.add(characters.toString()); + } + } } } else if (localName.equals(ELEMENT_PLATFORM)) { state = state & ~IN_PLATFORM; @@ -264,6 +302,9 @@ milestoneNames.put(about, characters.toString()); } } + } else if (state == (IN_FIELDS | IN_LI | IN_FIELD)) { + // FIELDS NAME + currentName = characters.toString(); } } else if (localName.equals(ELEMENT_COMPONENTS)) { state = state & ~IN_COMPONENTS; @@ -286,6 +327,21 @@ state = state & ~IN_RESOLUTION; } else if (localName.equals(ELEMENT_KEYWORD)) { state = state & ~IN_KEYWORD; + } else if (localName.equals(ELEMENT_FIELDS)) { + state = state & ~IN_FIELDS; + } else if (localName.equals(ELEMENT_FIELD)) { + state = state & ~IN_FIELD; + } else if (localName.equals(ELEMENT_DESCRIPTION)) { + if (currentName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { + BugzillaCustomField newField = new BugzillaCustomField(characters.toString(), currentName); + List customOptionList = customOption.get(currentName); + if (customOptionList != null && !customOptionList.isEmpty()) + newField.setOptions(customOptionList); + configuration.addCustomField(newField); + } + } else if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { + state = state & ~IN_CUSTOM_OPTION; + currentCustomOptionName = ""; } } @@ -348,6 +404,12 @@ } break; + case IN_FIELDS | IN_LI | IN_FIELD: + if (attributes != null) { + about = attributes.getValue(ATTRIBUTE_RDF_ABOUT); + } + break; + } } Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java =================================================================== RCS file: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java diff -N src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCustomField.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Mylyn project committers and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ + +package org.eclipse.mylyn.internal.bugzilla.core; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * Class describing a custom Fields for a given Bugzilla installation. + * + * @author Frank Becker + * @since 2.3 + */ +public class BugzillaCustomField implements Serializable { + + private static final long serialVersionUID = 5703683576871326128L; + + public static final String CUSTOM_FIELD_PREFIX = "cf_"; + + private String name; + + private String description; + + private List options = new ArrayList(); + + public BugzillaCustomField(String description, String name) { + this.description = description; + this.name = name; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public List getOptions() { + return options; + } + + public void setOptions(List options) { + this.options = options; + } + + public void addOption(String option) { + this.options.add(option); + } +}