Source Code Cross Referenced for SyntaxDocument.java in  » Net » SkunkDAV » org » skunk » swing » text » syntax » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » SkunkDAV » org.skunk.swing.text.syntax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Copyright (c) 2001, Jacob Smullyan.
003:         *
004:         *  This is part of SkunkDAV, a WebDAV client.  See http://skunkdav.sourceforge.net/ 
005:         *  for the latest version.
006:         * 
007:         *  SkunkDAV is free software; you can redistribute it and/or
008:         *  modify it under the terms of the GNU General Public License as published
009:         *  by the Free Software Foundation; either version 2, or (at your option)
010:         *  any later version.
011:         * 
012:         *  SkunkDAV is distributed in the hope that it will be useful,
013:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *  General Public License for more details.
016:         * 
017:         *  You should have received a copy of the GNU General Public License
018:         *  along with SkunkDAV; see the file COPYING.  If not, write to the Free
019:         *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
020:         *  02111-1307, USA.
021:         */
022:        package org.skunk.swing.text.syntax;
023:
024:        import java.util.Enumeration;
025:        import javax.swing.SwingUtilities;
026:        import javax.swing.event.DocumentEvent;
027:        import javax.swing.event.DocumentListener;
028:        import javax.swing.event.UndoableEditEvent;
029:        import javax.swing.text.AbstractDocument;
030:        import javax.swing.text.AttributeSet;
031:        import javax.swing.text.BadLocationException;
032:        import javax.swing.text.DefaultStyledDocument;
033:        import javax.swing.text.Element;
034:        import javax.swing.text.Segment;
035:        import javax.swing.text.Style;
036:        import javax.swing.text.StyleContext;
037:        import javax.swing.text.StyledDocument;
038:        import javax.swing.undo.AbstractUndoableEdit;
039:        import javax.swing.undo.UndoableEdit;
040:        import org.skunk.trace.Debug;
041:        import org.skunk.util.GappedIntArray;
042:
043:        public class SyntaxDocument extends DefaultStyledDocument {
044:            private SyntaxContent content;
045:
046:            public SyntaxDocument() {
047:                super (new SyntaxContent(), StyleContext
048:                        .getDefaultStyleContext());
049:                this .content = (SyntaxContent) getContent();
050:                //an unfortunate hack -- content needs a reference to the document class, at least
051:                //until the content class knows where line breaks are
052:                content.setSyntaxDocument(this );
053:            }
054:
055:            public SyntaxTokenizer getSyntaxTokenizer() {
056:                return content.getSyntaxTokenizer();
057:            }
058:
059:            public void setSyntaxTokenizer(SyntaxTokenizer syntaxTokenizer) {
060:                content.setSyntaxTokenizer(syntaxTokenizer);
061:            }
062:
063:            public boolean isTokenizing() {
064:                return content.isTokenizing();
065:            }
066:
067:            public void setTokenizing(boolean tokenizing) {
068:                content.setTokenizing(tokenizing);
069:            }
070:
071:            protected final GappedIntArray getStyleBuffer() {
072:                return content.getStyleBuffer();
073:            }
074:
075:            /**
076:             * sets the file mode.
077:             * @param mode the file mode
078:             */
079:            public void setFileMode(FileMode mode) {
080:                content.setFileMode(mode);
081:            }
082:
083:            /**
084:             * returns the file mode of this tokenizer.
085:             * @return the file mode, or null if the tokenizer currently has no mode
086:             */
087:            public FileMode getFileMode() {
088:                return content.getFileMode();
089:            }
090:
091:            public void retokenizeAll() {
092:                if (isTokenizing())
093:                    getSyntaxTokenizer().tokenize(this , 0, getLength(), 0);
094:            }
095:        }
096:
097:        /* $Log: SyntaxDocument.java,v $
098:         /* Revision 1.17  2001/02/14 19:15:37  smulloni
099:         /* modified usage of the style buffer to pack state information into its ints.
100:         /* Previously, I had stipulated that a style could only be used in one state
101:         /* per mode; that restriction may now be lifted.
102:         /*
103:         /* Revision 1.16  2001/02/11 22:55:39  smulloni
104:         /* in order to capture undo and redo events, moving the style buffer and the
105:         /* tokenizer into the SyntaxContent class, a subclass of GapContent.
106:         /*
107:         /* Revision 1.15  2001/02/09 20:00:01  smulloni
108:         /* fixed particularly nasty bug in GappedIntArray.set(int, int[]), and other
109:         /* bugs in the syntax highlighting system.
110:         /*
111:         /* Revision 1.14  2001/02/02 23:30:33  smulloni
112:         /* adding customization features to the text editor.
113:         /*
114:         /* Revision 1.13  2001/01/30 23:03:19  smulloni
115:         /* beginning of integration of syntax highlighting into SimpleTextEditor.
116:         /*
117:         /* Revision 1.12  2001/01/30 18:01:27  smulloni
118:         /* first working beta of syntax highlighting.  Nasty bug in
119:         /* GappedIntArray.remove() fixed.
120:         /*
121:         /* Revision 1.11  2001/01/29 22:28:47  smulloni
122:         /* syntax highlighting package now uses a custom view for painting the
123:         /* highlights.  Fixed bug in get(int, int[]) in GappedIntArray.
124:         /*
125:         /* Revision 1.10  2001/01/25 22:50:48  smulloni
126:         /* integrating JFlex into still-broken syntax highlighting package.
127:         /*
128:         /* Revision 1.9  2001/01/20 00:16:07  smulloni
129:         /* moved style buffer to SyntaxDocument class.  I may move it out again.
130:         /*
131:         /* Revision 1.8  2001/01/18 22:29:21  smulloni
132:         /* experimental work on syntax package.
133:         /*
134:         /* Revision 1.7  2001/01/17 23:02:29  smulloni
135:         /* beginning to rework SyntaxDocument, SyntaxTokenizer, to shift the
136:         /* responsibility for handling context requirements from the document
137:         /* to the tokenizer.
138:         /*
139:         /* Revision 1.6  2001/01/16 21:13:24  smulloni
140:         /* more work on syntax highlighting infrastructure.
141:         /*
142:         /* Revision 1.5  2001/01/15 23:31:29  smulloni
143:         /* the syntax highlighting system crawls pitifully towards being less
144:         /* contemptible.
145:         /*
146:         /* Revision 1.4  2001/01/12 23:30:06  smulloni
147:         /* more hacking on syntax highlighting, which still sucks.
148:         /*
149:         /* Revision 1.3  2001/01/11 00:00:03  smulloni
150:         /* work on syntax highlighting, still very rough.
151:         /*
152:         /* Revision 1.2  2000/12/28 21:58:57  smulloni
153:         /* fiddling with syntax highlighting, not to much purpose.
154:         /*
155:         /* Revision 1.1  2000/12/27 22:05:09  smulloni
156:         /* work on syntax highlighting.
157:         /* */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.