Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 39599 Details for
Bug 136219
convert bug parser to use xml and rdf sources
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Provides default new bug attributes and OS/Platform detection fixed.
patch136219-5.txt (text/plain), 18.20 KB, created by
Robert Elves
on 2006-04-26 17:12:46 EDT
(
hide
)
Description:
Provides default new bug attributes and OS/Platform detection fixed.
Filename:
MIME Type:
Creator:
Robert Elves
Created:
2006-04-26 17:12:46 EDT
Size:
18.20 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.bugzilla.core >Index: src/org/eclipse/mylar/internal/bugzilla/core/BugzillaRepositoryUtil.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.core/src/org/eclipse/mylar/internal/bugzilla/core/BugzillaRepositoryUtil.java,v >retrieving revision 1.15 >diff -u -r1.15 BugzillaRepositoryUtil.java >--- src/org/eclipse/mylar/internal/bugzilla/core/BugzillaRepositoryUtil.java 26 Apr 2006 01:12:47 -0000 1.15 >+++ src/org/eclipse/mylar/internal/bugzilla/core/BugzillaRepositoryUtil.java 26 Apr 2006 20:42:51 -0000 >@@ -51,6 +51,7 @@ > import org.eclipse.mylar.bugzilla.core.IBugzillaBug; > import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants.BugzillaServerVersion; > import org.eclipse.mylar.internal.bugzilla.core.internal.BugParser; >+import org.eclipse.mylar.internal.bugzilla.core.internal.BugReportElement; > import org.eclipse.mylar.internal.bugzilla.core.internal.NewBugParser; > import org.eclipse.mylar.internal.bugzilla.core.internal.OfflineReportsFile; > import org.eclipse.mylar.internal.bugzilla.core.internal.RepositoryConfiguration; >@@ -67,7 +68,7 @@ > * @author Rob Elves (attachments) > */ > public class BugzillaRepositoryUtil { >- >+ > private static final String VALUE_CONTENTTYPEMETHOD_MANUAL = "manual"; > > private static final String VALUE_ISPATCH = "1"; >@@ -280,7 +281,7 @@ > "Unable to connect to Bugzilla server.\n" > + "Bug report will be created offline and saved for submission later.")) { > nbm.setConnected(false); >- setupProdConfigAttributes(serverUrl, nbm); >+ setupBugAttributes(serverUrl, nbm); > } else > throw new Exception("Bug report will not be created."); > } else >@@ -297,77 +298,82 @@ > } > > /** >- * Method to get attributes from ProductConfiguration if unable to connect >- * to Bugzilla server >- * >- * @param model - >- * the NewBugModel to store the attributes >+ * Adds bug attributes to new bug model and sets defaults > */ >- public static void setupProdConfigAttributes(String serverUrl, NewBugModel model) { >+ public static void setupBugAttributes(String serverUrl, NewBugModel model) { > > HashMap<String, Attribute> attributes = new HashMap<String, Attribute>(); > >- Attribute a = new Attribute("Severity"); >- a.setParameterName("bug_severity"); >+ Attribute a = new Attribute(BugReportElement.BUG_SEVERITY.toString()); >+ a.setParameterName(BugReportElement.BUG_SEVERITY.getKeyString()); > List<String> optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getSeverities(); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >- attributes.put("severites", a); >+ a.setValue(optionValues.get((optionValues.size() / 2))); >+ attributes.put(a.getName(), a); > >- a = new Attribute("OS"); >- a.setParameterName("op_sys"); >+ a = new Attribute(BugReportElement.OP_SYS.toString()); >+ a.setParameterName(BugReportElement.OP_SYS.getKeyString()); > optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getOSs(); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >- attributes.put("OSs", a); >+ attributes.put(a.getName(), a); > >- a = new Attribute("Platform"); >- a.setParameterName("rep_platform"); >+ a = new Attribute(BugReportElement.REP_PLATFORM.toString()); >+ a.setParameterName(BugReportElement.REP_PLATFORM.getKeyString()); > optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getPlatforms(); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >- attributes.put("platforms", a); >+ attributes.put(a.getName(), a); > >- a = new Attribute("Version"); >- a.setParameterName("version"); >+ a = new Attribute(BugReportElement.VERSION.toString()); >+ a.setParameterName(BugReportElement.VERSION.getKeyString()); > optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getVersions(model.getProduct()); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >- attributes.put("versions", a); >+ a.setValue(optionValues.get(optionValues.size() - 1)); >+ attributes.put(a.getName(), a); > > >- a = new Attribute("Component"); >- a.setParameterName("component"); >+ a = new Attribute(BugReportElement.COMPONENT.toString()); >+ a.setParameterName(BugReportElement.COMPONENT.getKeyString()); > optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getComponents(model.getProduct()); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >- attributes.put("components", a); >+ attributes.put(a.getName(), a); > > >- a = new Attribute("Priority"); >- a.setParameterName("priority"); >+ a = new Attribute(BugReportElement.PRIORITY.toString()); >+ a.setParameterName(BugReportElement.PRIORITY.getKeyString()); > optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getPriorities(); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >- attributes.put("priorities", a); >+ a.setValue(optionValues.get((optionValues.size() / 2))); >+ attributes.put(a.getName(), a); > > >- a = new Attribute("Product"); >- a.setParameterName("product"); >+ a = new Attribute(BugReportElement.PRODUCT.toString()); >+ a.setParameterName(BugReportElement.PRODUCT.getKeyString()); > optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getProducts(); > for (String option : optionValues) { > a.addOptionValue(option, option); > } >- attributes.put("products", a); >+ attributes.put(a.getName(), a); >+ >+ a = new Attribute(BugReportElement.BUG_STATUS.toString()); >+ a.setParameterName(BugReportElement.BUG_STATUS.getKeyString()); >+ optionValues = BugzillaPlugin.getDefault().getProductConfiguration(serverUrl).getStatusValues(); >+ for (String option : optionValues) { >+ a.addOptionValue(option, option); >+ } >+ attributes.put(a.getName(), a); > >- // set NBM Attributes (after all Attributes have been created, and added >- // to attributes map) > model.attributes = attributes; > } > >Index: src/org/eclipse/mylar/internal/bugzilla/core/internal/BugReportElement.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/bugzilla/core/internal/BugReportElement.java >diff -N src/org/eclipse/mylar/internal/bugzilla/core/internal/BugReportElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/bugzilla/core/internal/BugReportElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,84 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 University Of British Columbia and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * University Of British Columbia - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylar.internal.bugzilla.core.internal; >+ >+/** >+ * Bugzilla XML element enum. Each enum has the field name >+ * and associated xml element tag name. >+ * >+ * @author Rob Elves >+ */ >+public enum BugReportElement { >+ >+ // Format: ENUM ( "pretty name", "xml key" ) >+ >+ BUGZILLA ("bugzilla", "bugzilla"), >+ BUG ("bug","bug"), >+ BUG_ID ("Bug", "bug_id"), >+ CREATION_TS ("Creation Date", "creation_ts"), >+ SHORT_DESC ("Summary", "short_desc"), >+ DELTA_TS ("Last Modification", "delta_ts"), >+ REPORTER_ACCESSIBLE ("reporter_accessible", "reporter_accessible"), >+ CCLIST_ACCESSIBLE ("cclist_accessible", "cclist_accessible"), >+ CLASSIFICATION_ID ("Classification ID", "classification_id"), >+ CLASSIFICATION ("Classification", "classification"), >+ PRODUCT ("Product", "product"), >+ COMPONENT ("Component", "component"), >+ VERSION ("Version", "version"), >+ REP_PLATFORM ("Platform", "rep_platform"), >+ OP_SYS ("OS", "op_sys"), >+ BUG_STATUS ("Status", "bug_status"), >+ PRIORITY ("Priority", "priority"), >+ BUG_SEVERITY ("Severity", "bug_severity"), >+ TARGET_MILESTONE ("Target Milestone", "target_milestone"), >+ EVERCONFIRMED ("everconfirmed", "everconfirmed"), >+ REPORTER ("Reporter", "reporter"), >+ ASSIGNED_TO ("Assigned To", "assigned_to"), >+ CC ("CC", "cc"), >+ LONG_DESC ("Description", "long_desc"), >+ WHO ("who", "who"), >+ BUG_WHEN ("bug_when", "bug_when"), >+ THETEXT ("thetext", "thetext"), >+ ATTACHMENT ("attachment", "attachment"), >+ ATTACHID ("attachid", "attachid"), >+ DATE ("Date", "date"), >+ DESC ("desc", "desc"), >+ FILENAME ("filename", "filename"), >+ TYPE ("type", "type"), >+ DATA ("data", "data"), >+ UNKNOWN ("UNKNOWN", "UNKNOWN"); >+ >+ private final String prettyName; >+ private final String keyString; >+ >+ BugReportElement(String prettyName, String fieldName) { >+ this.prettyName = prettyName; >+ keyString = fieldName; >+ } >+ >+ public String getKeyString() { >+ return keyString; >+ } >+ >+ public String toString() { >+ return prettyName; >+ } >+ >+// public BugReportElementTag fromString(String str) { >+// for (BugReportElementTag tag : BugReportElementTag.values()) { >+// if (tag.toString().equals(str)) { >+// return tag; >+// } >+// } >+// return UNKNOWN; >+// } >+} >#P org.eclipse.mylar.bugzilla.ui >Index: src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java,v >retrieving revision 1.7 >diff -u -r1.7 AbstractBugzillaWizardPage.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java 26 Apr 2006 01:12:50 -0000 1.7 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java 26 Apr 2006 20:42:52 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.mylar.bugzilla.core.Attribute; > import org.eclipse.mylar.bugzilla.core.BugReport; > import org.eclipse.mylar.internal.bugzilla.core.NewBugModel; >+import org.eclipse.mylar.internal.bugzilla.core.internal.BugReportElement; > import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor; > import org.eclipse.mylar.internal.core.util.MylarStatusHandler; > import org.eclipse.swt.SWT; >@@ -49,7 +50,9 @@ > * @author Mik Kersten (hardening of initial prototype) > */ > public abstract class AbstractBugzillaWizardPage extends WizardPage implements Listener { >- >+ >+ private static final String KEY_OP_SYS = "op_sys"; >+ > /** The instance of the workbench */ > protected IWorkbench workbench; > >@@ -253,7 +256,7 @@ > * The event which occurred > */ > public void handleEvent(Event e) { >- boolean pageComplete = isPageComplete(); >+ boolean pageComplete = isPageComplete(); > > // Initialize a variable with the no error status > Status status = new Status(IStatus.OK, "not_used", 0, "", null); >@@ -292,7 +295,7 @@ > wizard.attributeCompleted = false; > return false; > } >- //saveDataToModel(); >+ // saveDataToModel(); > wizard.attributeCompleted = true; > return true; > } >@@ -307,7 +310,7 @@ > > nbm.setDescription(descriptionText.getText()); > nbm.setSummary(summaryText.getText()); >- >+ > // go through each of the attributes and sync their values with the > // combo boxes > for (Iterator<Attribute> it = nbm.getAttributes().iterator(); it.hasNext();) { >@@ -318,8 +321,8 @@ > try { > if (values == null) > values = new HashMap<String, String>(); >- if (key.equals(BugReport.ATTRIBUTE_OS)) { >- String os = oSCombo.getItem(oSCombo.getSelectionIndex()); >+ if (key.equals(BugReport.ATTRIBUTE_OS)) { >+ String os = oSCombo.getItem(oSCombo.getSelectionIndex()); > attribute.setValue(os); > } else if (key.equals(BugReport.ATTRIBUTE_VERSION)) { > String version = versionCombo.getItem(versionCombo.getSelectionIndex()); >@@ -354,7 +357,7 @@ > MylarStatusHandler.fail(e, "could not set attribute: " + attribute, false); > } > } >- //wizard.attributeCompleted = true; >+ // wizard.attributeCompleted = true; > } > > @Override >@@ -371,7 +374,7 @@ > // whether the priority exists or not > boolean priExist = false; > boolean mileExist = false; >- >+ > String url = null; > > // get the model for the new bug >@@ -409,7 +412,7 @@ > // Add the product to the composite > newLayout(attributesComposite, 1, "Product", PROPERTY); > newLayout(attributesComposite, 1, nbm.getProduct(), VALUE); >- >+ > // Populate Attributes > for (Iterator<Attribute> it = nbm.getAttributes().iterator(); it.hasNext();) { > Attribute attribute = it.next(); >@@ -433,7 +436,7 @@ > data.horizontalIndent = HORZ_INDENT; > data.widthHint = 150; > // create and populate the combo fields for the attributes >- if (key.equals("op_sys")) { >+ if (key.equals(KEY_OP_SYS)) { > newLayout(attributesComposite, 1, name, PROPERTY); > oSCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL | SWT.READ_ONLY); > >@@ -498,7 +501,7 @@ > index = 0; > platformCombo.select(index); > platformCombo.addListener(SWT.Modify, this); >- } else if (key.equals(BugReport.KEY_MILESTONE)) { >+ } else if (key.equals(BugReport.KEY_MILESTONE)) { > newLayout(attributesComposite, 1, name, PROPERTY); > milestoneCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL > | SWT.READ_ONLY); >@@ -559,23 +562,23 @@ > newLayout(attributesComposite, 1, "", PROPERTY); > } > >- Composite textComposite = new Composite(attributesComposite, SWT.NONE); >+ Composite textComposite = new Composite(attributesComposite, SWT.NONE); > textComposite.setLayout(new GridLayout(3, false)); > GridData textCompositeGD = new GridData(); > textCompositeGD.horizontalSpan = 4; > textCompositeGD.grabExcessHorizontalSpace = true; > textComposite.setLayoutData(textCompositeGD); >- >+ > GridData summaryTextData; >- >+ > if (url != null) { >- // add the assigned to text field >+ // add the assigned to text field > newLayout(textComposite, 1, BugReport.ATTRIBUTE_URL, PROPERTY); > urlText = new Text(textComposite, SWT.BORDER | SWT.SINGLE | SWT.WRAP); > summaryTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); > > summaryTextData.horizontalSpan = 2; >-// summaryTextData.widthHint = 200; >+ // summaryTextData.widthHint = 200; > urlText.setLayoutData(summaryTextData); > urlText.setText(url); > urlText.addListener(SWT.FocusOut, this); >@@ -583,7 +586,7 @@ > > newLayout(textComposite, 1, "Assigned To", PROPERTY); > Label l = new Label(textComposite, SWT.NONE); >-// l.setText(" "); >+ // l.setText(" "); > l.setText("(if email is incorrect submit will not proceed)"); > summaryTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); > summaryTextData.horizontalSpan = 1; >@@ -595,7 +598,6 @@ > summaryTextData.widthHint = 200; > assignedToText.setLayoutData(summaryTextData); > assignedToText.setText(""); >- > > // add the summary text field > newLayout(textComposite, 1, "Summary", PROPERTY); >@@ -667,7 +669,7 @@ > // */ > // public boolean offlineSelected() { > // return (offlineButton == null) ? false : offlineButton.getSelection(); >- // } >+ // } > > /* > * The following are Bugzilla's: OS's All AIX Windows 95 Windows 98 Windows >@@ -714,8 +716,8 @@ > > // Get OS Lookup Map > // Check that the result is in Values, if it is not, set it to other >- Attribute opSysAttribute = newBugModel.getAttribute(BugReport.ATTRIBUTE_OS); >- Attribute platformAttribute = newBugModel.getAttribute(BugReport.ATTRIBUTE_PLATFORM); >+ Attribute opSysAttribute = newBugModel.getAttribute(BugReportElement.OP_SYS.toString()); >+ Attribute platformAttribute = newBugModel.getAttribute(BugReportElement.REP_PLATFORM.toString()); > > String OS = Platform.getOS(); > String platform = Platform.getOSArch(); >@@ -723,7 +725,8 @@ > String bugzillaOS = null; // Bugzilla String for OS > String bugzillaPlatform = null; // Bugzilla String for Platform > >- if (java2buzillaOSMap != null && java2buzillaOSMap.containsKey(OS) && opSysAttribute != null && opSysAttribute.getOptionValues() != null) { >+ if (java2buzillaOSMap != null && java2buzillaOSMap.containsKey(OS) && opSysAttribute != null >+ && opSysAttribute.getOptionValues() != null) { > bugzillaOS = java2buzillaOSMap.get(OS); > if (opSysAttribute != null && !opSysAttribute.getOptionValues().values().contains(bugzillaOS)) { > // If the OS we found is not in the list of available >@@ -739,8 +742,9 @@ > > if (platform != null && java2buzillaPlatformMap.containsKey(platform)) { > bugzillaPlatform = java2buzillaPlatformMap.get(platform); >- >- if (platformAttribute != null && !platformAttribute.getOptionValues().values().contains(bugzillaPlatform)) { >+ >+ if (platformAttribute != null >+ && !platformAttribute.getOptionValues().values().contains(bugzillaPlatform)) { > // If the platform we found is not int the list of available > // optinos, set the > // Bugzilla Platform to null, and juse use "other" >@@ -757,8 +761,9 @@ > opSysAttribute.setValue(bugzillaOS); > if (bugzillaPlatform != null && platformAttribute != null) > platformAttribute.setValue(bugzillaPlatform); >+ > } catch (Exception e) { >- MylarStatusHandler.fail(e, "could not set platform options", false); >+ MylarStatusHandler.fail(e, "could not set platform options", false); > } > } > >Index: src/org/eclipse/mylar/internal/bugzilla/ui/wizard/BugzillaProductPage.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/wizard/BugzillaProductPage.java,v >retrieving revision 1.13 >diff -u -r1.13 BugzillaProductPage.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/wizard/BugzillaProductPage.java 26 Apr 2006 01:12:50 -0000 1.13 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/wizard/BugzillaProductPage.java 26 Apr 2006 20:42:52 -0000 >@@ -215,7 +215,7 @@ > // BugzillaRepositoryUtil.setupNewBugAttributes(serverUrl, model, false); > // } else { > >- BugzillaRepositoryUtil.setupProdConfigAttributes(serverUrl, model); >+ BugzillaRepositoryUtil.setupBugAttributes(serverUrl, model); > // } > model.setParsedAttributesStatus(true); > if (prevProduct == null) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 136219
:
39378
|
39381
|
39429
|
39484
|
39498
| 39599 |
39615
|
39833
|
39835
|
40093
|
40670
|
40671