Autocomplete optional companion "description" window

Post a reply

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: Autocomplete optional companion "description" window

Re: Autocomplete optional companion "description" window

Post by Guest » Sun May 30, 2010 12:22 am

Thank you, this fixed everything!

Re: Autocomplete optional companion "description" window

Post by 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.

Re: Autocomplete optional companion "description" window

Post by 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>"));

Re: Autocomplete optional companion "description" window

Post by 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).

Re: Autocomplete optional companion "description" window

Post by 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.

Re: Autocomplete optional companion "description" window

Post by 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.

Autocomplete optional companion "description" window

Post by Guest » Wed May 26, 2010 8:26 am

How do you implement this? :[

Top

cron