use of com.google.security.zynamics.binnavi.Gui.Debug.OptionsDialog.COptionsDialog in project binnavi by google.
the class CDebuggerFunctions method showDebuggerOptionsDialogAlways.
/**
* Shows the debugger options dialog.
*
* @param parent Parent window of the dialog.
* @param target Provides the debugger target.
* @param debugger The debugger whose options are shown in the dialog.
*/
public static void showDebuggerOptionsDialogAlways(final JFrame parent, final DebugTargetSettings target, final IDebugger debugger) {
Preconditions.checkNotNull(parent, "IE01559: Parent argument can not be null");
Preconditions.checkNotNull(target, "IE01560: Target argument can not be null");
Preconditions.checkNotNull(debugger, "IE01561: Debugger argument can not be null");
final TargetInformation targetInformation = debugger.getProcessManager().getTargetInformation();
if (targetInformation == null) {
CMessageBox.showInformation(parent, "Debugger information can not be shown before the debugger is active.");
return;
}
DebuggerOptions options = targetInformation.getDebuggerOptions();
if (options == null) {
CMessageBox.showInformation(parent, "Debugger information can not be shown before the debugger is active.");
return;
}
if (!debugger.isConnected()) {
CMessageBox.showInformation(parent, "Debugger information can not be shown since the debugger is not currently connected.");
return;
}
try {
options.setExceptions(new ArrayList<DebuggerException>(mergeExceptionsSettings(target, options.getExceptions(), debugger.getId())));
} catch (final CouldntLoadDataException exception) {
CUtilityFunctions.logException(exception);
final String message = "Exception settings could not be loaded.";
final String description = CUtilityFunctions.createDescription(String.format("BinNavi could not load the exception settings from the database."), new String[] { "Communication error while contacting the database" }, new String[] { "BinNavi is unable to show the debugger options dialog until the problem is resolved." + " The default debugger options will be used during this session." });
NaviErrorDialog.show(parent, message, description, exception);
}
final DebuggerEventSettings eventSettings = readDebuggerEventSettings(parent, debugger, target);
final COptionsDialog dlg = new COptionsDialog(parent, options, eventSettings);
dlg.setVisible(true);
options = dlg.getDebuggerOptions();
try {
writeDebuggerExceptionSettings(options, target, debugger.getId());
writeDebuggerEventSettings(debugger, target, dlg.getDebuggerEventSettings());
} catch (final CouldntSaveDataException exception) {
CUtilityFunctions.logException(exception);
CUtilityFunctions.logException(exception);
final String message = "Exception settings could not be written.";
final String description = CUtilityFunctions.createDescription(String.format("BinNavi could not write the debugger options to the database."), new String[] { "Communication error while contacting the database" }, new String[] { "BinNavi is unable to store the debugger options in the database.", "Nevertheless, the debugger options will be sent to the debugger." });
NaviErrorDialog.show(parent, message, description, exception);
}
sendExceptionSettings(parent, debugger, options.getExceptions());
sendDebuggerEventSettings(parent, debugger, target);
}
Aggregations