X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/ExceptionHandler.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/ExceptionHandler.java index fcf0d66..bdae82b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/ExceptionHandler.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/ExceptionHandler.java @@ -12,35 +12,39 @@ import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.widgets.Shell; - public class ExceptionHandler { - private static ExceptionHandler fgInstance= new ExceptionHandler(); - + private static ExceptionHandler fgInstance = new ExceptionHandler(); + public static void log(Throwable t, String message) { - PHPeclipsePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, PHPeclipsePlugin.PLUGIN_ID, - IStatus.ERROR, message, t)); + PHPeclipsePlugin.getDefault().getLog().log( + new Status(IStatus.ERROR, PHPeclipsePlugin.PLUGIN_ID, + IStatus.ERROR, message, t)); } - + public static void handle(CoreException e, String title, String message) { handle(e, PHPeclipsePlugin.getActiveWorkbenchShell(), title, message); } - - public static void handle(CoreException e, Shell parent, String title, String message) { + + public static void handle(CoreException e, Shell parent, String title, + String message) { fgInstance.perform(e, parent, title, message); } - - public static void handle(InvocationTargetException e, String title, String message) { + + public static void handle(InvocationTargetException e, String title, + String message) { handle(e, PHPeclipsePlugin.getActiveWorkbenchShell(), title, message); } - - public static void handle(InvocationTargetException e, Shell parent, String title, String message) { + + public static void handle(InvocationTargetException e, Shell parent, + String title, String message) { fgInstance.perform(e, parent, title, message); } - protected void perform(CoreException e, Shell shell, String title, String message) { + protected void perform(CoreException e, Shell shell, String title, + String message) { PHPeclipsePlugin.log(e); - IStatus status= e.getStatus(); + IStatus status = e.getStatus(); if (status != null) { ErrorDialog.openError(shell, title, message, status); } else { @@ -48,30 +52,34 @@ public class ExceptionHandler { } } - protected void perform(InvocationTargetException e, Shell shell, String title, String message) { - Throwable target= e.getTargetException(); + protected void perform(InvocationTargetException e, Shell shell, + String title, String message) { + Throwable target = e.getTargetException(); if (target instanceof CoreException) { - perform((CoreException)target, shell, title, message); + perform((CoreException) target, shell, title, message); } else { PHPeclipsePlugin.log(e); if (e.getMessage() != null && e.getMessage().length() > 0) { displayMessageDialog(e, e.getMessage(), shell, title, message); } else { - displayMessageDialog(e, target.getMessage(), shell, title, message); + displayMessageDialog(e, target.getMessage(), shell, title, + message); } } } - private void displayMessageDialog(Throwable t, String exceptionMessage, Shell shell, String title, String message) { - StringWriter msg= new StringWriter(); + private void displayMessageDialog(Throwable t, String exceptionMessage, + Shell shell, String title, String message) { + StringWriter msg = new StringWriter(); if (message != null) { msg.write(message); msg.write("\n\n"); } if (exceptionMessage == null || exceptionMessage.length() == 0) - msg.write(PHPUIMessages.getString("ExceptionDialog.seeErrorLogMessage")); + msg.write(PHPUIMessages + .getString("ExceptionDialog.seeErrorLogMessage")); else msg.write(exceptionMessage); - MessageDialog.openError(shell, title, msg.toString()); - } + MessageDialog.openError(shell, title, msg.toString()); + } } \ No newline at end of file