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 76980 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]
Swithed optio to "Autodetect Platform and OS"
clipboard.txt (text/plain), 18.81 KB, created by
maarten meijer
on 2007-08-26 06:02:05 EDT
(
hide
)
Description:
Swithed optio to "Autodetect Platform and OS"
Filename:
MIME Type:
Creator:
maarten meijer
Created:
2007-08-26 06:02:05 EDT
Size:
18.81 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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 26 Aug 2007 10:02:50 -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 >+ // Defaults to the first of each (sorted) list All, All > 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". > // >@@ -307,6 +340,7 @@ > if (bugzillaPlatform != null > && (bugzillaPlatform.compareTo("Power") == 0 || bugzillaPlatform.compareTo("PC") == 0) > && OS != null && OS.compareTo("macosx") == 0) { >+ // TODO: this may not even be a legal value in another repository! > bugzillaPlatform = "Macintosh"; > } else if (platformAttribute != null && platformAttribute.getOptionParameter(bugzillaPlatform) == null) { > // If the platform we found is not int the list of available >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.80 >diff -u -r1.80 BugzillaRepositoryConnector.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 17 Aug 2007 22:51:26 -0000 1.80 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 26 Aug 2007 10:02:50 -0000 >@@ -518,12 +518,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 { >@@ -586,11 +586,11 @@ > > a = BugzillaClient.makeNewAttribute(BugzillaReportElement.REP_PLATFORM); > optionValues = repositoryConfiguration.getPlatforms(); >- Collections.sort(optionValues); > for (String option : optionValues) { > a.addOption(option, option); > } > if (optionValues.size() > 0) { >+ // bug 159397 choose first platform: All > a.setValue(optionValues.get(0)); > } > >@@ -603,7 +603,8 @@ > a.addOption(option, option); > } > if (optionValues.size() > 0) { >- a.setValue(optionValues.get(optionValues.size() - 1)); >+ // bug 159397 change to choose first op_sys All >+ a.setValue(optionValues.get(0)); > } > > newTaskData.addAttribute(BugzillaReportElement.OP_SYS.getKeyString(), a); >@@ -614,7 +615,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); >@@ -624,7 +625,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 26 Aug 2007 10:02:50 -0000 >@@ -75,6 +75,7 @@ > return BugzillaReportElement.SHORT_DESC.getKeyString(); > } else if (key.equals(RepositoryTaskAttribute.PRODUCT)) { > return BugzillaReportElement.PRODUCT.getKeyString(); >+ // TODO: DATE_CREATION tested twice, see above! > } 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.46 >diff -u -r1.46 IBugzillaConstants.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 31 Jul 2007 20:08:51 -0000 1.46 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java 26 Aug 2007 10:02:50 -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="; > >@@ -257,4 +257,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"; >+ > } >#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.73 >diff -u -r1.73 BugzillaProductPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java 8 Aug 2007 17:11:55 -0000 1.73 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java 26 Aug 2007 10:02:52 -0000 >@@ -72,7 +72,7 @@ > * @author Mik Kersten > * @author Eugene Kuleshov > * @author Willian Mitsuda >- * >+ * > * Product selection page of new bug wizard > */ > public class BugzillaProductPage extends WizardPage { >@@ -106,7 +106,7 @@ > > /** > * Constructor for BugzillaProductPage >- * >+ * > * @param workbench > * The instance of the workbench > * @param bugWiz >@@ -355,7 +355,7 @@ > > /** > * Applies the status to the status line of a dialog page. >- * >+ * > * @param status > * The status to apply to the status line > */ >@@ -391,7 +391,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 26 Aug 2007 10:02:51 -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 autodetectPlatformOS; >+ >+ protected Combo defaultPlatformCombo; >+ >+ protected Combo defaultOSCombo; >+ > private Button cleanQAContact; > > private Button cachedConfigButton; >@@ -145,6 +153,88 @@ > 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) { >+ StatusHandler.log(e1, "Error retrieving Repository Configuration Settings"); >+ } >+ >+ Label defaultPlatformLabel = new Label(parent, SWT.NONE); >+ defaultPlatformLabel.setText("Autodetect Platform and OS"); >+ >+ Composite platformOSContainer = new Composite(parent, SWT.NONE); >+ GridLayout gridLayout = new GridLayout(3, false); >+ gridLayout.marginWidth = 0; >+ gridLayout.marginHeight = 0; >+ platformOSContainer.setLayout(gridLayout); >+ >+ autodetectPlatformOS = new Button(platformOSContainer, SWT.CHECK); >+ autodetectPlatformOS.addSelectionListener(new SelectionAdapter() { >+ >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ defaultPlatformCombo.setEnabled(!autodetectPlatformOS.getSelection()); >+ defaultOSCombo.setEnabled(!autodetectPlatformOS.getSelection()); >+ } >+ >+ }); >+ autodetectPlatformOS.setEnabled(null != repository); >+ if(null == repository) >+ autodetectPlatformOS.setToolTipText( >+ "This option will be enabled after the repository has been accessed."); >+ else >+ autodetectPlatformOS.setToolTipText( >+ "Use these settings to override the auto guessing of Platform and OS."); >+ autodetectPlatformOS.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 { >+ // remove value if no longer exists and set to All! >+ repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM); >+ defaultPlatformCombo.select(0); >+ } >+ } else { >+ defaultPlatformCombo.add("All"); >+ defaultPlatformCombo.select(0); >+ } >+ defaultPlatformCombo.setEnabled(!autodetectPlatformOS.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 { >+ // remove value if no longer exists and set to All! >+ repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS); >+ defaultOSCombo.select(0); >+ } >+ } else { >+ defaultOSCombo.add("All"); >+ defaultOSCombo.select(0); >+ } >+ defaultOSCombo.setEnabled(!autodetectPlatformOS.getSelection()); >+ > } > > public void setBugzillaVersion(String version) { >@@ -184,6 +274,15 @@ > repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP, > IBugzillaConstants.TIMESTAMP_NOT_AVAILABLE); > } >+ if (!autodetectPlatformOS.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 >Index: .refactorings/2007/8/35/refactorings.index >=================================================================== >RCS file: .refactorings/2007/8/35/refactorings.index >diff -N .refactorings/2007/8/35/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/8/35/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1 @@ >+1188118067596 Rename field 'defaults' >Index: .refactorings/2007/8/35/refactorings.history >=================================================================== >RCS file: .refactorings/2007/8/35/refactorings.history >diff -N .refactorings/2007/8/35/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/8/35/refactorings.history 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+<?xml version="1.0" encoding="utf-8"?> >+<session version="1.0"> >+<refactoring comment="Rename field 'defaults' in 'org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaRepositorySettingsPage' to 'autodetectPlatformOS' - Original project: 'org.eclipse.mylyn.bugzilla.ui' - Original element: 'org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaRepositorySettingsPage.defaults' - Renamed element: 'org.eclipse.mylyn.internal.bugzilla.ui.tasklist.BugzillaRepositorySettingsPage.autodetectPlatformOS' - Update references to refactored element - Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field 'defaults'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src<org.eclipse.mylyn.internal.bugzilla.ui.tasklist{BugzillaRepositorySettingsPage.java[BugzillaRepositorySettingsPage^defaults" name="autodetectPlatformOS" references="true" setter="false" stamp="1188118067596" textual="false" version="1.0"/> >+</session>
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