Java Code Examples for docking.widgets.OptionDialog#showOptionDialogWithCancelAsDefaultButton()

The following examples show how to use docking.widgets.OptionDialog#showOptionDialogWithCancelAsDefaultButton() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StackEditorModel.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private boolean avoidApplyingConflictingData() {
	if (!hasChanges()) {
		return true; // nothing to do (probably can't get here)
	}

	if (!stackChangedExternally) {
		return false; // not conflicts; nothing to avoid
	}

	int choice = OptionDialog.showOptionDialogWithCancelAsDefaultButton(provider.getComponent(),
		"Overwrite Program Changes?",
		"<html>The function's stack data has changed outside of this<br>" +
			"Stack Editor Provider.<br><BR>" +
			"Would you like to overwrite the external changes with your changes?",
		"Overwrite", OptionDialog.WARNING_MESSAGE);

	if (choice == OptionDialog.CANCEL_OPTION) {
		return true;
	}

	return false;
}
 
Example 2
Source File: DeleteArchiveAction.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionContext context) {
	GTree gTree = (GTree) context.getContextObject();
	TreePath[] selectionPaths = gTree.getSelectionPaths();
	FileArchiveNode node = (FileArchiveNode) selectionPaths[0].getLastPathComponent();

	if (OptionDialog.showOptionDialogWithCancelAsDefaultButton(gTree,
		"Confirm Delete Operation",
		"<html><b>Are you sure you want to delete archive: " +
			HTMLUtilities.escapeHTML(node.getName()) + "?<br><br>" +
			"<font color=\"red\">(WARNING: This action will permanently " +
			"delete the file from disk.)</font></b>",
		"Yes", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
		return;
	}

	try {
		((FileArchive) node.getArchive()).delete();
	}
	catch (IOException e1) {
		Msg.showError(this, null, "Error", "Error deleting data type archive.", e1);
	}
}
 
Example 3
Source File: ColumnFilterDialog.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Ask the user if they want to continue or lose their filter changes.
 *
 * @return true to close the dialog and lose the changes, false to abort the close.
 */
private boolean promptToCloseAndLoseChanges() {

	int choice = OptionDialog.showOptionDialogWithCancelAsDefaultButton(null,
		"Unapplied Changes", "Exit dialog and discard changes?", "Discard Changes");

	return choice != OptionDialog.CANCEL_OPTION;
}
 
Example 4
Source File: FrontEndPlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
boolean confirmDelete(String message) {
	int option = OptionDialog.showOptionDialogWithCancelAsDefaultButton(tool.getToolFrame(),
		"Confirm Delete", "Are you sure you want to delete\n" + message, "Delete",
		OptionDialog.QUESTION_MESSAGE);

	return (option != OptionDialog.CANCEL_OPTION);
}
 
Example 5
Source File: EquateTableProvider.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void showDeleteEquateOptionDialog() {
	String message = "Data type not found. Would you like to delete this equate?";
	int choice = OptionDialog.showOptionDialogWithCancelAsDefaultButton(equatesFilterPanel,
		"Delete Equate", message, "Delete Equate", OptionDialog.ERROR_MESSAGE);
	if (choice == OptionDialog.OPTION_ONE) {
		delete();
	}
}