Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2012-02-08 19:59:54 +0000
committerFrank Becker2012-02-08 19:59:54 +0000
commit06b60fa726bcd610fb5d64fce6cfda07130fde32 (patch)
treea9c4e94dab5e25f6b7b08fb3593ba574d9dc9756 /org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn
parent1ed0499f33860264f9efd2e8e6824b7a28440df0 (diff)
downloadorg.eclipse.mylyn.tasks-06b60fa726bcd610fb5d64fce6cfda07130fde32.tar.gz
org.eclipse.mylyn.tasks-06b60fa726bcd610fb5d64fce6cfda07130fde32.tar.xz
org.eclipse.mylyn.tasks-06b60fa726bcd610fb5d64fce6cfda07130fde32.zip
ASSIGNED - bug 168204: [patch] support bugzilla's usermatchmode for
matching names to email addresses https://bugs.eclipse.org/bugs/show_bug.cgi?id=168204 UI Part Change-Id: I3ccd86f6a304dcd9be8e2b7b924ae53a3a22f793
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java43
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PersonAttributeEditor.java15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java3
3 files changed, 49 insertions, 12 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java
index 1b6e430d1..ca2dc11fd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java
@@ -64,6 +64,8 @@ public class PersonProposalProvider implements IContentProposalProvider {
private final Map<String, String> proposals;
+ private Map<String, String> errorProposals;
+
public PersonProposalProvider(AbstractTask task, TaskData taskData) {
this(task, taskData, new HashMap<String, String>(0));
}
@@ -117,19 +119,21 @@ public class PersonProposalProvider implements IContentProposalProvider {
// retrieve subset of the tree set using key range
SortedSet<String> addressSet = getAddressSet();
- if (!searchText.equals("")) { //$NON-NLS-1$
- // lower bounds
- searchText = searchText.toLowerCase();
+ if (errorProposals == null || errorProposals.isEmpty()) {
+ if (!searchText.equals("")) { //$NON-NLS-1$
+ // lower bounds
+ searchText = searchText.toLowerCase();
- // compute the upper bound
- char[] nextWord = searchText.toCharArray();
- nextWord[searchText.length() - 1]++;
+ // compute the upper bound
+ char[] nextWord = searchText.toCharArray();
+ nextWord[searchText.length() - 1]++;
- // filter matching keys
- addressSet = new TreeSet<String>(addressSet.subSet(searchText, new String(nextWord)));
+ // filter matching keys
+ addressSet = new TreeSet<String>(addressSet.subSet(searchText, new String(nextWord)));
- // add matching keys based on pretty names
- addMatchingProposalsByPrettyName(addressSet, searchText);
+ // add matching keys based on pretty names
+ addMatchingProposalsByPrettyName(addressSet, searchText);
+ }
}
IContentProposal[] result = new IContentProposal[addressSet.size()];
@@ -207,6 +211,13 @@ public class PersonProposalProvider implements IContentProposalProvider {
}
});
+ if (errorProposals != null && !errorProposals.isEmpty()) {
+ for (String proposal : errorProposals.keySet()) {
+ addAddress(addressSet, proposal);
+ }
+ return addressSet;
+ }
+
if (proposals.size() > 0) {
if (repositoryUrl != null && connectorKind != null) {
currentUser = getCurrentUser(repositoryUrl, connectorKind);
@@ -322,4 +333,16 @@ public class PersonProposalProvider implements IContentProposalProvider {
}
}
+ public Map<String, String> getProposals() {
+ return proposals;
+ }
+
+ public Map<String, String> getErrorProposals() {
+ return errorProposals;
+ }
+
+ public void setErrorProposals(Map<String, String> errorProposals) {
+ this.errorProposals = errorProposals;
+ addressSet = null;
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PersonAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PersonAttributeEditor.java
index 42fb23043..40ee93f0c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PersonAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PersonAttributeEditor.java
@@ -26,6 +26,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -36,6 +37,8 @@ import org.eclipse.ui.forms.widgets.ImageHyperlink;
*/
public class PersonAttributeEditor extends TextAttributeEditor {
+ private ContentAssistCommandAdapter contentAssistCommandAdapter = null;
+
public PersonAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
super(manager, taskAttribute);
}
@@ -65,6 +68,8 @@ public class PersonAttributeEditor extends TextAttributeEditor {
final ImageHyperlink selfLink = new ImageHyperlink(composite, SWT.NO_FOCUS);
selfLink.setToolTipText(Messages.PersonAttributeEditor_Insert_My_User_Id_Tooltip);
+ //this is inserted to not get org.eclipse.swt.SWTException: Graphic is disposed on Mac OS Lion
+ selfLink.setImage(CommonImages.getImage(CommonImages.PERSON_ME_SMALL));
selfLink.setActiveImage(CommonImages.getImage(CommonImages.PERSON_ME_SMALL));
selfLink.setHoverImage(CommonImages.getImage(CommonImages.PERSON_ME_SMALL));
selfLink.addHyperlinkListener(new HyperlinkAdapter() {
@@ -85,7 +90,6 @@ public class PersonAttributeEditor extends TextAttributeEditor {
public void mouseEnter(MouseEvent e) {
((GridData) selfLink.getLayoutData()).exclude = false;
composite.layout();
- selfLink.setImage(CommonImages.getImage(CommonImages.PERSON_ME_SMALL));
selfLink.redraw();
version++;
}
@@ -98,7 +102,6 @@ public class PersonAttributeEditor extends TextAttributeEditor {
if (version != lastVersion || selfLink.isDisposed()) {
return;
}
- selfLink.setImage(null);
selfLink.redraw();
((GridData) selfLink.getLayoutData()).exclude = true;
composite.layout();
@@ -140,4 +143,12 @@ public class PersonAttributeEditor extends TextAttributeEditor {
getText().setBackground(color);
}
}
+
+ public ContentAssistCommandAdapter getContentAssistCommandAdapter() {
+ return contentAssistCommandAdapter;
+ }
+
+ public void setContentAssistCommandAdapter(ContentAssistCommandAdapter contentAssistCommandAdapter) {
+ this.contentAssistCommandAdapter = contentAssistCommandAdapter;
+ }
}
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 811e48eac..e9c0a44d7 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
@@ -99,6 +99,9 @@ public class AttributeEditorToolkit {
ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0], true);
adapter.setLabelProvider(labelPropsalProvider);
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
+ if (editor instanceof PersonAttributeEditor) {
+ ((PersonAttributeEditor) editor).setContentAssistCommandAdapter(adapter);
+ }
}
}
} else if (editor instanceof RichTextAttributeEditor) {

Back to the top