aboutsummaryrefslogtreecommitdiffstats
path: root/ajbrowser
diff options
context:
space:
mode:
Diffstat (limited to 'ajbrowser')
-rw-r--r--ajbrowser/src/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java68
1 files changed, 32 insertions, 36 deletions
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<IMessage.Kind> ignoring;
+ private List<IMessage> messages;
+
public BrowserMessageHandler() {
- ignoring = new ArrayList();
- messages = new ArrayList();
+ ignoring = new ArrayList<IMessage.Kind>();
+ messages = new ArrayList<IMessage>();
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<IMessage> 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 "<no stack trace available>";
- }
+ private String getStackTraceAsString(Throwable t) {
+ StringWriter stringWriter = new StringWriter();
+ if (t != null) {
+ t.printStackTrace(new PrintWriter(stringWriter));
+ return stringWriter.getBuffer().toString();
+ }
+ return "<no stack trace available>";
+ }
public void reset() {
messages.clear();
}
-
+
}