From d8adca998b37c37f09c8363713c2edd163fff815 Mon Sep 17 00:00:00 2001 From: Steffen Pingel Date: Wed, 14 Mar 2012 21:52:51 +0100 Subject: REOPENED - bug 373275: show "Content Assist Available" decoration in task list find box https://bugs.eclipse.org/bugs/show_bug.cgi?id=373275 * fix decoration on Windows * fix tooltip --- .../tasks/index/ui/IndexSearchHandler.java | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'org.eclipse.mylyn.tasks.index.ui/src/org/eclipse/mylyn/internal/tasks/index') diff --git a/org.eclipse.mylyn.tasks.index.ui/src/org/eclipse/mylyn/internal/tasks/index/ui/IndexSearchHandler.java b/org.eclipse.mylyn.tasks.index.ui/src/org/eclipse/mylyn/internal/tasks/index/ui/IndexSearchHandler.java index 0a2dce97c..59f8da32c 100644 --- a/org.eclipse.mylyn.tasks.index.ui/src/org/eclipse/mylyn/internal/tasks/index/ui/IndexSearchHandler.java +++ b/org.eclipse.mylyn.tasks.index.ui/src/org/eclipse/mylyn/internal/tasks/index/ui/IndexSearchHandler.java @@ -74,16 +74,29 @@ public class IndexSearchHandler extends AbstractSearchHandler { } @Override - public void adaptTextSearchControl(Text textControl) { + public void adaptTextSearchControl(final Text textControl) { + // make room for content assist decoration + if (textControl.getParent().getLayout() instanceof GridLayout) { + ((GridLayout) textControl.getParent().getLayout()).marginLeft = 6; + } + + // delay execution of to avoid empty key-binding in tooltip: The problem is that the binding service hasn't been + // initialized when the decoration is created on startup. + textControl.getDisplay().asyncExec(new Runnable() { + public void run() { + if (!textControl.isDisposed()) { + adaptTextSearchControlInternal(textControl); + } + } + }); + } + + private void adaptTextSearchControlInternal(Text textControl) { IContentProposalProvider proposalProvider = new ContentProposalProvider(TasksUiPlugin.getTaskList(), reference); final ContentAssistCommandAdapter adapter = new ContentAssistCommandAdapter(textControl, new TextContentAdapter(), proposalProvider, null, new char[0], true); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); - if (textControl.getParent().getLayout() instanceof GridLayout) { - ((GridLayout) textControl.getParent().getLayout()).marginLeft = 4; - } - // FilteredTree registers a traverse listener that focuses the tree when ENTER is pressed. This // causes focus to be lost when a content proposal is selected. To avoid transfer of focus the // traverse listener registered by FilteredTree is skipped while content assist is being used. -- cgit v1.2.3