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 |
} |