Skip to content

Commit

Permalink
fixed for unloading, cannot completely unload, using native libs
Browse files Browse the repository at this point in the history
  • Loading branch information
vsch committed Apr 10, 2023
1 parent daf7982 commit da2a28c
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .idea/runConfigurations/CLion_2020_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Version History
- [CLionArduinoPlugin Version Notes](#clionarduinoplugin-version-notes)
- [TO DO](#to-do)
- [1.5.20 Next](#1520-next)
- [1.5.24 Next](#1524-next)
- [1.5.11](#1511)
- [1.5.9](#159)
- [1.5.7](#157)
Expand Down Expand Up @@ -52,8 +52,10 @@
* Add: inspection to check that `CMakeLists.txt` is out of sync, especially if missing the
toolchain file.

### 1.5.20 Next
### 1.5.24 Next

* Fix: disable diff buttons if the toolchain file is not `ArduinoToolchain.cmake` so that other
toolchain files will not be erroneously compared to bundled version.
* Fix: add second diff button for toolchain diff viewing `Platform/Arduino.cmake`
* Fix: allow directories to be selected for toolchain file path.
* Fix: if a directory is selected add `ArduinoToolchain.cmake` file name automatically.
Expand Down
6 changes: 3 additions & 3 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<idea-plugin>
<idea-plugin url="http://github.com/vsch/CLionArduinoPlugin" require-restart="true">
<id>com.vladsch.clionarduinoplugin</id>
<name>Arduino Support</name>
<vendor email="" url="https://github.com/vsch/CLionArduinoPlugin">Vladimir Schneider</vendor>
<vendor email="[email protected]" url="https://github.com/vsch">Vladimir Schneider</vendor>

<version>1.5.19</version>
<version>1.5.25</version>
<!-- please see https://confluence.jetbrains.com/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
on how to target different products -->
<depends>com.intellij.modules.clion</depends>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ settings.eol.crlf=CR/LF (\\r\\n : 0x0D 0x0A)
settings.eol.lf=LF (\\n : 0x0A)
settings.eol.none=None
settings.file-templates.message=Path is a file
settings.file-toolchain-txt.message=Toolchain file is not derived from the bundled version. Viewing difference is not applicable.
settings.file-toolchain.message=Path is a file
settings.invalid-boards-txt.message=Selected boards.txt file appears to be invalid. No boards are defined in it.
settings.invalid-programmers-txt.message=Selected programmers.txt file appears to be invalid. No programmers are defined in it.
Expand Down Expand Up @@ -140,7 +141,9 @@ settings.toolchain-txt-create-failed.title=Create Toolchain Dir Failed
settings.toolchain-txt-create-success.label=<html><body>Toolchain directory was successfully created<br>and populated with bundled toolchain files.<br><br>Path: {0}</body></html>
settings.toolchain-txt-create-success.title=Toolchain Directory Created
settings.toolchain-txt-create.label=Create From Bundled
settings.toolchain-txt-diff.label=ArduinoToolchain Difference
settings.toolchain-txt-diff.title=Show difference between bundled ArduinoToolchain.cmake and selected toolchain file
settings.toolchain-txt-diff2.label=Platform/Arduino Difference
settings.toolchain-txt-diff2.title=Show difference between bundled Platform/Arduino.cmake and selected toolchain file
settings.toolchain-txt-file-directory.title=Select Path for Toolchain Directory
settings.toolchain-txt-path.label=&CMake Toolchain File:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@ public ArduinoApplicationComponent() {
FileTypeManager.getInstance().associateExtension(cpp, Strings.INO_EXT);
FileTypeManager.getInstance().associateExtension(cpp, Strings.PDE_EXT);
}));

Disposer.register(SerialPortManager.getInstance(), this);
}

public void dispose() {
ApplicationManager.getApplication().invokeLater(() ->
ApplicationManager.getApplication().runWriteAction(() -> {
FileType cpp = FileTypeManager.getInstance().getFileTypeByExtension(Strings.CPP_EXT);
FileTypeManager.getInstance().removeAssociatedExtension(cpp, Strings.INO_EXT);
FileTypeManager.getInstance().removeAssociatedExtension(cpp, Strings.PDE_EXT);
}));
FileType cpp = FileTypeManager.getInstance().getFileTypeByExtension(Strings.CPP_EXT);
FileTypeManager.getInstance().removeAssociatedExtension(cpp, Strings.INO_EXT);
FileTypeManager.getInstance().removeAssociatedExtension(cpp, Strings.PDE_EXT);
}

static public ArduinoApplicationComponent getInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void dispose() {
mySerialMonitorPanel = null;
myApplicationComponent = null;

disconnectPort();
myPortManager.removeProjectComponent(this);
myPortManager = null;

myListeners.clear();
Expand All @@ -98,9 +98,6 @@ public void dispose() {
myBuildMonitor.projectClosed();
myBuildMonitor = null;
}

SerialPortManager portManager = SerialPortManager.getInstance();
portManager.removeProjectComponent(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.vladsch.clionarduinoplugin.settings.ApplicationSettingsForm">
<grid id="27dc6" binding="myMainPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<xy x="20" y="20" width="672" height="404"/>
<xy x="20" y="20" width="810" height="404"/>
</constraints>
<properties/>
<border type="none"/>
Expand Down Expand Up @@ -288,7 +288,7 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="com/vladsch/clionarduinoplugin/localization/strings" key="settings.boards-txt-diff.label"/>
<text resource-bundle="com/vladsch/clionarduinoplugin/localization/strings" key="settings.toolchain-txt-diff.label"/>
<toolTipText resource-bundle="com/vladsch/clionarduinoplugin/localization/strings" key="settings.toolchain-txt-diff.title"/>
</properties>
</component>
Expand All @@ -297,7 +297,7 @@
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="com/vladsch/clionarduinoplugin/localization/strings" key="settings.boards-txt-diff.label"/>
<text resource-bundle="com/vladsch/clionarduinoplugin/localization/strings" key="settings.toolchain-txt-diff2.label"/>
<toolTipText resource-bundle="com/vladsch/clionarduinoplugin/localization/strings" key="settings.toolchain-txt-diff2.title"/>
</properties>
</component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,42 +572,46 @@ void updateOptions(boolean onSet) {
} else {
// try to open and read the file
File file = new File(toolchainTxtPathText);
if (!file.exists() || file.isDirectory()) {
if (file.isDirectory()) {
// add file name automatically
Path toolchainPath = Path.of(toolchainTxtPathText, "ArduinoToolchain.cmake");
toolchainTxtPathText = toolchainPath.toString();
file = toolchainPath.toFile();
String finalToolchainTxtPathText = toolchainTxtPathText;
ApplicationManager.getApplication().invokeLater(() -> {
myToolchainTxtPath.setText(finalToolchainTxtPathText);
});
//error = "<html><body><span style='color: red'>" + Bundle.message("settings.not-exists-toolchain-directory.message") + "</span></body></html>";
}
if (file.getName().equals("ArduinoToolchain.cmake")) {
if (!file.exists() || file.isDirectory()) {
if (file.isDirectory()) {
// add file name automatically
Path toolchainPath = Path.of(toolchainTxtPathText, "ArduinoToolchain.cmake");
toolchainTxtPathText = toolchainPath.toString();
file = toolchainPath.toFile();
String finalToolchainTxtPathText = toolchainTxtPathText;
ApplicationManager.getApplication().invokeLater(() -> {
myToolchainTxtPath.setText(finalToolchainTxtPathText);
});
//error = "<html><body><span style='color: red'>" + Bundle.message("settings.not-exists-toolchain-directory.message") + "</span></body></html>";
}

String parentPath = file.getParent();
String parentPath = file.getParent();

while (!parentPath.isEmpty()) {
File parent = new File(parentPath);
if (parent.exists()) {
canCreate = parent.isDirectory() && parent.canRead() && parent.canWrite();
break;
}
int pos = parentPath.lastIndexOf(File.separator);
if (pos <= 0) break;
while (!parentPath.isEmpty()) {
File parent = new File(parentPath);
if (parent.exists()) {
canCreate = parent.isDirectory() && parent.canRead() && parent.canWrite();
break;
}
int pos = parentPath.lastIndexOf(File.separator);
if (pos <= 0) break;

parentPath = parentPath.substring(0, pos);
}
if (!canCreate) {
error = "<html><body><span style='color: red'>" + Bundle.message("settings.not-exists-toolchain-rw.message") + "</span></body></html>";
parentPath = parentPath.substring(0, pos);
}
if (!canCreate) {
error = "<html><body><span style='color: red'>" + Bundle.message("settings.not-exists-toolchain-rw.message") + "</span></body></html>";
} else {
error = "<html><body><span style='color: red'>" + Bundle.message("settings.not-exists-toolchain.message") + "</span></body></html>";
}
} else if (file.isDirectory()) {
error = "<html><body><span style='color: red'>" + Bundle.message("settings.file-toolchain.message") + "</span></body></html>";
} else {
error = "<html><body><span style='color: red'>" + Bundle.message("settings.not-exists-toolchain.message") + "</span></body></html>";
// not necessarily our bundled toolchain
canShowDiff = true;
}
} else if (file.isDirectory()) {
error = "<html><body><span style='color: red'>" + Bundle.message("settings.file-toolchain.message") + "</span></body></html>";
} else {
// not necessarily our bundled toolchain
canShowDiff = true;
error = "<html><body><span style='color: red'>" + Bundle.message("settings.file-toolchain-txt.message") + "</span></body></html>";
}
}

Expand Down
14 changes: 14 additions & 0 deletions update-sandboxes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ IDE_LIST_NEW_LOCATION=(
"CLion2023.1"
"CLion2023.2"
"CLion2023.3"
"CLion2020-1"
"CLion2020-2"
"CLion2020-3"
"CLion2021-1"
"CLion2021-2"
"CLion2021-3"
"CLion2022-1"
"CLion2022-2"
"CLion2022-3"
"CLion2023-1"
"CLion2023-2"
"CLion2023-3"
"IdeaIC2020-1-EAP"
"IdeaIC2020-2-EAP"
"IdeaIC2020-3-EAP"
Expand Down Expand Up @@ -88,6 +100,8 @@ function Upd() {
# Upd "CLion2020-2" "plugins-sandbox"
# Upd "CLion2020-3" "plugins-sandbox"
Upd "CLion2021-2" "plugins-sandbox"
Upd "CLion2021-3" "plugins-sandbox"
# Upd "CLion2023-1" "plugins-sandbox"

# for plugin debugging in intellij-community under debugging
# UpdRaw "/Users/vlad/src/intellij-community/system/plugins-sandbox/plugins"
Expand Down

0 comments on commit da2a28c

Please sign in to comment.