From e478ea4e9387853441e67f11808effb558e8fea1 Mon Sep 17 00:00:00 2001 From: dragonmacher <48328597+dragonmacher@users.noreply.github.com> Date: Wed, 5 Oct 2022 11:27:35 -0400 Subject: [PATCH] GP-2173 - fixed undo closing an unsaved data type editor window --- .../datamgr/editor/DataTypeEditorManager.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/DataTypeEditorManager.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/DataTypeEditorManager.java index 308657c440..d05f007a9d 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/DataTypeEditorManager.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/DataTypeEditorManager.java @@ -358,14 +358,21 @@ public class DataTypeEditorManager DataTypeManager dataTypeManager = editor.getDataTypeManager(); DataTypeManager programDataTypeManager = domainObject.getDataTypeManager(); if (dataTypeManager == programDataTypeManager) { - DataTypePath dtPath = editor.getDtPath(); - CategoryPath categoryPath = dtPath.getCategoryPath(); - String name = dtPath.getDataTypeName(); - DataType dataType = programDataTypeManager.getDataType(categoryPath, name); - if (dataType == null || dataType.isDeleted()) { - dismissEditor(editor); - continue; - } + /* + + It is not clear why this check was added. It seem reasonable to always let the + editor know about the event. With this code enabled, editors with new, unsaved + types will be closed. + + DataTypePath dtPath = editor.getDtPath(); + CategoryPath categoryPath = dtPath.getCategoryPath(); + String name = dtPath.getDataTypeName(); + DataType dataType = programDataTypeManager.getDataType(categoryPath, name); + if (dataType == null || dataType.isDeleted()) { + dismissEditor(editor); + continue; + } + */ editor.domainObjectRestored(domainObject); } } @@ -519,8 +526,8 @@ public class DataTypeEditorManager PluginTool tool = plugin.getTool(); DTMEditFunctionSignatureDialog editSigDialog = new DTMEditFunctionSignatureDialog( plugin.getTool(), "Edit Function Signature", category, functionDefinition); - editSigDialog.setHelpLocation( - new HelpLocation("DataTypeManagerPlugin", "Function_Definition")); + editSigDialog + .setHelpLocation(new HelpLocation("DataTypeManagerPlugin", "Function_Definition")); tool.showDialog(editSigDialog); } @@ -530,7 +537,7 @@ public class DataTypeEditorManager /** * DTMEditFunctionSignatureDialog provides the ability to edit the - * function signature associated with a specific {@link FunctionDefinition}. + * function signature associated with a specific {@link FunctionDefinition}. * Use of this editor requires the presence of the tool-based datatype manager service. */ private class DTMEditFunctionSignatureDialog extends AbstractEditFunctionSignatureDialog {