1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Trigger Keywords update if a new library is added

Fixes #5415
This commit is contained in:
Martino Facchin 2016-10-27 12:41:44 +02:00
parent c6642c1bd2
commit 1d74bb87ac

View File

@ -1295,6 +1295,7 @@ public class Base {
}
private static String priorPlatformFolder;
private static boolean newLibraryImported;
public void onBoardOrPortChange() {
BaseNoGui.onBoardOrPortChange();
@ -1303,10 +1304,11 @@ public class Base {
TargetPlatform tp = BaseNoGui.getTargetPlatform();
if (tp != null) {
String platformFolder = tp.getFolder().getAbsolutePath();
if (priorPlatformFolder == null || !priorPlatformFolder.equals(platformFolder)) {
if (priorPlatformFolder == null || !priorPlatformFolder.equals(platformFolder) || newLibraryImported) {
pdeKeywords = new PdeKeywords();
pdeKeywords.reload();
priorPlatformFolder = platformFolder;
newLibraryImported = false;
for (Editor editor : editors) {
editor.updateKeywords(pdeKeywords);
}
@ -1346,6 +1348,7 @@ public class Base {
// Manager dialog is modal, waits here until closed
//handleAddLibrary();
newLibraryImported = true;
onBoardOrPortChange();
rebuildImportMenu(Editor.importMenu);
rebuildExamplesMenu(Editor.examplesMenu);
@ -2303,6 +2306,7 @@ public class Base {
// FIXME error when importing. ignoring :(
} finally {
// delete zip created temp folder, if exists
newLibraryImported = true;
FileUtils.recursiveDelete(tmpFolder);
}
}