Autocomplete optional companion "description" window

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Autocomplete optional companion "description" window

Postby Guest » Wed May 26, 2010 8:26 am

How do you implement this? :[
Guest
 

Re: Autocomplete optional companion "description" window

Postby robert » Wed May 26, 2010 12:03 pm

It's a setting on the AutoComplete instance you've already created.

Code: Select all
AutoCompletion ac = ...;
ac.setShowDescWindow(true);


You can browse the Javadoc for the entire library here.
User avatar
robert
 
Posts: 652
Joined: Sat May 10, 2008 5:16 pm

Re: Autocomplete optional companion "description" window

Postby Guest » Wed May 26, 2010 11:41 pm

okay, now how do I create descriptions? I can't seem to find it in the javadocs.
Guest
 

Re: Autocomplete optional companion "description" window

Postby robert » Fri May 28, 2010 2:04 am

If you use BasicCompletions, then you can call setSummary() on each one. This is the easiest possible way. Note that the text you pass to setSummary() should be HTML.

Note also that the Completion interface only defines getSummary(), not setSummary(), so you can create custom Completion implementations that actually compute the summary at runtime, and save a little memory. See the Java support in RSTALanguageSupport (currently only available in SVN).
User avatar
robert
 
Posts: 652
Joined: Sat May 10, 2008 5:16 pm

Re: Autocomplete optional companion "description" window

Postby Guest » Fri May 28, 2010 8:30 pm

What am I doing wrong here? Netbeans says "void type not allowed here".

Code: Select all
provider.addCompletion(new BasicCompletion(provider, "background", "some short description").setSummary("<html></html>"));
Guest
 

Re: Autocomplete optional companion "description" window

Postby robert » Fri May 28, 2010 11:24 pm

The setSummary() method doesn't return anything, so you cannot do it the way you are. There is, however, a constructor that also takes the summary text as a fourth argument. Try this instead:

Code: Select all
provider.addCompletion(new BasicCompletion(provider, "background", "some short description", "<html>This is the summary text"));


Alternatively, you can do this:

Code: Select all
Basiccompletion bc = new BasicCompletion(provider, "background", "some short description");
bc.setSummary("<html>This is the summary text");
provider.addCompletion(bc);


Note also that Swing is nice, and you don't have to type the closing "</html>" tag. It won't hurt anything if you do, but if you don't, it'll still render the same.
User avatar
robert
 
Posts: 652
Joined: Sat May 10, 2008 5:16 pm

Re: Autocomplete optional companion "description" window

Postby Guest » Sun May 30, 2010 12:22 am

Thank you, this fixed everything!
Guest
 


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron