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/ui/wizard/BugzillaProductPage.java (-4 / +5 lines)
Lines 69-75 Link Here
69
 * @author Mik Kersten
69
 * @author Mik Kersten
70
 * @author Eugene Kuleshov
70
 * @author Eugene Kuleshov
71
 * @author Willian Mitsuda
71
 * @author Willian Mitsuda
72
 * 
72
 *
73
 * Product selection page of new bug wizard
73
 * Product selection page of new bug wizard
74
 */
74
 */
75
public class BugzillaProductPage extends WizardPage {
75
public class BugzillaProductPage extends WizardPage {
Lines 103-109 Link Here
103
103
104
	/**
104
	/**
105
	 * Constructor for BugzillaProductPage
105
	 * Constructor for BugzillaProductPage
106
	 * 
106
	 *
107
	 * @param workbench
107
	 * @param workbench
108
	 *            The instance of the workbench
108
	 *            The instance of the workbench
109
	 * @param bugWiz
109
	 * @param bugWiz
Lines 341-347 Link Here
341
341
342
	/**
342
	/**
343
	 * Applies the status to the status line of a dialog page.
343
	 * Applies the status to the status line of a dialog page.
344
	 * 
344
	 *
345
	 * @param status
345
	 * @param status
346
	 *            The status to apply to the status line
346
	 *            The status to apply to the status line
347
	 */
347
	 */
Lines 377-383 Link Here
377
		model.setAttributeValue(BugzillaReportElement.PRODUCT.getKeyString(),
377
		model.setAttributeValue(BugzillaReportElement.PRODUCT.getKeyString(),
378
				(String) ((IStructuredSelection) productList.getViewer().getSelection()).getFirstElement());
378
				(String) ((IStructuredSelection) productList.getViewer().getSelection()).getFirstElement());
379
		BugzillaRepositoryConnector.setupNewBugAttributes(repository, model);
379
		BugzillaRepositoryConnector.setupNewBugAttributes(repository, model);
380
		BugzillaCorePlugin.getDefault().setPlatformOptions(model);
380
		// platform/os are now set to All/All
381
		BugzillaCorePlugin.getDefault().setPlatformDefaultsOrGuess(repository, model);
381
	}
382
	}
382
383
383
	@Override
384
	@Override
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java (+90 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.setSelection(null != platform && null != os);
193
194
		defaultPlatformCombo = new Combo(platformOSContainer, SWT.READ_ONLY);
195
		if (null != repositoryConfiguration) {
196
			List<String> optionValues = repositoryConfiguration.getPlatforms();
197
			for (String option : optionValues) {
198
				defaultPlatformCombo.add(option.toString());
199
			}
200
			if (null != platform && defaultPlatformCombo.indexOf(platform) >= 0) {
201
				defaultPlatformCombo.select(defaultPlatformCombo.indexOf(platform));
202
			} else {
203
				defaultPlatformCombo.select(0);
204
			}
205
		} else {
206
			defaultPlatformCombo.add("All");
207
			defaultPlatformCombo.select(0); // TODO bug 159397 choose first platform: All
208
		}
209
		defaultPlatformCombo.setEnabled(defaults.getSelection());
210
211
		defaultOSCombo = new Combo(platformOSContainer, SWT.READ_ONLY);
212
		if (null != repositoryConfiguration) {
213
			List<String> optionValues = repositoryConfiguration.getOSs();
214
			for (String option : optionValues) {
215
				defaultOSCombo.add(option.toString());
216
			}
217
			if (null != os && defaultOSCombo.indexOf(os) >= 0) {
218
				defaultOSCombo.select(defaultOSCombo.indexOf(os));
219
			} else {
220
				defaultOSCombo.select(0);
221
			}
222
		} else {
223
			defaultOSCombo.add("All");
224
			defaultOSCombo.select(0); // TODO bug 159397 choose first platform: All
225
		}
226
		defaultOSCombo.setEnabled(defaults.getSelection());
227
148
	}
228
	}
149
229
150
	public void setBugzillaVersion(String version) {
230
	public void setBugzillaVersion(String version) {
Lines 184-189 Link Here
184
			repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP,
264
			repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP,
185
					IBugzillaConstants.TIMESTAMP_NOT_AVAILABLE);
265
					IBugzillaConstants.TIMESTAMP_NOT_AVAILABLE);
186
		}
266
		}
267
		// TODO save the selected default Platform and OS here bug 159397
268
		if (defaults.getSelection()) {
269
			repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM,
270
					String.valueOf(defaultPlatformCombo.getItem(defaultPlatformCombo.getSelectionIndex())));
271
			repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_OS,
272
					String.valueOf(defaultOSCombo.getItem(defaultOSCombo.getSelectionIndex())));
273
		} else {
274
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM);
275
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS);
276
		}
187
	}
277
	}
188
278
189
	@Override
279
	@Override
(-)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 (-7 / +8 lines)
Lines 517-528 Link Here
517
517
518
	/**
518
	/**
519
	 * Adds bug attributes to new bug model and sets defaults
519
	 * Adds bug attributes to new bug model and sets defaults
520
	 * 
520
	 *
521
	 * @param proxySettings
521
	 * @param proxySettings
522
	 *            TODO
522
	 *            TODO
523
	 * @param characterEncoding
523
	 * @param characterEncoding
524
	 *            TODO
524
	 *            TODO
525
	 * 
525
	 *
526
	 */
526
	 */
527
	public static void setupNewBugAttributes(TaskRepository taskRepository, RepositoryTaskData newTaskData)
527
	public static void setupNewBugAttributes(TaskRepository taskRepository, RepositoryTaskData newTaskData)
528
			throws CoreException {
528
			throws CoreException {
Lines 585-596 Link Here
585
585
586
		a = BugzillaClient.makeNewAttribute(BugzillaReportElement.REP_PLATFORM);
586
		a = BugzillaClient.makeNewAttribute(BugzillaReportElement.REP_PLATFORM);
587
		optionValues = repositoryConfiguration.getPlatforms();
587
		optionValues = repositoryConfiguration.getPlatforms();
588
		Collections.sort(optionValues);
588
//		Collections.sort(optionValues); // TODO bug 159397 why sort platforms and not op sys?
589
		for (String option : optionValues) {
589
		for (String option : optionValues) {
590
			a.addOption(option, option);
590
			a.addOption(option, option);
591
		}
591
		}
592
		if (optionValues.size() > 0) {
592
		if (optionValues.size() > 0) {
593
			a.setValue(optionValues.get(0));
593
			a.setValue(optionValues.get(0)); // TODO bug 159397 choose first platform: All
594
		}
594
		}
595
595
596
		newTaskData.addAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString(), a);
596
		newTaskData.addAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString(), a);
Lines 602-608 Link Here
602
			a.addOption(option, option);
602
			a.addOption(option, option);
603
		}
603
		}
604
		if (optionValues.size() > 0) {
604
		if (optionValues.size() > 0) {
605
			a.setValue(optionValues.get(optionValues.size() - 1));
605
//			a.setValue(optionValues.get(optionValues.size() - 1)); // TODO bug 159397 choose last op_sys Windows Vista-WPF
606
			a.setValue(optionValues.get(0)); // TODO bug 159397 choose first op_sys All
606
		}
607
		}
607
608
608
		newTaskData.addAttribute(BugzillaReportElement.OP_SYS.getKeyString(), a);
609
		newTaskData.addAttribute(BugzillaReportElement.OP_SYS.getKeyString(), a);
Lines 613-619 Link Here
613
		for (String option : optionValues) {
614
		for (String option : optionValues) {
614
			a.addOption(option, option);
615
			a.addOption(option, option);
615
		}
616
		}
616
		a.setValue(optionValues.get((optionValues.size() / 2)));
617
		a.setValue(optionValues.get((optionValues.size() / 2))); // choose middle priority
617
618
618
		newTaskData.addAttribute(BugzillaReportElement.PRIORITY.getKeyString(), a);
619
		newTaskData.addAttribute(BugzillaReportElement.PRIORITY.getKeyString(), a);
619
		// attributes.put(a.getName(), a);
620
		// attributes.put(a.getName(), a);
Lines 623-629 Link Here
623
		for (String option : optionValues) {
624
		for (String option : optionValues) {
624
			a.addOption(option, option);
625
			a.addOption(option, option);
625
		}
626
		}
626
		a.setValue(optionValues.get((optionValues.size() / 2)));
627
		a.setValue(optionValues.get((optionValues.size() / 2))); // choose middle severity
627
628
628
		newTaskData.addAttribute(BugzillaReportElement.BUG_SEVERITY.getKeyString(), a);
629
		newTaskData.addAttribute(BugzillaReportElement.BUG_SEVERITY.getKeyString(), a);
629
		// attributes.put(a.getName(), a);
630
		// 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 255-258 Link Here
255
255
256
	public static final String TIMESTAMP_NOT_AVAILABLE = "n/a";
256
	public static final String TIMESTAMP_NOT_AVAILABLE = "n/a";
257
257
258
	public static final String BUGZILLA_DEF_OS = "bugzilla.default.os";
259
260
	public static final String BUGZILLA_DEF_PLATFORM = "bugzilla.default.platform";
261
258
}
262
}

Return to bug 159397