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,
                ShowVisibilityType.FOCUS);

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”

Advertisements

One thought on “NbEditorUtilities | 65

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s