Using addError & addExtraMessage - the ErrorList plugin API
Submitted by Friday, 20 April, 2007 - 20:40
on
I have been using jEdit alongside the Microsoft Visual C++ IDE (MSDEV) application for quite some time now, whilst writing embedded apps simulations PCs hosting XP.
Some time ago I bolted together a support tool that detected compilation log creation (.plg files generated by MSVC when compiling C/C++ projects) and then opened and parsed the errors & warnings.
From this data a bsh script file is generated, an then executed by jEdit to populate the ErrorList plugin's window accordingly.
So I can compile within another IDE, but edit and correct code within jEdit. Quite handy.
I later extended this tool to collate PC-Lint analysis results (also invoked within the IDE) in the same manner.
A typical example of the bsh file generated by the tool is as follows (I have only included a single addError invocation, but this is enough to demonstrate the script format):
//-----------------------------------------------------
import org.gjt.sp.jedit.*;
import org.gjt.sp.util.*;
import org.gjt.sp.jedit.gui.OptionsDialog;
import org.gjt.sp.jedit.msg.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import errorlist.*;
import java.util.*;
import gnu.regexp.*;
import console.*;
void run()
{
void log_errors()
{
errorlist.DefaultErrorSource errsrc;
errsrc = new errorlist.DefaultErrorSource("MSVC");
errorlist.ErrorSource.registerErrorSource(errsrc);
jEdit.getAction("error-list-clear").invoke(null);
errsrc.addError(ErrorSource.ERROR, "C:\\my_projects\\hw_if\\control\\ctrlapi.c",944,0,0,"LNT787: (Info -- enum constant 'DTV_PL_ASIG_AV_IP1_AUDIO' not used within switch)");
errsrc = null;
}
if(jEdit.getLastView() == null)
VFSManager.runInAWTThread(this);
else
log_errors();
}
run();
//-----------------------------------------------------
The problem I have here is that I wish to extend some of the messages in the plugin output to be multi-line, but I cannot see how to use the addExtraMessage method with the preceding code - can anybody explain how I would modify my bsh script output to permit this?
PS - if anyone else out there running a Windows OS also wants to generate errors/warnings in jEdit from externally generated files, then let me know!
Some time ago I bolted together a support tool that detected compilation log creation (.plg files generated by MSVC when compiling C/C++ projects) and then opened and parsed the errors & warnings.
From this data a bsh script file is generated, an then executed by jEdit to populate the ErrorList plugin's window accordingly.
So I can compile within another IDE, but edit and correct code within jEdit. Quite handy.
I later extended this tool to collate PC-Lint analysis results (also invoked within the IDE) in the same manner.
A typical example of the bsh file generated by the tool is as follows (I have only included a single addError invocation, but this is enough to demonstrate the script format):
//-----------------------------------------------------
import org.gjt.sp.jedit.*;
import org.gjt.sp.util.*;
import org.gjt.sp.jedit.gui.OptionsDialog;
import org.gjt.sp.jedit.msg.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import errorlist.*;
import java.util.*;
import gnu.regexp.*;
import console.*;
void run()
{
void log_errors()
{
errorlist.DefaultErrorSource errsrc;
errsrc = new errorlist.DefaultErrorSource("MSVC");
errorlist.ErrorSource.registerErrorSource(errsrc);
jEdit.getAction("error-list-clear").invoke(null);
errsrc.addError(ErrorSource.ERROR, "C:\\my_projects\\hw_if\\control\\ctrlapi.c",944,0,0,"LNT787: (Info -- enum constant 'DTV_PL_ASIG_AV_IP1_AUDIO' not used within switch)");
errsrc = null;
}
if(jEdit.getLastView() == null)
VFSManager.runInAWTThread(this);
else
log_errors();
}
run();
//-----------------------------------------------------
The problem I have here is that I wish to extend some of the messages in the plugin output to be multi-line, but I cannot see how to use the addExtraMessage method with the preceding code - can anybody explain how I would modify my bsh script output to permit this?
PS - if anyone else out there running a Windows OS also wants to generate errors/warnings in jEdit from externally generated files, then let me know!