3333import java .awt .Cursor ;
3434import java .awt .Desktop ;
3535import java .awt .Dimension ;
36+ import java .awt .Font ;
3637import java .awt .GridBagConstraints ;
3738import java .awt .GridBagLayout ;
3839import java .awt .Toolkit ;
@@ -314,6 +315,15 @@ public TextEditor(final Context context) {
314315 tabbed = new JTabbedPane ();
315316 tree = new FileSystemTree (log );
316317 body = new JSplitPane (JSplitPane .HORIZONTAL_SPLIT , new FileSystemTreePanel (tree , context ), tabbed );
318+ try {// on Aqua L&F, 'one touch arrows' collide with borderless options button, which in turn are
319+ // needed for proper resize of the search panel. Grrrrr....
320+ if ("com.apple.laf.AquaLookAndFeel" .equals (UIManager .getLookAndFeel ().getClass ().getName ())) {
321+ body .setOneTouchExpandable (false );
322+ }
323+ } catch (final Exception ignored ) {
324+ // do nothing
325+ }
326+
317327 // These items are dynamic and need to be initialized before EditorPane creation
318328 initializeDynamicMenuComponents ();
319329
@@ -549,7 +559,7 @@ public TextEditor(final Context context) {
549559
550560 toolsMenu = new JMenu ("Tools" );
551561 toolsMenu .setMnemonic (KeyEvent .VK_O );
552- addSeparator (toolsMenu , "Imports" );
562+ addSeparator (toolsMenu , "Imports: " );
553563 addImport = addToMenu (toolsMenu , "Add Import..." , 0 , 0 );
554564 addImport .setMnemonic (KeyEvent .VK_I );
555565 respectAutoImports = prefService .getBoolean (getClass (), AUTO_IMPORT_PREFS , false );
@@ -3781,7 +3791,7 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
37813791 });
37823792 popup .addSeparator ();
37833793
3784- jmi = new JMenuItem ("Clear Selected Text... " );
3794+ jmi = new JMenuItem ("Clear Selected Text" );
37853795 popup .add (jmi );
37863796 jmi .addActionListener (e -> {
37873797 if (textArea .getSelectedText () == null )
@@ -3791,7 +3801,7 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
37913801 });
37923802 final DefaultHighlighter highlighter = (DefaultHighlighter )textArea .getHighlighter ();
37933803 highlighter .setDrawsLayeredHighlights (false );
3794- jmi = new JMenuItem ("Highlight Selected Text... " );
3804+ jmi = new JMenuItem ("Highlight Selected Text" );
37953805 popup .add (jmi );
37963806 jmi .addActionListener (e -> {
37973807 try {
@@ -3804,7 +3814,7 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
38043814 UIManager .getLookAndFeel ().provideErrorFeedback (textArea );
38053815 }
38063816 });
3807- jmi = new JMenuItem ("Clear highlights... " );
3817+ jmi = new JMenuItem ("Clear Highlights " );
38083818 popup .add (jmi );
38093819 jmi .addActionListener (e -> {
38103820 textArea .getHighlighter ().removeAllHighlights ();
@@ -3813,14 +3823,27 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
38133823 }
38143824
38153825 private static void addSeparator (final JMenu menu , final String header ) {
3816- final JLabel label = new JLabel (header );
3817- // label.setHorizontalAlignment(SwingConstants.LEFT);
3818- label .setEnabled (false );
3819- label .setForeground (getDisabledComponentColor ());
38203826 if (menu .getMenuComponentCount () > 1 ) {
38213827 menu .addSeparator ();
38223828 }
3823- menu .add (label );
3829+ try { // on Aqua L&F the label is never rendered. It seems only menu items with an actual
3830+ // actionlistener are registered on the menubar!?
3831+ if ("com.apple.laf.AquaLookAndFeel" .equals (UIManager .getLookAndFeel ().getClass ().getName ())) {
3832+ final JMenuItem label = new JMenuItem ("↓ " + header );
3833+ label .setEnabled (false );
3834+ label .setFont (label .getFont ().deriveFont (Font .ITALIC )); // ignored
3835+ label .addActionListener (e -> label .setActionCommand ("dummy" ));
3836+ menu .add (label );
3837+ } else {
3838+ final JLabel label = new JLabel (header );
3839+ // label.setHorizontalAlignment(SwingConstants.LEFT);
3840+ label .setEnabled (false );
3841+ label .setForeground (getDisabledComponentColor ());
3842+ menu .add (label );
3843+ }
3844+ } catch (final Exception ignored ) {
3845+ // do nothing
3846+ }
38243847 }
38253848
38263849 private static Collection <File > assembleFlatFileCollection (final Collection <File > collection , final File [] files ) {
0 commit comments