rossluk commented on code in PR #5579:
URL: https://github.com/apache/netbeans/pull/5579#discussion_r1120810326


##########
php/php.editor/src/org/netbeans/modules/php/editor/actions/FixUsesPerformer.java:
##########
@@ -148,14 +146,24 @@ private void processSelections() {
             }
         }
         replaceUnimportedItems();
-        String insertString = createInsertString(useParts);
+        String insertString = createInsertString(useParts, 
shouldAppendLineAfter(startOffset));
         // avoid being recognized as a modified file
         if (insertString.isEmpty()) {
             
StatusDisplayer.getDefault().setStatusText(Bundle.FixUsesPerformer_noChanges());
         } else {
             editList.replace(startOffset, 0, insertString, false, 0);
         }
     }
+    
+    private boolean shouldAppendLineAfter(int lineOffset)
+    {
+        try {
+            return LineDocumentUtils.getNextNonWhitespace(baseDocument, 
lineOffset, LineDocumentUtils.getLineEnd(baseDocument, lineOffset)) != -1;
+        }  catch (BadLocationException ex) {
+            Exceptions.printStackTrace(ex);
+        }
+        return false;

Review Comment:
   i am not a java developer, if it would be better i am willing to make 
changes, but just checked few files with similar logic and there is usually 
return outside



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to