jEdit Community - Resources for users of the jEdit Text Editor
Manipulating jEdit from external process.
Submitted by PaulCollingwood on Wednesday, 22 February, 2006 - 10:24
I was wondering if anyone knows if it's possible to access a running version of jEdit (and it's plugins) from an external application?

I have very,very little understanding of Java, but instincts tell me that maybe this could be achieved via a JVM instance in control of an application.
Could someone confirm whether this is possible?

The reason I would like to perform such a task is to invoke calls to the ErrorList pligin, via it's addError() call, as is outline here....

http://community.jedit.org/cgi-bin/TWiki/view/Plugins/PluginDebuggingTechniques

I would like to write a WIN32 application that performs such a tesk, and this would ideally be written in either VB or C.

Has anyone got any ideas how I would get started on this?

Many Thanks Smiling
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Thanks for the advice, Robert
by PaulCollingwood on Tue, 14/03/2006 - 14:06
Thanks for the advice, Robert.
I've tried using jEditLanucher with sone degree of success - I was wondering if anyone knew why the follong process does'nt work completely...

Calling the jEditLancher (application executable jedit.exe) like this:

jedit -run=test.bsh

With a beanshell script TEST.BSH as follows:

//--------------
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.*;

DefaultErrorSource errsrc;
void run()
{
errsrc = new DefaultErrorSource("Whatever"); ErrorSource.registerErrorSource(errsrc);

errsrc.clear();

errsrc.addError(ErrorSource.ERROR, "c:\\test.c",1,0,0,"Oh dear!");

ErrorSource.unregisterErrorSource(errsrc);
errsrc = null;
}
run();
//--------------

Will run without any reported error, and sure enough, an error message is logged in the ErrorList dialog as expected. However, running the same script again results in another IDENTICAL error message being added - in other words the errsrc.clear() directive is not working. In fact, using the jEdit menu option to clear the ErrorList does not remove these messages either!

A possoble clue to the problem is given when I change the script to this:

errsrc.addError(ErrorSource.ERROR, "c:\\test.c",3,0,0,"Oh my!");
errsrc.addError(ErrorSource.ERROR, "c:\\test.c",2,0,0,"Ooops!");
errsrc.addError(ErrorSource.ERROR, "c:\\test.c",3,0,0,"Not again!");
errsrc.clear();
errsrc.addError(ErrorSource.ERROR, "c:\\test.c",1,0,0,"Oh dear!");

In this case I only get the LAST error message, so in other words the clear() methos works within the scope of this BSH script.

Does anyone know whats going wrong? Further, how do I use the addError() method fron an invoked BSH script in the same way as a plugin does?

Hope someone can help!
Paul
jEditLauncher
by Robert Schwenn on Thu, 23/02/2006 - 20:30
I guess that You have to deal with the jEditLauncher (www.rutherfurd.net/jEdit/launcher).

From the user's guide: " The core of the jEditLauncher package is a COM component that can communicate with the EditServer.. ..the functions of jEditLauncher are available .. using the Win32::OLE package"

It seems that You can can control jEdit only by Beanshell scripts with LauncherObject.EvalScript("String_with_BeanshellStatements"). Robert

 
jEditLauncher - what's going wrong?
by PaulCollingwood on Tue, 14/03/2006 - 11:07
See above...
 
after trial and error...
by Robert Schwenn on Tue, 14/03/2006 - 21:38
Hi Paul,
the following macro works, if it is invoked from within jedit and from an ordinary commandline (javaw -jar %JEDIT_HOME%\JEdit.jar -reuseview -run=xxx.bsh).
Robert

void run() {
errorlist.DefaultErrorSource errsrc;
errsrc = new errorlist.DefaultErrorSource("Whatever");
errorlist.ErrorSource.registerErrorSource(errsrc);

//This can't work, because errsrc is a newly created object,
//that doesn't contain any errors yet:
//errsrc.clear();

//clear list of errors via the action, that also can be invoked by keyed-in
//in the actionbar or by clicking the appropriate button.
jEdit.getAction("error-list-clear").invoke(null);

//Add new error
errsrc.addError(ErrorSource.ERROR, "c:\\test.c",1,0,0,"Oh dear!");

//Do not unregister - so the errors stay deleteable by the errorlist plugin itself (see above)
//errorlist.ErrorSource.unregisterErrorSource(errsrc);
errsrc = null;

}
run();
User login
Browse archives
« December 2014  
MoTuWeThFrSaSu
1
2
3
4
5
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
33%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1092
Syndication
file   ver   dls
German Localization light   4.4.2.1   47365
Context Free Art (*.cfdg)   0.31   37317
JBuilder scheme   .001   11741
R Edit Mode - extensive version   0.1   11480
BBEdit scheme   1.0   11306
ColdFusion scheme   1.0   11295
Advanced HTML edit mode   1.0   10932
Matlab Edit Mode   1.0   10797
jEdit XP icons   1.0   10258
XP icons for jEdit   1.1   10030