Reputation: 275
I am enhanching one form based multipage editor. In which, swt controls are used as UI elements for some pages and xtexteditor as text editor for one other page which has feature of displaying content assist when we press ctrl + space keys together.
I want to add the same content assist feature with swt text widgets.
Que 1: Is it possible to add content assist feature with text widget?
Que 2: If we can add content assist feature with text widget, then which type of editor (texteditor/celleditor/any other) should i use with text widget?
I tried to use textcelleditor(jface celleditor) with my swt text widget and I went through many articles but they all are using textcelleditor(jface celleditor) with swt tableviewer.
Links:
http://javafind.appspot.com/model?id=318036
http://www.subshell.com/en/subshell/blog/Eclipse-RCP-Comboboxes-inside-a-JFace-TableViewer100.html
http://www.eclipse.org/articles/Article-Table-viewer/table_viewer.html
http://www.eclipsezone.com/eclipse/forums/t53044.html
http://www.eclipse.org/forums/index.php/t/171575/
Can any one help me on this point that "how can i add content assist (xtexteditor based or any other like jface celleditor) with text widgets".
Thanks in advance!!
Upvotes: 2
Views: 458
Reputation: 23939
Use ContentProposalAdapter from JFace. Available out of the box.
Text text;
IContentProposalProvider contentProvider = (content, position) -> {
return new IContentProposal[]{
String replacement = "replacement text";
new new ContentProposal(replacement, "Label", "Description", replacement.length() - 1);
};
ContentProposalAdapter contentProposal = new ContentProposalAdapter(text, new TextContentAdapter(), contentProvider, null);
contentProposal.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
Upvotes: 0