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 75221 Details for
Bug 159397
Improve auto detection of platform/os for new bug submission
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]
Setting default platform and OS in Bugzilla additional settings
bug159397-patch-v1 (text/plain), 16.35 KB, created by
maarten meijer
on 2007-08-02 09:52:12 EDT
(
hide
)
Description:
Setting default platform and OS in Bugzilla additional settings
Filename:
MIME Type:
Creator:
maarten meijer
Created:
2007-08-02 09:52:12 EDT
Size:
16.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java,v >retrieving revision 1.72 >diff -u -r1.72 BugzillaProductPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java 10 Jul 2007 00:30:00 -0000 1.72 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java 2 Aug 2007 13:46:56 -0000 >@@ -69,7 +69,7 @@ > * @author Mik Kersten > * @author Eugene Kuleshov > * @author Willian Mitsuda >- * >+ * > * Product selection page of new bug wizard > */ > public class BugzillaProductPage extends WizardPage { >@@ -103,7 +103,7 @@ > > /** > * Constructor for BugzillaProductPage >- * >+ * > * @param workbench > * The instance of the workbench > * @param bugWiz >@@ -341,7 +341,7 @@ > > /** > * Applies the status to the status line of a dialog page. >- * >+ * > * @param status > * The status to apply to the status line > */ >@@ -377,7 +377,8 @@ > model.setAttributeValue(BugzillaReportElement.PRODUCT.getKeyString(), > (String) ((IStructuredSelection) productList.getViewer().getSelection()).getFirstElement()); > BugzillaRepositoryConnector.setupNewBugAttributes(repository, model); >- BugzillaCorePlugin.getDefault().setPlatformOptions(model); >+ // platform/os are now set to All/All >+ BugzillaCorePlugin.getDefault().setPlatformDefaultsOrGuess(repository, model); > } > > @Override >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java,v >retrieving revision 1.65 >diff -u -r1.65 BugzillaRepositorySettingsPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java 13 Jul 2007 17:45:22 -0000 1.65 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java 2 Aug 2007 13:46:56 -0000 >@@ -12,6 +12,7 @@ > import java.net.MalformedURLException; > import java.net.Proxy; > import java.net.URL; >+import java.util.List; > > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -35,6 +36,7 @@ > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Combo; > import org.eclipse.swt.widgets.Composite; >@@ -58,6 +60,12 @@ > > protected Combo repositoryVersionCombo; > >+ protected Button defaults; >+ >+ protected Combo defaultPlatformCombo; >+ >+ protected Combo defaultOSCombo; >+ > private Button cleanQAContact; > > private Button cachedConfigButton; >@@ -145,6 +153,78 @@ > cachedConfigButton.setSelection(isCached); > } > >+ RepositoryConfiguration repositoryConfiguration = null; >+ String platform = null; >+ String os = null; >+ try { >+ if (null != repository) { >+ repositoryConfiguration = >+ BugzillaCorePlugin.getRepositoryConfiguration(repository, false); >+ platform = >+ repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM); >+ os = >+ repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_OS); >+ } >+ } catch (CoreException e1) { >+ // TODO Auto-generated catch block >+ e1.printStackTrace(); >+ } >+ >+ Label defaultPlatformLabel = new Label(parent, SWT.NONE); >+ defaultPlatformLabel.setText("Default Platform/OS"); >+ >+ Composite platformOSContainer = new Composite(parent, SWT.NONE); >+ GridLayout gridLayout = new GridLayout(3, false); >+ gridLayout.marginWidth = 0; >+ gridLayout.marginHeight = 0; >+ platformOSContainer.setLayout(gridLayout); >+ >+ defaults = new Button(platformOSContainer, SWT.CHECK); >+ defaults.addSelectionListener(new SelectionAdapter() { >+ >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ defaultPlatformCombo.setEnabled(defaults.getSelection()); >+ defaultOSCombo.setEnabled(defaults.getSelection()); >+ } >+ >+ }); >+ defaults.setSelection(null != platform && null != os); >+ >+ defaultPlatformCombo = new Combo(platformOSContainer, SWT.READ_ONLY); >+ if (null != repositoryConfiguration) { >+ List<String> optionValues = repositoryConfiguration.getPlatforms(); >+ for (String option : optionValues) { >+ defaultPlatformCombo.add(option.toString()); >+ } >+ if (null != platform && defaultPlatformCombo.indexOf(platform) >= 0) { >+ defaultPlatformCombo.select(defaultPlatformCombo.indexOf(platform)); >+ } else { >+ defaultPlatformCombo.select(0); >+ } >+ } else { >+ defaultPlatformCombo.add("All"); >+ defaultPlatformCombo.select(0); // TODO bug 159397 choose first platform: All >+ } >+ defaultPlatformCombo.setEnabled(defaults.getSelection()); >+ >+ defaultOSCombo = new Combo(platformOSContainer, SWT.READ_ONLY); >+ if (null != repositoryConfiguration) { >+ List<String> optionValues = repositoryConfiguration.getOSs(); >+ for (String option : optionValues) { >+ defaultOSCombo.add(option.toString()); >+ } >+ if (null != os && defaultOSCombo.indexOf(os) >= 0) { >+ defaultOSCombo.select(defaultOSCombo.indexOf(os)); >+ } else { >+ defaultOSCombo.select(0); >+ } >+ } else { >+ defaultOSCombo.add("All"); >+ defaultOSCombo.select(0); // TODO bug 159397 choose first platform: All >+ } >+ defaultOSCombo.setEnabled(defaults.getSelection()); >+ > } > > public void setBugzillaVersion(String version) { >@@ -184,6 +264,16 @@ > repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP, > IBugzillaConstants.TIMESTAMP_NOT_AVAILABLE); > } >+ // TODO save the selected default Platform and OS here bug 159397 >+ if (defaults.getSelection()) { >+ repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM, >+ String.valueOf(defaultPlatformCombo.getItem(defaultPlatformCombo.getSelectionIndex()))); >+ repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_OS, >+ String.valueOf(defaultOSCombo.getItem(defaultOSCombo.getSelectionIndex()))); >+ } else { >+ repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM); >+ repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS); >+ } > } > > @Override >#P org.eclipse.mylyn.bugzilla.core >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java,v >retrieving revision 1.15 >diff -u -r1.15 BugzillaCorePlugin.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java 26 Jun 2007 01:16:07 -0000 1.15 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java 2 Aug 2007 13:46:57 -0000 >@@ -58,12 +58,12 @@ > > public BugzillaCorePlugin() { > super(); >- java2buzillaPlatformMap.put("x86", "PC"); >+ java2buzillaPlatformMap.put("x86", "PC"); // can be PC or Macintosh! > java2buzillaPlatformMap.put("x86_64", "PC"); > java2buzillaPlatformMap.put("ia64", "PC"); > java2buzillaPlatformMap.put("ia64_32", "PC"); > java2buzillaPlatformMap.put("sparc", "Sun"); >- java2buzillaPlatformMap.put("ppc", "Power"); >+ java2buzillaPlatformMap.put("ppc", "Power PC"); // not Power! > > } > >@@ -228,7 +228,7 @@ > > /** > * Convenience method for logging statuses to the plugin log >- * >+ * > * @param status > * the status to log > */ >@@ -238,7 +238,7 @@ > > /** > * Convenience method for logging exceptions to the plugin log >- * >+ * > * @param e > * the exception to log > */ >@@ -259,11 +259,38 @@ > return bugFile; > } > >+ >+ public void setPlatformDefaultsOrGuess(TaskRepository repository, RepositoryTaskData newBugModel) { >+ >+ String platform = >+ repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM); >+ String os = >+ repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_OS); >+ >+ // set both or none >+ if(null != os && null != platform) { >+ RepositoryTaskAttribute opSysAttribute = >+ newBugModel.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()); >+ RepositoryTaskAttribute platformAttribute = >+ newBugModel.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString()); >+ >+ // TODO something can still go wrong when the allowed values on the repository change... >+ opSysAttribute.setValue(os); >+ platformAttribute.setValue(platform); >+ return; >+ } >+ // fall through to old code >+ setPlatformOptions(newBugModel); >+ } >+ >+ >+ > public void setPlatformOptions(RepositoryTaskData newBugModel) { > try { > > // Get OS Lookup Map > // Check that the result is in Values, if it is not, set it to other >+ // TODO Defaults to the first of each (sorted) list All, All bug 159397 > RepositoryTaskAttribute opSysAttribute = newBugModel.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()); > RepositoryTaskAttribute platformAttribute = newBugModel.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString()); > >@@ -272,13 +299,19 @@ > > String bugzillaOS = null; // Bugzilla String for OS > String bugzillaPlatform = null; // Bugzilla String for Platform >- >+/* >+ AIX -> AIX >+ Linux -> Linux >+ HP-UX -> HP-UX >+ Solaris -> Solaris >+ MacOS X -> Mac OS X >+ */ > bugzillaOS = System.getProperty("os.name") + " " + System.getProperty("os.version"); > // We start with the most specific Value as the Search String. > // If we didn't find it we remove the last part of the version String or the OS Name from > // the Search String and continue with the test until we found it or the Search String is empty. >- // >- // The search in casesensitive. >+ // >+ // The search in casesensitive. > if (opSysAttribute != null) { > while (bugzillaOS != null && opSysAttribute.getOptionParameter(bugzillaOS) == null) { > int dotindex = bugzillaOS.lastIndexOf('.'); >@@ -298,7 +331,7 @@ > > if (platform != null && java2buzillaPlatformMap.containsKey(platform)) { > bugzillaPlatform = java2buzillaPlatformMap.get(platform); >- // Bugzilla knows the following Platforms [All, PC, Macintosh, Other] >+ // Bugzilla knows the following Platforms [All, Macintosh, Other, PC, Power PC, Sun] > // Platform.getOSArch() returns "x86" on Intel Mac's and "ppc" on Power Mac's > // so bugzillaPlatform is "Power" or "PC". > // >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.78 >diff -u -r1.78 BugzillaRepositoryConnector.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 13 Jul 2007 17:45:26 -0000 1.78 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 2 Aug 2007 13:46:57 -0000 >@@ -517,12 +517,12 @@ > > /** > * Adds bug attributes to new bug model and sets defaults >- * >+ * > * @param proxySettings > * TODO > * @param characterEncoding > * TODO >- * >+ * > */ > public static void setupNewBugAttributes(TaskRepository taskRepository, RepositoryTaskData newTaskData) > throws CoreException { >@@ -585,12 +585,12 @@ > > a = BugzillaClient.makeNewAttribute(BugzillaReportElement.REP_PLATFORM); > optionValues = repositoryConfiguration.getPlatforms(); >- Collections.sort(optionValues); >+// Collections.sort(optionValues); // TODO bug 159397 why sort platforms and not op sys? > for (String option : optionValues) { > a.addOption(option, option); > } > if (optionValues.size() > 0) { >- a.setValue(optionValues.get(0)); >+ a.setValue(optionValues.get(0)); // TODO bug 159397 choose first platform: All > } > > newTaskData.addAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString(), a); >@@ -602,7 +602,8 @@ > a.addOption(option, option); > } > if (optionValues.size() > 0) { >- a.setValue(optionValues.get(optionValues.size() - 1)); >+// a.setValue(optionValues.get(optionValues.size() - 1)); // TODO bug 159397 choose last op_sys Windows Vista-WPF >+ a.setValue(optionValues.get(0)); // TODO bug 159397 choose first op_sys All > } > > newTaskData.addAttribute(BugzillaReportElement.OP_SYS.getKeyString(), a); >@@ -613,7 +614,7 @@ > for (String option : optionValues) { > a.addOption(option, option); > } >- a.setValue(optionValues.get((optionValues.size() / 2))); >+ a.setValue(optionValues.get((optionValues.size() / 2))); // choose middle priority > > newTaskData.addAttribute(BugzillaReportElement.PRIORITY.getKeyString(), a); > // attributes.put(a.getName(), a); >@@ -623,7 +624,7 @@ > for (String option : optionValues) { > a.addOption(option, option); > } >- a.setValue(optionValues.get((optionValues.size() / 2))); >+ a.setValue(optionValues.get((optionValues.size() / 2))); // choose middle severity > > newTaskData.addAttribute(BugzillaReportElement.BUG_SEVERITY.getKeyString(), a); > // attributes.put(a.getName(), a); >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeFactory.java,v >retrieving revision 1.18 >diff -u -r1.18 BugzillaAttributeFactory.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeFactory.java 26 Jun 2007 01:16:07 -0000 1.18 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeFactory.java 2 Aug 2007 13:46:57 -0000 >@@ -75,6 +75,7 @@ > return BugzillaReportElement.SHORT_DESC.getKeyString(); > } else if (key.equals(RepositoryTaskAttribute.PRODUCT)) { > return BugzillaReportElement.PRODUCT.getKeyString(); >+ // TODO: tested twice!! > } else if (key.equals(RepositoryTaskAttribute.DATE_CREATION)) { > return BugzillaReportElement.CREATION_TS.getKeyString(); > } else if (key.equals(RepositoryTaskAttribute.KEYWORDS)) { >Index: src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java,v >retrieving revision 1.45 >diff -u -r1.45 IBugzillaConstants.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 13 Jul 2007 17:45:26 -0000 1.45 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 2 Aug 2007 13:46:58 -0000 >@@ -13,7 +13,7 @@ > public interface IBugzillaConstants { > > //public static final String POST_ARGS_PASSWORD = "&Bugzilla_password="; >- //public static final String POST_ARGS_LOGIN = "GoAheadAndLogIn=1&Bugzilla_login="; >+ //public static final String POST_ARGS_LOGIN = "GoAheadAndLogIn=1&Bugzilla_login="; > > public static final String PROPERTY_CONFIGTIMESTAMP = "org.eclipse.mylyn.tasklist.repositories.config.timestamp"; > >@@ -73,12 +73,12 @@ > > public static final String URL_GET_CONFIG_RDF = "/config.cgi?ctype=rdf"; > >- //For including fields in the xml (XML Summary mode as they like to call it) >- //use &field=fieldname for example to only reveal the product information append &field=product >+ //For including fields in the xml (XML Summary mode as they like to call it) >+ //use &field=fieldname for example to only reveal the product information append &field=product > //to exclude from the xml use excludefield=fieldname. See bugzilla QuckSearch for a list of >- //fields that can be used (repositoryurl/quicksearchhack.html). >+ //fields that can be used (repositoryurl/quicksearchhack.html). > //If somebody knows where this is officially documented I'd appreciate it if they would post a link here >- // and on bug#161321. Thanks -relves >+ // and on bug#161321. Thanks -relves > // (see also: https://bugzilla.mozilla.org/show_bug.cgi?id=136603https://bugzilla.mozilla.org/show_bug.cgi?id=136603) > public static final String URL_GET_SHOW_BUG_XML = "/show_bug.cgi?ctype=xml&excludefield=attachmentdata&id="; > >@@ -255,4 +255,8 @@ > > public static final String TIMESTAMP_NOT_AVAILABLE = "n/a"; > >+ public static final String BUGZILLA_DEF_OS = "bugzilla.default.os"; >+ >+ public static final String BUGZILLA_DEF_PLATFORM = "bugzilla.default.platform"; >+ > }
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 159397
:
52059
|
74915
|
74916
| 75221 |
75222
|
76811
|
76812
|
76980
|
76981