Skip to content

Commit 41092be

Browse files
committed
Merge branch 'editor-refactor-fixup'
2 parents 6508403 + 10dcc1d commit 41092be

File tree

139 files changed

+499
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+499
-6
lines changed

app/src/processing/app/Base.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,7 @@ public void rebuildExamplesMenu(JMenu menu) {
12541254
}
12551255

12561256
private static String priorPlatformFolder;
1257+
private static boolean newLibraryImported;
12571258

12581259
public void onBoardOrPortChange() {
12591260
BaseNoGui.onBoardOrPortChange();
@@ -1262,10 +1263,11 @@ public void onBoardOrPortChange() {
12621263
TargetPlatform tp = BaseNoGui.getTargetPlatform();
12631264
if (tp != null) {
12641265
String platformFolder = tp.getFolder().getAbsolutePath();
1265-
if (priorPlatformFolder == null || !priorPlatformFolder.equals(platformFolder)) {
1266+
if (priorPlatformFolder == null || !priorPlatformFolder.equals(platformFolder) || newLibraryImported) {
12661267
pdeKeywords = new PdeKeywords();
12671268
pdeKeywords.reload();
12681269
priorPlatformFolder = platformFolder;
1270+
newLibraryImported = false;
12691271
for (Editor editor : editors) {
12701272
editor.updateKeywords(pdeKeywords);
12711273
}
@@ -1305,6 +1307,7 @@ protected void onIndexesUpdated() throws Exception {
13051307
// Manager dialog is modal, waits here until closed
13061308

13071309
//handleAddLibrary();
1310+
newLibraryImported = true;
13081311
onBoardOrPortChange();
13091312
rebuildImportMenu(Editor.importMenu);
13101313
rebuildExamplesMenu(Editor.examplesMenu);
@@ -2262,6 +2265,7 @@ public void handleAddLibrary() {
22622265
// FIXME error when importing. ignoring :(
22632266
} finally {
22642267
// delete zip created temp folder, if exists
2268+
newLibraryImported = true;
22652269
FileUtils.recursiveDelete(tmpFolder);
22662270
}
22672271
}

app/src/processing/app/Editor.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,6 +1691,13 @@ public void createTabs() {
16911691
selectTab(0);
16921692
}
16931693

1694+
/**
1695+
* Reorders tabs as per current sketch's files order
1696+
*/
1697+
public void reorderTabs() {
1698+
Collections.sort(tabs, (x, y) -> Sketch.CODE_DOCS_COMPARATOR.compare(x.getSketchFile(), y.getSketchFile()));
1699+
}
1700+
16941701
/**
16951702
* Add a new tab.
16961703
*
@@ -1704,6 +1711,12 @@ public void createTabs() {
17041711
protected void addTab(SketchFile file, String contents) throws IOException {
17051712
EditorTab tab = new EditorTab(this, file, contents);
17061713
tabs.add(tab);
1714+
reorderTabs();
1715+
}
1716+
1717+
protected void removeTab(SketchFile file) throws IOException {
1718+
int index = findTabIndex(file);
1719+
tabs.remove(index);
17071720
}
17081721

17091722
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

app/src/processing/app/SketchController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ public void handleDeleteCode() throws IOException {
260260
return;
261261
}
262262

263+
editor.removeTab(current);
264+
263265
// just set current tab to the main tab
264266
editor.selectTab(0);
265267

arduino-core/src/processing/app/BaseNoGui.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,17 @@ static public PreferencesMap getBoardPreferences() {
166166

167167
// Add all tools dependencies from the (possibily) referenced core
168168
String core = prefs.get("build.core");
169-
if (core.contains(":")) {
169+
if (core != null && core.contains(":")) {
170170
String split[] = core.split(":");
171171
TargetPlatform referenced = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
172-
ContributedPlatform referencedPlatform = indexer.getContributedPlaform(referenced);
173-
if (referencedPlatform != null)
174-
requiredTools.addAll(referencedPlatform.getResolvedTools());
172+
if (referenced != null) {
173+
ContributedPlatform referencedPlatform = indexer.getContributedPlaform(referenced);
174+
if (referencedPlatform != null)
175+
requiredTools.addAll(referencedPlatform.getResolvedTools());
176+
} else {
177+
String msg = tr("The current selected board needs the core '{0}' that is not installed.");
178+
System.out.println(I18n.format(msg, core));
179+
}
175180
}
176181

177182
String prefix = "runtime.tools.";

arduino-core/src/processing/app/Sketch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class Sketch {
3131

3232
private File buildPath;
3333

34-
private static final Comparator<SketchFile> CODE_DOCS_COMPARATOR = new Comparator<SketchFile>() {
34+
public static final Comparator<SketchFile> CODE_DOCS_COMPARATOR = new Comparator<SketchFile>() {
3535
@Override
3636
public int compare(SketchFile x, SketchFile y) {
3737
if (x.isPrimary() && !y.isPrimary())

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,10 @@ msgstr ""
20062006
msgid "The Udp class has been renamed EthernetUdp."
20072007
msgstr ""
20082008

2009+
#: ../../../../../arduino-core/src/processing/app/BaseNoGui.java:173
2010+
msgid "The current selected board needs the core '{0}' that is not installed."
2011+
msgstr ""
2012+
20092013
#: Editor.java:2147
20102014
#, java-format
20112015
msgid ""

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,9 @@
14631463
#: debug/Compiler.java:432
14641464
!The\ Udp\ class\ has\ been\ renamed\ EthernetUdp.=
14651465

1466+
#: ../../../../../arduino-core/src/processing/app/BaseNoGui.java:173
1467+
!The\ current\ selected\ board\ needs\ the\ core\ '{0}'\ that\ is\ not\ installed.=
1468+
14661469
#: Editor.java:2147
14671470
#, java-format
14681471
!The\ file\ "{0}"\ needs\ to\ be\ inside\na\ sketch\ folder\ named\ "{1}".\nCreate\ this\ folder,\ move\ the\ file,\ and\ continue?=

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,6 +2007,10 @@ msgstr ""
20072007
msgid "The Udp class has been renamed EthernetUdp."
20082008
msgstr ""
20092009

2010+
#: ../../../../../arduino-core/src/processing/app/BaseNoGui.java:173
2011+
msgid "The current selected board needs the core '{0}' that is not installed."
2012+
msgstr ""
2013+
20102014
#: Editor.java:2147
20112015
#, java-format
20122016
msgid ""

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,9 @@ System\ Default=Stelsel Verstek
14641464
#: debug/Compiler.java:432
14651465
!The\ Udp\ class\ has\ been\ renamed\ EthernetUdp.=
14661466

1467+
#: ../../../../../arduino-core/src/processing/app/BaseNoGui.java:173
1468+
!The\ current\ selected\ board\ needs\ the\ core\ '{0}'\ that\ is\ not\ installed.=
1469+
14671470
#: Editor.java:2147
14681471
#, java-format
14691472
!The\ file\ "{0}"\ needs\ to\ be\ inside\na\ sketch\ folder\ named\ "{1}".\nCreate\ this\ folder,\ move\ the\ file,\ and\ continue?=

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,6 +2007,10 @@ msgstr "A clase Servidor ha estau renombrada a EthernetServer"
20072007
msgid "The Udp class has been renamed EthernetUdp."
20082008
msgstr "A clase Udp ha estau renombrada a EthernetUdp"
20092009

2010+
#: ../../../../../arduino-core/src/processing/app/BaseNoGui.java:173
2011+
msgid "The current selected board needs the core '{0}' that is not installed."
2012+
msgstr ""
2013+
20102014
#: Editor.java:2147
20112015
#, java-format
20122016
msgid ""

0 commit comments

Comments
 (0)