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 322867 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java (-24 / +12 lines)
Lines 611-643 Link Here
611
			BugzillaTaskDataHandler.createAttribute(existingReport, element);
611
			BugzillaTaskDataHandler.createAttribute(existingReport, element);
612
		}
612
		}
613
		String useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE);
613
		String useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE);
614
		if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
614
		BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.TARGET_MILESTONE,
615
			BugzillaTaskDataHandler.createAttribute(existingReport, BugzillaAttribute.TARGET_MILESTONE);
615
				IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE, taskRepository, existingReport, true);
616
		}
617
		for (BugzillaAttribute element : reportElements2) {
616
		for (BugzillaAttribute element : reportElements2) {
618
			BugzillaTaskDataHandler.createAttribute(existingReport, element);
617
			BugzillaTaskDataHandler.createAttribute(existingReport, element);
619
		}
618
		}
620
		useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USEQACONTACT);
619
		BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.QA_CONTACT, IBugzillaConstants.BUGZILLA_PARAM_USEQACONTACT,
621
		if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
620
				taskRepository, existingReport, true);
622
			BugzillaTaskDataHandler.createAttribute(existingReport, BugzillaAttribute.QA_CONTACT);
621
		BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.STATUS_WHITEBOARD,
623
		}
622
				IBugzillaConstants.BUGZILLA_PARAM_USESTATUSWHITEBOARD, taskRepository, existingReport, true);
624
		useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USESTATUSWHITEBOARD);
623
		BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.ALIAS, IBugzillaConstants.BUGZILLA_PARAM_USEBUGALIASES,
625
		if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
624
				taskRepository, existingReport, false);
626
			BugzillaTaskDataHandler.createAttribute(existingReport, BugzillaAttribute.STATUS_WHITEBOARD);
625
		BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.CLASSIFICATION,
627
		}
626
				IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION, taskRepository, existingReport, false);
628
		useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USEBUGALIASES);
627
		BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.SEE_ALSO, IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO,
629
		if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
628
				taskRepository, existingReport, false);
630
			BugzillaTaskDataHandler.createAttribute(existingReport, BugzillaAttribute.ALIAS);
631
		}
632
		useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION);
633
		if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
634
			BugzillaTaskDataHandler.createAttribute(existingReport, BugzillaAttribute.CLASSIFICATION);
635
		}
636
		useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO);
637
		if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
638
			BugzillaTaskDataHandler.createAttribute(existingReport, BugzillaAttribute.SEE_ALSO);
639
		}
640
641
	}
629
	}
642
630
643
	public static String getBugUrlWithoutLogin(String repositoryUrl, String id) {
631
	public static String getBugUrlWithoutLogin(String repositoryUrl, String id) {
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaUtil.java (+67 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 Frank Becker and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Frank Becker - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.internal.bugzilla.core;
13
14
import org.eclipse.mylyn.tasks.core.TaskRepository;
15
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
16
import org.eclipse.mylyn.tasks.core.data.TaskData;
17
18
public class BugzillaUtil {
19
	public static void addAttributeIfUsed(BugzillaAttribute constant, String propertyName,
20
			TaskRepository taskRepository, TaskData existingReport, boolean createWhenNull) {
21
		String useParam = taskRepository.getProperty(propertyName);
22
		if (createWhenNull) {
23
			if (useParam == null || (useParam != null && useParam.equals("true"))) { //$NON-NLS-1$
24
				BugzillaTaskDataHandler.createAttribute(existingReport, constant);
25
			}
26
		} else {
27
			if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
28
				BugzillaTaskDataHandler.createAttribute(existingReport, constant);
29
			}
30
31
		}
32
	}
33
34
	public static void createAttributeWithKindDefaultIfUsed(String parsedText, BugzillaAttribute tag,
35
			TaskData repositoryTaskData, String propertyName, boolean defaultWhenNull) {
36
37
		TaskAttribute attribute = repositoryTaskData.getRoot().getMappedAttribute(tag.getKey());
38
		if (attribute == null) {
39
			attribute = BugzillaTaskDataHandler.createAttribute(repositoryTaskData, tag);
40
			attribute.setValue(parsedText);
41
		} else {
42
			attribute.addValue(parsedText);
43
		}
44
//		TaskRepository repository = repositoryTaskData.getAttributeMapper().getTaskRepository();
45
//		repository.removeProperty(IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO);
46
//		repository.removeProperty(IBugzillaConstants.BUGZILLA_PARAM_USEBUGALIASES);
47
//		repository.removeProperty(IBugzillaConstants.BUGZILLA_PARAM_USEQACONTACT);
48
//		repository.removeProperty(IBugzillaConstants.BUGZILLA_PARAM_USESTATUSWHITEBOARD);
49
//		repository.removeProperty(IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE);
50
//		repository.removeProperty(IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION);
51
		String useParam = repositoryTaskData.getAttributeMapper().getTaskRepository().getProperty(propertyName);
52
		if (defaultWhenNull) {
53
			if (useParam == null || (useParam != null && useParam.equals("true"))) { //$NON-NLS-1$
54
				attribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
55
			} else {
56
				attribute.getMetaData().setKind(null);
57
			}
58
		} else {
59
			if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
60
				attribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
61
			} else {
62
				attribute.getMetaData().setKind(null);
63
			}
64
		}
65
66
	}
67
}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java (-35 / +18 lines)
Lines 487-532 Link Here
487
				attachment.setAuthor(author);
487
				attachment.setAuthor(author);
488
			}
488
			}
489
			break;
489
			break;
490
		case CLASSIFICATION:
491
		case TARGET_MILESTONE:
490
		case TARGET_MILESTONE:
491
			BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
492
					IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE, true);
493
			break;
492
		case QA_CONTACT:
494
		case QA_CONTACT:
495
			BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
496
					IBugzillaConstants.BUGZILLA_PARAM_USEQACONTACT, true);
497
			break;
493
		case STATUS_WHITEBOARD:
498
		case STATUS_WHITEBOARD:
499
			BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
500
					IBugzillaConstants.BUGZILLA_PARAM_USESTATUSWHITEBOARD, true);
501
			break;
502
		case CLASSIFICATION:
503
			BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
504
					IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION, false);
505
			break;
494
		case ALIAS:
506
		case ALIAS:
507
			BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
508
					IBugzillaConstants.BUGZILLA_PARAM_USEBUGALIASES, false);
509
			break;
495
		case SEE_ALSO:
510
		case SEE_ALSO:
496
			TaskAttribute suppressAttribute = createAttrribute(parsedText, tag);
511
			BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
497
			String propertyName = null;
512
					IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO, false);
498
			switch (tag) {
499
			case CLASSIFICATION:
500
				propertyName = IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION;
501
				break;
502
			case TARGET_MILESTONE:
503
				propertyName = IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE;
504
				break;
505
			case QA_CONTACT:
506
				propertyName = IBugzillaConstants.BUGZILLA_PARAM_USEQACONTACT;
507
				break;
508
			case STATUS_WHITEBOARD:
509
				propertyName = IBugzillaConstants.BUGZILLA_PARAM_USESTATUSWHITEBOARD;
510
				break;
511
			case ALIAS:
512
				propertyName = IBugzillaConstants.BUGZILLA_PARAM_USEBUGALIASES;
513
				break;
514
			case SEE_ALSO:
515
				propertyName = IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO;
516
				break;
517
			default:
518
				propertyName = null;
519
				break;
520
			}
521
			String useParam = repositoryTaskData.getAttributeMapper().getTaskRepository().getProperty(propertyName);
522
			if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
523
				suppressAttribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
524
				if (BugzillaAttribute.CLASSIFICATION.equals(tag)) {
525
					suppressAttribute.getMetaData().setReadOnly(true);
526
				}
527
			} else {
528
				suppressAttribute.getMetaData().setKind(null);
529
			}
530
			break;
513
			break;
531
		default:
514
		default:
532
			createAttrribute(parsedText, tag);
515
			createAttrribute(parsedText, tag);
(-)plugin.xml (-1 / +1 lines)
Lines 20-26 Link Here
20
         repositoryKind="bugzilla"
20
         repositoryKind="bugzilla"
21
         urlRepository="https://bugs.eclipse.org/bugs"
21
         urlRepository="https://bugs.eclipse.org/bugs"
22
         version="3.4.4">
22
         version="3.4.4">
23
         <attribute name="useclassification" value="true"/>
23
         <attribute name="useclassification" value="false"/>
24
         <attribute name="usetargetmilestone" value="true"/>
24
         <attribute name="usetargetmilestone" value="true"/>
25
         <attribute name="useqacontact" value="true"/>
25
         <attribute name="useqacontact" value="true"/>
26
         <attribute name="usestatuswhiteboard" value="true"/>
26
         <attribute name="usestatuswhiteboard" value="true"/>
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java (-20 / +26 lines)
Lines 151-157 Link Here
151
	@Override
151
	@Override
152
	protected void createAdditionalControls(Composite parent) {
152
	protected void createAdditionalControls(Composite parent) {
153
		addRepositoryTemplatesToServerUrlCombo();
153
		addRepositoryTemplatesToServerUrlCombo();
154
155
		Label shortLoginLabel = new Label(parent, SWT.NONE);
154
		Label shortLoginLabel = new Label(parent, SWT.NONE);
156
		shortLoginLabel.setText(LABEL_SHORT_LOGINS);
155
		shortLoginLabel.setText(LABEL_SHORT_LOGINS);
157
		cleanQAContact = new Button(parent, SWT.CHECK | SWT.LEFT);
156
		cleanQAContact = new Button(parent, SWT.CHECK | SWT.LEFT);
Lines 360-384 Link Here
360
						break;
359
						break;
361
					}
360
					}
362
				}
361
				}
363
362
				if (myTemplate != null) {
364
			}
363
					// we have an Template but no values in the Repository so we use the Template values
365
			if (myTemplate != null) {
364
					boolean value = Boolean.parseBoolean(myTemplate.getAttribute("useclassification")); //$NON-NLS-1$
366
				// we have an Template but no values in the Repository so we use the Template values
365
					useclassification.setSelection(!value);
367
				boolean value = Boolean.parseBoolean(myTemplate.getAttribute("useclassification")); //$NON-NLS-1$
366
					value = Boolean.parseBoolean(myTemplate.getAttribute("usetargetmilestone")); //$NON-NLS-1$
368
				useclassification.setSelection(!value);
367
					usetargetmilestone.setSelection(!value);
369
				value = Boolean.parseBoolean(myTemplate.getAttribute("usetargetmilestone")); //$NON-NLS-1$
368
					value = Boolean.parseBoolean(myTemplate.getAttribute("useqacontact")); //$NON-NLS-1$
370
				usetargetmilestone.setSelection(!value);
369
					useqacontact.setSelection(!value);
371
				value = Boolean.parseBoolean(myTemplate.getAttribute("useqacontact")); //$NON-NLS-1$
370
					value = Boolean.parseBoolean(myTemplate.getAttribute("usestatuswhiteboard")); //$NON-NLS-1$
372
				useqacontact.setSelection(!value);
371
					usestatuswhiteboard.setSelection(!value);
373
				value = Boolean.parseBoolean(myTemplate.getAttribute("usestatuswhiteboard")); //$NON-NLS-1$
372
					value = Boolean.parseBoolean(myTemplate.getAttribute("usebugaliases")); //$NON-NLS-1$
374
				usestatuswhiteboard.setSelection(!value);
373
					usebugaliases.setSelection(!value);
375
				value = Boolean.parseBoolean(myTemplate.getAttribute("usebugaliases")); //$NON-NLS-1$
374
					value = Boolean.parseBoolean(myTemplate.getAttribute("use_see_also")); //$NON-NLS-1$
376
				usebugaliases.setSelection(!value);
375
					use_see_also.setSelection(!value);
377
				value = Boolean.parseBoolean(myTemplate.getAttribute("use_see_also")); //$NON-NLS-1$
376
378
				use_see_also.setSelection(!value);
377
					value = Boolean.parseBoolean(myTemplate.getAttribute("useXMLRPC")); //$NON-NLS-1$
379
378
					useXMLRPCstatusTransitions.setSelection(value);
380
				value = Boolean.parseBoolean(myTemplate.getAttribute("useXMLRPC")); //$NON-NLS-1$
379
				} else {
381
				useXMLRPCstatusTransitions.setSelection(value);
380
					useclassification.setSelection(true);
381
					usetargetmilestone.setSelection(false);
382
					useqacontact.setSelection(false);
383
					usestatuswhiteboard.setSelection(false);
384
					usebugaliases.setSelection(true);
385
					use_see_also.setSelection(true);
386
					useXMLRPCstatusTransitions.setSelection(true);
387
				}
382
			} else {
388
			} else {
383
				// we use the repository values
389
				// we use the repository values
384
				boolean value = Boolean.parseBoolean(repository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION));
390
				boolean value = Boolean.parseBoolean(repository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION));

Return to bug 322867