Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 159397 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java (-8 / +41 lines)
Lines 58-69 Link Here
58
58
59
	public BugzillaCorePlugin() {
59
	public BugzillaCorePlugin() {
60
		super();
60
		super();
61
		java2buzillaPlatformMap.put("x86", "PC");
61
		java2buzillaPlatformMap.put("x86", "PC"); // can be PC or Macintosh!
62
		java2buzillaPlatformMap.put("x86_64", "PC");
62
		java2buzillaPlatformMap.put("x86_64", "PC");
63
		java2buzillaPlatformMap.put("ia64", "PC");
63
		java2buzillaPlatformMap.put("ia64", "PC");
64
		java2buzillaPlatformMap.put("ia64_32", "PC");
64
		java2buzillaPlatformMap.put("ia64_32", "PC");
65
		java2buzillaPlatformMap.put("sparc", "Sun");
65
		java2buzillaPlatformMap.put("sparc", "Sun");
66
		java2buzillaPlatformMap.put("ppc", "Power");
66
		java2buzillaPlatformMap.put("ppc", "Power PC"); // not Power!
67
67
68
	}
68
	}
69
69
Lines 228-234 Link Here
228
228
229
	/**
229
	/**
230
	 * Convenience method for logging statuses to the plugin log
230
	 * Convenience method for logging statuses to the plugin log
231
	 * 
231
	 *
232
	 * @param status
232
	 * @param status
233
	 *            the status to log
233
	 *            the status to log
234
	 */
234
	 */
Lines 238-244 Link Here
238
238
239
	/**
239
	/**
240
	 * Convenience method for logging exceptions to the plugin log
240
	 * Convenience method for logging exceptions to the plugin log
241
	 * 
241
	 *
242
	 * @param e
242
	 * @param e
243
	 *            the exception to log
243
	 *            the exception to log
244
	 */
244
	 */
Lines 259-269 Link Here
259
		return bugFile;
259
		return bugFile;
260
	}
260
	}
261
261
262
263
	public void setPlatformDefaultsOrGuess(TaskRepository repository, RepositoryTaskData newBugModel) {
264
265
		String platform =
266
			repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM);
267
		String os =
268
			repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_OS);
269
270
		// set both or none
271
		if(null != os && null != platform) {
272
			RepositoryTaskAttribute opSysAttribute =
273
				newBugModel.getAttribute(BugzillaReportElement.OP_SYS.getKeyString());
274
			RepositoryTaskAttribute platformAttribute =
275
				newBugModel.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString());
276
277
			// TODO something can still go wrong when the allowed values on the repository change...
278
			opSysAttribute.setValue(os);
279
			platformAttribute.setValue(platform);
280
			return;
281
		}
282
		// fall through to old code
283
		setPlatformOptions(newBugModel);
284
	}
285
286
287
262
	public void setPlatformOptions(RepositoryTaskData newBugModel) {
288
	public void setPlatformOptions(RepositoryTaskData newBugModel) {
263
		try {
289
		try {
264
290
265
			// Get OS Lookup Map
291
			// Get OS Lookup Map
266
			// Check that the result is in Values, if it is not, set it to other
292
			// Check that the result is in Values, if it is not, set it to other
293
			// TODO Defaults to the first of each (sorted) list All, All bug 159397
267
			RepositoryTaskAttribute opSysAttribute = newBugModel.getAttribute(BugzillaReportElement.OP_SYS.getKeyString());
294
			RepositoryTaskAttribute opSysAttribute = newBugModel.getAttribute(BugzillaReportElement.OP_SYS.getKeyString());
268
			RepositoryTaskAttribute platformAttribute = newBugModel.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString());
295
			RepositoryTaskAttribute platformAttribute = newBugModel.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString());
269
296
Lines 272-284 Link Here
272
299
273
			String bugzillaOS = null; // Bugzilla String for OS
300
			String bugzillaOS = null; // Bugzilla String for OS
274
			String bugzillaPlatform = null; // Bugzilla String for Platform
301
			String bugzillaPlatform = null; // Bugzilla String for Platform
275
302
/*
303
			AIX -> AIX
304
			Linux -> Linux
305
			HP-UX -> HP-UX
306
			Solaris -> Solaris
307
			MacOS X -> Mac OS X
308
 */
276
			bugzillaOS = System.getProperty("os.name") + " " + System.getProperty("os.version");
309
			bugzillaOS = System.getProperty("os.name") + " " + System.getProperty("os.version");
277
			// We start with the most specific Value as the Search String.
310
			// We start with the most specific Value as the Search String.
278
			// If we didn't find it we remove the last part of the version String or the OS Name from
311
			// If we didn't find it we remove the last part of the version String or the OS Name from
279
			// the Search String and continue with the test until we found it or the Search String is empty.
312
			// the Search String and continue with the test until we found it or the Search String is empty.
280
			// 
313
			//
281
			// The search in casesensitive.	
314
			// The search in casesensitive.
282
			if (opSysAttribute != null) {
315
			if (opSysAttribute != null) {
283
				while (bugzillaOS != null && opSysAttribute.getOptionParameter(bugzillaOS) == null) {
316
				while (bugzillaOS != null && opSysAttribute.getOptionParameter(bugzillaOS) == null) {
284
					int dotindex = bugzillaOS.lastIndexOf('.');
317
					int dotindex = bugzillaOS.lastIndexOf('.');
Lines 298-304 Link Here
298
331
299
			if (platform != null && java2buzillaPlatformMap.containsKey(platform)) {
332
			if (platform != null && java2buzillaPlatformMap.containsKey(platform)) {
300
				bugzillaPlatform = java2buzillaPlatformMap.get(platform);
333
				bugzillaPlatform = java2buzillaPlatformMap.get(platform);
301
				// Bugzilla knows the following Platforms [All, PC, Macintosh, Other]
334
				// Bugzilla knows the following Platforms [All, Macintosh, Other, PC, Power PC, Sun]
302
				// Platform.getOSArch() returns "x86" on Intel Mac's and "ppc" on Power Mac's
335
				// Platform.getOSArch() returns "x86" on Intel Mac's and "ppc" on Power Mac's
303
				// so bugzillaPlatform is "Power" or "PC".
336
				// so bugzillaPlatform is "Power" or "PC".
304
				//
337
				//
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java (-6 / +11 lines)
Lines 518-529 Link Here
518
518
519
	/**
519
	/**
520
	 * Adds bug attributes to new bug model and sets defaults
520
	 * Adds bug attributes to new bug model and sets defaults
521
	 * 
521
	 *
522
	 * @param proxySettings
522
	 * @param proxySettings
523
	 *            TODO
523
	 *            TODO
524
	 * @param characterEncoding
524
	 * @param characterEncoding
525
	 *            TODO
525
	 *            TODO
526
	 * 
526
	 *
527
	 */
527
	 */
528
	public static void setupNewBugAttributes(TaskRepository taskRepository, RepositoryTaskData newTaskData)
528
	public static void setupNewBugAttributes(TaskRepository taskRepository, RepositoryTaskData newTaskData)
529
			throws CoreException {
529
			throws CoreException {
Lines 586-596 Link Here
586
586
587
		a = BugzillaClient.makeNewAttribute(BugzillaReportElement.REP_PLATFORM);
587
		a = BugzillaClient.makeNewAttribute(BugzillaReportElement.REP_PLATFORM);
588
		optionValues = repositoryConfiguration.getPlatforms();
588
		optionValues = repositoryConfiguration.getPlatforms();
589
		Collections.sort(optionValues);
589
		// TODO bug 159397 why sort platforms and not op sys?
590
//		Collections.sort(optionValues);
590
		for (String option : optionValues) {
591
		for (String option : optionValues) {
591
			a.addOption(option, option);
592
			a.addOption(option, option);
592
		}
593
		}
593
		if (optionValues.size() > 0) {
594
		if (optionValues.size() > 0) {
595
			// TODO bug 159397 choose first platform: All
594
			a.setValue(optionValues.get(0));
596
			a.setValue(optionValues.get(0));
595
		}
597
		}
596
598
Lines 603-609 Link Here
603
			a.addOption(option, option);
605
			a.addOption(option, option);
604
		}
606
		}
605
		if (optionValues.size() > 0) {
607
		if (optionValues.size() > 0) {
606
			a.setValue(optionValues.get(optionValues.size() - 1));
608
			// bug 159397 chose last op_sys Windows Vista-WPF
609
//			a.setValue(optionValues.get(optionValues.size() - 1));
610
			// bug 159397 chagne to choose first op_sys All
611
			a.setValue(optionValues.get(0));
607
		}
612
		}
608
613
609
		newTaskData.addAttribute(BugzillaReportElement.OP_SYS.getKeyString(), a);
614
		newTaskData.addAttribute(BugzillaReportElement.OP_SYS.getKeyString(), a);
Lines 614-620 Link Here
614
		for (String option : optionValues) {
619
		for (String option : optionValues) {
615
			a.addOption(option, option);
620
			a.addOption(option, option);
616
		}
621
		}
617
		a.setValue(optionValues.get((optionValues.size() / 2)));
622
		a.setValue(optionValues.get((optionValues.size() / 2))); // choose middle priority
618
623
619
		newTaskData.addAttribute(BugzillaReportElement.PRIORITY.getKeyString(), a);
624
		newTaskData.addAttribute(BugzillaReportElement.PRIORITY.getKeyString(), a);
620
		// attributes.put(a.getName(), a);
625
		// attributes.put(a.getName(), a);
Lines 624-630 Link Here
624
		for (String option : optionValues) {
629
		for (String option : optionValues) {
625
			a.addOption(option, option);
630
			a.addOption(option, option);
626
		}
631
		}
627
		a.setValue(optionValues.get((optionValues.size() / 2)));
632
		a.setValue(optionValues.get((optionValues.size() / 2))); // choose middle severity
628
633
629
		newTaskData.addAttribute(BugzillaReportElement.BUG_SEVERITY.getKeyString(), a);
634
		newTaskData.addAttribute(BugzillaReportElement.BUG_SEVERITY.getKeyString(), a);
630
		// attributes.put(a.getName(), a);
635
		// attributes.put(a.getName(), a);
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeFactory.java (+1 lines)
Lines 75-80 Link Here
75
			return BugzillaReportElement.SHORT_DESC.getKeyString();
75
			return BugzillaReportElement.SHORT_DESC.getKeyString();
76
		} else if (key.equals(RepositoryTaskAttribute.PRODUCT)) {
76
		} else if (key.equals(RepositoryTaskAttribute.PRODUCT)) {
77
			return BugzillaReportElement.PRODUCT.getKeyString();
77
			return BugzillaReportElement.PRODUCT.getKeyString();
78
			// TODO: tested twice!!
78
		} else if (key.equals(RepositoryTaskAttribute.DATE_CREATION)) {
79
		} else if (key.equals(RepositoryTaskAttribute.DATE_CREATION)) {
79
			return BugzillaReportElement.CREATION_TS.getKeyString();
80
			return BugzillaReportElement.CREATION_TS.getKeyString();
80
		} else if (key.equals(RepositoryTaskAttribute.KEYWORDS)) {
81
		} else if (key.equals(RepositoryTaskAttribute.KEYWORDS)) {
(-)src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java (-5 / +9 lines)
Lines 13-19 Link Here
13
public interface IBugzillaConstants {
13
public interface IBugzillaConstants {
14
14
15
	//public static final String POST_ARGS_PASSWORD = "&Bugzilla_password=";
15
	//public static final String POST_ARGS_PASSWORD = "&Bugzilla_password=";
16
	//public static final String POST_ARGS_LOGIN = "GoAheadAndLogIn=1&Bugzilla_login=";	
16
	//public static final String POST_ARGS_LOGIN = "GoAheadAndLogIn=1&Bugzilla_login=";
17
17
18
	public static final String PROPERTY_CONFIGTIMESTAMP = "org.eclipse.mylyn.tasklist.repositories.config.timestamp";
18
	public static final String PROPERTY_CONFIGTIMESTAMP = "org.eclipse.mylyn.tasklist.repositories.config.timestamp";
19
19
Lines 73-84 Link Here
73
73
74
	public static final String URL_GET_CONFIG_RDF = "/config.cgi?ctype=rdf";
74
	public static final String URL_GET_CONFIG_RDF = "/config.cgi?ctype=rdf";
75
75
76
	//For including fields in the xml (XML Summary mode as they like to call it) 
76
	//For including fields in the xml (XML Summary mode as they like to call it)
77
	//use &field=fieldname for example to only reveal the product information append &field=product 
77
	//use &field=fieldname for example to only reveal the product information append &field=product
78
	//to exclude from the xml use excludefield=fieldname. See bugzilla QuckSearch for a list of
78
	//to exclude from the xml use excludefield=fieldname. See bugzilla QuckSearch for a list of
79
	//fields that can be used (repositoryurl/quicksearchhack.html). 
79
	//fields that can be used (repositoryurl/quicksearchhack.html).
80
	//If somebody knows where this is officially documented I'd appreciate it if they would post a link here
80
	//If somebody knows where this is officially documented I'd appreciate it if they would post a link here
81
	// and on bug#161321. Thanks -relves 
81
	// and on bug#161321. Thanks -relves
82
	// (see also: https://bugzilla.mozilla.org/show_bug.cgi?id=136603https://bugzilla.mozilla.org/show_bug.cgi?id=136603)
82
	// (see also: https://bugzilla.mozilla.org/show_bug.cgi?id=136603https://bugzilla.mozilla.org/show_bug.cgi?id=136603)
83
	public static final String URL_GET_SHOW_BUG_XML = "/show_bug.cgi?ctype=xml&excludefield=attachmentdata&id=";
83
	public static final String URL_GET_SHOW_BUG_XML = "/show_bug.cgi?ctype=xml&excludefield=attachmentdata&id=";
84
84
Lines 257-260 Link Here
257
257
258
	public static final String TIMESTAMP_NOT_AVAILABLE = "n/a";
258
	public static final String TIMESTAMP_NOT_AVAILABLE = "n/a";
259
259
260
	public static final String BUGZILLA_DEF_OS = "bugzilla.default.os";
261
262
	public static final String BUGZILLA_DEF_PLATFORM = "bugzilla.default.platform";
263
260
}
264
}
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java (-4 / +5 lines)
Lines 72-78 Link Here
72
 * @author Mik Kersten
72
 * @author Mik Kersten
73
 * @author Eugene Kuleshov
73
 * @author Eugene Kuleshov
74
 * @author Willian Mitsuda
74
 * @author Willian Mitsuda
75
 * 
75
 *
76
 * Product selection page of new bug wizard
76
 * Product selection page of new bug wizard
77
 */
77
 */
78
public class BugzillaProductPage extends WizardPage {
78
public class BugzillaProductPage extends WizardPage {
Lines 106-112 Link Here
106
106
107
	/**
107
	/**
108
	 * Constructor for BugzillaProductPage
108
	 * Constructor for BugzillaProductPage
109
	 * 
109
	 *
110
	 * @param workbench
110
	 * @param workbench
111
	 *            The instance of the workbench
111
	 *            The instance of the workbench
112
	 * @param bugWiz
112
	 * @param bugWiz
Lines 355-361 Link Here
355
355
356
	/**
356
	/**
357
	 * Applies the status to the status line of a dialog page.
357
	 * Applies the status to the status line of a dialog page.
358
	 * 
358
	 *
359
	 * @param status
359
	 * @param status
360
	 *            The status to apply to the status line
360
	 *            The status to apply to the status line
361
	 */
361
	 */
Lines 391-397 Link Here
391
		model.setAttributeValue(BugzillaReportElement.PRODUCT.getKeyString(),
391
		model.setAttributeValue(BugzillaReportElement.PRODUCT.getKeyString(),
392
				(String) ((IStructuredSelection) productList.getViewer().getSelection()).getFirstElement());
392
				(String) ((IStructuredSelection) productList.getViewer().getSelection()).getFirstElement());
393
		BugzillaRepositoryConnector.setupNewBugAttributes(repository, model);
393
		BugzillaRepositoryConnector.setupNewBugAttributes(repository, model);
394
		BugzillaCorePlugin.getDefault().setPlatformOptions(model);
394
		// platform/os are now set to All/All
395
		BugzillaCorePlugin.getDefault().setPlatformDefaultsOrGuess(repository, model);
395
	}
396
	}
396
397
397
	@Override
398
	@Override
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java (+91 lines)
Lines 12-17 Link Here
12
import java.net.MalformedURLException;
12
import java.net.MalformedURLException;
13
import java.net.Proxy;
13
import java.net.Proxy;
14
import java.net.URL;
14
import java.net.URL;
15
import java.util.List;
15
16
16
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IProgressMonitor;
Lines 35-40 Link Here
35
import org.eclipse.swt.events.SelectionAdapter;
36
import org.eclipse.swt.events.SelectionAdapter;
36
import org.eclipse.swt.events.SelectionEvent;
37
import org.eclipse.swt.events.SelectionEvent;
37
import org.eclipse.swt.events.SelectionListener;
38
import org.eclipse.swt.events.SelectionListener;
39
import org.eclipse.swt.layout.GridLayout;
38
import org.eclipse.swt.widgets.Button;
40
import org.eclipse.swt.widgets.Button;
39
import org.eclipse.swt.widgets.Combo;
41
import org.eclipse.swt.widgets.Combo;
40
import org.eclipse.swt.widgets.Composite;
42
import org.eclipse.swt.widgets.Composite;
Lines 58-63 Link Here
58
60
59
	protected Combo repositoryVersionCombo;
61
	protected Combo repositoryVersionCombo;
60
62
63
	protected Button defaults;
64
65
	protected Combo defaultPlatformCombo;
66
67
	protected Combo defaultOSCombo;
68
61
	private Button cleanQAContact;
69
	private Button cleanQAContact;
62
70
63
	private Button cachedConfigButton;
71
	private Button cachedConfigButton;
Lines 145-150 Link Here
145
			cachedConfigButton.setSelection(isCached);
153
			cachedConfigButton.setSelection(isCached);
146
		}
154
		}
147
155
156
		RepositoryConfiguration repositoryConfiguration = null;
157
		String platform = null;
158
		String os = null;
159
		try {
160
			if (null != repository) {
161
				repositoryConfiguration =
162
					BugzillaCorePlugin.getRepositoryConfiguration(repository, false);
163
				platform =
164
					repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM);
165
				os =
166
					repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_OS);
167
			}
168
		} catch (CoreException e1) {
169
			// TODO Auto-generated catch block
170
			e1.printStackTrace();
171
		}
172
173
		Label defaultPlatformLabel = new Label(parent, SWT.NONE);
174
		defaultPlatformLabel.setText("Default Platform/OS");
175
176
		Composite platformOSContainer = new Composite(parent, SWT.NONE);
177
		GridLayout gridLayout = new GridLayout(3, false);
178
		gridLayout.marginWidth = 0;
179
		gridLayout.marginHeight = 0;
180
		platformOSContainer.setLayout(gridLayout);
181
182
		defaults = new Button(platformOSContainer, SWT.CHECK);
183
		defaults.addSelectionListener(new SelectionAdapter() {
184
185
			@Override
186
			public void widgetSelected(SelectionEvent e) {
187
				defaultPlatformCombo.setEnabled(defaults.getSelection());
188
				defaultOSCombo.setEnabled(defaults.getSelection());
189
			}
190
191
		});
192
		defaults.setEnabled(null != repository);
193
		defaults.setSelection(null != platform && null != os);
194
195
		defaultPlatformCombo = new Combo(platformOSContainer, SWT.READ_ONLY);
196
		if (null != repositoryConfiguration) {
197
			List<String> optionValues = repositoryConfiguration.getPlatforms();
198
			for (String option : optionValues) {
199
				defaultPlatformCombo.add(option.toString());
200
			}
201
			if (null != platform && defaultPlatformCombo.indexOf(platform) >= 0) {
202
				defaultPlatformCombo.select(defaultPlatformCombo.indexOf(platform));
203
			} else {
204
				defaultPlatformCombo.select(0);
205
			}
206
		} else {
207
			defaultPlatformCombo.add("All");
208
			defaultPlatformCombo.select(0);
209
		}
210
		defaultPlatformCombo.setEnabled(defaults.getSelection());
211
212
		defaultOSCombo = new Combo(platformOSContainer, SWT.READ_ONLY);
213
		if (null != repositoryConfiguration) {
214
			List<String> optionValues = repositoryConfiguration.getOSs();
215
			for (String option : optionValues) {
216
				defaultOSCombo.add(option.toString());
217
			}
218
			if (null != os && defaultOSCombo.indexOf(os) >= 0) {
219
				defaultOSCombo.select(defaultOSCombo.indexOf(os));
220
			} else {
221
				defaultOSCombo.select(0);
222
			}
223
		} else {
224
			defaultOSCombo.add("All");
225
			defaultOSCombo.select(0); // TODO bug 159397 choose first platform: All
226
		}
227
		defaultOSCombo.setEnabled(defaults.getSelection());
228
148
	}
229
	}
149
230
150
	public void setBugzillaVersion(String version) {
231
	public void setBugzillaVersion(String version) {
Lines 184-189 Link Here
184
			repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP,
265
			repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP,
185
					IBugzillaConstants.TIMESTAMP_NOT_AVAILABLE);
266
					IBugzillaConstants.TIMESTAMP_NOT_AVAILABLE);
186
		}
267
		}
268
		// TODO save the selected default Platform and OS here bug 159397
269
		if (defaults.getSelection()) {
270
			repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM,
271
					String.valueOf(defaultPlatformCombo.getItem(defaultPlatformCombo.getSelectionIndex())));
272
			repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_OS,
273
					String.valueOf(defaultOSCombo.getItem(defaultOSCombo.getSelectionIndex())));
274
		} else {
275
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM);
276
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS);
277
		}
187
	}
278
	}
188
279
189
	@Override
280
	@Override

Return to bug 159397