mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-21 15:54:39 +01:00
Refactored function to get status of menus in MacOSX
This commit is contained in:
parent
59a57a9312
commit
369b23a7d2
@ -971,7 +971,7 @@ public class Base {
|
||||
// Save out the current prefs state
|
||||
PreferencesData.save();
|
||||
|
||||
if (!OSUtils.isMacOS() || System.getProperty("apple.laf.useScreenMenuBar") == "false") {
|
||||
if (!OSUtils.hasMacOSStyleMenus()) {
|
||||
// If this was fired from the menu or an AppleEvent (the Finder),
|
||||
// then Mac OS X will send the terminate signal itself.
|
||||
System.exit(0);
|
||||
|
@ -619,7 +619,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
fileMenu.add(item);
|
||||
|
||||
// macosx already has its own preferences and quit menu
|
||||
if (!OSUtils.isMacOS() || System.getProperty("apple.laf.useScreenMenuBar") == "false") {
|
||||
if (!OSUtils.hasMacOSStyleMenus()) {
|
||||
fileMenu.addSeparator();
|
||||
|
||||
item = newJMenuItem(tr("Preferences"), ',');
|
||||
@ -1252,7 +1252,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
menu.add(item);
|
||||
|
||||
// macosx already has its own about menu
|
||||
if (!OSUtils.isMacOS() || System.getProperty("apple.laf.useScreenMenuBar") == "false") {
|
||||
if (!OSUtils.hasMacOSStyleMenus()) {
|
||||
menu.addSeparator();
|
||||
item = new JMenuItem(tr("About Arduino"));
|
||||
item.addActionListener(new ActionListener() {
|
||||
@ -1812,7 +1812,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
String prompt = I18n.format(tr("Save changes to \"{0}\"? "),
|
||||
sketch.getName());
|
||||
|
||||
if (!OSUtils.isMacOS() || System.getProperty("apple.laf.useScreenMenuBar") == "false") {
|
||||
if (!OSUtils.hasMacOSStyleMenus()) {
|
||||
int result =
|
||||
JOptionPane.showConfirmDialog(this, prompt, tr("Close"),
|
||||
JOptionPane.YES_NO_CANCEL_OPTION,
|
||||
|
@ -26,4 +26,7 @@ public class OSUtils {
|
||||
return System.getProperty("os.name").contains("Mac");
|
||||
}
|
||||
|
||||
static public boolean hasMacOSStyleMenus() {
|
||||
return OSUtils.isMacOS() && System.getProperty("apple.laf.useScreenMenuBar").equals("true");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user