This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 168430
Collapse All | Expand All

(-)editor.lib/src/org/netbeans/editor/ext/ExtKit.java (-3 / +22 lines)
Lines 915-927 Link Here
915
                            }
915
                            }
916
916
917
                            int lineCount = Utilities.getRowCount(doc, startPos, endPos);
917
                            int lineCount = Utilities.getRowCount(doc, startPos, endPos);
918
                            boolean comment = forceComment != null ? forceComment : !allComments(doc, startPos, lineCount);
918
                            if (forceComment != null) {
919
919
                                //comment/uncomment action
920
                            if (comment) {
920
                                if (forceComment.booleanValue()) {
921
                                comment(doc, startPos, lineCount);
921
                                comment(doc, startPos, lineCount);
922
                            } else {
922
                            } else {
923
                                uncomment(doc, startPos, lineCount);
923
                                uncomment(doc, startPos, lineCount);
924
                            }
924
                            }
925
                            } else {
926
                                //toggle comment action -> toggles comment at each line separately
927
                                int pos = endPos;
928
                                int startPosOfLine;
929
                                final int oneLine = 1;
930
                                do {
931
                                    startPosOfLine = Utilities.getRowStart(doc, pos);
932
                                    final boolean isCommentAtLine = allComments(doc, startPosOfLine, oneLine);
933
                                    if (!isCommentAtLine) {
934
                                        comment(doc, startPosOfLine, oneLine);
935
                                    } else {
936
                                        uncomment(doc, startPosOfLine, oneLine);
937
                                    }
938
                                    pos = startPosOfLine - 1;
939
940
                                } while (startPosOfLine>startPos);
941
942
                            }
943
925
                            NavigationHistory.getEdits().markWaypoint(target, startPos, false, true);
944
                            NavigationHistory.getEdits().markWaypoint(target, startPos, false, true);
926
                        } catch (BadLocationException e) {
945
                        } catch (BadLocationException e) {
927
                            target.getToolkit().beep();
946
                            target.getToolkit().beep();

Return to bug 168430