- /**
- * Open a message box that informs the user about unimplemented
- * functionality. This method is for developer convenience.
- *
- * @param source
- * a {@link java.lang.Object} object.
- */
- public static void notImplementedMessage(Object source) {
- warningDialog("Not yet implemented", source,
- "This functionality is not yet implemented.");
- }
-
- /**
- * <p>
- * informationDialog
- * </p>
- *
- * @param title
- * a {@link java.lang.String} object.
- * @param message
- * a {@link java.lang.String} object.
- */
- public static void informationDialog(final String title,
- final String message) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- MessageDialog.openInformation(getShell(), title, message);
- }
- });
- }
-
- public static void informationDialog(final String title,
- final IStatus status) {
- informationDialog(title, status.getMessage());
- }
-
- /**
- * <p>
- * warningDialog
- * </p>
- *
- * @param title
- * The dialogs title
- * @param source
- * The object where the warning was generated (used by log4j)
- * @param message
- * An informative String to be presented to the user
- */
- public static void warningDialog(final String title, final Object source,
- final String message) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- MessageDialog.openWarning(getShell(), title, message);
- Class<? extends Object> clazz = source != null ? source
- .getClass() : AbstractUtility.class;
- warn(clazz, message);
- }
- });
- }
-
- /**
- * @param title
- * @param termBase
- * @param status
- */
- public static void warningDialog(String title, Object source,
- IStatus status) {
- warningDialog(title, source, status.getMessage());
- }
-
- /**
- * <p>
- * errorDialog
- * </p>
- *
- * @param title
- * The dialogs title
- * @param source
- * The object where the warning was generated (used by log4j)
- * @param message
- * An informative String to be presented to the user
- * @param title
- * The dialogs title
- * @param t
- * a Throwable if one exists or null
- */
- public static void errorDialog(final String title, final Object source,
- final String message, final Throwable t) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- MessageDialog.openError(getShell(), title, message + getCauseRecursively(t));
- Class<? extends Object> clazz = source != null ? source
- .getClass() : this.getClass();
- error(clazz, message, t);
- }
-
- private String getCauseRecursively(Throwable t) {
- if(t == null){
- return "";
- }
-
- if(t.getCause() != null){
- return getCauseRecursively(t.getCause());
- }else{
- return String.format("\n\nException: %s\nMessage: %s", t.getClass().getSimpleName(), t.getMessage());
- }
-
- }
- });
- }
-
- public static void errorDialog(final String title, final Object source,
- final String message){
- errorDialog(title, source, message, null);
- }
-
- /**
- * <p>
- * errorDialog
- * </p>
- *
- * @param title
- * a {@link java.lang.String} object.
- * @param source
- * a {@link java.lang.Object} object.
- * @param status
- * a {@link org.eclipse.core.runtime.IStatus} object.
- */
- public static void errorDialog(final String title, final Object source,
- final IStatus status) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- ErrorDialog.openError(getShell(), title, null, status);
- Class<? extends Object> clazz = source != null ? source
- .getClass() : this.getClass();
- error(clazz, status);
- }
- });
- }
-
- /**
- * <p>
- * confirmDialog
- * </p>
- *
- * @param title
- * a {@link java.lang.String} object.
- * @param message
- * a {@link java.lang.String} object.
- * @return a boolean.
- */
- public static boolean confirmDialog(String title, String message) {
- return MessageDialog.openQuestion(getShell(), title, message);
- }
-