From: wisberg Date: Mon, 5 May 2003 15:18:01 +0000 (+0000) Subject: implement binary-incompatible API for detecting whether any warnings exist, to enable... X-Git-Tag: V1_1_0_RC2~69 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4c00febe0b767ff8b466456c5d89e45673451961;p=aspectj.git implement binary-incompatible API for detecting whether any warnings exist, to enable/disable message display. --- diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java index 5324e50bc..46a162c1e 100644 --- a/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java +++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/CompilerMessagesPanel.java @@ -45,6 +45,7 @@ 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; public CompilerMessagesPanel() { try { @@ -94,15 +95,25 @@ public class CompilerMessagesPanel extends JPanel implements TaskListManager { public void addSourcelineTask(IMessage message) { listModel.addElement(new CompilerMessage(message)); + if (!hasWarning && IMessage.WARNING.isSameOrLessThan(message.getKind())) { + hasWarning = true; + } BrowserManager.getDefault().showMessages(); } 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(); } + public boolean hasWarning() { + return hasWarning; + } + public void clearTasks() { listModel.clear(); } diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java index 2664088bf..3647a33fa 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java @@ -26,26 +26,41 @@ import org.aspectj.bridge.*; public class NullIdeTaskListManager implements TaskListManager { List sourceLineTasks = new ArrayList(); + boolean hasWarning = false; public void addSourcelineTask( String message, ISourceLocation sourceLocation, IMessage.Kind kind) { addSourcelineTask(new Message(message, kind, null, sourceLocation)); + if (!hasWarning && IMessage.WARNING.isSameOrLessThan(kind)) { + hasWarning = true; + } } public void addSourcelineTask(IMessage message) { sourceLineTasks.add(new SourceLineTask(message)); + if (!hasWarning && IMessage.WARNING.isSameOrLessThan(message.getKind())) { + hasWarning = true; + } // System.out.println("> added sourceline task: " + message + ", file: " + sourceLocation.getSourceFile().getAbsolutePath() // + ": " + sourceLocation.getLine()); } public void addProjectTask(String message, IMessage.Kind kind) { + if (!hasWarning && IMessage.WARNING.isSameOrLessThan(kind)) { + hasWarning = true; + } // System.out.println("> added project task: " + message + ", kind: " + kind); } + public boolean hasWarning() { + return hasWarning; + } + public void clearTasks() { sourceLineTasks = new ArrayList(); + hasWarning = false; // System.out.println("> cleared tasks"); }