01: /*
02: * Copyright (c) 2000, Jacob Smullyan
03: *
04: * This is part of SkunkDAV, a WebDAV client. See http://skunkdav.sourceforge.net/
05: * for the latest version.
06: *
07: * SkunkDAV is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License as published
09: * by the Free Software Foundation; either version 2, or (at your option)
10: * any later version.
11: *
12: * SkunkDAV is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with SkunkDAV; see the file COPYING. If not, write to the Free
19: * Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20: * 02111-1307, USA.
21: */
22:
23: package org.skunk.dav.client.gui.editor.action;
24:
25: import java.awt.event.ActionEvent;
26: import javax.swing.AbstractAction;
27: import javax.swing.JCheckBoxMenuItem;
28: import org.skunk.dav.client.gui.Buffer;
29: import org.skunk.dav.client.gui.ExplorerApp;
30: import org.skunk.dav.client.gui.editor.SimpleTextEditor;
31:
32: public class SyntaxHighlightAction extends AbstractAction {
33: public void actionPerformed(ActionEvent ae) {
34: Buffer b = ExplorerApp.getAppContext().getCurrentView()
35: .getFocussedBuffer();
36: if (b != null && b instanceof SimpleTextEditor) {
37: SimpleTextEditor editor = (SimpleTextEditor) b;
38: Object src = ae.getSource();
39: if (src instanceof JCheckBoxMenuItem) {
40: boolean tokenize = ((JCheckBoxMenuItem) src)
41: .isSelected();
42: editor.setTokenizing(tokenize);
43: if (tokenize)
44: editor.getSyntaxDocument().retokenizeAll();
45: }
46: editor.getComponent().repaint();
47: }
48: }
49: }
50:
51: /* $Log: SyntaxHighlightAction.java,v $
52: /* Revision 1.3 2001/02/08 20:23:43 smulloni
53: /* added a python mode
54: /* */
|