Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to add content assist in a form-based editor's Text widget?
How to add content assist in a form-based editor's Text widget? [message #463117] Wed, 26 October 2005 21:18
Channing Walton is currently offline Channing WaltonFriend
Messages: 110
Registered: July 2009
Senior Member
Hi,
I am trying to add content assist to a Text instance on a Form in a Form-based editor in an RCP app, but have two problems:

1. the completion keybinding does not activate the content assist (do I need to create the keybinding?)

2. after modifying the text in the Text widget, saving the editor results in an exception from the SaveAction:
org.eclipse.jface.util.Assert$AssertionFailedException: Assertion failed: parent control has CueHandler: LayoutComposite {}
at org.eclipse.jface.util.Assert.isTrue(Assert.java:180)
at
org.eclipse.jface.contentassist.AbstractControlContentAssist SubjectAdapter$SmartFieldController$FieldFocusListener.insta ll(AbstractControlContentAssistSubjectAdapter.java:622)
at
org.eclipse.jface.contentassist.AbstractControlContentAssist SubjectAdapter$SmartFieldController$FieldFocusListener.focus Gained(AbstractControlContentAssistSubjectAdapter.java:603)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:105)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1412)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1436)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1417)
at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java: 1995)
at org.eclipse.swt.widgets.Control.forceFocus(Control.java:637)
at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:674)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2137)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:122)
at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelp er.java:100)
at org.eclipse.ui.internal.EditorManager.savePart(EditorManager .java:1140)
at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage .java:2741)
at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPa ge.java:2754)

----

This is what I am doing to add the content assist:

// add content assist to functionText
private void addContentAssist() {
TextContentAssistSubjectAdapter adapter = new TextContentAssistSubjectAdapter(functionText);
final SubjectControlContentAssistant assistant = new SubjectControlContentAssistant();

assistant.enableAutoActivation(true);
assistant.enableAutoInsert(true);
assistant.enablePrefixCompletion(false);
assistant.setContentAssistProcessor(new FieldDescriptorContentAssistProcessor(fieldDescriptors), IDocument.DEFAULT_CONTENT_TYPE);

assistant.install(adapter);

ContentAssistHandler contentAssistHandler = ContentAssistHandler.createHandlerForText(functionText, assistant);
contentAssistHandler.setEnabled(true);
}

The content assistant is really basic with computeCompletionProposals returning a set of Strings, but its never being called.

I cannot find an example of using content assist in a formbased editor, so any help is much appreciated.

Channing
Previous Topic:How to resize a MessageDialog subclass and still see the button Bar
Next Topic:Button in SWT and AWT
Goto Forum:
  


Current Time: Thu Apr 25 19:11:29 GMT 2024

Powered by FUDForum. Page generated in 0.02463 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top