Skip to content

Commit e500c7c

Browse files
committed
Enabling "external editor" now requires to save all sketches.
Fix #6196
1 parent db4a540 commit e500c7c

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

app/src/cc/arduino/view/preferences/Preferences.java

+16
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import cc.arduino.i18n.Languages;
3535
import processing.app.Base;
3636
import processing.app.BaseNoGui;
37+
import processing.app.Editor;
3738
import processing.app.I18n;
3839
import processing.app.PreferencesData;
3940
import processing.app.Theme;
@@ -42,6 +43,7 @@
4243

4344
import javax.swing.*;
4445
import java.awt.*;
46+
import java.awt.event.ItemEvent;
4547
import java.awt.event.WindowEvent;
4648
import java.io.File;
4749
import java.util.LinkedList;
@@ -243,6 +245,20 @@ public void mouseEntered(java.awt.event.MouseEvent evt) {
243245
checkboxesContainer.add(verifyUploadBox);
244246

245247
externalEditorBox.setText(tr("Use external editor"));
248+
externalEditorBox.addItemListener(ev -> {
249+
if (ev.getStateChange() == ItemEvent.SELECTED) {
250+
for (Editor e : base.getEditors()) {
251+
if (e.getSketch().isModified()) {
252+
String msg = tr("You have unsaved changes!\nYou must save all your sketches to enable this option.");
253+
JOptionPane.showMessageDialog(null, msg,
254+
tr("Can't enable external editor"),
255+
JOptionPane.INFORMATION_MESSAGE);
256+
externalEditorBox.setSelected(false);
257+
}
258+
}
259+
}
260+
});
261+
246262
checkboxesContainer.add(externalEditorBox);
247263

248264
cacheCompiledCore.setText(tr("Aggressively cache compiled core"));

arduino-core/src/processing/app/i18n/Resources_en.po

+14
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,10 @@ msgstr "CRC doesn't match, file is corrupted. It may be a temporary problem, ple
427427
msgid "Can only pass one of: {0}"
428428
msgstr "Can only pass one of: {0}"
429429

430+
#: ../../../../../app/src/cc/arduino/view/preferences/Preferences.java:254
431+
msgid "Can't enable external editor"
432+
msgstr ""
433+
430434
#: ../../../processing/app/BaseNoGui.java:504
431435
#: ../../../processing/app/BaseNoGui.java:549
432436
msgid "Can't find the sketch in the specified path"
@@ -469,6 +473,10 @@ msgstr "Chinese (Taiwan)"
469473
msgid "Chinese (Taiwan) (Big5)"
470474
msgstr "Chinese (Taiwan) (Big5)"
471475

476+
#: ../../../../../app/src/processing/app/AbstractTextMonitor.java:80
477+
msgid "Clear output"
478+
msgstr ""
479+
472480
#: ../../../../../app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java:98
473481
msgid "Click for a list of unofficial boards support URLs"
474482
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
24552463
msgid "You forgot your sketchbook"
24562464
msgstr "You forgot your sketchbook"
24572465

2466+
#: ../../../../../app/src/cc/arduino/view/preferences/Preferences.java:252
2467+
msgid ""
2468+
"You have unsaved changes!\n"
2469+
"You must save all your sketches to enable this option."
2470+
msgstr ""
2471+
24582472
#: ../../../processing/app/AbstractMonitor.java:92
24592473
msgid ""
24602474
"You've pressed {0} but nothing was sent. Should you select a line ending?"

arduino-core/src/processing/app/i18n/Resources_en.properties

+9
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ CRC\ doesn't\ match,\ file\ is\ corrupted.\ It\ may\ be\ a\ temporary\ problem,\
298298
#, java-format
299299
Can\ only\ pass\ one\ of\:\ {0}=Can only pass one of\: {0}
300300

301+
#: ../../../../../app/src/cc/arduino/view/preferences/Preferences.java:254
302+
!Can't\ enable\ external\ editor=
303+
301304
#: ../../../processing/app/BaseNoGui.java:504
302305
#: ../../../processing/app/BaseNoGui.java:549
303306
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)
330333
#: ../../../processing/app/Preferences.java:143
331334
Chinese\ (Taiwan)\ (Big5)=Chinese (Taiwan) (Big5)
332335

336+
#: ../../../../../app/src/processing/app/AbstractTextMonitor.java:80
337+
!Clear\ output=
338+
333339
#: ../../../../../app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java:98
334340
Click\ for\ a\ list\ of\ unofficial\ boards\ support\ URLs=Click for a list of unofficial boards support URLs
335341

@@ -1771,6 +1777,9 @@ You\ cannot\ save\ the\ sketch\ into\ a\ folder\ninside\ itself.\ This\ would\ g
17711777
#: Base.java:1888
17721778
You\ forgot\ your\ sketchbook=You forgot your sketchbook
17731779

1780+
#: ../../../../../app/src/cc/arduino/view/preferences/Preferences.java:252
1781+
!You\ have\ unsaved\ changes\!\nYou\ must\ save\ all\ your\ sketches\ to\ enable\ this\ option.=
1782+
17741783
#: ../../../processing/app/AbstractMonitor.java:92
17751784
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?
17761785

build/shared/revisions.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ARDUINO 1.8.3
33
[ide]
44
* Serial Monitor: added "Clear output" button. Thanks @MichaelSy
55
* added option in preferences.txt for: custom title, comment/uncomment shortcut, always show file extensions. Thanks @MichaelSy
6+
* Enabling "Use external editor" option now requires to save all sketches.
67

78
ARDUINO 1.8.2 2017.03.22
89

0 commit comments

Comments
 (0)