Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Word wrap on ConfigurableCompletionProposal tooltips - how?
Word wrap on ConfigurableCompletionProposal tooltips - how? [message #1053330] Fri, 03 May 2013 21:09 Go to next message
Chris Ainsley is currently offline Chris Ainsley
Messages: 74
Registered: March 2010
Location: UK
Member

A very simple question. How do I enable word-wrap on the detail of completion proposals (see attached screenshot). Currently all of my proposal details are being clipped off-screen.

Code:

I'm using the following constructor to construct my completion proposals:

ConfigurableCompletionProposal completionProposal = new ConfigurableCompletionProposal(templateId,  context.getOffset() - prefix.length(),prefix.length(),templateId.length(), null /* Image */ ,new StyledString(templateId),null,templateDescription);


Screenshot:

http://s11.postimg.org/f49vnq403/wordwrap.png
Re: Word wrap on ConfigurableCompletionProposal tooltips - how? [message #1053350 is a reply to message #1053330] Sat, 04 May 2013 05:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6130
Registered: July 2009
Senior Member
Hi if can wait one week. we solved this in our project but i dont remember how
Re: Word wrap on ConfigurableCompletionProposal tooltips - how? [message #1053631 is a reply to message #1053350] Mon, 06 May 2013 20:29 Go to previous messageGo to next message
Chris Ainsley is currently offline Chris Ainsley
Messages: 74
Registered: March 2010
Location: UK
Member

Christian Dietrich wrote on Sat, 04 May 2013 18:36
Hi if can wait one week. we solved this in our project but i dont remember how


Thanks Christian. Any assistance here is much appreciated.
Re: Word wrap on ConfigurableCompletionProposal tooltips - how? [message #1086209 is a reply to message #1053350] Tue, 13 August 2013 20:27 Go to previous messageGo to next message
Chris Ainsley is currently offline Chris Ainsley
Messages: 74
Registered: March 2010
Location: UK
Member

Still having problems with this. I wonder if you located the code Christian?
Re: Word wrap on ConfigurableCompletionProposal tooltips - how? [message #1086382 is a reply to message #1086209] Wed, 14 August 2013 02:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6130
Registered: July 2009
Senior Member
Hi,

we subclassed DefaultInformationControl and changed setVisible as follows

	@Override
	public void setVisible(boolean visible) {
		if (getShell().isVisible() == visible) {
			return;
		}
		getShell().setVisible(visible);
	}


then we extended XtextSourceViewerConfiguration to hook in the new class

	@Override
	public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
		return new IInformationControlCreator() {
			@Override
			public IInformationControl createInformationControl(Shell parent) {
				return new BasisDefaultInformationControl(parent, SWT.TOOL | SWT.ON_TOP, SWT.WRAP, null, null);
			}
		};
	}
Re: Word wrap on ConfigurableCompletionProposal tooltips - how? [message #1086674 is a reply to message #1086382] Wed, 14 August 2013 10:36 Go to previous message
Chris Ainsley is currently offline Chris Ainsley
Messages: 74
Registered: March 2010
Location: UK
Member

Thanks Christian. That worked.

I'm very happy indeed.

And I know its obvious to non-beginners, but for beginners reading this thread, you also have to add this to your YourAppNameUIModule.java

	public Class<? extends XtextSourceViewerConfiguration> bindXtextSourceViewerConfiguration() {
		return YourAppNameSourceViewerConfiguration.class;
	}

Previous Topic:Xtext-enabled TextArea
Next Topic:I could not open the editor. Target Plug in xText
Goto Forum:
  


Current Time: Fri Jul 25 05:01:01 EDT 2014

Powered by FUDForum. Page generated in 0.03481 seconds