aboutsummaryrefslogtreecommitdiffstats
path: root/ajbrowser
diff options
context:
space:
mode:
Diffstat (limited to 'ajbrowser')
-rw-r--r--ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserProperties.java5
-rw-r--r--ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java91
2 files changed, 37 insertions, 59 deletions
diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserProperties.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserProperties.java
index d8a09a2d8..8d0d2cf8e 100644
--- a/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserProperties.java
+++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserProperties.java
@@ -161,4 +161,9 @@ public class BrowserProperties implements ProjectPropertiesAdapter {
public Set getAspectPath( ) { // XXX unimplemented
return null;
}
+
+ public Map getSourcePathResources() {
+ return null;
+ }
+
}
diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java
index e03885ef6..cbc09c877 100644
--- a/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java
+++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java
@@ -15,22 +15,13 @@
package org.aspectj.tools.ajbrowser;
import java.awt.BorderLayout;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.DefaultListModel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.TaskListManager;
-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 java.awt.event.*;
+
+import javax.swing.*;
+
+import org.aspectj.ajde.*;
+import org.aspectj.ajde.ui.swing.*;
+import org.aspectj.bridge.*;
import org.aspectj.bridge.IMessage.Kind;
/**
@@ -45,11 +36,11 @@ public class CompilerMessagesPanel extends JPanel implements TaskListManager {
private JList list = new JList();
private DefaultListModel listModel = new DefaultListModel();
private BorderLayout borderLayout1 = new BorderLayout();
- private boolean hasWarning = false;
+ private boolean hasWarning = false;
public CompilerMessagesPanel() {
try {
- jbInit();
+ jbInit();
}
catch(Exception e) {
e.printStackTrace();
@@ -61,10 +52,8 @@ public class CompilerMessagesPanel extends JPanel implements TaskListManager {
if (e.getClickCount() >= 1) {
int index = list.locationToIndex(e.getPoint());
if (listModel.getSize() >= index && index != -1) {
- CompilerMessage cm = (CompilerMessage)listModel.getElementAt(index);
- if ((null != cm) && (null != cm.message)) {
- displayMessage(cm.message);
- }
+ IMessage message = (IMessage)listModel.getElementAt(index);
+ Ajde.getDefault().getEditorAdapter().showSourceLine(message.getISourceLocation(), true);
}
}
}
@@ -72,50 +61,29 @@ 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();
- BrowserManager.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(IMessage message) {
- listModel.addElement(new CompilerMessage(message));
- if (!hasWarning && IMessage.WARNING.isSameOrLessThan(message.getKind())) {
- hasWarning = true;
- }
- BrowserManager.getDefault().showMessages();
+ public void addSourcelineTask(IMessage message) {
+ listModel.addElement(message);
+ checkIfWarning(message.getKind());
+ }
+
+ public void addSourcelineTask(String message, ISourceLocation sourceLocation, IMessage.Kind kind) {
+ listModel.addElement(new Message(message, kind, null, sourceLocation));
+ checkIfWarning(kind);
}
public void addProjectTask(String message, IMessage.Kind kind) {
- IMessage m = new Message(message, kind, null, null);
- listModel.addElement(new CompilerMessage(m));
- if (!hasWarning && IMessage.WARNING.isSameOrLessThan(kind)) {
- hasWarning = true;
- }
- BrowserManager.getDefault().showMessages();
+ listModel.addElement(new Message(message, kind, null, null));
+ checkIfWarning(kind);
}
-
- public boolean hasWarning() {
- return hasWarning;
- }
-
+
+ private void checkIfWarning(Kind kind) {
+ if (kind.equals(IMessage.WARNING)) hasWarning = true;
+ }
+
public void clearTasks() {
listModel.clear();
+ hasWarning = false;
}
private void jbInit() throws Exception {
@@ -123,6 +91,11 @@ public class CompilerMessagesPanel extends JPanel implements TaskListManager {
this.add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(list, null);
}
+
+ public boolean hasWarning() {
+ return hasWarning;
+ }
+
}