diff options
author | spingel | 2008-11-13 09:01:51 +0000 |
---|---|---|
committer | spingel | 2008-11-13 09:01:51 +0000 |
commit | 1624a4678c344343ec593056ca68752384b106ae (patch) | |
tree | c46ecb73e3ed0dcef05c7e516c494b14d1f719a5 /org.eclipse.mylyn.bugzilla.ui | |
parent | 8645e94682673298a6874d46d46f95c81ad9e2d2 (diff) | |
download | org.eclipse.mylyn.tasks-1624a4678c344343ec593056ca68752384b106ae.tar.gz org.eclipse.mylyn.tasks-1624a4678c344343ec593056ca68752384b106ae.tar.xz org.eclipse.mylyn.tasks-1624a4678c344343ec593056ca68752384b106ae.zip |
NEW - bug 254982: [patch][api] RepositoryCompletionProcessor is internal API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=254982
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui')
-rw-r--r-- | org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java | 83 |
1 files changed, 14 insertions, 69 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java index 71100eec1..f03f0f185 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java @@ -31,9 +31,6 @@ import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.fieldassist.ComboContentAdapter; import org.eclipse.jface.fieldassist.ContentProposalAdapter; -import org.eclipse.jface.fieldassist.ControlDecoration; -import org.eclipse.jface.fieldassist.FieldDecoration; -import org.eclipse.jface.fieldassist.FieldDecorationRegistry; import org.eclipse.jface.fieldassist.IContentProposalProvider; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.ILabelProvider; @@ -44,14 +41,12 @@ import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin; import org.eclipse.mylyn.internal.bugzilla.ui.editor.KeywordsDialog; -import org.eclipse.mylyn.internal.tasks.ui.PersonProposalLabelProvider; -import org.eclipse.mylyn.internal.tasks.ui.PersonProposalProvider; import org.eclipse.mylyn.internal.tasks.ui.util.WebBrowserDialog; import org.eclipse.mylyn.tasks.core.IRepositoryQuery; import org.eclipse.mylyn.tasks.core.RepositoryStatus; import org.eclipse.mylyn.tasks.core.TaskRepository; +import org.eclipse.mylyn.tasks.ui.TasksUi; import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage; -import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.events.ModifyEvent; @@ -75,8 +70,8 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter; -import org.eclipse.ui.keys.IBindingService; import org.eclipse.ui.progress.IProgressService; +import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; /** * Bugzilla search page @@ -143,8 +138,6 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L private static final String HEIGHT = "height"; //$NON-NLS-1$ - private Rectangle fNewBounds; - private IRepositoryQuery originalQuery = null; protected boolean restoring = false; @@ -481,11 +474,14 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L handleWidgetSelected(emailPattern, emailOperation, previousEmailPatterns); } }); - ContentAssistCommandAdapter adapter = applyContentAssist(emailPattern, createContentProposalProvider()); - ILabelProvider propsalLabelProvider = createProposalLabelProvider(); - if (propsalLabelProvider != null) { - adapter.setLabelProvider(propsalLabelProvider); - } + IContentProposalProvider proposalProvider = TasksUi.getUiFactory().createPersonContentProposalProvider( + getTaskRepository()); + ILabelProvider proposalLabelProvider = TasksUi.getUiFactory().createPersonContentProposalLabelProvider( + getTaskRepository()); + + ContentAssistCommandAdapter adapter = new ContentAssistCommandAdapter(emailPattern, new ComboContentAdapter(), + proposalProvider, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0], true); + adapter.setLabelProvider(proposalLabelProvider); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); Composite emailComposite = new Composite(composite, SWT.NONE); @@ -533,11 +529,10 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L handleWidgetSelected(emailPattern2, emailOperation2, previousEmailPatterns2); } }); - ContentAssistCommandAdapter adapter2 = applyContentAssist(emailPattern2, createContentProposalProvider()); - ILabelProvider propsalLabelProvider2 = createProposalLabelProvider(); - if (propsalLabelProvider2 != null) { - adapter2.setLabelProvider(propsalLabelProvider2); - } + ContentAssistCommandAdapter adapter2 = new ContentAssistCommandAdapter(emailPattern2, + new ComboContentAdapter(), proposalProvider, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, + new char[0], true); + adapter.setLabelProvider(proposalLabelProvider); adapter2.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); Composite emailComposite2 = new Composite(composite, SWT.NONE); @@ -1817,56 +1812,6 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L this.restoreQueryOptions = restoreQueryOptions; } - /** - * Adds content assist to the given text field. - * - * @param text - * text field to decorate. - * @param proposalProvider - * instance providing content proposals - * @return the ContentAssistCommandAdapter for the field. - */ - // XXX get this from the AttributeEditorToolkit - private ContentAssistCommandAdapter applyContentAssist(Combo text, IContentProposalProvider proposalProvider) { - ControlDecoration controlDecoration = new ControlDecoration(text, (SWT.TOP | SWT.LEFT)); - controlDecoration.setMarginWidth(0); - controlDecoration.setShowHover(true); - controlDecoration.setShowOnlyOnFocus(true); - - FieldDecoration contentProposalImage = FieldDecorationRegistry.getDefault().getFieldDecoration( - FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); - controlDecoration.setImage(contentProposalImage.getImage()); - - ComboContentAdapter textContentAdapter = new ComboContentAdapter(); - - ContentAssistCommandAdapter adapter = new ContentAssistCommandAdapter(text, textContentAdapter, - proposalProvider, "org.eclipse.ui.edit.text.contentAssist.proposals", new char[0]); - - IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class); - controlDecoration.setDescriptionText(NLS.bind("Content Assist Available ({0})", - bindingService.getBestActiveBindingFormattedFor(adapter.getCommandId()))); - - return adapter; - } - - /** - * Creates an IContentProposalProvider to provide content assist proposals for the given attribute. - * - * @param attribute - * attribute for which to provide content assist. - * @return the IContentProposalProvider. - */ - // XXX get this from the AttributeEditorToolkit? - private IContentProposalProvider createContentProposalProvider() { - return new PersonProposalProvider(getTaskRepository().getRepositoryUrl(), - getTaskRepository().getConnectorKind()); - } - - // XXX get this from the AttributeEditorToolkit? - private ILabelProvider createProposalLabelProvider() { - return new PersonProposalLabelProvider(); - } - private String[] convertStringListToArray(java.util.List<String> stringList) { return stringList.toArray(new String[stringList.size()]); } |