From 12d632e738e87ebd58cd6b05dc6f2aa54c027ce7 Mon Sep 17 00:00:00 2001
From: Phillipus
Date: Wed, 4 Dec 2024 18:59:52 +0000
Subject: [PATCH] Check whether workbench is closing before restore global
actions
- If we check this then we don't get a NPE when editing a diagram label and quitting Archi
- We'll still catch exceptions just in case
---
.../ui/components/GlobalActionDisablementHandler.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/ui/components/GlobalActionDisablementHandler.java b/com.archimatetool.editor/src/com/archimatetool/editor/ui/components/GlobalActionDisablementHandler.java
index 7be6c918a..69155d018 100644
--- a/com.archimatetool.editor/src/com/archimatetool/editor/ui/components/GlobalActionDisablementHandler.java
+++ b/com.archimatetool.editor/src/com/archimatetool/editor/ui/components/GlobalActionDisablementHandler.java
@@ -104,8 +104,7 @@ public void clearGlobalActions() {
* Restore the Global Action Handlers that were set to null
*/
public void restoreGlobalActions() {
- if(actionBars != null) {
- // Restore Actions
+ if(actionBars != null && !PlatformUI.getWorkbench().isClosing()) { // Ensure we're not closing the workbench
try {
for(Entry entry : savedActions.entrySet()) {
actionBars.setGlobalActionHandler(entry.getKey(), entry.getValue());
@@ -116,10 +115,12 @@ public void restoreGlobalActions() {
// Update
actionBars.updateActionBars();
}
- catch(NullPointerException ex) {
+ catch(Exception ex) {
+ ex.printStackTrace();
// Catch this because in Archi 4.5 and later (Eclipse 4.11 and later) if we are editing
// in a DirectEditManager and close the app we get a NPE in Eclipse
- // this just stops the NPE written to the log
+ // this just stops the NPE written to the log.
+ // Note we shouldn't get this now as we check PlatformUI.getWorkbench().isClosing()
}
}
}