[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: How to add content assist in a form-based editor's Text widget?

Hi,
upon reflection I think I posted this to the wrong group. I'll try over at the SWT group.

Channing

Channing Walton wrote:
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.AbstractControlContentAssistSubjectAdapter$SmartFieldController$FieldFocusListener.install(AbstractControlContentAssistSubjectAdapter.java:622)


at org.eclipse.jface.contentassist.AbstractControlContentAssistSubjectAdapter$SmartFieldController$FieldFocusListener.focusGained(AbstractControlContentAssistSubjectAdapter.java:603)

at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.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(ApplicationWindow.java:674)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2137)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:122)


at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.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(WorkbenchPage.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