diff --git a/app/src/cc/arduino/view/preferences/Preferences.java b/app/src/cc/arduino/view/preferences/Preferences.java index ba1837f2623..2ea7c0295b1 100644 --- a/app/src/cc/arduino/view/preferences/Preferences.java +++ b/app/src/cc/arduino/view/preferences/Preferences.java @@ -34,6 +34,7 @@ import cc.arduino.i18n.Languages; import processing.app.Base; import processing.app.BaseNoGui; +import processing.app.Editor; import processing.app.I18n; import processing.app.PreferencesData; import processing.app.Theme; @@ -42,6 +43,7 @@ import javax.swing.*; import java.awt.*; +import java.awt.event.ItemEvent; import java.awt.event.WindowEvent; import java.io.File; import java.util.LinkedList; @@ -243,6 +245,21 @@ public void mouseEntered(java.awt.event.MouseEvent evt) { checkboxesContainer.add(verifyUploadBox); externalEditorBox.setText(tr("Use external editor")); + externalEditorBox.addItemListener(ev -> { + if (ev.getStateChange() == ItemEvent.SELECTED) { + for (Editor e : base.getEditors()) { + if (e.getSketch().isModified()) { + String msg = tr("You have unsaved changes!\nYou must save all your sketches to enable this option."); + JOptionPane.showMessageDialog(null, msg, + tr("Can't enable external editor"), + JOptionPane.INFORMATION_MESSAGE); + externalEditorBox.setSelected(false); + return; + } + } + } + }); + checkboxesContainer.add(externalEditorBox); cacheCompiledCore.setText(tr("Aggressively cache compiled core")); diff --git a/arduino-core/src/processing/app/i18n/Resources_en.po b/arduino-core/src/processing/app/i18n/Resources_en.po index ad730f0bc8d..843efe95bb1 100644 --- a/arduino-core/src/processing/app/i18n/Resources_en.po +++ b/arduino-core/src/processing/app/i18n/Resources_en.po @@ -427,6 +427,10 @@ msgstr "CRC doesn't match, file is corrupted. It may be a temporary problem, ple msgid "Can only pass one of: {0}" msgstr "Can only pass one of: {0}" +#: ../../../../../app/src/cc/arduino/view/preferences/Preferences.java:254 +msgid "Can't enable external editor" +msgstr "" + #: ../../../processing/app/BaseNoGui.java:504 #: ../../../processing/app/BaseNoGui.java:549 msgid "Can't find the sketch in the specified path" @@ -469,6 +473,10 @@ msgstr "Chinese (Taiwan)" msgid "Chinese (Taiwan) (Big5)" msgstr "Chinese (Taiwan) (Big5)" +#: ../../../../../app/src/processing/app/AbstractTextMonitor.java:80 +msgid "Clear output" +msgstr "" + #: ../../../../../app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java:98 msgid "Click for a list of unofficial boards support URLs" msgstr "Click for a list of unofficial boards support URLs" @@ -2455,6 +2463,12 @@ msgstr "You cannot save the sketch into a folder\ninside itself. This would go o msgid "You forgot your sketchbook" msgstr "You forgot your sketchbook" +#: ../../../../../app/src/cc/arduino/view/preferences/Preferences.java:252 +msgid "" +"You have unsaved changes!\n" +"You must save all your sketches to enable this option." +msgstr "" + #: ../../../processing/app/AbstractMonitor.java:92 msgid "" "You've pressed {0} but nothing was sent. Should you select a line ending?" diff --git a/arduino-core/src/processing/app/i18n/Resources_en.properties b/arduino-core/src/processing/app/i18n/Resources_en.properties index 5904bc22560..b83ed873736 100644 --- a/arduino-core/src/processing/app/i18n/Resources_en.properties +++ b/arduino-core/src/processing/app/i18n/Resources_en.properties @@ -298,6 +298,9 @@ CRC\ doesn't\ match,\ file\ is\ corrupted.\ It\ may\ be\ a\ temporary\ problem,\ #, java-format Can\ only\ pass\ one\ of\:\ {0}=Can only pass one of\: {0} +#: ../../../../../app/src/cc/arduino/view/preferences/Preferences.java:254 +!Can't\ enable\ external\ editor= + #: ../../../processing/app/BaseNoGui.java:504 #: ../../../processing/app/BaseNoGui.java:549 Can't\ find\ the\ sketch\ in\ the\ specified\ path=Can't find the sketch in the specified path @@ -330,6 +333,9 @@ Chinese\ (Taiwan)=Chinese (Taiwan) #: ../../../processing/app/Preferences.java:143 Chinese\ (Taiwan)\ (Big5)=Chinese (Taiwan) (Big5) +#: ../../../../../app/src/processing/app/AbstractTextMonitor.java:80 +!Clear\ output= + #: ../../../../../app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java:98 Click\ for\ a\ list\ of\ unofficial\ boards\ support\ URLs=Click for a list of unofficial boards support URLs @@ -1771,6 +1777,9 @@ You\ cannot\ save\ the\ sketch\ into\ a\ folder\ninside\ itself.\ This\ would\ g #: Base.java:1888 You\ forgot\ your\ sketchbook=You forgot your sketchbook +#: ../../../../../app/src/cc/arduino/view/preferences/Preferences.java:252 +!You\ have\ unsaved\ changes\!\nYou\ must\ save\ all\ your\ sketches\ to\ enable\ this\ option.= + #: ../../../processing/app/AbstractMonitor.java:92 You've\ pressed\ {0}\ but\ nothing\ was\ sent.\ Should\ you\ select\ a\ line\ ending?=You've pressed {0} but nothing was sent. Should you select a line ending? diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index 9620205575e..18c225f8bee 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -3,6 +3,7 @@ ARDUINO 1.8.3 [ide] * Serial Monitor: added "Clear output" button. Thanks @MichaelSy * added option in preferences.txt for: custom title, comment/uncomment shortcut, always show file extensions. Thanks @MichaelSy +* Enabling "Use external editor" option now requires to save all sketches. ARDUINO 1.8.2 2017.03.22