Don't ask for confirmation on renaming, don't commit return type

This commit is contained in:
caheckman 2019-09-17 14:52:44 -04:00
parent 1257f06c17
commit 23cb2634ab
2 changed files with 9 additions and 10 deletions

View file

@ -15,7 +15,6 @@
*/ */
package ghidra.app.plugin.core.decompile.actions; package ghidra.app.plugin.core.decompile.actions;
import docking.widgets.OptionDialog;
import ghidra.framework.plugintool.PluginTool; import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.listing.Function; import ghidra.program.model.listing.Function;
import ghidra.program.model.listing.Program; import ghidra.program.model.listing.Program;
@ -69,13 +68,6 @@ public class RenameVariableTask extends RenameTask {
} }
commitRequired = RetypeVariableAction.checkFullCommit(var, hfunction); commitRequired = RetypeVariableAction.checkFullCommit(var, hfunction);
if (commitRequired) { if (commitRequired) {
int resp =
OptionDialog.showOptionDialog(tool.getToolFrame(), "Parameter Commit Required",
"Renaming a parameter requires all other parameters to be committed!\nContinue with rename?",
"Continue");
if (resp != OptionDialog.OPTION_ONE) {
return false;
}
exactSpot = null; // Don't try to split out if we need to commit exactSpot = null; // Don't try to split out if we need to commit
} }

View file

@ -157,10 +157,17 @@ public class RetypeVariableAction extends AbstractDecompilerAction {
dt = dataTypeManager.resolve(dt, null); dt = dataTypeManager.resolve(dt, null);
} }
if (commitRequired) { if (commitRequired) {
// Don't use datatypes of other parameters if the datatypes were floating.
// Datatypes were floating if signature source was DEFAULT
boolean useDataTypes =
hfunction.getFunction().getSignatureSource() != SourceType.DEFAULT;
try { try {
HighFunctionDBUtil.commitParamsToDatabase(hfunction, true, HighFunctionDBUtil.commitParamsToDatabase(hfunction, useDataTypes,
SourceType.USER_DEFINED); SourceType.USER_DEFINED);
HighFunctionDBUtil.commitReturnToDatabase(hfunction, SourceType.USER_DEFINED); if (useDataTypes) {
HighFunctionDBUtil.commitReturnToDatabase(hfunction,
SourceType.USER_DEFINED);
}
} }
catch (DuplicateNameException e) { catch (DuplicateNameException e) {
throw new AssertException("Unexpected exception", e); throw new AssertException("Unexpected exception", e);