aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-04-30 02:36:02 +0000
committerwisberg <wisberg>2003-04-30 02:36:02 +0000
commit3bc503e4539c492dd8f1d06f03a729d3171320ba (patch)
treefef8ef6633718162bc805af3c882d3b30a9c2b81
parent632ce1e11ac421e2cdfbe51582ccf3f4968eddc3 (diff)
downloadaspectj-3bc503e4539c492dd8f1d06f03a729d3171320ba.tar.gz
aspectj-3bc503e4539c492dd8f1d06f03a729d3171320ba.zip
- using IMessage-based API's for displaying messages
- if a source line message contains a throwable and the user double-clicks, this displays the error dialog that permits them to copy the trace. That should mean that multiple exceptions can be in the task list.
-rw-r--r--ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java33
1 files changed, 29 insertions, 4 deletions
diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java
index 61a808aab..5324e50bc 100644
--- a/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java
+++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java
@@ -30,6 +30,8 @@ import org.aspectj.ajde.ui.swing.CompilerMessage;
import org.aspectj.ajde.ui.swing.CompilerMessagesCellRenderer;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.Message;
+import org.aspectj.bridge.IMessage.Kind;
/**
* Used to display a list of compiler messages that can be clicked in order
@@ -59,7 +61,9 @@ public class CompilerMessagesPanel extends JPanel implements TaskListManager {
int index = list.locationToIndex(e.getPoint());
if (listModel.getSize() >= index && index != -1) {
CompilerMessage cm = (CompilerMessage)listModel.getElementAt(index);
- Ajde.getDefault().getEditorManager().showSourceLine(cm.sourceLocation, true);
+ if ((null != cm) && (null != cm.message)) {
+ displayMessage(cm.message);
+ }
}
}
}
@@ -67,14 +71,35 @@ public class CompilerMessagesPanel extends JPanel implements TaskListManager {
list.addMouseListener(mouseListener);
list.setCellRenderer(new CompilerMessagesCellRenderer());
}
+
+ public void addSourcelineTask(
+ String message,
+ ISourceLocation sourceLocation,
+ Kind kind) {
+ addSourcelineTask(new Message(message, kind, null, sourceLocation));
+ }
+
+ /**
+ * called when user double-clicks on a message.
+ */
+ protected void displayMessage(IMessage message) {
+ ISourceLocation loc = message.getISourceLocation();
+ Ajde.getDefault().getEditorManager().showSourceLine(loc, true);
+ // show dialog with stack trace if thrown
+ Throwable thrown = message.getThrown();
+ if (null != thrown) {
+ Ajde.getDefault().getErrorHandler().handleError(message.getMessage(), thrown);
+ }
+ }
- public void addSourcelineTask(String message, ISourceLocation sourceLocation, IMessage.Kind kind) {
- listModel.addElement(new CompilerMessage(message, sourceLocation,kind));
+ public void addSourcelineTask(IMessage message) {
+ listModel.addElement(new CompilerMessage(message));
BrowserManager.getDefault().showMessages();
}
public void addProjectTask(String message, IMessage.Kind kind) {
- listModel.addElement(new CompilerMessage(message,kind));
+ IMessage m = new Message(message, kind, null, null);
+ listModel.addElement(new CompilerMessage(m));
BrowserManager.getDefault().showMessages();
}