NbEditorUtilities | 65

NetBeans 6.1

Another thing developers might have experienced, i.e. invocation of show static methods of class NbEditorUtilities. You used the following syntax,

NbEditorUtilities.getLine(d, offset, true).show(Line.SHOW_GOTO);

d instance of Document, offset is int, true is boolean ofcourse 😉

NetBeans 6.5

Now, things have changed, and the above methods are deprecated. So, you need to do the following to get similar result,

NbEditorUtilities.getLine(doc, offset, true).show(ShowOpenType.OPEN,

SHOW_GOTO got deprecated, and thus, came into being 2 enum classes- ShowOpenType and ShowVisibilityType. This is what the javadocs states-

ShowOpenType and ShowVisibilityType is replacement for constants SHOW_TRY_SHOW, SHOW_SHOW, SHOW_GOTO, SHOW_TOFRONT, SHOW_REUSE, SHOW_REUSE_NEW. It is to provide full control over show method behavior without need to add new constant for missing flag combination.

This was another API change I came across, and probably notified here lately. Anyways, its a great utility, so use it at right place, right time.

“Make your learning pluggable, use NetBeans Platform”