nl.tudelft.goal.SimpleIDE.ParserMessagesPanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simpleidemodules Show documentation
Show all versions of simpleidemodules Show documentation
An IDE for GOAL based on JEdit.
The newest version!
package nl.tudelft.goal.SimpleIDE;
import java.io.File;
import java.util.Set;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import goal.util.Observer;
import languageTools.errors.Message;
/**
* Shows all current parser errors
*
* @author W.Pasman
*
*/
public class ParserMessagesPanel extends JScrollPane {
private static final long serialVersionUID = -4639663680838109224L;
JTextArea text = new JTextArea();
IdeFiles fileInfo = IdeFiles.getInstance();
public ParserMessagesPanel() {
setViewportView(text);
fileInfo.addObserver(new Observer() {
@Override
public void eventOccured(IdeFiles source, File evt) {
refreshErrors();
}
});
}
/**
* refresh the displayed errors.
*/
private void refreshErrors() {
String message = "";
for (File file : fileInfo.getUsedFiles()) {
Set errors = fileInfo.getErrors(file);
Set warnings = fileInfo.getWarnings(file);
if (errors.isEmpty() && warnings.isEmpty()) {
continue;
}
message += "\n";
for (Message error : errors) {
message += error.toString() + "\n";
}
for (Message warning : warnings) {
message += warning.toString() + "\n";
}
}
text.setText(message);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy