Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2012-08-01 18:36:10 +0000
committerFrank Becker2012-08-01 18:36:10 +0000
commitfe7be2708d01b7e224d724be593ca552a703788b (patch)
treed4878448510badc06656a905c9589186488c5bab /org.eclipse.mylyn.bugzilla.ui/src
parent4e1bf657fd32c2eab2069ecba8a145d97411c629 (diff)
downloadorg.eclipse.mylyn.tasks-fe7be2708d01b7e224d724be593ca552a703788b.tar.gz
org.eclipse.mylyn.tasks-fe7be2708d01b7e224d724be593ca552a703788b.tar.xz
org.eclipse.mylyn.tasks-fe7be2708d01b7e224d724be593ca552a703788b.zip
ASSIGNED - bug 382173: user match for cc has changed in Bugzilla
https://bugs.eclipse.org/bugs/show_bug.cgi?id=382173 Change-Id: I92808d8f588b4f147ac0a0f4c073eb6506239709
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui/src')
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java56
1 files changed, 47 insertions, 9 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
index 90a33a433..ce7353c76 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
@@ -630,23 +630,25 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
BugzillaUserMatchResponse response = bugzillaStatus.getUserMatchResponse();
FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
FieldDecoration fieldDecoration = registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
+ FieldDecoration fieldDecorationWarning = registry.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
StringBuilder fields = new StringBuilder();
StringBuilder detail = new StringBuilder();
count += decorateControlsAndUpdateMessages(response.getAssignedToMsg(), response.getAssignedToProposals(),
getModel().getTaskData().getRoot().getAttribute(BugzillaAttribute.ASSIGNED_TO.getKey()), fields,
- detail, fieldDecoration);
+ detail, fieldDecoration, fieldDecorationWarning);
count += decorateControlsAndUpdateMessages(response.getQaContactMsg(), response.getQaContactProposals(),
getModel().getTaskData().getRoot().getAttribute(BugzillaAttribute.QA_CONTACT.getKey()), fields, detail,
- fieldDecoration);
+ fieldDecoration, fieldDecorationWarning);
count += decorateControlsAndUpdateMessages(response.getNewCCMsg(), response.getNewCCProposals(),
getModel().getTaskData().getRoot().getAttribute(BugzillaAttribute.NEWCC.getKey()), fields, detail,
- fieldDecoration);
+ fieldDecoration, fieldDecorationWarning);
updateTaskEditorPageMessageWithError(bugzillaStatus, detail.toString(), count == 1, fields.toString());
}
private int decorateControlsAndUpdateMessages(String message, List<String> proposals, TaskAttribute attribute,
- StringBuilder fields, StringBuilder detail, FieldDecoration fieldDecoration) {
+ StringBuilder fields, StringBuilder detail, FieldDecoration fieldDecoration,
+ FieldDecoration fieldDecorationWarning) {
if (attribute == null || (message == null && proposals.size() == 0)) {
return 0;
}
@@ -669,7 +671,41 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
}
AbstractAttributeEditor editor = getEditorForAttribute(attribute);
if (editor != null) {
- decorateEditorWithError(fieldDecoration, message, newPersonProposalMap, editor);
+ decorateEditorWithError(fieldDecoration, fieldDecorationWarning, message, newPersonProposalMap, editor);
+ }
+ return 1;
+ }
+
+ private int decorateControlsAndUpdateMessages(String message, Map<String, List<String>> proposals,
+ TaskAttribute attribute, StringBuilder fields, StringBuilder detail, FieldDecoration fieldDecoration,
+ FieldDecoration fieldDecorationWarning) {
+ if (attribute == null || (message == null && proposals.size() == 0)) {
+ return 0;
+ }
+ Map<String, String> newPersonProposalMap = new HashMap<String, String>();
+ if (fields.length() > 0) {
+ fields.append(MessageFormat.format(Messages.BugzillaTaskEditorPage_Error_Label_N, attribute.getMetaData()
+ .getLabel()));
+ } else {
+ fields.append(MessageFormat.format(Messages.BugzillaTaskEditorPage_Error_Label_1, attribute.getMetaData()
+ .getLabel()));
+ }
+ detail.append(attribute.getMetaData().getLabel() + "\n"); //$NON-NLS-1$
+ if (message != null && !message.equals("")) { //$NON-NLS-1$
+ detail.append(MessageFormat.format(Messages.BugzillaTaskEditorPage_DetailLine, message));
+ } else {
+ for (String key : proposals.keySet()) {
+ detail.append(MessageFormat.format("\t{0}\n", key));
+
+ for (String proposalValue : proposals.get(key)) {
+ detail.append(MessageFormat.format(Messages.BugzillaTaskEditorPage_DetailLine, proposalValue));
+ newPersonProposalMap.put(proposalValue, proposalValue);
+ }
+ }
+ }
+ AbstractAttributeEditor editor = getEditorForAttribute(attribute);
+ if (editor != null) {
+ decorateEditorWithError(fieldDecoration, fieldDecorationWarning, message, newPersonProposalMap, editor);
}
return 1;
}
@@ -726,12 +762,14 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
* @param newPersonProposalMap
* @param editor
*/
- private void decorateEditorWithError(FieldDecoration fieldDecoration, String message,
- Map<String, String> newPersonProposalMap, AbstractAttributeEditor editor) {
+ private void decorateEditorWithError(FieldDecoration fieldDecoration, FieldDecoration fieldDecorationWarning,
+ String message, Map<String, String> newPersonProposalMap, AbstractAttributeEditor editor) {
final Control control = editor.getControl();
final ControlDecoration decoration = new ControlDecoration(control, SWT.LEFT | SWT.DOWN);
- decoration.setImage(fieldDecoration.getImage());
+ decoration.setImage(newPersonProposalMap.size() == 1
+ ? fieldDecorationWarning.getImage()
+ : fieldDecoration.getImage());
IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
if (message != null && !message.equals("")) { //$NON-NLS-1$
decoration.setDescriptionText(message);
@@ -742,7 +780,7 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
bindingService.getBestActiveBindingFormattedFor(ContentAssistCommandAdapter.CONTENT_PROPOSAL_COMMAND)));
errorDecorations.add(decoration);
- PersonAttributeEditor personEditor = ((PersonAttributeEditor) editor);
+ final PersonAttributeEditor personEditor = ((PersonAttributeEditor) editor);
final PersonProposalProvider personProposalProvider = (PersonProposalProvider) personEditor.getContentAssistCommandAdapter()
.getContentProposalProvider();
personProposalProvider.setErrorProposals(newPersonProposalMap);

Back to the top