Skip to content

Instantly share code, notes, and snippets.

Created February 27, 2023 15:35
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
This #jarchi script shows alternative MessageDialog windows with more options using Java "jface" dialogs
* Example message dialogs via jface
var MessageDialog= Java.type('org.eclipse.jface.dialogs.MessageDialog');
// Standard Error Message, with "ok" button and error icon
MessageDialog.openError(shell,"Error","your errortext");
// Standard Confirm Message, with "ok" and "cancel" button, will return true of false
var result=MessageDialog.openConfirm(shell,"Confirm","your confirmation request");
// Standard Information Message, with "ok" button and information icon
MessageDialog.openInformation(shell,"Information","your information");
// Standard Question Message, with "yes" "no" buttons, returning "true"/"false"
result=MessageDialog.openQuestion(shell,"Question","your question");
// Standard warning Message, with "ok" button and warning icon
MessageDialog.openWarning(shell,"Warning","your warningtext");
// more sophisticated one, you can provide your own buttons, and set the type of standard icon
// returns index within array of button that has been clicked on
var buttons=["left","middle","right"];
owndialog = new MessageDialog(shell,"Own messagebox",null,"own messagebox info",MessageDialog.INFORMATION,buttons,0);;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment