Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 90808 Details for
Bug 192452
add content assist to bugzilla search/query dialog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch
patch192452.txt (text/plain), 9.62 KB, created by
Frank Becker
on 2008-02-26 17:38:17 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2008-02-26 17:38:17 EST
Size:
9.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.tests >Index: src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java,v >retrieving revision 1.1 >diff -u -r1.1 PersonProposalProviderTest.java >--- src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java 23 Aug 2007 01:08:09 -0000 1.1 >+++ src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java 26 Feb 2008 22:36:28 -0000 >@@ -12,12 +12,14 @@ > > import org.eclipse.jface.fieldassist.IContentProposal; > import org.eclipse.mylyn.internal.tasks.ui.PersonProposalProvider; >+import org.eclipse.mylyn.tasks.core.AbstractTask; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskData; > import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryTask; > > public class PersonProposalProviderTest extends TestCase { > > public void testGetProposalsNullParameters() { >- PersonProposalProvider provider = new PersonProposalProvider(null, null); >+ PersonProposalProvider provider = new PersonProposalProvider((AbstractTask) null, (RepositoryTaskData) null); > IContentProposal[] result = provider.getProposals("", 0); > assertNotNull(result); > assertEquals(0, result.length); >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java,v >retrieving revision 1.17 >diff -u -r1.17 PersonProposalProvider.java >--- src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java 31 Jul 2007 19:11:48 -0000 1.17 >+++ src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java 26 Feb 2008 22:36:29 -0000 >@@ -39,9 +39,31 @@ > > private SortedSet<String> addressSet = null; > >+ private String repositoryUrl; >+ >+ private String repositoryKind; >+ > public PersonProposalProvider(AbstractTask repositoryTask, RepositoryTaskData taskData) { > this.currentTask = repositoryTask; > this.currentTaskData = taskData; >+ if (repositoryTask != null) { >+ repositoryUrl = repositoryTask.getRepositoryUrl(); >+ repositoryKind = repositoryTask.getConnectorKind(); >+ } >+ >+ if (repositoryUrl == null || repositoryKind == null) { >+ if (taskData != null) { >+ repositoryUrl = taskData.getRepositoryUrl(); >+ repositoryKind = taskData.getRepositoryKind(); >+ } >+ } >+ } >+ >+ public PersonProposalProvider(String repositoryUrl, String repositoryKind) { >+ currentTask = null; >+ currentTaskData = null; >+ this.repositoryUrl = repositoryUrl; >+ this.repositoryKind = repositoryKind; > } > > public IContentProposal[] getProposals(String contents, int position) { >@@ -84,21 +106,6 @@ > } > addAddresses(currentTaskData, addressSet); > >- String repositoryUrl = null; >- String repositoryKind = null; >- >- if (currentTask != null) { >- repositoryUrl = currentTask.getRepositoryUrl(); >- repositoryKind = currentTask.getConnectorKind(); >- } >- >- if (repositoryUrl == null || repositoryKind == null) { >- if (currentTaskData != null) { >- repositoryUrl = currentTaskData.getRepositoryUrl(); >- repositoryKind = currentTaskData.getRepositoryKind(); >- } >- } >- > if (repositoryUrl != null && repositoryKind != null) { > Set<AbstractTask> tasks = new HashSet<AbstractTask>(); > if (currentTask != null) { >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java,v >retrieving revision 1.90 >diff -u -r1.90 BugzillaSearchPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 26 Feb 2008 03:30:30 -0000 1.90 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 26 Feb 2008 22:36:31 -0000 >@@ -22,21 +22,32 @@ > import org.eclipse.jface.dialogs.IDialogConstants; > 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; > import org.eclipse.jface.window.Window; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryQuery; > import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; > 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.monitor.core.StatusHandler; > import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; > import org.eclipse.mylyn.tasks.core.RepositoryStatus; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute; > import org.eclipse.mylyn.tasks.core.TaskRepository; > import org.eclipse.mylyn.tasks.core.TaskRepositoryManager; > import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; > import org.eclipse.mylyn.tasks.ui.search.AbstractRepositoryQueryPage; >+import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.SashForm; > import org.eclipse.swt.events.ModifyEvent; >@@ -58,7 +69,9 @@ > 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.internal.help.WorkbenchHelpSystem; >+import org.eclipse.ui.keys.IBindingService; > import org.eclipse.ui.progress.IProgressService; > > /** >@@ -432,7 +445,14 @@ > handleWidgetSelected(emailPattern, emailOperation, previousEmailPatterns); > } > }); >- >+ ContentAssistCommandAdapter adapter = applyContentAssist(emailPattern, >+ createContentProposalProvider(null)); >+ ILabelProvider propsalLabelProvider = createProposalLabelProvider(null); >+ if (propsalLabelProvider != null) { >+ adapter.setLabelProvider(propsalLabelProvider); >+ } >+ adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); >+ > Composite emailComposite = new Composite(composite, SWT.NONE); > emailComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); > GridLayout emailLayout = new GridLayout(); >@@ -480,6 +500,13 @@ > handleWidgetSelected(emailPattern2, emailOperation2, previousEmailPatterns2); > } > }); >+ ContentAssistCommandAdapter adapter2 = applyContentAssist(emailPattern2, >+ createContentProposalProvider(null)); >+ ILabelProvider propsalLabelProvider2 = createProposalLabelProvider(null); >+ if (propsalLabelProvider2 != null) { >+ adapter2.setLabelProvider(propsalLabelProvider2); >+ } >+ adapter2.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); > > Composite emailComposite2 = new Composite(composite, SWT.NONE); > emailComposite2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); >@@ -1811,4 +1838,53 @@ > public void setRestoreQueryOptions(boolean restoreQueryOptions) { > 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. >+ */ >+ protected 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. >+ */ >+ protected IContentProposalProvider createContentProposalProvider(RepositoryTaskAttribute attribute) { >+ return new PersonProposalProvider(repository.getUrl(), repository.getConnectorKind()); >+ } >+ >+ >+ protected ILabelProvider createProposalLabelProvider(RepositoryTaskAttribute attribute) { >+ return new PersonProposalLabelProvider(); >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 192452
: 90808 |
90809
|
95016
|
95017