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
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82349
Context Free Art (*.cfdg)   0.31   46055
BBEdit scheme   1.0   18595
JBuilder scheme   .001   18495
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293