JBuilder 2007 Code Assist / JBuilder 2006 CodeInsight

One of the annoying differences for me between JBuilder 2006 and JBuilder 2007 has been one way Content Assist (JB2007/Eclipse terminology) functions in comparison to CodeInsight (JB2006 terminology). In JB2006, when you invoke CodeInsight in the middle of an expression and select a method, JB2006 overwrites the relevant part of expression, leaving you with a syntactically correct expression. In JB2007, when you do the same thing, it inserts the selected method, leaving you with a syntactically incorrect expression.

For example, say you have this following code snippet:

String myVar = stringVar.toUpperCase();

Let’s say you want myVar to contain the lower case value of stringVar, but you forget the exact name of the function (or you don’t want to type it in yourself). So what I do is put the cursor after the "o" in "toUpperCase", then press Ctrl+Space, then arrow to the toLowerCase method, and press Enter. In JB2006 you end up with:

String myVar = stringVar.toLowerCase();

That’s perfect. But in JB2007, you end up with:

String myVar = stringVar.toLowerCase()UpperCase();

Ugh! Now you have to go manually delete the UpperCase() part.

But it turns out that is only the JB2007 default behavior. Bill J. from the R&D team pointed this out to me the other day (and he may have got it from the newsgroups, so apologies in advance if I am stealing somebody else’s discovery without propery attribution). At any rate, in JB2007, if you hold down the Ctrl key before pressing Enter, it will overwrite, not insert. What’s more, you can change the default behavior. Select Window | Preferences | Editor | Content Assist | Completion Overwrites, and the default behavior will overwrite, just like JB2006. And regardless of your default, you can always toggle the behavior with the Ctrl key.

Posted by Charles Overbeck on February 27th, 2007 under Eclipse, JBuilder |



3 Responses to “JBuilder 2007 Code Assist / JBuilder 2006 CodeInsight”

  1. Gillmer J. Derge (TeamB) Says:

    Thanks for the tip, though I would still argue that JB2006 was better at this.

    First, you can’t really "always" toggle the behavior with Ctrl. If there’s only one possible completion, it will be filled in as soon as you press Ctrl-Space and before you can decide whether you want to use Enter or Ctrl-Enter.

    Second, JB2006 actually supports similar options, but it ties them to Enter vs. <any other non-identifier character> instead of Enter vs. Ctrl-Enter. In practice, that means that it always does the "right" thing, and it saves me a keystroke (ex. "." instead of "Enter .").

  2. Lori Olson Says:

    I would argue that for JB2007, that "Completion Overwrites" should be default, since that is what JBuilder users expect.

  3. David Orriss Jr Says:

    Gillmer and Lori pegged it. The default behavior in Eclipse can be really annoying - especially for those new to Eclipse.

Leave a Comment


Server Response from: dnrh2.codegear.com

 
© Copyright 2008 Embarcadero Technologies, Inc. All Rights Reserved. Contact Us  |   Site Map  |   Legal Notices  |   Privacy Policy  |   Report Software Piracy