Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2016-07-24 18:47:09 +0000
committerSam Davis2016-07-25 20:42:16 +0000
commitacb48310b78598fc0f37ac3bf1b262bc0ee7feb5 (patch)
treeafa8f3baca6c1f2a6d984d011ac6bebfc1ea6903
parent7e5534c82054fc763ae7fd51c8d4b5ed5466fe8e (diff)
downloadorg.eclipse.mylyn.tasks-acb48310b78598fc0f37ac3bf1b262bc0ee7feb5.tar.gz
org.eclipse.mylyn.tasks-acb48310b78598fc0f37ac3bf1b262bc0ee7feb5.tar.xz
org.eclipse.mylyn.tasks-acb48310b78598fc0f37ac3bf1b262bc0ee7feb5.zip
498401: fix ContentAssist for "Add CC:"
Change-Id: I6ba24b3272b4015c6976d102d7ef6b107f54c2b2 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=498401
-rw-r--r--org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkitTest.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java21
2 files changed, 27 insertions, 18 deletions
diff --git a/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkitTest.java b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkitTest.java
index 1ff7ac11b..44b0183f6 100644
--- a/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkitTest.java
+++ b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkitTest.java
@@ -26,6 +26,7 @@ import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.commons.workbench.editors.CommonTextSupport;
import org.eclipse.mylyn.internal.tasks.ui.OptionsProposalProvider;
+import org.eclipse.mylyn.internal.tasks.ui.PersonProposalProvider;
import org.eclipse.mylyn.internal.tasks.ui.editors.LabelsAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.MultiSelectionAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.SingleSelectionAttributeEditor;
@@ -109,23 +110,30 @@ public class AttributeEditorToolkitTest {
@Test
public void testAdaptLabelsAttributeEditor() {
- assertOptionsProposalProvider(true);
- assertOptionsProposalProvider(false);
+ assertOptionsProposalProvider(true, false);
+ assertOptionsProposalProvider(false, false);
+ assertOptionsProposalProvider(true, true);
}
- private void assertOptionsProposalProvider(boolean isMultiSelect) {
- taskAttribute.getMetaData().setType(
- isMultiSelect ? TaskAttribute.TYPE_MULTI_SELECT : TaskAttribute.TYPE_SINGLE_SELECT);
+ private void assertOptionsProposalProvider(boolean isMultiSelect, boolean isPerson) {
+ taskAttribute.getMetaData().setKind(isPerson ? TaskAttribute.KIND_PEOPLE : TaskAttribute.KIND_DEFAULT);
+ taskAttribute.getMetaData()
+ .setType(isMultiSelect ? TaskAttribute.TYPE_MULTI_SELECT : TaskAttribute.TYPE_SINGLE_SELECT);
LabelsAttributeEditor editor = new LabelsAttributeEditor(taskDataModel, taskAttribute);
editor.createControl(WorkbenchUtil.getShell(), formToolkit);
toolkit.adapt(editor);
verify(toolkit).createContentProposalProvider(editor);
- ArgumentCaptor<IContentProposalProvider> providerCaptor = ArgumentCaptor.forClass(IContentProposalProvider.class);
+ ArgumentCaptor<IContentProposalProvider> providerCaptor = ArgumentCaptor
+ .forClass(IContentProposalProvider.class);
verify(toolkit).createContentAssistCommandAdapter(eq(editor.getControl()), providerCaptor.capture());
IContentProposalProvider proposalProvider = providerCaptor.getValue();
- assertTrue(proposalProvider instanceof OptionsProposalProvider);
- assertEquals(isMultiSelect, ((OptionsProposalProvider) proposalProvider).isMultiSelect());
+ if (isPerson) {
+ assertTrue(proposalProvider instanceof PersonProposalProvider);
+ } else {
+ assertTrue(proposalProvider instanceof OptionsProposalProvider);
+ assertEquals(isMultiSelect, ((OptionsProposalProvider) proposalProvider).isMultiSelect());
+ }
assertNull(toolkit.commandAdapter.getAutoActivationCharacters());
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java
index a38bea1a7..29c1d1c42 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java
@@ -165,7 +165,7 @@ public class AttributeEditorToolkit {
/**
* Adds content assist to the given text field.
- *
+ *
* @param text
* text field to decorate.
* @param proposalProvider
@@ -175,8 +175,8 @@ public class AttributeEditorToolkit {
private ControlDecoration installContentAssistControlDecoration(Control control) {
ControlDecoration controlDecoration = new ControlDecoration(control, (SWT.TOP | SWT.LEFT));
controlDecoration.setShowOnlyOnFocus(true);
- FieldDecoration contentProposalImage = FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
+ FieldDecoration contentProposalImage = FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
controlDecoration.setImage(contentProposalImage.getImage());
IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
controlDecoration.setDescriptionText(NLS.bind(Messages.AttributeEditorToolkit_Content_Assist_Available__X_,
@@ -186,7 +186,7 @@ public class AttributeEditorToolkit {
/**
* Creates an IContentProposalProvider to provide content assist proposals for the given attribute.
- *
+ *
* @param editor
* editor for which to provide content assist.
* @return the IContentProposalProvider.
@@ -194,7 +194,8 @@ public class AttributeEditorToolkit {
IContentProposalProvider createContentProposalProvider(AbstractAttributeEditor editor) {
TaskAttribute attribute = editor.getTaskAttribute();
Map<String, String> proposals = attribute.getTaskData().getAttributeMapper().getOptions(attribute);
- if (editor instanceof LabelsAttributeEditor) {
+ if (editor instanceof LabelsAttributeEditor
+ && !attribute.getMetaData().getKind().equals(TaskAttribute.KIND_PEOPLE)) {
return new OptionsProposalProvider(proposals,
TaskAttribute.TYPE_MULTI_SELECT.equals(attribute.getMetaData().getType()));
}
@@ -220,7 +221,7 @@ public class AttributeEditorToolkit {
/**
* Subclasses that support HTML preview of ticket description and comments override this method to return an
* instance of AbstractRenderingEngine
- *
+ *
* @return <code>null</code> if HTML preview is not supported for the repository (default)
* @since 2.1
*/
@@ -230,7 +231,7 @@ public class AttributeEditorToolkit {
/**
* Called to check if there's content assist available for the given attribute.
- *
+ *
* @param attribute
* the attribute
* @return true if content assist is available for the specified attribute.
@@ -263,7 +264,7 @@ public class AttributeEditorToolkit {
/**
* Adds input validation to an attribute editor and a controlDecoration if invalid
- *
+ *
* @since 3.5
*/
public static void createValidator(final AbstractAttributeEditor attributeEditor, Control control,
@@ -273,8 +274,8 @@ public class AttributeEditorToolkit {
Assert.isNotNull(attributeEditor);
final ControlDecoration decoration = new ControlDecoration(control, SWT.BOTTOM | SWT.LEFT);
decoration.setMarginWidth(2);
- FieldDecoration errorDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_ERROR);
+ FieldDecoration errorDecoration = FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
decoration.setImage(errorDecoration.getImage());
decoration.hide();
final TaskDataModelListener validationListener = new TaskDataModelListener() {

Back to the top