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

The following examples show how to use docking.widgets.OptionDialog#showOptionNoCancelDialog() . 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: GhidraScript.java    From ghidra with Apache License 2.0 6 votes vote down vote up
protected boolean promptToKeepChangesOnException() {

		String message = "<html>Encountered exception running script \"" +
			HTMLUtilities.escapeHTML(sourceFile.getName()) +
			"\".<br><br>Keep the changes to the program?";
		//@formatter:off
			int choice =
					OptionDialog.showOptionNoCancelDialog(
					null,
					"Keep Changes?",
					message,
					"<html>No (<font color=\"red\">discard</font> changes)",
					"<html>Yes (<font color=\"green\">keep</font> changes)",
					OptionDialog.QUESTION_MESSAGE);
		//@formatter:on

		if (choice == OptionDialog.OPTION_TWO) { // Yes
			return true;
		}
		return false;
	}
 
Example 2
Source File: FunctionEditorDialog.java    From ghidra with Apache License 2.0 6 votes vote down vote up
protected boolean handleParseException(Exception exception) {
	String message = exception.getMessage();

	String details = CParserUtils.handleParseProblem(exception, signatureTextField.getText());
	if (details != null) {
		message = details;
	}

	message = HTMLUtilities.wrapAsHTML(
		message + "<BR><BR><CENTER><B>Do you want to continue editing or " +
			"abort your changes?</B></CENTER>");
	int result = OptionDialog.showOptionNoCancelDialog(rootPanel, "Invalid Function Signature",
		message, "Continue Editing", "Abort Changes", OptionDialog.ERROR_MESSAGE);
	if (result == OptionDialog.OPTION_TWO) {
		model.resetSignatureTextField();
		return true;
	}
	return false;
}
 
Example 3
Source File: GhidraTool.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private boolean promptUserToSave() {
	int result =
		OptionDialog.showOptionNoCancelDialog(getToolFrame(), NON_AUTOSAVE_SAVE_TOOL_TITLE,
			"The tool configuration has changed for " + getName() +
				".\nDo you want to save it to your " + "tool chest?",
			"&Save", "Do&n't Save", OptionDialog.QUESTION_MESSAGE);
	return (result == OptionDialog.OPTION_ONE);
}
 
Example 4
Source File: AbstractManualMatchFromToolsAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private boolean validateExistingMatch(VTController controller) {
	VTMatch match = subToolContext.getMatch();
	if (match == null) {
		return true;
	}

	int choice = OptionDialog.showOptionNoCancelDialog(null, "Match Exists",
		"<html>You have attempted to create a manual when a match already exists.<br>" +
			"Would you like to select the match in the matches table?",
		"Yes", "No", OptionDialog.QUESTION_MESSAGE);
	if (choice == 1) {
		controller.setSelectedMatch(match);
	}
	return false;
}
 
Example 5
Source File: AbstractManualMatchFromToolsAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private boolean validateCursorPosition() {
	boolean sourceCursorOnScreen = subToolContext.isSourceCursorOnScreen();
	boolean destinationCursorOnScreen = subToolContext.isDestinationCursorOnScreen();

	if (sourceCursorOnScreen && destinationCursorOnScreen) {
		return true;
	}

	String message = "";
	if (!sourceCursorOnScreen) {
		message += " <b>source tool</b>";
	}

	if (!destinationCursorOnScreen) {
		message += " and the <b>destination tool</b>";
	}

	int choice = OptionDialog.showOptionNoCancelDialog(null, "Cursor Offscreen",
		"<html>Your cursor is off the screen in the " + message + ".<br>" +
			"There is a chance the cursor is not in the function you " +
			"currently see.<br>Would you like to continue creating a match?",
		"Yes", "No", OptionDialog.QUESTION_MESSAGE);
	if (choice != 1) {
		return false;
	}
	return true;
}