Skip to main content


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] Sat, 04 May 2013 01:09 Go to next message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
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 09:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi if can wait one week. we solved this in our project but i dont remember how

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Word wrap on ConfigurableCompletionProposal tooltips - how? [message #1053631 is a reply to message #1053350] Tue, 07 May 2013 00:29 Go to previous messageGo to next message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
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] Wed, 14 August 2013 00:27 Go to previous messageGo to next message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
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 06:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
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);
			}
		};
	}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Word wrap on ConfigurableCompletionProposal tooltips - how? [message #1086674 is a reply to message #1086382] Wed, 14 August 2013 14:36 Go to previous message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
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 Mar 29 07:02:13 GMT 2024

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

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

Back to the top