From fd23b0ccc10a27777caf9872a0c4ced3e9130081 Mon Sep 17 00:00:00 2001 From: Gary Bentley Date: Wed, 18 Oct 2017 21:28:50 +1000 Subject: [PATCH] Only add the add section menu if there are children menu items. --- src/com/quollwriter/ui/sidebars/ProjectSideBar.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/com/quollwriter/ui/sidebars/ProjectSideBar.java b/src/com/quollwriter/ui/sidebars/ProjectSideBar.java index c80b7df3..adc70ec6 100644 --- a/src/com/quollwriter/ui/sidebars/ProjectSideBar.java +++ b/src/com/quollwriter/ui/sidebars/ProjectSideBar.java @@ -1205,8 +1205,6 @@ public void actionPerformed (ActionEvent ev) JMenu sm = new JMenu ("Add section" + (belowObjType != null ? " below" : "")); - m.add (sm); - for (final String sect : defSections) { @@ -1251,6 +1249,14 @@ public void actionPerformed (ActionEvent ev) } + // Only add the section menu if there are children. + if (sm.getComponentCount () > 0) + { + + m.add (sm); + + } + } }