From: aclement Date: Wed, 14 Jul 2010 20:57:00 +0000 (+0000) Subject: generics X-Git-Tag: V1_6_10RC1~118 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f134b1cde4e17044e28855168165adfc42064478;p=aspectj.git generics --- diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java index 11c57d6a5..b8dcf1c41 100644 --- a/ajbrowser/src/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java +++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java @@ -23,72 +23,68 @@ import org.aspectj.bridge.IMessage; import org.aspectj.bridge.IMessage.Kind; /** - * MessageHandler used by AjBrowser that displays ERROR messages with - * exceptions and ABORT messages in an error dialog. Other messages are - * displayed by the MessageHandlerPanel. By default INFO and WEAVEINFO - * messages are ignored. + * MessageHandler used by AjBrowser that displays ERROR messages with exceptions and ABORT messages in an error dialog. Other + * messages are displayed by the MessageHandlerPanel. By default INFO and WEAVEINFO messages are ignored. */ public class BrowserMessageHandler implements IUIBuildMessageHandler { - private List ignoring; - private List messages; - + private List ignoring; + private List messages; + public BrowserMessageHandler() { - ignoring = new ArrayList(); - messages = new ArrayList(); + ignoring = new ArrayList(); + messages = new ArrayList(); ignore(IMessage.INFO); ignore(IMessage.WEAVEINFO); } - + public boolean handleMessage(IMessage message) throws AbortException { Kind messageKind = message.getKind(); if (isIgnoring(messageKind)) { return true; } - if (messageKind.equals(IMessage.ABORT) - || (message.getThrown() != null) ) { - String stack = getStackTraceAsString(message.getThrown()); - ErrorDialog errorDialog = new ErrorDialog( - Ajde.getDefault().getRootFrame(), - "AJDE Error", message.getThrown(), message.getMessage(), stack); - errorDialog.setVisible(true); - return true; + if (messageKind.equals(IMessage.ABORT) || (message.getThrown() != null)) { + String stack = getStackTraceAsString(message.getThrown()); + ErrorDialog errorDialog = new ErrorDialog(Ajde.getDefault().getRootFrame(), "AJDE Error", message.getThrown(), + message.getMessage(), stack); + errorDialog.setVisible(true); + return true; } messages.add(message); return true; } public void dontIgnore(Kind kind) { - if (null != kind) { - ignoring.remove(kind); - } + if (null != kind) { + ignoring.remove(kind); + } } public boolean isIgnoring(Kind kind) { return ((null != kind) && (ignoring.contains(kind))); } - + public void ignore(Kind kind) { - if ((null != kind) && (!ignoring.contains(kind))) { - ignoring.add(kind); - } + if ((null != kind) && (!ignoring.contains(kind))) { + ignoring.add(kind); + } } - - public List getMessages() { + + public List getMessages() { return messages; } - private String getStackTraceAsString(Throwable t) { - StringWriter stringWriter = new StringWriter(); - if (t != null) { - t.printStackTrace(new PrintWriter(stringWriter)); - return stringWriter.getBuffer().toString(); - } - return ""; - } + private String getStackTraceAsString(Throwable t) { + StringWriter stringWriter = new StringWriter(); + if (t != null) { + t.printStackTrace(new PrintWriter(stringWriter)); + return stringWriter.getBuffer().toString(); + } + return ""; + } public void reset() { messages.clear(); } - + }