Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions dependencies.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


# Dependencies of `io.spine.tools:intellij-platform:2.0.0-SNAPSHOT.240`
# Dependencies of `io.spine.tools:intellij-platform:2.0.0-SNAPSHOT.241`

## Runtime
1. **Group** : be.cyberelf.nanoxml. **Name** : nanoxml. **Version** : 2.2.3.
Expand Down Expand Up @@ -493,12 +493,12 @@

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Sun Dec 15 16:11:25 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Jan 14 15:55:52 CET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:intellij-platform-java:2.0.0-SNAPSHOT.240`
# Dependencies of `io.spine.tools:intellij-platform-java:2.0.0-SNAPSHOT.241`

## Runtime
1. **Group** : be.cyberelf.nanoxml. **Name** : nanoxml. **Version** : 2.2.3.
Expand Down Expand Up @@ -1752,12 +1752,12 @@ This report was generated on **Sun Dec 15 16:11:25 WET 2024** using [Gradle-Lice

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Sun Dec 15 16:11:25 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Jan 14 15:55:52 CET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-plugin-base:2.0.0-SNAPSHOT.240`
# Dependencies of `io.spine.tools:spine-plugin-base:2.0.0-SNAPSHOT.241`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -2505,12 +2505,12 @@ This report was generated on **Sun Dec 15 16:11:25 WET 2024** using [Gradle-Lice

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Sun Dec 15 16:11:26 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Jan 14 15:55:53 CET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-plugin-testlib:2.0.0-SNAPSHOT.240`
# Dependencies of `io.spine.tools:spine-plugin-testlib:2.0.0-SNAPSHOT.241`

## Runtime
1. **Group** : com.google.auto.value. **Name** : auto-value-annotations. **Version** : 1.10.2.
Expand Down Expand Up @@ -3373,12 +3373,12 @@ This report was generated on **Sun Dec 15 16:11:26 WET 2024** using [Gradle-Lice

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Sun Dec 15 16:11:26 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Jan 14 15:55:53 CET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-psi:2.0.0-SNAPSHOT.240`
# Dependencies of `io.spine.tools:spine-psi:2.0.0-SNAPSHOT.241`

## Runtime
1. **Group** : be.cyberelf.nanoxml. **Name** : nanoxml. **Version** : 2.2.3.
Expand Down Expand Up @@ -4380,12 +4380,12 @@ This report was generated on **Sun Dec 15 16:11:26 WET 2024** using [Gradle-Lice

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Sun Dec 15 16:11:26 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Jan 14 15:55:53 CET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-psi-java:2.0.0-SNAPSHOT.240`
# Dependencies of `io.spine.tools:spine-psi-java:2.0.0-SNAPSHOT.241`

## Runtime
1. **Group** : be.cyberelf.nanoxml. **Name** : nanoxml. **Version** : 2.2.3.
Expand Down Expand Up @@ -6065,12 +6065,12 @@ This report was generated on **Sun Dec 15 16:11:26 WET 2024** using [Gradle-Lice

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Sun Dec 15 16:11:27 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Jan 14 15:55:54 CET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-tool-base:2.0.0-SNAPSHOT.240`
# Dependencies of `io.spine.tools:spine-tool-base:2.0.0-SNAPSHOT.241`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -6867,4 +6867,4 @@ This report was generated on **Sun Dec 15 16:11:27 WET 2024** using [Gradle-Lice

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Sun Dec 15 16:11:27 WET 2024** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Jan 14 15:55:54 CET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject.
-->
<groupId>io.spine.tools</groupId>
<artifactId>tool-base</artifactId>
<version>2.0.0-SNAPSHOT.240</version>
<version>2.0.0-SNAPSHOT.241</version>

<inceptionYear>2015</inceptionYear>

Expand Down
37 changes: 33 additions & 4 deletions psi-java/src/main/kotlin/io/spine/tools/psi/java/PsiCommands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,41 @@ package io.spine.tools.psi.java
import com.intellij.openapi.command.CommandProcessor
import io.spine.tools.psi.java.Environment.commandProcessor
import io.spine.tools.psi.java.Environment.project
import kotlin.system.exitProcess

/**
* Executes the given [Runnable] as a PSI modification
* [command][CommandProcessor.executeCommand].
* Executes the given [runnable] as a PSI modification [command][CommandProcessor.executeCommand],
* ensuring any errors thrown by the [runnable] are handled using the provided [errorHandler].
*
* By default, the `CoreCommandProcessor` used for PSI command processing suppresses
* any [Throwable] thrown by the command, making it difficult for PSI users to detect
* and handle errors.
*
* To address this, the given [runnable] is wrapped in a try-catch block.
* Any thrown errors or exceptions are passed to the provided [errorHandler].
*
* If no custom [errorHandler] is provided, the default behavior is to print the stack
* trace to [System.err] and terminate the process with the exit code `1`.
*
* @param runnable The [Runnable] to execute as a PSI modification.
* @param errorHandler A lambda to handle any [Throwable] thrown by the [runnable].
* Defaults to printing the stack trace and terminating the process with the exit code `1`.
*/
@JvmOverloads
@JvmName("execute")
public fun execute(runnable: Runnable) {
commandProcessor.executeCommand(project, runnable, null, null)
@Suppress("TooGenericExceptionCaught") // We need everything, including `java.lang.Error`.
public fun execute(errorHandler: (Throwable) -> Unit = ::printAndTerminate, runnable: Runnable) {
val withHandledErrors = Runnable {
try {
runnable.run()
} catch (t: Throwable) {
errorHandler(t)
}
}
commandProcessor.executeCommand(project, withHandledErrors, null, null)
}

private fun printAndTerminate(t: Throwable) {
t.printStackTrace()
exitProcess(1)
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 should be a constant visible somewhere in the public documentation. Please see how we do it in ProtoData.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, we probably should use 1 there too because ProtoData usually exits with 255.

}
2 changes: 1 addition & 1 deletion version.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

val versionToPublish: String by extra("2.0.0-SNAPSHOT.240")
val versionToPublish: String by extra("2.0.0-SNAPSHOT.241")
Loading