jEdit Community - Resources for users of the jEdit Text Editor
How to catch message about buffer change
Submitted by Riven on Wednesday, 7 September, 2011 - 20:38
Hi,

I'm trying to develop simple plugin which response to buffer changes. So far I build a JAR file called SimpleLock.jar, containing .props file actions.xml and apropriate java.class files.

My problem is, that after creating and saving some buffer no Dialog appear and no text file is written on C: drive (these are the actions, that should be done after buffer saved).

Here is sample source code:

public class SimpleLockPlugin extends EBPlugin
{
public void handleMessage(EBMessage msg)
{
//I guess some dialog should appear if any message is captured.
JOptionPane.showMessageDialog(null, "Some message.");

//My own class for writing content to file
FileEditor.writeContentToFile("Some message.", "C:\\simpleLock.txt");

if(msg instanceof BufferUpdate)
{
//I guess some dialog should appear if any message related to buffer update is captured.
JOptionPane.showMessageDialog(null, "Some message.");

if( ((BufferUpdate) msg).getWhat().equals(BufferUpdate.SAVED) )
{
String path = ((BufferUpdate) msg).getBuffer().getPath();

//I guess some dialog with path to saved file should appear if any message related to buffer saved is captured.
JOptionPane.showMessageDialog(null, path);
return;
}
}
}
}

I aslo get some errors at jEdit startup, right after opening plugin manager window:
org.xml.sax.SAXParseException: Content is not allowed in prolog.
Every time I open plugin manager wondow two SAXParseException appear.

Is it related to my probem with catching buffer changes?

I'm using jEdit 4.4.1

Any help would be appreciated.

Best regards,
Riven
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Mailing List
by Robert Schwenn on Thu, 08/09/2011 - 18:13
Could You, please, ask at the Mailing List ( https://lists.sourceforge.net/lists/listinfo/jedit-devel ). There are the developers.

Also, You could have a look at sources of other plugins, that do similar things.

Robert
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   82347
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18494
BBEdit scheme   1.0   18115
ColdFusion scheme   1.0   18023
R Edit Mode - extensive version   0.1   17472
Advanced HTML edit mode   1.0   16205
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14292