Skip to content

Commit

Permalink
Check whether workbench is closing before restore global actions
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Phillipus committed Dec 4, 2024
1 parent 5526a98 commit 12d632e
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, IAction> entry : savedActions.entrySet()) {
actionBars.setGlobalActionHandler(entry.getKey(), entry.getValue());
Expand All @@ -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()
}
}
}
Expand Down

0 comments on commit 12d632e

Please sign in to comment.