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


001:        package tide.exttools.JLint;
002:
003:        import tide.editor.linemessages.*;
004:        import java.awt.Color;
005:        import tide.editor.MainEditorFrame;
006:        import snow.utils.storage.StorageVector;
007:        import tide.utils.SyntaxUtils;
008:        import snow.utils.StringUtils;
009:
010:        /** From the parsed output.
011:         */
012:        public final class JLintLineMessage extends LineMessage {
013:            String mess, shortMess;
014:            String category = ""; // guessed
015:            int priority = 1;
016:
017:            private JLintLineMessage(String javaName, String mess, int line,
018:                    long created) {
019:                super (javaName, line, created);
020:                this .mess = mess;
021:
022:                shortMess = SyntaxUtils.makeAllJavaNamesSimpleInText(mess);
023:
024:                String jnPack = StringUtils.removeAfterLastIncluded(javaName,
025:                        ".");
026:                if (jnPack != null) {
027:                    jnPack = jnPack.replace(".", "/") + "/";
028:                    shortMess = shortMess.replace(jnPack, "");
029:                }
030:
031:                // manual categorization based on doc and text part (tricky but good results !)
032:                category = shortMess;
033:
034:                // Bounds, Domain, Zero Result, Not Overridden
035:                if (category.indexOf("is not synchronized") > 0) {
036:                    category = "Not synchronized";
037:                } else if (category.endsWith("not overridden")) {
038:                    category = "Not overridden";
039:                } else if (category.indexOf("can cause deadlock") > 0) {
040:                    category = "Can cause deadlock";
041:                } else if (category
042:                        .startsWith("Data can be lost as a result of truncation")) {
043:                    category = "Data can be lost as a result of truncation";
044:                } else if (category
045:                        .indexOf("forms the loop in class dependency graph") > 0) {
046:                    category = "Loop in class dependency graph";
047:                } else if (category.indexOf("may be out of array bounds") > 0) {
048:                    priority = 2;
049:                    category = "Potential out of array bound";
050:                } else if (category.indexOf("is out of array bounds") > 0) {
051:                    category = "Out of array bound";
052:                } else if (category.indexOf("requested while holding lock") > 0) {
053:                    category = "Potential locking problem";
054:                } else if (category
055:                        .indexOf("can be accessed from different threads") > 0) {
056:                    category = "Thread access issue";
057:                } else if (category.indexOf("without check for NULL") > 0) {
058:                    category = "Missing check for null";
059:                } else if (category.indexOf("is not overridden by method") > 0) {
060:                    category = "Missing override";
061:                } else if (category.indexOf("changed outside synchronization") > 0) {
062:                    category = "Missing synchronization";
063:                } else if (category.indexOf("Zero operand for") >= 0) {
064:                    category = "Zero operand";
065:                }
066:
067:                else {
068:                    // remove names..
069:                    category = StringUtils
070:                            .balancedRemoveAll(category, "'", "'");
071:                }
072:            }
073:
074:            public static void createAndAdd(final String line,
075:                    boolean ignoreIrrelevant) {
076:                int pos = line.indexOf(".java:");
077:                if (pos == -1)
078:                    return;
079:                String javaName = line.substring(0, pos);
080:                String pa = MainEditorFrame.instance.getActualProject()
081:                        .getSources_Home().getAbsolutePath();
082:                if (!pa.endsWith("\\"))
083:                    pa += "\\";
084:                if (javaName.startsWith(pa)) {
085:                    javaName = javaName.substring(pa.length());
086:                }
087:
088:                javaName = javaName.replace('\\', '.');
089:
090:                //System.out.println("JN="+javaName);
091:
092:                int posEnd = line.indexOf(':', pos + 6);
093:                int lineNr = -1;
094:                if (posEnd > 0) {
095:                    try {
096:                        lineNr = Integer.parseInt(line.substring(pos + 6,
097:                                posEnd));
098:                    } catch (Exception e) {
099:                        e.printStackTrace();
100:                    }
101:                }
102:
103:                String mess = line.substring(posEnd + 1).trim();
104:                if (mess.endsWith(".")) {
105:                    mess = mess.substring(0, mess.length() - 1);
106:                }
107:                JLintLineMessage lm = new JLintLineMessage(javaName, mess,
108:                        lineNr, System.currentTimeMillis());
109:
110:                if (ignoreIrrelevant
111:                        && LineMessagesManager.getInstance()
112:                                .getIrrelevantCategories().contains(
113:                                        lm.getCategory()))
114:                    return;
115:
116:                LineMessagesManager.getInstance().add(lm);
117:            }
118:
119:            @Override
120:            public String getMessage() {
121:                return mess;
122:            }
123:
124:            @Override
125:            public String getCategory() {
126:                return category;
127:            } // manually parsed and guessed
128:
129:            @Override
130:            public int getPriority() {
131:                return priority;
132:            }
133:
134:            @Override
135:            public String getMessageForTableColumn() {
136:                return shortMess;
137:            }
138:
139:            @Override
140:            public String toStringHTML() {
141:                return "JLint: " + shortMess;
142:            }
143:
144:            @Override
145:            public Color getColor() {
146:                return Color.cyan;
147:            }
148:
149:            @Override
150:            public String getLetter() {
151:                return null;
152:            } // point
153:
154:            @Override
155:            public int getShiftX() {
156:                return 4;
157:            }
158:
159:            @Override
160:            public String getMessageOriginator() {
161:                return "JLint";
162:            }
163:
164:            @Override
165:            public StorageVector getStorageRepresentation() {
166:                StorageVector sv = new StorageVector();
167:                sv.add(1);
168:                sv.add("JLintLineMessage");
169:                sv.add(javaName);
170:                sv.add(mess);
171:                sv.add(line);
172:                sv.add(created);
173:                return sv;
174:            }
175:
176:            public static JLintLineMessage createFromStorageVector(
177:                    StorageVector sv) {
178:                long created = sv.size() > 5 ? (Long) sv.get(5) : System
179:                        .currentTimeMillis();
180:
181:                return new JLintLineMessage((String) sv.get(2), (String) sv
182:                        .get(3), (Integer) sv.get(4), created);
183:            }
184:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.