33
33
import java .awt .Cursor ;
34
34
import java .awt .Desktop ;
35
35
import java .awt .Dimension ;
36
+ import java .awt .Font ;
36
37
import java .awt .GridBagConstraints ;
37
38
import java .awt .GridBagLayout ;
38
39
import java .awt .Toolkit ;
@@ -314,6 +315,15 @@ public TextEditor(final Context context) {
314
315
tabbed = new JTabbedPane ();
315
316
tree = new FileSystemTree (log );
316
317
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
+
317
327
// These items are dynamic and need to be initialized before EditorPane creation
318
328
initializeDynamicMenuComponents ();
319
329
@@ -549,7 +559,7 @@ public TextEditor(final Context context) {
549
559
550
560
toolsMenu = new JMenu ("Tools" );
551
561
toolsMenu .setMnemonic (KeyEvent .VK_O );
552
- addSeparator (toolsMenu , "Imports" );
562
+ addSeparator (toolsMenu , "Imports: " );
553
563
addImport = addToMenu (toolsMenu , "Add Import..." , 0 , 0 );
554
564
addImport .setMnemonic (KeyEvent .VK_I );
555
565
respectAutoImports = prefService .getBoolean (getClass (), AUTO_IMPORT_PREFS , false );
@@ -3781,7 +3791,7 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
3781
3791
});
3782
3792
popup .addSeparator ();
3783
3793
3784
- jmi = new JMenuItem ("Clear Selected Text... " );
3794
+ jmi = new JMenuItem ("Clear Selected Text" );
3785
3795
popup .add (jmi );
3786
3796
jmi .addActionListener (e -> {
3787
3797
if (textArea .getSelectedText () == null )
@@ -3791,7 +3801,7 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
3791
3801
});
3792
3802
final DefaultHighlighter highlighter = (DefaultHighlighter )textArea .getHighlighter ();
3793
3803
highlighter .setDrawsLayeredHighlights (false );
3794
- jmi = new JMenuItem ("Highlight Selected Text... " );
3804
+ jmi = new JMenuItem ("Highlight Selected Text" );
3795
3805
popup .add (jmi );
3796
3806
jmi .addActionListener (e -> {
3797
3807
try {
@@ -3804,7 +3814,7 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
3804
3814
UIManager .getLookAndFeel ().provideErrorFeedback (textArea );
3805
3815
}
3806
3816
});
3807
- jmi = new JMenuItem ("Clear highlights... " );
3817
+ jmi = new JMenuItem ("Clear Highlights " );
3808
3818
popup .add (jmi );
3809
3819
jmi .addActionListener (e -> {
3810
3820
textArea .getHighlighter ().removeAllHighlights ();
@@ -3813,14 +3823,27 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
3813
3823
}
3814
3824
3815
3825
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 ());
3820
3826
if (menu .getMenuComponentCount () > 1 ) {
3821
3827
menu .addSeparator ();
3822
3828
}
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
+ }
3824
3847
}
3825
3848
3826
3849
private static Collection <File > assembleFlatFileCollection (final Collection <File > collection , final File [] files ) {
0 commit comments