java - How to add buttons to the JFace ErrorDialog -
i'm trying add "cancel" button popup dialog, dialog gives user info , allows them hit yes or view details. problem there no cancel button , add one.
the dialog jface errordialog
uses premade multistatus
display error message. dialog opens , gives ok button or cancel button. there anyway directly manipulate how dialog creates buttons or other method use change how looks? appreciated!
if (errordialog.openerror(shell, messages.consistencyaction_confirm_dialog_title, null, multistatus, istatus.warning) != window.ok) { return; }
this dialog i'm trying change. checking make sure presses ok, if don't exit. can exit hitting red x in corner it'd less confusing have button.
you can extend errordialog
class can override createbuttonsforbuttonbar
method.
for example eclipse p2 install plugin:
public class okcancelerrordialog extends errordialog { public okcancelerrordialog(shell parentshell, string dialogtitle, string message, istatus status, int displaymask) { super(parentshell, dialogtitle, message, status, displaymask); } @override protected void createbuttonsforbuttonbar(composite parent) { // create ok, cancel , details buttons createbutton(parent, idialogconstants.ok_id, idialogconstants.ok_label, true); createbutton(parent, idialogconstants.cancel_id, idialogconstants.cancel_label, true); createdetailsbutton(parent); } }
with can't use static errordialog.openerror
method, instead have like:
okcancelerrordialog dialog = new okcancelerrordialog(shell, messages.consistencyaction_confirm_dialog_title, null, multistatus, istatus.warning);
Comments
Post a Comment