Source Code Cross Referenced for MoeSyntaxView.java in  » IDE » bluej-editor » bluej » editor » moe » 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 » IDE » bluej editor » bluej.editor.moe 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright (c) 2000, 2005 BlueJ Group, Deakin University
002:        //
003:        // This software is made available under the terms of the "MIT License"
004:        // A copy of this license is included with this source distribution
005:        // in "license.txt" and is also available at:
006:        // http://www.opensource.org/licenses/mit-license.html 
007:        // Any queries should be directed to Michael Kolling mik@bluej.org
008:
009:        package bluej.editor.moe;
010:
011:        /**
012:         * MoeSyntaxView.java - adapted from
013:         * SyntaxView.java - jEdit's own Swing view implementation
014:         * to add Syntax highlighting to the BlueJ programming environment.
015:         */
016:
017:        import javax.swing.text.*;
018:
019:        import java.awt.*;
020:        import bluej.Config;
021:        import bluej.prefmgr.PrefMgr;
022:        import org.syntax.jedit.*;
023:        import org.syntax.jedit.tokenmarker.*;
024:
025:        /**
026:         * A Swing view implementation that colorizes lines of a
027:         * SyntaxDocument using a TokenMarker.
028:         *
029:         * This class should not be used directly; a SyntaxEditorKit
030:         * should be used instead.
031:         *
032:         * @author Slava Pestov
033:         * @author Bruce Quig
034:         * @author Michael Kolling
035:         *
036:         * @version $Id: MoeSyntaxView.java 3357 2005-05-02 03:23:33Z davmac $
037:         */
038:
039:        public class MoeSyntaxView extends BlueJSyntaxView {
040:            // Attributes for lines and document
041:            public static final String BREAKPOINT = "break";
042:            public static final String STEPMARK = "step";
043:
044:            static final Image breakImage = Config.getImageAsIcon(
045:                    "image.editor.breakmark").getImage();
046:            static final Image stepImage = Config.getImageAsIcon(
047:                    "image.editor.stepmark").getImage();
048:            static final Image breakStepImage = Config.getImageAsIcon(
049:                    "image.editor.breakstepmark").getImage();
050:
051:            /**
052:             * Creates a new MoeSyntaxView for painting the specified element.
053:             * @param elem The element
054:             */
055:            public MoeSyntaxView(Element elem) {
056:                super (elem);
057:            }
058:
059:            /**
060:             * Draw a line for the moe editor.
061:             */
062:            public void paintTaggedLine(Segment lineText, int lineIndex,
063:                    Graphics g, int x, int y, SyntaxDocument document,
064:                    TokenMarker tokenMarker, Color def, Element line) {
065:                if (PrefMgr.getFlag(PrefMgr.LINENUMBERS))
066:                    drawLineNumber(g, lineIndex + 1, x, y);
067:
068:                // draw breakpoint and/or step image
069:
070:                if (hasTag(line, BREAKPOINT)) {
071:                    if (hasTag(line, STEPMARK)) {
072:                        g.drawImage(breakStepImage, x - 1, y + 3
073:                                - breakStepImage.getHeight(null), null);
074:                    } else { // break only
075:                        g.drawImage(breakImage, x - 1, y + 3
076:                                - breakImage.getHeight(null), null);
077:                    }
078:                } else if (hasTag(line, STEPMARK)) {
079:                    g.drawImage(stepImage, x - 1, y + 3
080:                            - stepImage.getHeight(null), null);
081:                }
082:
083:                if (tokenMarker == null) {
084:                    Utilities.drawTabbedText(lineText, x + BREAKPOINT_OFFSET,
085:                            y, g, this , 0);
086:                } else {
087:                    paintSyntaxLine(lineText, lineIndex, x + BREAKPOINT_OFFSET,
088:                            y, g, document, tokenMarker, def);
089:                }
090:            }
091:
092:            /**
093:             * redefined paint method to paint breakpoint area
094:             *
095:             */
096:            public void paint(Graphics g, Shape allocation) {
097:                // if uncompiled, fill the tag line with grey
098:                Rectangle bounds = allocation.getBounds();
099:                if (Boolean.FALSE.equals(getDocument().getProperty(
100:                        MoeEditor.COMPILED))) {
101:                    g.setColor(Color.lightGray);
102:                    g.fillRect(0, 0, bounds.x + TAG_WIDTH, bounds.y
103:                            + bounds.height);
104:                }
105:
106:                // paint the lines
107:                super .paint(g, allocation);
108:
109:                // paint the tag separator line
110:                g.setColor(Color.black);
111:                g.drawLine(bounds.x + TAG_WIDTH, 0, bounds.x + TAG_WIDTH,
112:                        bounds.y + bounds.height);
113:            }
114:
115:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.