Source Code Cross Referenced for Lint4JLineMessage.java in  » IDE » tIDE » tide » exttools » lint4j » 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 » tIDE » tide.exttools.lint4j 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package tide.exttools.lint4j;
002:
003:        import tide.editor.linemessages.*;
004:        import java.awt.Color;
005:        import tide.editor.MainEditorFrame;
006:        import snow.utils.storage.StorageVector;
007:
008:        public final class Lint4JLineMessage extends LineMessage {
009:            String mess;
010:            int priority;
011:            String category = "Lint4J";
012:
013:            private Lint4JLineMessage(String javaName, String mess, int line,
014:                    int priority, long created) {
015:                super (javaName, line, created);
016:                this .mess = mess;
017:                this .priority = priority;
018:
019:                if (mess.indexOf("shadows") > 0) {
020:                    category = "Shadowing";
021:                } else if (mess.indexOf("strongly recommended") > 0) {
022:                    category = "Strong recommendation";
023:                } else if (mess.indexOf("should") > 0
024:                        || mess.indexOf("could be") > 0) {
025:                    category = "Recommendation";
026:                } else if (mess.indexOf("Possible debug call") >= 0) {
027:                    category = "Possible debug call";
028:                } else if (mess.indexOf("instead") > 0) {
029:                    category = "Bad practice";
030:                } else if (mess.indexOf("unexpected behavior") > 0) {
031:                    category = "Unexpected behavior";
032:                } else if (mess.indexOf("slows down") > 0
033:                        || mess.indexOf("significantly better") > 0) {
034:                    category = "Performance";
035:                } else if (mess.indexOf("possible scoping problem") > 0) {
036:                    category = "Possible scoping problem";
037:                }
038:
039:            }
040:
041:            public static boolean createAndAdd(final String line,
042:                    boolean ignoreIrrelevant) {
043:
044:                int pos = line.indexOf(".java:");
045:                if (pos == -1)
046:                    return false;
047:                String javaName = line.substring(0, pos);
048:                String pa = MainEditorFrame.instance.getActualProject()
049:                        .getSources_Home().getAbsolutePath();
050:                if (!pa.endsWith("\\"))
051:                    pa += "\\";
052:
053:                // TODO: startswithIgnoreCase !!!!
054:                if (javaName.startsWith(pa)) {
055:                    javaName = javaName.substring(pa.length());
056:                }
057:
058:                javaName = javaName.replace('\\', '.');
059:
060:                int posEnd = line.indexOf(':', pos + 6);
061:                int lineNr = -1;
062:                if (posEnd > 0) {
063:                    try {
064:                        lineNr = Integer.parseInt(line.substring(pos + 6,
065:                                posEnd));
066:                    } catch (Exception e) {
067:                        e.printStackTrace();
068:                    }
069:                }
070:
071:                String messLine = line.substring(posEnd + 1).trim();
072:                int priority = 1;
073:                try {
074:                    priority = Integer.parseInt(messLine.substring(1, 2));
075:                    messLine = messLine.substring(5);
076:                } catch (Exception e) {
077:                    e.printStackTrace();
078:                }
079:
080:                Lint4JLineMessage lm = new Lint4JLineMessage(javaName,
081:                        messLine, lineNr, priority, System.currentTimeMillis());
082:
083:                if (ignoreIrrelevant
084:                        && LineMessagesManager.getInstance()
085:                                .getIrrelevantCategories().contains(
086:                                        lm.getCategory())) {
087:                    return false;
088:                }
089:
090:                LineMessagesManager.getInstance().add(lm);
091:                return true;
092:            }
093:
094:            @Override
095:            public String toStringHTML() {
096:                return "Lint4J: " + mess;
097:            }
098:
099:            @Override
100:            public String getMessage() {
101:                return mess;
102:            }
103:
104:            @Override
105:            public Color getColor() {
106:                return Color.magenta;
107:            }
108:
109:            @Override
110:            public String getLetter() {
111:                return null;
112:            } // point
113:
114:            @Override
115:            public int getShiftX() {
116:                return 2;
117:            }
118:
119:            @Override
120:            public String getMessageOriginator() {
121:                return "Lint4J";
122:            }
123:
124:            @Override
125:            public int getPriority() {
126:                return priority;
127:            }
128:
129:            @Override
130:            public String getCategory() {
131:                return category;
132:            } // manually parsed and guessed
133:
134:            @Override
135:            public StorageVector getStorageRepresentation() {
136:                StorageVector sv = new StorageVector();
137:                sv.add(1);
138:                sv.add("Lint4JLineMessage");
139:                sv.add(javaName);
140:                sv.add(mess);
141:                sv.add(line);
142:                sv.add(priority);
143:                sv.add(created);
144:                return sv;
145:            }
146:
147:            public static Lint4JLineMessage createFromStorageVector(
148:                    StorageVector sv) {
149:                long created = sv.size() > 6 ? (Long) sv.get(6) : System
150:                        .currentTimeMillis();
151:                return new Lint4JLineMessage((String) sv.get(2), (String) sv
152:                        .get(3), (Integer) sv.get(4), (Integer) sv.get(5),
153:                        created);
154:            }
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.