Skip to content

Commit

Permalink
add optional index parameter to appendFoldingMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
Mino260806 authored and bobbylight committed Aug 4, 2024
1 parent e807361 commit 4bf7714
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,27 @@ public void addParser(Parser parser) {
* @see #createPopupMenu()
*/
protected void appendFoldingMenu(JPopupMenu popup) {
popup.addSeparator();
appendFoldingMenu(popup, popup.getComponentCount());
}


/**
* Appends a submenu with code folding options to this text component's
* popup menu.
*
* @param popup The popup menu to append to.
* @param index The index where to append the context menu.
* @see #createPopupMenu()
*/
protected void appendFoldingMenu(JPopupMenu popup, int index) {
popup.add(new JPopupMenu.Separator(), index);
ResourceBundle bundle = ResourceBundle.getBundle(MSG);
foldingMenu = new JMenu(bundle.getString("ContextMenu.Folding"));
foldingMenu.add(createPopupMenuItem(toggleCurrentFoldAction));
foldingMenu.add(createPopupMenuItem(collapseAllCommentFoldsAction));
foldingMenu.add(createPopupMenuItem(collapseAllFoldsAction));
foldingMenu.add(createPopupMenuItem(expandAllFoldsAction));
popup.add(foldingMenu);
popup.add(foldingMenu, index+1);

}

Expand Down

0 comments on commit 4bf7714

Please sign in to comment.