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

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java (+48 lines)
Lines 16-21 Link Here
16
import java.util.List;
16
import java.util.List;
17
import java.util.Set;
17
import java.util.Set;
18
18
19
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.jface.dialogs.Dialog;
20
import org.eclipse.jface.dialogs.Dialog;
20
import org.eclipse.jface.dialogs.MessageDialog;
21
import org.eclipse.jface.dialogs.MessageDialog;
21
import org.eclipse.jface.layout.GridDataFactory;
22
import org.eclipse.jface.layout.GridDataFactory;
Lines 88-93 Link Here
88
89
89
	protected Text votesText;
90
	protected Text votesText;
90
91
92
	protected Text assignedTo;
93
91
	/**
94
	/**
92
	 * Creates a new <code>ExistingBugEditor</code>.
95
	 * Creates a new <code>ExistingBugEditor</code>.
93
	 */
96
	 */
Lines 634-637 Link Here
634
		}
637
		}
635
		return bugzillaDuplicateDetectors;
638
		return bugzillaDuplicateDetectors;
636
	}
639
	}
640
641
	/**
642
	 * @author Frank Becker (bug 198027)
643
	 */
644
	@Override
645
	protected void addAssignedTo(Composite peopleComposite) {
646
		RepositoryTaskAttribute assignedAttribute = taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED);
647
		if (assignedAttribute != null) {
648
			String bugzillaVersion;
649
			try {
650
				bugzillaVersion = BugzillaCorePlugin.getRepositoryConfiguration(repository, false).getInstallVersion();
651
			} catch (CoreException e1) {
652
				// ignore
653
				bugzillaVersion = "2.18";
654
			}
655
			if (bugzillaVersion.compareTo("3.1")<0) {
656
				// old bugzilla workflow is used
657
				super.addAssignedTo(peopleComposite);
658
				return;
659
			}
660
			Label label = createLabel(peopleComposite, assignedAttribute);
661
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
662
			assignedTo = createTextField(peopleComposite, assignedAttribute, SWT.FLAT);
663
			GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(assignedTo);
664
			assignedTo.addModifyListener(new ModifyListener() {
665
				public void modifyText(ModifyEvent e) {
666
					String sel = assignedTo.getText();
667
					RepositoryTaskAttribute a = taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED);
668
					if (!(a.getValue().equals(sel))) {
669
						a.setValue(sel);
670
						markDirty(true);
671
					}
672
				}
673
			});
674
			FormToolkit toolkit = getManagedForm().getToolkit();
675
			Label dummylabel = toolkit.createLabel(peopleComposite, "");
676
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(dummylabel);
677
			RepositoryTaskAttribute attribute = taskData.getAttribute(BugzillaReportElement.SET_DEFAULT_ASSIGNEE.getKeyString());
678
			if (attribute == null) {
679
				taskData.setAttributeValue(BugzillaReportElement.SET_DEFAULT_ASSIGNEE.getKeyString(), "0");
680
				attribute = taskData.getAttribute(BugzillaReportElement.SET_DEFAULT_ASSIGNEE.getKeyString());
681
			}
682
			addButtonField(peopleComposite, attribute, SWT.CHECK);
683
		}
684
	}
637
}
685
}
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java (-8 / +17 lines)
Lines 1791-1804 Link Here
1791
		peopleComposite.setLayout(layout);
1791
		peopleComposite.setLayout(layout);
1792
		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(peopleComposite);
1792
		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(peopleComposite);
1793
1793
1794
		RepositoryTaskAttribute assignedAttribute = taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED);
1794
		addAssignedTo(peopleComposite);
1795
		if (assignedAttribute != null) {
1795
		
1796
			Label label = createLabel(peopleComposite, assignedAttribute);
1797
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
1798
			Text textField = createTextField(peopleComposite, assignedAttribute, SWT.FLAT | SWT.READ_ONLY);
1799
			GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(textField);
1800
		}
1801
1802
		RepositoryTaskAttribute reporterAttribute = taskData.getAttribute(RepositoryTaskAttribute.USER_REPORTER);
1796
		RepositoryTaskAttribute reporterAttribute = taskData.getAttribute(RepositoryTaskAttribute.USER_REPORTER);
1803
		if (reporterAttribute != null) {
1797
		if (reporterAttribute != null) {
1804
1798
Lines 3474-3477 Link Here
3474
		controlBySelectableObject.remove(item);
3468
		controlBySelectableObject.remove(item);
3475
	}
3469
	}
3476
3470
3471
	/**
3472
	 * This method allow you to overwrite the generation of the form area for "assigned to" in the peopleLayout.<br><br>
3473
	 * The overwrite is used for Bugzilla Versions > 3.0
3474
	 * @since 2.1
3475
	 * @author Frank Becker (bug 198027)
3476
	 */
3477
	protected void addAssignedTo(Composite peopleComposite) {
3478
		RepositoryTaskAttribute assignedAttribute = taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED);
3479
		if (assignedAttribute != null) {
3480
			Label label = createLabel(peopleComposite, assignedAttribute);
3481
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
3482
			Text textField = createTextField(peopleComposite, assignedAttribute, SWT.FLAT | SWT.READ_ONLY);
3483
			GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(textField);			
3484
		}
3485
	}
3477
}
3486
}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java (-6 / +16 lines)
Lines 179-188 Link Here
179
179
180
	public void configureTaskData(TaskRepository repository, RepositoryTaskData taskData) throws CoreException {
180
	public void configureTaskData(TaskRepository repository, RepositoryTaskData taskData) throws CoreException {
181
		connector.updateAttributeOptions(repository, taskData);
181
		connector.updateAttributeOptions(repository, taskData);
182
		addValidOperations(taskData, repository.getUserName());
182
		addValidOperations(taskData, repository.getUserName(), repository);
183
	}
183
	}
184
184
185
	private void addValidOperations(RepositoryTaskData bugReport, String userName) throws CoreException {
185
	private void addValidOperations(RepositoryTaskData bugReport, String userName, TaskRepository repository)
186
			throws CoreException {
186
		BUGZILLA_REPORT_STATUS status;
187
		BUGZILLA_REPORT_STATUS status;
187
		try {
188
		try {
188
			status = BUGZILLA_REPORT_STATUS.valueOf(bugReport.getStatus());
189
			status = BUGZILLA_REPORT_STATUS.valueOf(bugReport.getStatus());
Lines 198-212 Link Here
198
			addOperation(bugReport, BUGZILLA_OPERATION.accept, userName);
199
			addOperation(bugReport, BUGZILLA_OPERATION.accept, userName);
199
			addOperation(bugReport, BUGZILLA_OPERATION.resolve, userName);
200
			addOperation(bugReport, BUGZILLA_OPERATION.resolve, userName);
200
			addOperation(bugReport, BUGZILLA_OPERATION.duplicate, userName);
201
			addOperation(bugReport, BUGZILLA_OPERATION.duplicate, userName);
201
			addOperation(bugReport, BUGZILLA_OPERATION.reassign, userName);
202
			addOperation(bugReport, BUGZILLA_OPERATION.reassignbycomponent, userName);
203
			break;
202
			break;
204
		case ASSIGNED:
203
		case ASSIGNED:
205
			addOperation(bugReport, BUGZILLA_OPERATION.none, userName);
204
			addOperation(bugReport, BUGZILLA_OPERATION.none, userName);
206
			addOperation(bugReport, BUGZILLA_OPERATION.resolve, userName);
205
			addOperation(bugReport, BUGZILLA_OPERATION.resolve, userName);
207
			addOperation(bugReport, BUGZILLA_OPERATION.duplicate, userName);
206
			addOperation(bugReport, BUGZILLA_OPERATION.duplicate, userName);
208
			addOperation(bugReport, BUGZILLA_OPERATION.reassign, userName);
209
			addOperation(bugReport, BUGZILLA_OPERATION.reassignbycomponent, userName);
210
			break;
207
			break;
211
		case RESOLVED:
208
		case RESOLVED:
212
			addOperation(bugReport, BUGZILLA_OPERATION.none, userName);
209
			addOperation(bugReport, BUGZILLA_OPERATION.none, userName);
Lines 223-228 Link Here
223
			addOperation(bugReport, BUGZILLA_OPERATION.reopen, userName);
220
			addOperation(bugReport, BUGZILLA_OPERATION.reopen, userName);
224
			addOperation(bugReport, BUGZILLA_OPERATION.close, userName);
221
			addOperation(bugReport, BUGZILLA_OPERATION.close, userName);
225
		}
222
		}
223
		String bugzillaVersion;
224
		try {
225
			bugzillaVersion = BugzillaCorePlugin.getRepositoryConfiguration(repository, false).getInstallVersion();
226
		} catch (CoreException e1) {
227
			// ignore
228
			bugzillaVersion = "2.18";
229
		}
230
		if (bugzillaVersion.compareTo("3.1") < 0
231
				&& (status == BUGZILLA_REPORT_STATUS.NEW || status == BUGZILLA_REPORT_STATUS.ASSIGNED)) {
232
			// old bugzilla workflow is used
233
			addOperation(bugReport, BUGZILLA_OPERATION.reassign, userName);
234
			addOperation(bugReport, BUGZILLA_OPERATION.reassignbycomponent, userName);
235
		}
226
	}
236
	}
227
237
228
	private void addOperation(RepositoryTaskData bugReport, BUGZILLA_OPERATION opcode, String userName) {
238
	private void addOperation(RepositoryTaskData bugReport, BUGZILLA_OPERATION opcode, String userName) {
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaReportElement.java (-1 / +1 lines)
Lines 35-41 Link Here
35
			false), PRIORITY("Priority:", "priority", false, false), PRODUCT("Product:", "product", false), REP_PLATFORM(
35
			false), PRIORITY("Priority:", "priority", false, false), PRODUCT("Product:", "product", false), REP_PLATFORM(
36
			"Platform:", "rep_platform", false), REPORTER("Reporter:", "reporter", true, true), REPORTER_ACCESSIBLE(
36
			"Platform:", "rep_platform", false), REPORTER("Reporter:", "reporter", true, true), REPORTER_ACCESSIBLE(
37
			"Reporter", "reporter_accessible", true), RESOLUTION("Resolution:", "resolution", false, true), // Exiting bug field, new cc
37
			"Reporter", "reporter_accessible", true), RESOLUTION("Resolution:", "resolution", false, true), // Exiting bug field, new cc
38
	REMAINING_TIME("Hours Left:", "remaining_time", true), SHORT_DESC("Summary:", "short_desc", true), TARGET_MILESTONE(
38
	REMAINING_TIME("Hours Left:", "remaining_time", true), SET_DEFAULT_ASSIGNEE("Reassign to default assignee", "set_default_assignee", false), SHORT_DESC("Summary:", "short_desc", true), TARGET_MILESTONE(
39
			"Target milestone:", "target_milestone", false), THETEXT("thetext", "thetext", false, true), TYPE("type",
39
			"Target milestone:", "target_milestone", false), THETEXT("thetext", "thetext", false, true), TYPE("type",
40
			"type"), UNKNOWN("UNKNOWN", "UNKNOWN"), VERSION("Version:", "version", false), INSTALL_VERSION(
40
			"type"), UNKNOWN("UNKNOWN", "UNKNOWN"), VERSION("Version:", "version", false), INSTALL_VERSION(
41
			"version of bugzilla installed", "install_version", true), VOTES("Votes:", "votes", true, true), WORK_TIME(
41
			"version of bugzilla installed", "install_version", true), VOTES("Votes:", "votes", true, true), WORK_TIME(
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java (-1 / +1 lines)
Lines 886-892 Link Here
886
			} else if (a.getId().equals(BugzillaReportElement.CC.getKeyString())
886
			} else if (a.getId().equals(BugzillaReportElement.CC.getKeyString())
887
					|| a.getId().equals(RepositoryTaskAttribute.REMOVE_CC)
887
					|| a.getId().equals(RepositoryTaskAttribute.REMOVE_CC)
888
					|| a.getId().equals(BugzillaReportElement.REPORTER.getKeyString())
888
					|| a.getId().equals(BugzillaReportElement.REPORTER.getKeyString())
889
					|| a.getId().equals(BugzillaReportElement.ASSIGNED_TO.getKeyString())
889
//					|| a.getId().equals(BugzillaReportElement.ASSIGNED_TO.getKeyString())
890
					|| a.getId().equals(BugzillaReportElement.CREATION_TS.getKeyString())) {
890
					|| a.getId().equals(BugzillaReportElement.CREATION_TS.getKeyString())) {
891
				continue;
891
				continue;
892
			} else if (a.getId() != null && a.getId().compareTo("") != 0) {
892
			} else if (a.getId() != null && a.getId().compareTo("") != 0) {

Return to bug 198027