diff -r b70d83633857 apisupport.refactoring/src/org/netbeans/modules/apisupport/hints/UseNbBundleMessages.java --- a/apisupport.refactoring/src/org/netbeans/modules/apisupport/hints/UseNbBundleMessages.java Wed Apr 11 15:33:03 2012 +0200 +++ b/apisupport.refactoring/src/org/netbeans/modules/apisupport/hints/UseNbBundleMessages.java Wed Apr 11 15:36:32 2012 +0200 @@ -111,12 +111,12 @@ }) public static List run(HintContext context) { final CompilationInfo compilationInfo = context.getInfo(); - final TreePath treePath = context.getPath(); + TreePath treePath = context.getPath(); Tree tree = treePath.getLeaf(); int[] span; final String key; final FileObject src = compilationInfo.getFileObject(); - final MethodInvocationTree mit; + MethodInvocationTree mit; if (tree.getKind() == Kind.METHOD_INVOCATION) { mit = (MethodInvocationTree) tree; ExpressionTree methodSelect = mit.getMethodSelect(); @@ -219,8 +219,10 @@ } @Override protected void performRewrite(JavaFix.TransformationContext ctx) throws Exception { WorkingCopy wc = ctx.getWorkingCopy(); + TreePath treePath = ctx.getPath(); TreeMaker make = wc.getTreeMaker(); - if (mit != null) { + if (treePath.getLeaf().getKind() == Kind.METHOD_INVOCATION) { + MethodInvocationTree mit = (MethodInvocationTree) treePath.getLeaf(); CompilationUnitTree cut = wc.getCompilationUnit(); boolean imported = false; String importBundleStar = cut.getPackageName() + ".Bundle.*";