View | Details | Raw Unified | Return to bug 209073 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java (+13 lines)
Lines 665-670 Link Here
665
		a.setHidden(false);
665
		a.setHidden(false);
666
666
667
		newTaskData.addAttribute(BugzillaReportElement.BUG_FILE_LOC.getKeyString(), a);
667
		newTaskData.addAttribute(BugzillaReportElement.BUG_FILE_LOC.getKeyString(), a);
668
669
		a = BugzillaClient.makeNewAttribute(BugzillaReportElement.DEPENDSON);
670
		a.setValue("");
671
		a.setReadOnly(false);
672
		newTaskData.addAttribute(BugzillaReportElement.DEPENDSON.getKeyString(), a);
673
		a = BugzillaClient.makeNewAttribute(BugzillaReportElement.BLOCKED);
674
		a.setValue("");
675
		a.setReadOnly(false);
676
		newTaskData.addAttribute(BugzillaReportElement.BLOCKED.getKeyString(), a);
677
		a = BugzillaClient.makeNewAttribute(BugzillaReportElement.NEWCC);
678
		a.setValue("");
679
		a.setReadOnly(false);
680
		newTaskData.addAttribute(BugzillaReportElement.NEWCC.getKeyString(), a);
668
		// attributes.put(a.getName(), a);
681
		// attributes.put(a.getName(), a);
669
682
670
		// newReport.attributes = attributes;
683
		// newReport.attributes = attributes;
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java (-1 / +10 lines)
Lines 3584-3595 Link Here
3584
		if (assignedAttribute != null) {
3584
		if (assignedAttribute != null) {
3585
			Label label = createLabel(peopleComposite, assignedAttribute);
3585
			Label label = createLabel(peopleComposite, assignedAttribute);
3586
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
3586
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
3587
			Text textField = createTextField(peopleComposite, assignedAttribute, SWT.FLAT | SWT.READ_ONLY);
3587
			Text textField = createTextField(peopleComposite, assignedAttribute, SWT.FLAT);
3588
			GridDataFactory.fillDefaults().grab(true, false).applyTo(textField);
3588
			GridDataFactory.fillDefaults().grab(true, false).applyTo(textField);
3589
			if (haveRealName) {
3589
			if (haveRealName) {
3590
				textField.setText(textField.getText() + " <"
3590
				textField.setText(textField.getText() + " <"
3591
						+ taskData.getAttributeValue(RepositoryTaskAttribute.USER_ASSIGNED) + ">");
3591
						+ taskData.getAttributeValue(RepositoryTaskAttribute.USER_ASSIGNED) + ">");
3592
			}
3592
			}
3593
3594
			
3595
			ContentAssistCommandAdapter adapter = applyContentAssist(textField,
3596
					createContentProposalProvider(assignedAttribute));
3597
			ILabelProvider propsalLabelProvider = createProposalLabelProvider(assignedAttribute);
3598
			if (propsalLabelProvider != null) {
3599
				adapter.setLabelProvider(propsalLabelProvider);
3600
			}
3601
			adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
3593
		}
3602
		}
3594
	}
3603
	}
3595
3604
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java (+11 lines)
Lines 17-23 Link Here
17
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.jface.dialogs.Dialog;
18
import org.eclipse.jface.dialogs.Dialog;
19
import org.eclipse.jface.dialogs.MessageDialog;
19
import org.eclipse.jface.dialogs.MessageDialog;
20
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
20
import org.eclipse.jface.layout.GridDataFactory;
21
import org.eclipse.jface.layout.GridDataFactory;
22
import org.eclipse.jface.viewers.ILabelProvider;
21
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
23
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
22
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement;
24
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement;
23
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
25
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
Lines 48-53 Link Here
48
import org.eclipse.swt.widgets.Shell;
50
import org.eclipse.swt.widgets.Shell;
49
import org.eclipse.swt.widgets.Text;
51
import org.eclipse.swt.widgets.Text;
50
import org.eclipse.ui.PlatformUI;
52
import org.eclipse.ui.PlatformUI;
53
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
51
import org.eclipse.ui.forms.IFormColors;
54
import org.eclipse.ui.forms.IFormColors;
52
import org.eclipse.ui.forms.editor.FormEditor;
55
import org.eclipse.ui.forms.editor.FormEditor;
53
import org.eclipse.ui.forms.events.HyperlinkAdapter;
56
import org.eclipse.ui.forms.events.HyperlinkAdapter;
Lines 635-640 Link Here
635
					}
638
					}
636
				}
639
				}
637
			});
640
			});
641
			ContentAssistCommandAdapter adapter = applyContentAssist(assignedTo,
642
					createContentProposalProvider(assignedAttribute));
643
			ILabelProvider propsalLabelProvider = createProposalLabelProvider(assignedAttribute);
644
			if (propsalLabelProvider != null) {
645
				adapter.setLabelProvider(propsalLabelProvider);
646
			}
647
			adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
648
638
			FormToolkit toolkit = getManagedForm().getToolkit();
649
			FormToolkit toolkit = getManagedForm().getToolkit();
639
			Label dummylabel = toolkit.createLabel(peopleComposite, "");
650
			Label dummylabel = toolkit.createLabel(peopleComposite, "");
640
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(dummylabel);
651
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(dummylabel);
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java (-23 / +97 lines)
Lines 7-22 Link Here
7
 *******************************************************************************/
7
 *******************************************************************************/
8
package org.eclipse.mylyn.internal.bugzilla.ui.editor;
8
package org.eclipse.mylyn.internal.bugzilla.ui.editor;
9
9
10
import org.eclipse.core.runtime.CoreException;
10
import org.eclipse.core.runtime.IProgressMonitor;
11
import org.eclipse.core.runtime.IProgressMonitor;
11
import org.eclipse.jface.dialogs.MessageDialog;
12
import org.eclipse.jface.dialogs.MessageDialog;
12
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
13
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
13
import org.eclipse.jface.layout.GridDataFactory;
14
import org.eclipse.jface.layout.GridDataFactory;
14
import org.eclipse.jface.viewers.ILabelProvider;
15
import org.eclipse.jface.viewers.ILabelProvider;
16
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
15
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement;
17
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement;
16
import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin;
18
import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin;
17
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
19
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
18
import org.eclipse.mylyn.tasks.ui.editors.AbstractNewRepositoryTaskEditor;
20
import org.eclipse.mylyn.tasks.ui.editors.AbstractNewRepositoryTaskEditor;
19
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.events.ModifyEvent;
23
import org.eclipse.swt.events.ModifyListener;
24
import org.eclipse.swt.layout.GridData;
20
import org.eclipse.swt.layout.GridLayout;
25
import org.eclipse.swt.layout.GridLayout;
21
import org.eclipse.swt.widgets.Composite;
26
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Label;
27
import org.eclipse.swt.widgets.Label;
Lines 66-95 Link Here
66
		layout.marginRight = 5;
71
		layout.marginRight = 5;
67
		peopleComposite.setLayout(layout);
72
		peopleComposite.setLayout(layout);
68
		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(peopleComposite);
73
		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(peopleComposite);
69
74
		addAssignedTo(peopleComposite);
70
		Label label = toolkit.createLabel(peopleComposite, "Assign to:");
75
		addSelfToCC(peopleComposite);
71
		GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
76
		addCCList(peopleComposite);
72
		Composite textFieldComposite = toolkit.createComposite(peopleComposite);
77
		getManagedForm().getToolkit().paintBordersFor(peopleComposite);
73
		GridDataFactory.fillDefaults().grab(true, false).applyTo(textFieldComposite);
74
		GridLayout textLayout = new GridLayout();
75
		textFieldComposite.setLayout(textLayout);
76
77
		RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED);
78
79
		Text textField = createTextField(textFieldComposite, attribute, SWT.FLAT);
80
		toolkit.paintBordersFor(textFieldComposite);
81
		GridDataFactory.fillDefaults().grab(true, false).applyTo(textField);
82
		peopleSection.setClient(peopleComposite);
78
		peopleSection.setClient(peopleComposite);
83
79
		peopleSection.setEnabled(true);
84
		ContentAssistCommandAdapter adapter = applyContentAssist(textField, createContentProposalProvider(attribute));
85
86
		ILabelProvider propsalLabelProvider = createProposalLabelProvider(attribute);
87
		if (propsalLabelProvider != null) {
88
			adapter.setLabelProvider(propsalLabelProvider);
89
		}
90
		adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
91
92
		toolkit.paintBordersFor(peopleComposite);
93
	}
80
	}
94
81
95
	@Override
82
	@Override
Lines 116-119 Link Here
116
		super.submitToRepository();
103
		super.submitToRepository();
117
	}
104
	}
118
105
106
	@Override
107
	protected void createCustomAttributeLayout(Composite composite) {
108
109
		RepositoryTaskAttribute attribute = this.taskData.getAttribute(BugzillaReportElement.DEPENDSON.getKeyString());
110
		if (attribute != null && !attribute.isReadOnly()) {
111
			Label label = createLabel(composite, attribute);
112
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
113
			Composite textFieldComposite = getManagedForm().getToolkit().createComposite(composite);
114
			GridLayout textLayout = new GridLayout();
115
			textLayout.marginWidth = 1;
116
			textLayout.marginHeight = 3;
117
			textLayout.verticalSpacing = 3;
118
			textFieldComposite.setLayout(textLayout);
119
			GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
120
			textData.horizontalSpan = 1;
121
			textData.widthHint = 135;
122
123
			final Text text = createTextField(textFieldComposite, attribute, SWT.FLAT);
124
			text.setLayoutData(textData);
125
			getManagedForm().getToolkit().paintBordersFor(textFieldComposite);
126
		}
127
128
		attribute = this.taskData.getAttribute(BugzillaReportElement.BLOCKED.getKeyString());
129
		if (attribute != null && !attribute.isReadOnly()) {
130
			Label label = createLabel(composite, attribute);
131
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
132
			Composite textFieldComposite = getManagedForm().getToolkit().createComposite(composite);
133
			GridLayout textLayout = new GridLayout();
134
			textLayout.marginWidth = 1;
135
			textLayout.marginHeight = 3;
136
			textLayout.verticalSpacing = 3;
137
			textFieldComposite.setLayout(textLayout);
138
			GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
139
			textData.horizontalSpan = 1;
140
			textData.widthHint = 135;
141
			final Text text = createTextField(textFieldComposite, attribute, SWT.FLAT);
142
			text.setLayoutData(textData);
143
			getManagedForm().getToolkit().paintBordersFor(textFieldComposite);
144
		}
145
	}
146
147
	@Override
148
	protected boolean hasContentAssist(RepositoryTaskAttribute attribute) {
149
		return BugzillaReportElement.NEWCC.getKeyString().equals(attribute.getId());
150
	}
151
	@Override
152
	protected void addAssignedTo(Composite peopleComposite) {
153
154
		RepositoryTaskAttribute assignedAttribute = taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED);
155
		if (assignedAttribute != null) {
156
			String bugzillaVersion;
157
			try {
158
				bugzillaVersion = BugzillaCorePlugin.getRepositoryConfiguration(repository, false).getInstallVersion();
159
			} catch (CoreException e1) {
160
				// ignore
161
				bugzillaVersion = "2.18";
162
			}
163
			if (bugzillaVersion.compareTo("3.1") < 0) {
164
				// old bugzilla workflow is used
165
				super.addAssignedTo(peopleComposite);
166
				return;
167
			}
168
			Label label = createLabel(peopleComposite, assignedAttribute);
169
			GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
170
			final Text assignedTo = createTextField(peopleComposite, assignedAttribute, SWT.FLAT);
171
			GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(assignedTo);
172
			assignedTo.addModifyListener(new ModifyListener() {
173
				public void modifyText(ModifyEvent e) {
174
					String sel = assignedTo.getText();
175
					RepositoryTaskAttribute a = taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED);
176
					if (!(a.getValue().equals(sel))) {
177
						a.setValue(sel);
178
						markDirty(true);
179
					}
180
				}
181
			});
182
183
			ContentAssistCommandAdapter adapter = applyContentAssist(assignedTo,
184
					createContentProposalProvider(assignedAttribute));
185
			ILabelProvider propsalLabelProvider = createProposalLabelProvider(assignedAttribute);
186
			if (propsalLabelProvider != null) {
187
				adapter.setLabelProvider(propsalLabelProvider);
188
			}
189
			adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
190
		}
191
	}
192
119
}
193
}

Return to bug 209073