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


001:        package tide.exttools.checkstyle;
002:
003:        import snow.utils.StringUtils;
004:        import java.util.HashSet;
005:        import tide.editor.linemessages.*;
006:        import java.awt.Color;
007:        import tide.editor.MainEditorFrame;
008:        import snow.utils.storage.StorageVector;
009:
010:        /** Only working well if language ENGLISH !!
011:         */
012:        public final class CSLineMessage extends LineMessage {
013:            String mess;
014:            int column;
015:            String category = ""; // guessed
016:
017:            private CSLineMessage(String javaName, String mess, int line,
018:                    int column, long created) {
019:                super (javaName, line, created);
020:                this .mess = mess;
021:                this .column = column;
022:
023:                if (mess.contains("must match pattern")) {
024:                    category = "Naming";
025:                } else if (mess.contains("Conditional logic can be removed")) {
026:                    category = "Conditional logic can be removed";
027:                } else if (mess.contains("Comment matches to-do format")) {
028:                    category = "TODO tag";
029:                } else if (mess
030:                        .contains("modifier out of order with the JLS suggestions")) {
031:                    category = "Modifier out of order";
032:                } else if (mess.contains("Duplicate import")) {
033:                    category = "Duplicate import";
034:                } else if (mess.contains("Avoid nested blocks")) {
035:                    category = "Avoid nested blocks";
036:                } else if (mess.contains("Got an exception -")) {
037:                    category = "INTERNAL Checkstyle ERROR";
038:                } else if (mess.contains("File does not end with a newline")) {
039:                    category = "Extension";
040:                } else if (mess.contains("not designed for extension")) {
041:                    category = "Extension";
042:                } else if (mess.contains("Definition of 'equals()'")) {
043:                    category = "Equals without hashcode";
044:                } else if (mess.contains("Array brackets at illegal position")) {
045:                    category = "Brackets";
046:                } else if (mess.contains("'.*' form of import")) {
047:                    category = "Wildcard import";
048:                } else if (mess.contains("Line contains a tab character")) {
049:                    category = "Tabs";
050:                } else if (mess.contains("Must have at least one statement")
051:                        || mess.contains("Empty statement")) {
052:                    category = "Empty";
053:                } else if (mess
054:                        .contains("must be private and have accessor methods")) {
055:                    category = "Bean";
056:                } else if (mess
057:                        .contains("interfaces should describe a type and hence have methods")) {
058:                    category = "Interface without method";
059:                } else if (mess.contains("Expression can be simplified")) {
060:                    category = "Expression can be simplified";
061:                } else if (mess.contains("switch without \"default\" clause")) {
062:                    category = "Ugly switch";
063:                } else if (mess.contains("Avoid inline conditionals")) {
064:                    category = "Avoid inline conditionals";
065:                } else if (mess.contains("Import from illegal package")) {
066:                    category = "Illegal import";
067:                } else if (mess.contains("Method length is")) {
068:                    category = "Long method";
069:                } else if (mess.contains("hides a field")) {
070:                    category = "Hidden field";
071:                } else if (mess.contains("Complexity")) {
072:                    category = "Complexity";
073:                } else if (mess.contains("Unused import")) {
074:                    category = "Unused import";
075:                } else if (mess.contains("Unclosed HTML tag")
076:                        || mess.contains("Extra HTML tag")
077:                        || mess.contains("Incomplete HTML tag")) {
078:                    category = "Bad HTML tag";
079:                } else if (mess.contains("must use '{}'")) {
080:                    category = "Missing braces";
081:                } else if (mess.contains("default constructor")) {
082:                    category = "Default constructor";
083:                } else if (mess.contains("Empty catch block")) {
084:                    category = "Unuseful code";
085:                } else if (mess.contains("Expected @")) {
086:                    category = "Missing Javadoc tag";
087:                } else if (mess.contains("Unused @")) {
088:                    category = "Unuseful Javadoc tag";
089:                } else if (mess.contains("should be")) {
090:                    category = "Should Be";
091:                } else if (mess.contains("trailing spaces")) {
092:                    category = "Trailing spaces";
093:                } else if (mess.contains("More than ")) {
094:                    category = "Too much";
095:                } else if (mess.contains("Line is longer than")) {
096:                    category = "Long line";
097:                } else if (mess.contains("longer than ")
098:                        || mess.contains("File length is")) {
099:                    category = "Too long";
100:                } else if (mess.contains("magic ")) {
101:                    category = "Magic";
102:                } else if (mess.contains("Javadoc")) {
103:                    category = "Javadoc";
104:                } else if (mess.contains("whitespace")) {
105:                    category = "Whitespace";
106:                } else if (mess.contains("period")) {
107:                    category = "Period";
108:                } else if (mess.contains("uppercase")) {
109:                    category = "Case";
110:                } else if (mess.contains("lowercase")) {
111:                    category = "Case";
112:                }
113:
114:                else if (mess.contains("Redundant")) {
115:                    category = "Redundancy";
116:                } else if (mess.contains("an @")) {
117:                    category = "Javadoc";
118:                } else if (mess.contains("Empty") && mess.contains("block")) {
119:                    category = "Empty block";
120:                }
121:
122:                else {
123:                    category = mess;
124:                    category = StringUtils
125:                            .balancedRemoveAll(category, "'", "'");
126:                    category = StringUtils
127:                            .balancedRemoveAll(category, "<", ">");
128:                    category = StringUtils
129:                            .balancedRemoveAll(category, "(", ")");
130:
131:                    if (!unknownCat.contains(mess)) {
132:                        System.out.println("Unknown Checkstyle category: "
133:                                + mess);
134:                        unknownCat.add(mess);
135:                    }
136:
137:                }
138:            }
139:
140:            static HashSet<String> unknownCat = new HashSet<String>();
141:
142:            /** true: added, false: ignored
143:             */
144:            public static boolean createAndAdd(final String line,
145:                    boolean ignoreIrrelevant) {
146:                int pos = line.indexOf(".java:");
147:                if (pos == -1)
148:                    return false;
149:                String javaName = line.substring(0, pos);
150:                String pa = MainEditorFrame.instance.getActualProject()
151:                        .getSources_Home().getAbsolutePath();
152:                if (!pa.endsWith("\\"))
153:                    pa += "\\";
154:                if (javaName.startsWith(pa)) {
155:                    javaName = javaName.substring(pa.length());
156:                }
157:
158:                javaName = javaName.replace("\\", ".");
159:
160:                //System.out.println("JN="+javaName);
161:
162:                int posEnd = line.indexOf(':', pos + 6);
163:                int lineNr = -1;
164:                if (posEnd > 0) {
165:                    try {
166:                        lineNr = Integer.parseInt(line.substring(pos + 6,
167:                                posEnd));
168:                    } catch (Exception e) {
169:                        e.printStackTrace();
170:                    }
171:                }
172:
173:                int colNr = -1;
174:                int posEndCol = line.indexOf(':', posEnd + 1);
175:                if (posEndCol > 0) {
176:                    // may not exist...
177:                    try {
178:                        colNr = Integer.parseInt(line.substring(posEnd + 1,
179:                                posEndCol)) - 1; // Sep2007: -1
180:                        posEnd = posEndCol;
181:                    } catch (Exception ignore) {
182:                    }
183:                }
184:
185:                CSLineMessage lm = new CSLineMessage(javaName, line.substring(
186:                        posEnd + 1).trim(), lineNr, colNr, System
187:                        .currentTimeMillis());
188:
189:                if (ignoreIrrelevant
190:                        && LineMessagesManager.getInstance()
191:                                .getIrrelevantCategories().contains(
192:                                        lm.getCategory()))
193:                    return false;
194:
195:                LineMessagesManager.getInstance().add(lm);
196:
197:                return true;
198:            }
199:
200:            @Override
201:            public int getColumn() {
202:                return column;
203:            }
204:
205:            @Override
206:            public String toStringHTML() {
207:                return "CheckStyle: " + mess;
208:            }
209:
210:            @Override
211:            public String getMessage() {
212:                return mess;
213:            }
214:
215:            @Override
216:            public Color getColor() {
217:                return Color.blue;
218:            }
219:
220:            @Override
221:            public String getLetter() {
222:                return "S";
223:            }
224:
225:            @Override
226:            public int getShiftX() {
227:                return 6;
228:            }
229:
230:            @Override
231:            public String getMessageOriginator() {
232:                return "CheckStyle";
233:            }
234:
235:            @Override
236:            public int getPriority() {
237:                return 2;
238:            }
239:
240:            @Override
241:            public String getCategory() {
242:                return category;
243:            } // manually parsed and guessed
244:
245:            @Override
246:            public StorageVector getStorageRepresentation() {
247:                StorageVector sv = new StorageVector();
248:                sv.add(1);
249:                sv.add("CSLineMessage");
250:                sv.add(javaName);
251:                sv.add(mess);
252:                sv.add(line);
253:                sv.add(column);
254:                sv.add(created);
255:                return sv;
256:            }
257:
258:            //@Override
259:            public static CSLineMessage createFromStorageVector(StorageVector sv) {
260:                long created = sv.size() > 6 ? (Long) sv.get(6) : System
261:                        .currentTimeMillis();
262:                return new CSLineMessage((String) sv.get(2),
263:                        (String) sv.get(3), (Integer) sv.get(4), (Integer) sv
264:                                .get(5), created);
265:            }
266:
267:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.