rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
private void generateSourceFile(ClassData classData) throws IOException | private void generateSourceFile(SourceFileData sourceFileData) throws IOException | private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.getName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
String filename = classData.getName() + ".html"; | String filename = sourceFileData.getNormalizedName() + ".html"; | private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.getName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
String classPackageName = classData.getPackageName(); | String classPackageName = sourceFileData.getPackageName(); | private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.getName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
out.print(classData.getPackageName() + "."); | out.print(sourceFileData.getPackageName() + "."); | private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.getName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
out.print(classData.getName()); | out.print(sourceFileData.getBaseName()); | private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.getName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
out.println(generateTableRowForClass(classData)); | out.println(generateTableRowForSourceFile(sourceFileData)); | private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.getName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
File sourceFile = new File(sourceDir, classData .getSourceFileName()); | File sourceFile = new File(sourceDir, sourceFileData .getName()); | private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.getName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
if (classData.isValidSourceLineNumber(lineNumber)) | if (sourceFileData.isValidSourceLineNumber(lineNumber)) | private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.getName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
long numberOfHits = classData.getHitCount(lineNumber); | long numberOfHits = sourceFileData .getHitCount(lineNumber); | private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.getName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
Iterator iter = projectData.getClasses().iterator(); | Iterator iter = projectData.getSourceFiles().iterator(); | private void generateSourceFiles() { Iterator iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); try { generateSourceFile(classData); } catch (Exception e) { logger.info("Could not generate HTML file for class " + classData.getName()); } } } |
ClassData classData = (ClassData)iter.next(); | SourceFileData sourceFileData = (SourceFileData)iter.next(); | private void generateSourceFiles() { Iterator iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); try { generateSourceFile(classData); } catch (Exception e) { logger.info("Could not generate HTML file for class " + classData.getName()); } } } |
generateSourceFile(classData); | generateSourceFile(sourceFileData); | private void generateSourceFiles() { Iterator iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); try { generateSourceFile(classData); } catch (Exception e) { logger.info("Could not generate HTML file for class " + classData.getName()); } } } |
logger.info("Could not generate HTML file for class " + classData.getName()); | logger.info("Could not generate HTML file for source file " + sourceFileData.getName()); | private void generateSourceFiles() { Iterator iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); try { generateSourceFile(classData); } catch (Exception e) { logger.info("Could not generate HTML file for class " + classData.getName()); } } } |
String url2 = "frame-classes-" + packageData.getName() + ".html"; | String url2 = "frame-sourcefiles-" + packageData.getName() + ".html"; | private String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; double lineCoverage = -1; double branchCoverage = -1; double ccn = Util.getCCN(new File(sourceDir, packageData .getSourceFileName()), false); if (packageData.getNumberOfValidLines() > 0) lineCoverage = packageData.getLineCoverageRate(); if (packageData.getNumberOfValidBranches() > 0) branchCoverage = packageData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"'>" + generatePackageName(packageData) + "</a></td>"); ret.append("<td class=\"value\">" + packageData.getChildren().size() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); } |
+ "\" onClick='parent.classList.location.href=\"" + url2 | + "\" onClick='parent.sourceFileList.location.href=\"" + url2 | private String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; double lineCoverage = -1; double branchCoverage = -1; double ccn = Util.getCCN(new File(sourceDir, packageData .getSourceFileName()), false); if (packageData.getNumberOfValidLines() > 0) lineCoverage = packageData.getLineCoverageRate(); if (packageData.getNumberOfValidBranches() > 0) branchCoverage = packageData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"'>" + generatePackageName(packageData) + "</a></td>"); ret.append("<td class=\"value\">" + packageData.getChildren().size() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); } |
Collection result = new ArrayList(children.size() * 15); for (Iterator it = children.values().iterator(); it.hasNext(); ) { PackageData packageData = (PackageData) it.next(); result.addAll(packageData.getChildren()); } return result; | return this.classes.values(); | public Collection getClasses() { Collection result = new ArrayList(children.size() * 15); // just an approximation, no science here for (Iterator it = children.values().iterator(); it.hasNext(); ) { PackageData packageData = (PackageData) it.next(); result.addAll(packageData.getChildren()); } return result; } |
private void addInstrumentation(File file) | private void addInstrumentation(File baseDir, String filename) | private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } else if (isArchive(file)) { addInstrumentationToArchive(file); } } |
if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } else if (isArchive(file)) { addInstrumentationToArchive(file); } | logger.debug("filename: " + filename); File file; if (baseDir == null) file = new File(filename); else file = new File(baseDir, filename); addInstrumentation(file); | private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } else if (isArchive(file)) { addInstrumentationToArchive(file); } } |
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception | private void addInstrumentationToArchive(File archive) | private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } } |
ZipEntry entry; while ((entry = archive.getNextEntry()) != null) | logger.debug("Instrumenting archive " + archive.getAbsolutePath()); File outputFile = null; ZipInputStream input = null; ZipOutputStream output = null; try { try { input = new ZipInputStream(new FileInputStream(archive)); } catch (FileNotFoundException e) { logger.warn("Cannot open archive file: " + archive.getAbsolutePath(), e); return; } try { if (destinationDirectory != null) { outputFile = new File(destinationDirectory, archive .getName()); } else { outputFile = File.createTempFile( "CoberturaInstrumentedArchive", "jar"); outputFile.deleteOnExit(); } output = new ZipOutputStream(new FileOutputStream(outputFile)); } catch (IOException e) { logger.warn("Cannot open file for instrumented archive: " + archive.getAbsolutePath(), e); return; } try { addInstrumentationToArchive(input, output); } catch (Exception e) { logger.warn("Cannot instrument archive: " + archive.getAbsolutePath(), e); return; } } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } if (output != null) { try { output.close(); } catch (IOException e) { } } } if (destinationDirectory == null) | private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } } |
ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); if (isClass(entry)) { ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } output.write(entryBytes); output.closeEntry(); archive.closeEntry(); | IOUtil.moveFile(outputFile, archive); | private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } } |
catch (Exception e) | catch (IOException e) | private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } } |
logger.warn("Problems with archive entry: " + entry); throw e; | logger.warn("Cannot instrument archive: " + archive.getAbsolutePath(), e); return; | private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } } |
output.flush(); | private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } } |
|
cv = new ClassInstrumenter(projectData, cw, ignoreRegex); | cv = new ClassInstrumenter(this.projectData, cw, this.ignoreRegexs); | private void addInstrumentationToSingleClass(File file) { logger.debug("Instrumenting class " + file.getAbsolutePath()); InputStream inputStream = null; ClassWriter cw; ClassInstrumenter cv; try { inputStream = new FileInputStream(file); ClassReader cr = new ClassReader(inputStream); cw = new ClassWriter(true); cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); } catch (Throwable t) { logger.warn("Unable to instrument file " + file.getAbsolutePath(), t); return; } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } } OutputStream outputStream = null; try { if (cv.isInstrumented()) { // If destinationDirectory is null, then overwrite // the original, uninstrumented file. File outputFile; if (destinationDirectory == null) outputFile = file; else outputFile = new File(destinationDirectory, cv .getClassName().replace('.', File.separatorChar) + ".class"); File parentFile = outputFile.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } byte[] instrumentedClass = cw.toByteArray(); outputStream = new FileOutputStream(outputFile); outputStream.write(instrumentedClass); } } catch (IOException e) { logger.warn("Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } } } |
Main main = new Main(); | public static void main(String[] args) { long startTime = System.currentTimeMillis(); Main main = new Main(); boolean hasCommandsFile = false; String commandsFileName = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--commandsfile")) { hasCommandsFile = true; commandsFileName = args[++i]; } } if (hasCommandsFile) { List arglist = new ArrayList(); BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader( commandsFileName)); String line; while ((line = bufferedReader.readLine()) != null) arglist.add(line); } catch (IOException e) { logger.fatal("Unable to read temporary commands file " + commandsFileName + "."); logger.info(e); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { } } } args = (String[])arglist.toArray(new String[arglist.size()]); } main.parseArguments(args); long stopTime = System.currentTimeMillis(); System.out.println("Instrument time: " + (stopTime - startTime) + "ms"); } |
|
main.parseArguments(args); | new Main(args); | public static void main(String[] args) { long startTime = System.currentTimeMillis(); Main main = new Main(); boolean hasCommandsFile = false; String commandsFileName = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--commandsfile")) { hasCommandsFile = true; commandsFileName = args[++i]; } } if (hasCommandsFile) { List arglist = new ArrayList(); BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader( commandsFileName)); String line; while ((line = bufferedReader.readLine()) != null) arglist.add(line); } catch (IOException e) { logger.fatal("Unable to read temporary commands file " + commandsFileName + "."); logger.info(e); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { } } } args = (String[])arglist.toArray(new String[arglist.size()]); } main.parseArguments(args); long stopTime = System.currentTimeMillis(); System.out.println("Instrument time: " + (stopTime - startTime) + "ms"); } |
setSortable(true); | public RoomList() { super(new String[]{" ", "Name", "Address", "Occupants"}); getColumnModel().setColumnMargin(0); getColumnModel().getColumn(0).setMaxWidth(30); getColumnModel().getColumn(3).setMaxWidth(80); setSelectionBackground(Table.SELECTION_COLOR); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); setRowSelectionAllowed(true); setSortable(true); addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { enterRoom(); } } public void mouseReleased(MouseEvent e) { checkPopup(e); } public void mousePressed(MouseEvent e) { checkPopup(e); } }); } |
|
password = passwordDialog.getPassword("Password Required", "This group chat room requires a password to enter.", SparkRes.getImageIcon(SparkRes.LOCK_16x16), SparkManager.getMainWindow()); | password = passwordDialog.getPassword("Password Required", "This group chat room requires a password to enter.", SparkRes.getImageIcon(SparkRes.LOCK_16x16), SparkManager.getFocusedComponent()); | public static void autoJoinConferenceRoom(final String roomName, String roomJID, String password) { ChatManager chatManager = SparkManager.getChatManager(); final MultiUserChat groupChat = new MultiUserChat(SparkManager.getConnection(), roomJID); LocalPreferences pref = SettingsManager.getLocalPreferences(); final String nickname = pref.getNickname().trim(); try { GroupChatRoom chatRoom = (GroupChatRoom)chatManager.getChatContainer().getChatRoom(roomJID); MultiUserChat muc = chatRoom.getMultiUserChat(); if (!muc.isJoined()) { joinRoom(muc, nickname, password); } chatManager.getChatContainer().activateChatRoom(chatRoom); return; } catch (ChatRoomNotFoundException e) { } final GroupChatRoom room = new GroupChatRoom(groupChat); room.setTabTitle(roomName); if (requiresPassword(roomJID) && password == null) { final PasswordDialog passwordDialog = new PasswordDialog(); password = passwordDialog.getPassword("Password Required", "This group chat room requires a password to enter.", SparkRes.getImageIcon(SparkRes.LOCK_16x16), SparkManager.getMainWindow()); if (!ModelUtil.hasLength(password)) { return; } } final List errors = new ArrayList(); final String userPassword = password; final SwingWorker startChat = new SwingWorker() { public Object construct() { if (!groupChat.isJoined()) { int groupChatCounter = 0; while (true) { groupChatCounter++; String joinName = nickname; if (groupChatCounter > 1) { joinName = joinName + groupChatCounter; } if (groupChatCounter < 10) { try { if (ModelUtil.hasLength(userPassword)) { groupChat.join(joinName, userPassword); } else { groupChat.join(joinName); } break; } catch (XMPPException ex) { int code = 0; if (ex.getXMPPError() != null) { code = ex.getXMPPError().getCode(); } if (code == 0) { errors.add("No response from server."); } else if (code == 401) { errors.add("The password did not match the rooms password."); } else if (code == 403) { errors.add("You have been banned from this room."); } else if (code == 404) { errors.add("The room you are trying to enter does not exist."); } else if (code == 407) { errors.add("You are not a member of this room.\nThis room requires you to be a member to join."); } else if (code != 409) { break; } } } else { break; } } } return "ok"; } public void finished() { if (errors.size() > 0) { String error = (String)errors.get(0); JOptionPane.showMessageDialog(SparkManager.getMainWindow(), error, "Unable to join the room at this time.", JOptionPane.ERROR_MESSAGE); return; } else if (groupChat.isJoined()) { ChatManager chatManager = SparkManager.getChatManager(); chatManager.getChatContainer().addChatRoom(room); chatManager.getChatContainer().activateChatRoom(room); } else { JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Unable to join the room.", "Error", JOptionPane.ERROR_MESSAGE); return; } } }; startChat.start(); } |
boolean selected = treeNode.isSelected(); treeNode.dispose(); if (holder instanceof DisplayedNote) { this.treeNode = tree.addTreeNode(((DisplayedNote) holder).treeNode, this); } else { this.treeNode = tree.addRootNode(this); } treeNode.setSelected(selected); | moveTreeNode(newHolder, tree); treeNode.setSelected(true); | public void move(DisplayedNoteHolder newHolder, NoteTree tree, int index) { // Move DisplayedNote holder.removeDisplayedNote(this); holder = newHolder; holder.addDisplayedNote(this, index); // Move Note note.move(newHolder.getNoteHolder(), index); // Move Tree Node boolean selected = treeNode.isSelected(); treeNode.dispose(); if (holder instanceof DisplayedNote) { this.treeNode = tree.addTreeNode(((DisplayedNote) holder).treeNode, this); } else { this.treeNode = tree.addRootNode(this); } treeNode.setSelected(selected); } |
return "TODO"; | return ClassHelper.getPackageName(className).replace('.', '/') + '/' + instrumentation.getSourceFileName(); | private String getFileName(String className, CoverageData instrumentation) { // TODO: Find a better way to get this return "TODO"; //return ClassHelper.getPackageName(className).replace('.', '/') + '/' + instrumentation.getSourceFileName(); } |
public NoteTreeNode(NoteTreeNode parent, DisplayedNote data) { | protected NoteTreeNode(NoteTreeNode parent, DisplayedNote data) { | public NoteTreeNode(NoteTreeNode parent, DisplayedNote data) { treeItem = new TreeItem(parent.treeItem, SWT.NONE, data.getNote().getIndex()); init(data); } |
if (isSelected() == selected) { return; } | public void setSelected(boolean selected) { List<TreeItem> selectionTemp = Arrays.asList(treeItem.getParent().getSelection()); List<TreeItem> selection = new LinkedList<TreeItem>(selectionTemp); if (selected) { selection.add(treeItem); } else { selection.remove(treeItem); } TreeItem[] newSelection = selection.toArray(new TreeItem[selection.size()]); treeItem.getParent().setSelection(newSelection); } |
|
return _allCategories; | if(_allCategories==null){ return new LinkedHashMap(); } else{ return _allCategories; } | public Map getCategories() { if (_allCategories == null) { Collection cats = CategoryUtil.getCategories(); if(cats!=null && !cats.isEmpty()){ _allCategories = new LinkedHashMap(); _allCategories.put(ArticleUtil.getBundle().getLocalizedText("All categories"), "-1"); Iterator cat = cats.iterator(); while (cat.hasNext()) { String category = (String) cat.next(); _allCategories.put(ArticleUtil.getBundle().getLocalizedText(category),category); } } } return _allCategories; } |
if(!getSearchCategory().equals("-1")){ | if(!("-1").equals(getSearchCategory())){ | public SearchRequest getSearchRequest(String scope, Locale locale) throws SearchException { SearchRequest s = new SearchRequest(); s.addSelection(IWSlideConstants.PROPERTY_CREATION_DATE); s.addSelection(IWSlideConstants.PROPERTY_CATEGORY); s.addScope(new SearchScope(scope)); SearchExpression whereExpression = null; //String localeString = ""; //((locale!=null)?locale.getLanguage():""); //TODO create search input for language SearchExpression namePatternExpression = s.compare(CompareOperator.LIKE, IWSlideConstants.PROPERTY_DISPLAY_NAME,"%.article"); //todo search by the content type //SearchExpression contentTypeExpression = s.compare(CompareOperator.LIKE, ArticleItemBean.PROPERTY_CONTENT_TYPE, ArticleItemBean.ARTICLE_FILENAME_SCOPE); whereExpression = namePatternExpression; //whereExpression = contentTypeExpression; SearchExpression creationDateFromExpression = null; if(getSearchPublishedFrom() != null){ Date from = getSearchPublishedFrom(); IWTimestamp stamp = new IWTimestamp(from); //the date's time is at 24:00 so anything from that day will not be found. So be back up a day to 24:00 stamp.addDays(-1); from = stamp.getDate(); creationDateFromExpression = s.compare(CompareOperator.GTE, IWSlideConstants.PROPERTY_CREATION_DATE,from); whereExpression = s.and(whereExpression,creationDateFromExpression); } SearchExpression creationDateToExpression = null; if(getSearchPublishedTo() != null){ creationDateToExpression = s.compare(CompareOperator.LTE, IWSlideConstants.PROPERTY_CREATION_DATE,getSearchPublishedTo()); whereExpression = s.and(whereExpression,creationDateToExpression); } // List categoryExpressions = new ArrayList(); if(!getSearchCategory().equals("-1")){ SearchExpression categoryExpression = s.compare(CompareOperator.LIKE,IWSlideConstants.PROPERTY_CATEGORY,","+getSearchCategory()+","); whereExpression = s.and(whereExpression,categoryExpression); } String author = getSearchAuthor(); if(author!=null && !"".equals(author)){ SearchExpression authorExpression = s.compare(CompareOperator.LIKE,IWSlideConstants.PROPERTY_CREATOR_DISPLAY_NAME,"%"+author+"%"); whereExpression = s.and(whereExpression,authorExpression); } // }// whereExpression = s.and(whereExpression,categoryExpression);// for (Iterator iter = categoryList.iterator(); iter.hasNext();) {// String categoryName = (String) iter.next();// categoryExpressions.add(s.compare(CompareOperator.LIKE,IWSlideConstants.PROPERTY_CATEGORY,"%"+categoryName+"%"));// }// Iterator expr = categoryExpressions.iterator();// if(expr.hasNext()){// SearchExpression categoryExpression = (SearchExpression)expr.next();// while(expr.hasNext()){// categoryExpression = s.or(categoryExpression,(SearchExpression)expr.next());// }// whereExpression = s.and(whereExpression,categoryExpression);// }// } SearchExpression containsExpression = null; if(getSearchText() != null && !"".equals(getSearchText())){ containsExpression = s.contains(getSearchText()); if(whereExpression!=null){ whereExpression = s.and(whereExpression,containsExpression); }else{ whereExpression = containsExpression; } } s.setWhereExpression(whereExpression); System.out.println("------------------------"); System.out.println(s.asString()); System.out.println("------------------------"); return s; } |
if (e.getSource() instanceof SparkTab) { SparkTab tab = (SparkTab)e.getSource(); setSelectedTab(tab); } | public void mouseClicked(MouseEvent e) { } |
|
if(e.isPopupTrigger()){ return; } if (e.getSource() instanceof SparkTab) { SparkTab tab = (SparkTab)e.getSource(); setSelectedTab(tab); } | public void mousePressed(MouseEvent e) { if(e.isPopupTrigger()){ return; } if (e.getSource() instanceof SparkTab) { SparkTab tab = (SparkTab)e.getSource(); setSelectedTab(tab); } } |
|
textLabel.setFont(defaultFont); | public void setSelected(boolean selected) { super.setSelected(selected); this.selected = selected; if (boldWhenActive && selected) { textLabel.setFont(textLabel.getFont().deriveFont(Font.BOLD)); } else { textLabel.setFont(defaultFont); } invalidate(); repaint(); } |
|
put(varName,toolType); | put(varName,tool); | WC(final Broker broker) { _broker = broker; try { String tools = (String) _broker.getValue("config","TemplateTools"); Enumeration tenum = new StringTokenizer(tools); while (tenum.hasMoreElements()) { String toolName = (String) tenum.nextElement(); try { Class toolType = Class.forName(toolName); String varName = getToolName(toolName); Object tool = toolType.newInstance(); put(varName,toolType); } catch (ClassNotFoundException ce) { _log.exception(ce); _log.error("Tool class " + toolName + " not found: " + ce); } catch (IllegalAccessException ia) { _log.exception(ia); _log.error("Tool class and methods must be public for " + toolName + ": " + ia); } catch (InstantiationException ie) { _log.exception(ie); _log.error("Tool class " + toolName + " must have a public zero " + "argument or default constructor: " + ie); } } } catch (NotFoundException e) { _log.exception(e); _log.error("Could not locate TemplateTools in config: " + e); } catch (InvalidTypeException e) { _log.exception(e); _log.error("Could not access config: " + e); } } |
" is a " + name.getClass()); | " is a " + c + ": " + v); | final public ContextTool getTool(String name) throws InvalidContextException { try { return (ContextTool) getMacro(name); } catch (ClassCastException ce) { throw new InvalidContextException("Not a tool, " + name + " is a " + name.getClass()); } } |
WebContext wc = (WebContext) clone(null); | WebContext wc = (WebContext) clone(); | final public WebContext clone( final HttpServletRequest req, final HttpServletResponse resp) { try { // want: new local vars, both existing tools tables, no bean, // plus store req and resp somewhere, plus existing broker WebContext wc = (WebContext) clone(null); wc._request = req; wc._response = resp; return wc; } catch (Exception e) { _log.error("Clone not supported on WebContext!"); return null; } } |
this.myName, name, desc, ignoreRegex); | this.myName, name, desc, ignoreRegexs); | public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions); if (!instrument) return mv; return mv == null ? null : new MethodInstrumenter(classData, mv, this.myName, name, desc, ignoreRegex); } |
final String owner, final String myName, final String myDescriptor, final Pattern ignoreRegexp) | final String owner, final String myName, final String myDescriptor, final Collection ignoreRegexs) | public MethodInstrumenter(ClassData classData, final MethodVisitor mv, final String owner, final String myName, final String myDescriptor, final Pattern ignoreRegexp) { super(mv); this.classData = classData; this.ownerClass = owner; this.myName = myName; this.myDescriptor = myDescriptor; this.ignoreRegex = ignoreRegexp; } |
this.ignoreRegex = ignoreRegexp; | this.ignoreRegexs = ignoreRegexs; | public MethodInstrumenter(ClassData classData, final MethodVisitor mv, final String owner, final String myName, final String myDescriptor, final Pattern ignoreRegexp) { super(mv); this.classData = classData; this.ownerClass = owner; this.myName = myName; this.myDescriptor = myDescriptor; this.ignoreRegex = ignoreRegexp; } |
int availableRows = testHeadlines.length; int nrOfRows = rows.intValue(); if (nrOfRows == 0) { nrOfRows = availableRows; | int availableRows = 0; ArticleItemBean[] articleItemBean; try { articleItemBean = (ArticleItemBean[])loadAllArticlesInFolder(new File("/Test/article/")).toArray(new ArticleItemBean[0]); availableRows = articleItemBean.length; int nrOfRows = rows.intValue(); if (nrOfRows == 0) { nrOfRows = availableRows; } int maxRow = Math.min(start.intValue() + nrOfRows,availableRows); for (int i = start.intValue(); i < maxRow; i++) { ArticleListBean a = new ArticleListBean(String.valueOf(i), articleItemBean[i].getHeadline(), articleItemBean[i].getItemType(), articleItemBean[i].getAuthor(), articleItemBean[i].getStatus()); _dataModel.set(a, i); } | public void updateDataModel(Integer start, Integer rows) { if (_dataModel == null) { _dataModel = new WFDataModel(); } int availableRows = testHeadlines.length; int nrOfRows = rows.intValue(); if (nrOfRows == 0) { nrOfRows = availableRows; } int maxRow = start.intValue() + nrOfRows; if (maxRow > availableRows) { maxRow = availableRows; } for (int i = start.intValue(); i < maxRow; i++) { ArticleListBean a = new ArticleListBean(String.valueOf(i), testHeadlines[i], testPublished[i], testAuthors[i], testStatus[i]); if (i == 5) { // set test style red a.setTestStyle("color:red"); } _dataModel.set(a, i); } _dataModel.setRowCount(availableRows); } |
int maxRow = start.intValue() + nrOfRows; if (maxRow > availableRows) { maxRow = availableRows; | catch (XmlException e) { e.printStackTrace(); | public void updateDataModel(Integer start, Integer rows) { if (_dataModel == null) { _dataModel = new WFDataModel(); } int availableRows = testHeadlines.length; int nrOfRows = rows.intValue(); if (nrOfRows == 0) { nrOfRows = availableRows; } int maxRow = start.intValue() + nrOfRows; if (maxRow > availableRows) { maxRow = availableRows; } for (int i = start.intValue(); i < maxRow; i++) { ArticleListBean a = new ArticleListBean(String.valueOf(i), testHeadlines[i], testPublished[i], testAuthors[i], testStatus[i]); if (i == 5) { // set test style red a.setTestStyle("color:red"); } _dataModel.set(a, i); } _dataModel.setRowCount(availableRows); } |
for (int i = start.intValue(); i < maxRow; i++) { ArticleListBean a = new ArticleListBean(String.valueOf(i), testHeadlines[i], testPublished[i], testAuthors[i], testStatus[i]); if (i == 5) { a.setTestStyle("color:red"); } _dataModel.set(a, i); | catch (IOException e) { e.printStackTrace(); | public void updateDataModel(Integer start, Integer rows) { if (_dataModel == null) { _dataModel = new WFDataModel(); } int availableRows = testHeadlines.length; int nrOfRows = rows.intValue(); if (nrOfRows == 0) { nrOfRows = availableRows; } int maxRow = start.intValue() + nrOfRows; if (maxRow > availableRows) { maxRow = availableRows; } for (int i = start.intValue(); i < maxRow; i++) { ArticleListBean a = new ArticleListBean(String.valueOf(i), testHeadlines[i], testPublished[i], testAuthors[i], testStatus[i]); if (i == 5) { // set test style red a.setTestStyle("color:red"); } _dataModel.set(a, i); } _dataModel.setRowCount(availableRows); } |
searchArticlesNode.setVisibleInMenus(false); | public void addArticleViews(IWBundle bundle){ ContentViewManager cViewManager = ContentViewManager.getInstance(bundle.getApplication()); ViewNode contentNode = cViewManager.getContentNode(); DefaultViewNode articleNode = new DefaultViewNode("article",contentNode); articleNode.setJspUri(bundle.getJSPURI("createarticle.jsp")); articleNode.setKeyboardShortcut(new KeyboardShortcut("a")); articleNode.setName("#{localizedStrings['com.idega.block.article']['article']}"); DefaultViewNode createNewArticleNode = new DefaultViewNode("create",articleNode); String jspUri = bundle.getJSPURI("createarticle.jsp"); createNewArticleNode.setJspUri(jspUri); createNewArticleNode.setName("#{localizedStrings['com.idega.block.article']['create_article']}"); DefaultViewNode editNewArticleNode = new DefaultViewNode("edit",articleNode);// editNewArticleNode.setJspUri(bundle.getJSPURI("createarticle.jsp")); editNewArticleNode.setJspUri(bundle.getJSPURI("editarticle.jsp")); editNewArticleNode.setVisibleInMenus(false); editNewArticleNode.setName("#{localizedStrings['com.idega.block.article']['edit']}"); DefaultViewNode listArticlesNode = new DefaultViewNode("list",articleNode); listArticlesNode.setJspUri(bundle.getJSPURI("listarticles.jsp")); listArticlesNode.setName("#{localizedStrings['com.idega.block.article']['list_articles']}"); DefaultViewNode previewArticlesNode = new DefaultViewNode("preview",articleNode); previewArticlesNode.setJspUri(bundle.getJSPURI("previewarticle.jsp")); previewArticlesNode.setVisibleInMenus(false); previewArticlesNode.setName("#{localizedStrings['com.idega.block.article']['preview']}"); DefaultViewNode searchArticlesNode = new DefaultViewNode("search",articleNode); searchArticlesNode.setJspUri(bundle.getJSPURI("searcharticle.jsp")); searchArticlesNode.setName("#{localizedStrings['com.idega.block.article']['search_articles']}"); searchArticlesNode.setVisibleInMenus(false); } |
|
classes.addAll(sourceFileData.getChildren()); | classes.addAll(sourceFileData.getClasses()); | public SortedSet getClasses() { SortedSet classes = new TreeSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { SourceFileData sourceFileData = (SourceFileData)iter.next(); classes.addAll(sourceFileData.getChildren()); } return classes; } |
_colorName = null; | final public WikiPage parse(WikiPageBuilder builder) throws ParseException { Token t; label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case QUOTED_BLOCK: case BOLD: case UNDERLINE: case ITALIC: case LT: case GT: case COLOR: case HEADER: case COLOR_HEADER_TERMINATE: case RULE: case EMAIL: case URL: case WIKI_TERM: case SHORT_WIKI_TERM: case WORD: case NEW_PARAGRAPH: case LINE_BREAK: case INDENT: case WHITESPACE: case ASTERISK: case UNDERSCORE: case CARET: case DOUBLE_LBRACKET: case DELIMITERS: ; break; default: jj_la1[0] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LT: t = jj_consume_token(LT); builder.lt(); break; case GT: t = jj_consume_token(GT); builder.gt(); break; case BOLD: t = jj_consume_token(BOLD); builder.bold(); break; case UNDERLINE: t = jj_consume_token(UNDERLINE); builder.underline(); break; case ITALIC: t = jj_consume_token(ITALIC); builder.italic(); break; case COLOR: t = jj_consume_token(COLOR); if (_headerName != null || _colorName != null) { builder.endColorOrHeader(); String word = t.image.substring(1); if (builder.isWikiTermReference (word)) builder.wikiTerm (word); else builder.word (word); _colorName = null; _headerName = null; } else { _colorName = t.image.substring(1); builder.color (_colorName); } break; case HEADER: t = jj_consume_token(HEADER); _headerName = t.image.substring(2); builder.header (_headerName); break; case COLOR_HEADER_TERMINATE: t = jj_consume_token(COLOR_HEADER_TERMINATE); if (_headerName == null && _colorName == null) builder.word ("^"); else { builder.endColorOrHeader (); _headerName = null; } break; case RULE: t = jj_consume_token(RULE); builder.ruler(); break; case EMAIL: t = jj_consume_token(EMAIL); builder.email(t.image); break; case WIKI_TERM: t = jj_consume_token(WIKI_TERM); if (builder.isWikiTermReference (t.image)) builder.wikiTerm (t.image); else builder.word (t.image); break; case SHORT_WIKI_TERM: t = jj_consume_token(SHORT_WIKI_TERM); if (builder.isWikiTermReference (t.image)) builder.wikiTerm (t.image.substring(0, t.image.length()-1)); else builder.word (t.image); break; case WORD: t = jj_consume_token(WORD); builder.word (t.image); break; case NEW_PARAGRAPH: t = jj_consume_token(NEW_PARAGRAPH); builder.paragraph (); break; case LINE_BREAK: t = jj_consume_token(LINE_BREAK); builder.newline(); break; case INDENT: t = jj_consume_token(INDENT); builder.indent(2); break; case WHITESPACE: t = jj_consume_token(WHITESPACE); builder.space(); break; case ASTERISK: t = jj_consume_token(ASTERISK); builder.word ("*"); break; case UNDERSCORE: t = jj_consume_token(UNDERSCORE); builder.word ("_"); break; case CARET: t = jj_consume_token(CARET); builder.word ("^"); break; case DOUBLE_LBRACKET: t = jj_consume_token(DOUBLE_LBRACKET); builder.word ("[["); break; case DELIMITERS: t = jj_consume_token(DELIMITERS); builder.word (t.image); break; case URL: t = jj_consume_token(URL); builder.url (t.image); break; case QUOTED_BLOCK: t = jj_consume_token(QUOTED_BLOCK); builder.quotedBlock (t.image.substring(2, t.image.length()-2)); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } {if (true) return builder.getPage ();} throw new Error("Missing return statement in function"); } |
|
Element body = (Element)webResponse.getDOM().getDocumentElement().getElementsByTagName("body").item(0); NodeList elems = body.getElementsByTagName("textarea"); response = elems.item(0).getChildNodes().item(0).getNodeValue(); | NodeList list = webResponse.getDOM().getDocumentElement().getElementsByTagName("div"); int length = list.getLength(); for (int i = 0; i < length; i++) { Element element = (Element)list.item(i); if ("result_box".equals(element.getAttribute("id"))) { Node translation = element.getFirstChild(); if (translation != null) { response = translation.getNodeValue(); } } } | private static String useGoogleTranslator(String text, TranslationType type) { String response = null; String urlString = "http://translate.google.com/translate_t?text=" + text + "&langpair=" + type.getID(); // disable scripting to avoid requiring js.jar HttpUnitOptions.setScriptingEnabled(false); // create the conversation object which will maintain state for us WebConversation wc = new WebConversation(); // Obtain the google translation page WebRequest webRequest = new GetMethodWebRequest(urlString); // required to prevent a 403 forbidden error from google webRequest.setHeaderField("User-agent", "Mozilla/4.0"); try { WebResponse webResponse = wc.getResponse(webRequest); Element body = (Element)webResponse.getDOM().getDocumentElement().getElementsByTagName("body").item(0); NodeList elems = body.getElementsByTagName("textarea"); response = elems.item(0).getChildNodes().item(0).getNodeValue(); } catch (MalformedURLException e) { Log.error("Could not for url: " + e); } catch (IOException e) { Log.error("Could not get response: " + e); } catch (SAXException e) { Log.error("Could not parse response content: " + e); } return response; } |
return path.replace('/', '\\'); | return path.replace('\\', '/'); | private String getCorrectedPath(String path) { return path.replace('/', '\\'); } |
if (!isRegistered) { | boolean reg = TransportManager.isRegistered(SparkManager.getConnection(), transport); if (!reg) { | private void addTransport(final Transport transport) { final StatusBar statusBar = SparkManager.getWorkspace().getStatusBar(); final JPanel commandPanel = statusBar.getCommandPanel(); final boolean isRegistered = TransportManager.isRegistered(SparkManager.getConnection(), transport); final RolloverButton button = new RolloverButton(); if (!isRegistered) { button.setIcon(transport.getInactiveIcon()); } else { button.setIcon(transport.getIcon()); } button.setToolTipText(transport.getInstructions()); commandPanel.add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!isRegistered) { TransportManager.registerWithService(SparkManager.getConnection(), transport.getServiceName()); // Send Presence Presence presence = statusBar.getPresence(); statusBar.changeAvailability(presence); } else { int confirm = JOptionPane.showConfirmDialog(SparkManager.getMainWindow(), "Would you like to disable this active transport?", "Disable Transport", JOptionPane.YES_NO_OPTION); if (confirm == JOptionPane.YES_OPTION) { try { TransportManager.unregister(SparkManager.getConnection(), transport.getServiceName()); } catch (XMPPException e1) { e1.printStackTrace(); } } } } }); uiMap.put(transport, button); statusBar.invalidate(); statusBar.validate(); statusBar.repaint(); } |
try { populateTransports(SparkManager.getConnection()); } catch (Exception e) { return; } for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportManager.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; RolloverButton button = uiMap.get(transport); if (!registered) { button.setIcon(transport.getInactiveIcon()); } else { button.setIcon(transport.getIcon()); | SwingWorker thread = new SwingWorker() { public Object construct() { try { populateTransports(SparkManager.getConnection()); for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); | public void initialize() { try { populateTransports(SparkManager.getConnection()); } catch (Exception e) { return; } for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportManager.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; RolloverButton button = uiMap.get(transport); if (!registered) { button.setIcon(transport.getInactiveIcon()); } else { button.setIcon(transport.getIcon()); } } } }, new PacketTypeFilter(Presence.class)); } |
}, new PacketTypeFilter(Presence.class)); | public void initialize() { try { populateTransports(SparkManager.getConnection()); } catch (Exception e) { return; } for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportManager.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; RolloverButton button = uiMap.get(transport); if (!registered) { button.setIcon(transport.getInactiveIcon()); } else { button.setIcon(transport.getIcon()); } } } }, new PacketTypeFilter(Presence.class)); } |
|
public void finished() { Boolean b = (Boolean)get(); if (!b) { return; } SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportManager.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; if (presence.getType() == Presence.Type.UNAVAILABLE) { registered = false; } RolloverButton button = uiMap.get(transport); if (!registered) { button.setIcon(transport.getInactiveIcon()); } else { button.setIcon(transport.getIcon()); } } } }, new PacketTypeFilter(Presence.class)); } }; thread.start(); | public void initialize() { try { populateTransports(SparkManager.getConnection()); } catch (Exception e) { return; } for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportManager.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; RolloverButton button = uiMap.get(transport); if (!registered) { button.setIcon(transport.getInactiveIcon()); } else { button.setIcon(transport.getIcon()); } } } }, new PacketTypeFilter(Presence.class)); } |
|
if (presence == null || presence.getType() == Presence.Type.UNAVAILABLE) { registered = false; } | public static boolean isRegistered(XMPPConnection con, Transport transport) { Presence presence = con.getRoster().getPresence(transport.getServiceName()); boolean registered = presence != null && presence.getMode() != null; return registered; } |
|
dialog.setLocationRelativeTo(SparkManager.getMainWindow()); | public static void registerWithService(final XMPPConnection con, final String serviceName) { final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); final TransportRegistrationPanel regPanel = new TransportRegistrationPanel(serviceName); mainPanel.add(regPanel, BorderLayout.CENTER); final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final RolloverButton registerButton = new RolloverButton("Register", null); final RolloverButton cancelButton = new RolloverButton("Cancel", null); buttonPanel.add(registerButton); buttonPanel.add(cancelButton); mainPanel.add(buttonPanel, BorderLayout.SOUTH); // Create Dialog Transport transport = TransportManager.getTransport(serviceName); final JDialog dialog = new JDialog(SparkManager.getMainWindow(), transport.getTitle(), true); dialog.add(mainPanel); dialog.pack(); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); dialog.setSize(400, 200); registerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String username = regPanel.getScreenName(); String password = regPanel.getPassword(); if (!ModelUtil.hasLength(username) || !ModelUtil.hasLength(password)) { JOptionPane.showMessageDialog(mainPanel, "Username and/or Password need to be supplied.", "Registration Error", JOptionPane.ERROR_MESSAGE); return; } try { registerUser(con, serviceName, username, password); // Send updated presence. } catch (XMPPException e1) { JOptionPane.showMessageDialog(mainPanel, "Unable to register with Transport.", "Registration Error", JOptionPane.ERROR_MESSAGE); } dialog.dispose(); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); } }); dialog.setVisible(true); } |
|
getFileSet(dir); | FileSet fileSet = getFileSet(dir); fileSet.createInclude().setName("**/*.class"); | private void createFilesetForDirectory(File dir) { getFileSet(dir); } |
throw new BuildException("'includeClasses' is required when 'fromClasspath' is used"); | throw new BuildException("'includeClasses' is required when 'instrumentationClasspath' is used"); | private void processInstrumentationClasspath() { if (includeClassesRegexs.size() == 0) { throw new BuildException("'includeClasses' is required when 'fromClasspath' is used"); } String[] sources = instrumentationClasspath.list(); for (int i = 0; i < sources.length; i++) { File fileOrDir = new File(sources[i]); if (fileOrDir.exists()) { if (fileOrDir.isDirectory()) { createFilesetForDirectory(fileOrDir); } else { addFileToFilesets(fileOrDir); } } } } |
hook = (Runnable) shutdownHooks.removeFirst(); | hook = (Runnable) shutdownHooks.removeLast(); | private void notifyShutdownHooks() { while (!shutdownHooks.isEmpty()) { Runnable hook; synchronized (shutdownHooks) { hook = (Runnable) shutdownHooks.removeFirst(); } try { hook.run(); } catch (Throwable e) { log.warn("Error from kernel shutdown hook", e); } } } |
if (directive == null) | Directive d; try { d = (Directive) desc.dirClass.newInstance(); } catch (Exception e) { | public Object build(BuildContext bc) throws BuildException { if (directive == null) throw new BuildException("Error instantiating Directive object for #" + desc.name); return directive.build(this, bc); } |
return directive.build(this, bc); | }; return d.build(this, bc); | public Object build(BuildContext bc) throws BuildException { if (directive == null) throw new BuildException("Error instantiating Directive object for #" + desc.name); return directive.build(this, bc); } |
System.err.println ("render: >"); | protected String renderGT() { System.err.println ("render: >"); return ">"; } |
|
System.err.println ("render: <"); | protected String renderLT() { System.err.println ("render: <"); return "<"; } |
|
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); | public void visitBeanDefinition(BeanDefinition beanDefinition, Object data) throws BeansException { super.visitBeanDefinition(beanDefinition, data); | public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); if (!(beanDefinition instanceof RootBeanDefinition)) { return; } RootBeanDefinition rootBeanDefinition = ((RootBeanDefinition) beanDefinition); Class beanType = rootBeanDefinition.getBeanClass(); for (Iterator iterator = lifecycleMap.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); Class lifecycleInterface = (Class) entry.getKey(); LifecycleMethods value = (LifecycleMethods) entry.getValue(); if (lifecycleInterface.isAssignableFrom(beanType)) { if (rootBeanDefinition.getInitMethodName() == null) { rootBeanDefinition.setInitMethodName(value.initMethodName); } if (rootBeanDefinition.getDestroyMethodName() == null) { rootBeanDefinition.setDestroyMethodName(value.destroyMethodName); } if (rootBeanDefinition.getInitMethodName() != null && rootBeanDefinition.getDestroyMethodName() != null) { return; } } } } |
void visitBeanFactory(ConfigurableListableBeanFactory beanRegistry) throws BeansException; | void visitBeanFactory(ConfigurableListableBeanFactory beanRegistry, Object data) throws BeansException; | void visitBeanFactory(ConfigurableListableBeanFactory beanRegistry) throws BeansException; |
synchronized(_clock) { if ((TIME - dateTime) > 1000) { date = new Date(TIME); } return date; } | synchronized(_lock) { if (_clock != null) { if ((TIME - dateTime) > 1000) { date = new Date(TIME); } } else { date = new Date(); } return date; } | public static Date getDate() { synchronized(_clock) { if ((TIME - dateTime) > 1000) { date = new Date(TIME); } return date; } } |
public HTMLReport(ProjectData projectData, File outputDir, FileFinder finder) | public HTMLReport(ProjectData projectData, File outputDir, FileFinder finder, ComplexityCalculator complexity) | public HTMLReport(ProjectData projectData, File outputDir, FileFinder finder) throws Exception { this.destinationDir = outputDir; this.finder = finder; this.projectData = projectData; CopyFiles.copy(outputDir); generatePackageList(); generateSourceFileLists(); generateOverviews(); generateSourceFiles(); } |
this.complexity = complexity; | public HTMLReport(ProjectData projectData, File outputDir, FileFinder finder) throws Exception { this.destinationDir = outputDir; this.finder = finder; this.projectData = projectData; CopyFiles.copy(outputDir); generatePackageList(); generateSourceFileLists(); generateOverviews(); generateSourceFiles(); } |
|
File sourceFile = finder.findFile(sourceFileData.getName()); | File sourceFile = finder.getFileForSource(sourceFileData.getName()); | private void generateSourceFile(SourceFileData sourceFileData) throws IOException { if (!sourceFileData.containsInstrumentationInfo()) { LOGGER.info("Data file does not contain instrumentation " + "information for the file " + sourceFileData.getName() + ". Ensure this class was instrumented, and this " + "data file contains the instrumentation information."); } String filename = sourceFileData.getNormalizedName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = sourceFileData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(sourceFileData.getPackageName() + "."); } out.print(sourceFileData.getBaseName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeader("Classes in this File", false)); // TODO: Change this to actually show multiple classes. out.println(generateTableRowForSourceFile(sourceFileData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = finder.findFile(sourceFileData.getName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (sourceFileData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = sourceFileData .getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } } |
double ccn = packageData.getCCN(finder); | double ccn = complexity.getCCNForPackage(packageData); | private String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-sourcefiles-" + packageData.getName() + ".html"; double lineCoverage = -1; double branchCoverage = -1; double ccn = packageData.getCCN(finder); if (packageData.getNumberOfValidLines() > 0) lineCoverage = packageData.getLineCoverageRate(); if (packageData.getNumberOfValidBranches() > 0) branchCoverage = packageData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.sourceFileList.location.href=\"" + url2 + "\"'>" + generatePackageName(packageData) + "</a></td>"); ret.append("<td class=\"value\">" + packageData.getNumberOfChildren() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); } |
File file = finder.findFile(sourceFileData.getName()); if (file == null) { System.out.println("FILE IS NULL: " + sourceFileData.getName()); } double ccn = Util.getCCN(file, false); | double ccn = complexity.getCCNForSourceFile(sourceFileData); | private String generateTableRowForSourceFile(SourceFileData sourceFileData) { StringBuffer ret = new StringBuffer(); double lineCoverage = -1; double branchCoverage = -1; File file = finder.findFile(sourceFileData.getName()); if (file == null) { System.out.println("FILE IS NULL: " + sourceFileData.getName()); } double ccn = Util.getCCN(file, false); if (sourceFileData.getNumberOfValidLines() > 0) lineCoverage = sourceFileData.getLineCoverageRate(); if (sourceFileData.getNumberOfValidBranches() > 0) branchCoverage = sourceFileData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + sourceFileData.getNormalizedName() + ".html\">" + sourceFileData.getBaseName() + "</a></td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); } |
double ccnSum = 0; int count = 0; for (Iterator it = finder.getBaseDirectories().iterator(); it.hasNext(); ) { File basedir = (File) it.next(); ccnSum += Util.getCCN(basedir.getAbsoluteFile(), true); count++; } double ccn = ccnSum / (double) count; | private String generateTableRowForTotal() { StringBuffer ret = new StringBuffer(); double lineCoverage = -1; double branchCoverage = -1; double ccnSum = 0; int count = 0; for (Iterator it = finder.getBaseDirectories().iterator(); it.hasNext(); ) { File basedir = (File) it.next(); ccnSum += Util.getCCN(basedir.getAbsoluteFile(), true); count++; } double ccn = ccnSum / (double) count; if (projectData.getNumberOfValidLines() > 0) lineCoverage = projectData.getLineCoverageRate(); if (projectData.getNumberOfValidBranches() > 0) branchCoverage = projectData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><b>All Packages</b></td>"); ret.append("<td class=\"value\">" + projectData.getNumberOfSourceFiles() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); } |
|
private void moveToOfflineGroup(String bareJID) { | private void moveToOfflineGroup(final String bareJID) { | private void moveToOfflineGroup(String bareJID) { final Iterator groupIterator = new ArrayList(groupList).iterator(); while (groupIterator.hasNext()) { final ContactGroup group = (ContactGroup)groupIterator.next(); final ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { item.showUserGoingOfflineOnline(); item.setIcon(SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON)); group.fireContactGroupUpdated(); int numberOfMillisecondsInTheFuture = 3000; Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { item.setPresence(null); // Check for ContactItemHandler. group.removeContactItem(item); checkGroup(group); if (offlineGroup.getContactItemByJID(item.getFullJID()) == null) { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } }, timeToRun); } } } |
Roster roster = SparkManager.getConnection().getRoster(); Presence userPresence = roster.getPresence(bareJID); if (userPresence != null) { return; } | private void moveToOfflineGroup(String bareJID) { final Iterator groupIterator = new ArrayList(groupList).iterator(); while (groupIterator.hasNext()) { final ContactGroup group = (ContactGroup)groupIterator.next(); final ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { item.showUserGoingOfflineOnline(); item.setIcon(SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON)); group.fireContactGroupUpdated(); int numberOfMillisecondsInTheFuture = 3000; Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { item.setPresence(null); // Check for ContactItemHandler. group.removeContactItem(item); checkGroup(group); if (offlineGroup.getContactItemByJID(item.getFullJID()) == null) { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } }, timeToRun); } } } |
|
Roster roster = SparkManager.getConnection().getRoster(); Presence userPresence = roster.getPresence(bareJID); if (userPresence != null) { return; } | public void run() { item.setPresence(null); // Check for ContactItemHandler. group.removeContactItem(item); checkGroup(group); if (offlineGroup.getContactItemByJID(item.getFullJID()) == null) { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } |
|
public void searchContacts(String contact, JFrame parent) { | public void searchContacts(String contact, final JFrame parent) { if (parents.get(parent) == null) { parents.put(parent, parent.getGlassPane()); } final Component glassPane = (Component)parents.get(parent); parent.setGlassPane(glassPane); | public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); } |
if (window != null) { window.dispose(); } | public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); } |
|
window = new JWindow(parent); | public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); } |
|
window.setLayout(new BorderLayout()); | public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); } |
|
layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); | layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 50, 0)); | public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); } |
window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); | public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); } |
|
window.dispose(); | public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); } |
|
window.dispose(); | parent.setGlassPane(glassPane); parent.getGlassPane().setVisible(false); contactField.dispose(); | public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); } |
parent.setGlassPane(mainPanel); parent.getGlassPane().setVisible(true); contactField.focus(); mainPanel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { parent.setGlassPane(glassPane); parent.getGlassPane().setVisible(false); contactField.dispose(); } }); parent.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent) { parent.setGlassPane(glassPane); parent.getGlassPane().setVisible(false); contactField.dispose(); parent.removeWindowListener(this); } }); | public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); } |
|
setResourcePath(DEFAULT_RESOURCE_PATH); | setBaseFolderPath(DEFAULT_RESOURCE_PATH); | public ArticleListViewer() { super(); setBeanIdentifier(ARTICLE_LIST_BEAN); setResourcePath(DEFAULT_RESOURCE_PATH); } |
String name = constructorArgNames[i]; | Property name = new Property(constructorArgNames[i]); | private Object[] extractConstructorArgs(Map propertyValues, Class[] constructorArgTypes) { Object[] parameters = new Object[constructorArgNames.length]; for (int i = 0; i < constructorArgNames.length; i++) { String name = constructorArgNames[i]; Class type = constructorArgTypes[i]; Object value; if (propertyValues.containsKey(name)) { value = propertyValues.remove(name); if (!isInstance(type, value) && !isConvertable(type, value)) { throw new ConstructionException("Invalid and non-convertable constructor parameter type: " + "name=" + name + ", " + "index=" + i + ", " + "expected=" + Classes.getClassName(type, true) + ", " + "actual=" + Classes.getClassName(value, true)); } value = convert(type, value); } else { value = getDefaultValue(type); } parameters[i] = value; } return parameters; } |
if (name == null) throw new NullPointerException("name is null"); Object value = properties.get(name); | Object value = properties.get(new Property(name)); | public Object getProperty(String name) { if (name == null) throw new NullPointerException("name is null"); Object value = properties.get(name); return value; } |
return ACTION_ARRAY; | return super.getToolbarActions(); | public String[] getToolbarActions(){ return ACTION_ARRAY; } |
if ((ignoreRegex != null) && (pm.matches(owner, ignoreRegex))) classData.removeLine(currentLine); | Iterator iter = ignoreRegexs.iterator(); while (iter.hasNext()) { Pattern ignoreRegex = (Pattern)iter.next(); if ((ignoreRegexs != null) && (pm.matches(owner, ignoreRegex))) { classData.removeLine(currentLine); return; } } | public void visitMethodInsn(int opcode, String owner, String name, String desc) { super.visitMethodInsn(opcode, owner, name, desc); if ((ignoreRegex != null) && (pm.matches(owner, ignoreRegex))) classData.removeLine(currentLine); } |
public void addNoteTab(DisplayedNote displayedNote) { new NoteTab(tabFolder, l, displayedNote); | public NoteTab addNoteTab(DisplayedNote displayedNote) { return new NoteTab(tabFolder, l, displayedNote); | public void addNoteTab(DisplayedNote displayedNote) { new NoteTab(tabFolder, l, displayedNote); } |
text = new Text(parent, SWT.NONE); | tabItem.addDisposeListener(this); text = new Text(parent, SWT.MULTI | SWT.WRAP); | public NoteTab(final CTabFolder parent, Listener l, DisplayedNote displayedNote) { this.displayedNote = displayedNote; tabItem = new CTabItem(parent, SWT.NONE); tabItem.setText(displayedNote.getName()); tabItem.setData(this); text = new Text(parent, SWT.NONE); text.setText(displayedNote.getNote().getText()); tabItem.setControl(text); displayedNote.setTab(this); select(); l.mapEvent(tabItem, SWT.Dispose, MainController.CLOSE_TAB); } |
l.mapEvent(tabItem, SWT.Dispose, MainController.CLOSE_TAB); | public NoteTab(final CTabFolder parent, Listener l, DisplayedNote displayedNote) { this.displayedNote = displayedNote; tabItem = new CTabItem(parent, SWT.NONE); tabItem.setText(displayedNote.getName()); tabItem.setData(this); text = new Text(parent, SWT.NONE); text.setText(displayedNote.getNote().getText()); tabItem.setControl(text); displayedNote.setTab(this); select(); l.mapEvent(tabItem, SWT.Dispose, MainController.CLOSE_TAB); } |
|
WFTabBar tb = (WFTabBar) link.getParent().getParent().getParent().findComponent(MAIN_TASKBAR_ID); tb.setSelectedButtonId(TASK_ID_EDIT); | WFTabbedPane tb = (WFTabbedPane) link.getParent().getParent().getParent().findComponent(MAIN_TASKBAR_ID); tb.setSelectedMenuItemId(TASK_ID_EDIT); | public void processAction(ActionEvent event) { UIComponent link = event.getComponent(); String id = WFUtil.getParameter(link, "id"); WFTabBar tb = (WFTabBar) link.getParent().getParent().getParent().findComponent(MAIN_TASKBAR_ID); tb.setSelectedButtonId(TASK_ID_EDIT); ArticleBlock ab = (ArticleBlock) tb.findComponent(ArticleBlock.ARTICLE_BLOCK_ID); ab.setEditMode(); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "sv"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", "headline"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", id); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", "author"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setComment", "comment"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setDescription", "description"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setSource", "source"); if (link.getId().equals(ArticleListBean.ARTICLE_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", ContentItemCase.STATUS_PUBLISHED); } else { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", ContentItemCase.STATUS_UNDER_REVIEW); } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setMainCategoryId", new Integer(3)); ab.updateEditButtons(); } |
WFTabBar tb = (WFTabBar) findComponent(MAIN_TASKBAR_ID); tb.setSelectedButtonId(TASK_ID_EDIT); | WFTabbedPane tb = (WFTabbedPane) findComponent(MAIN_TASKBAR_ID); tb.setSelectedMenuItemId(TASK_ID_EDIT); | public void setEditMode() { WFTabBar tb = (WFTabBar) findComponent(MAIN_TASKBAR_ID); tb.setSelectedButtonId(TASK_ID_EDIT); ArticleBlock ab = (ArticleBlock) tb.findComponent(ArticleBlock.ARTICLE_BLOCK_ID); ab.setEditMode(); } |
return start + (int) (end *java.lang.Math.random()/(Integer.MAX_VALUE+1.0)); | return start + (int)((end - start + 1) * java.lang.Math.random()); | public static final int random(int start, int end) { return start + (int) (end *java.lang.Math.random()/(Integer.MAX_VALUE+1.0)); } |
CGI_Impersonator cgi = new CGI_Impersonator(wc.getRequest()); | CGI_Impersonator cgi = new CGI_Impersonator(wc); | public Object init(Context context) throws PropertyException { try { WebContext wc = (WebContext) context; CGI_Impersonator cgi = new CGI_Impersonator(wc.getRequest()); return cgi; } catch (ClassCastException ce) { throw new PropertyException( "CGITool only works with WebContext", ce); } } |
CGI_Impersonator(final HttpServletRequest r) { requst_ = r; | CGI_Impersonator(WebContext wc) { requst_ = wc.getRequest(); sc_ = ((ServletBroker)wc.getBroker()).getServletContext(); | CGI_Impersonator(final HttpServletRequest r) { requst_ = r; } |
if (System.getProperty("xbean.dir") != null) { File f = new File(System.getProperty("xbean.dir") + uri); try { return new FileInputStream(f); } catch (FileNotFoundException e) { } } | protected InputStream loadResource(String uri) { // lets try the thread context class loader first InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri); if (in == null) { in = getClass().getClassLoader().getResourceAsStream(uri); if (in == null) { logger.debug("Could not find resource: " + uri); } } return in; } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.