1 18 19 package org.netbeans.modules.changelog; 20 21 22 import java.util.*; 23 import org.openide.windows.*; 24 import org.openide.*; 25 26 30 public class LogPrinter_Output implements LogPrinter { 31 32 private OutputWriter writer; 33 private boolean includeSummary; 34 35 public LogPrinter_Output() { 36 writer = TopManager.getDefault().getStdOut(); 37 } 38 39 public void printHeader(ChangeLogProcessor processor) { 40 includeSummary = processor.isIncludeSummary(); 41 if (processor.isIncludeQueryDescription()) { 42 writer.println("Query:"); 43 if (processor.getDateRange() != null) { 44 writer.println(" Date Range:" + processor.getDateRange()); 45 } 46 if (processor.getRevisionRange() != null) { 47 writer.println(" Revision Filter:" + processor.getRevisionRange()); 48 } 49 if (processor.getMessageFilter() != null) { 50 String messageType = ""; 51 if (processor.getMessageFilterType() == ChangeLogProcessor.MESSAGE_FILTER_SUBSTRING) { 52 messageType = "Substring"; 53 } else if (processor.getMessageFilterType() == ChangeLogProcessor.MESSAGE_FILTER_SOME_WORDS) { 54 messageType = "Any of words"; 55 } else if (processor.getMessageFilterType() == ChangeLogProcessor.MESSAGE_FILTER_ALL_WORDS) { 56 messageType = "All of words"; 57 } else if (processor.getMessageFilterType() == ChangeLogProcessor.MESSAGE_FILTER_REGEXP) { 58 messageType = "Regular expression"; 59 } 60 writer.println(" Message Filter (" + messageType + "):" + processor.getMessageFilter()); 61 } 62 if (processor.getFileFilter() != null) { 63 String fileType = ""; 64 if (processor.getFileFilterType() == ChangeLogProcessor.FILE_FILTER_SUBSTRING) { 65 fileType = "Substring"; 66 } else if (processor.getFileFilterType() == ChangeLogProcessor.FILE_FILTER_REGEXP) { 67 fileType = "Regular expression"; 68 } 69 writer.println(" Contained Files Filter (" + fileType + "):" + processor.getFileFilter()); 70 } 71 if (processor.getSortMode() == ChangeLogProcessor.SORT_BY_DATE) { 72 writer.print(" Sort: by Date"); 73 } else if (processor.getSortMode() == ChangeLogProcessor.SORT_BY_USER) { 74 writer.print(" Sort: by User"); 75 } 76 if (processor.isDescendingSort()) { 77 writer.println(" (Descending)"); 78 } else { 79 writer.println(" (Ascending)"); 80 } 81 } 82 } 83 84 public void printGroupHeader(RevisionsGroup group) { 85 writer.println("--------------------------------------------------"); 86 writer.println("User: " + group.getUser()); 87 writer.println("Date: " + group.getStartingDate()); 88 writer.println("Message:" + group.getMessage()); 89 } 90 91 public void printSingleRevision(LogInfoRevision revision) { 92 String repoFileName = revision.getLogInfoHeader().getRepositoryFilename(); 93 repoFileName = repoFileName.substring(0, repoFileName.length() - 2); 94 writer.println(" " + revision.getNumber() + " " + repoFileName); 95 } 96 97 public void printGroupFooter(RevisionsGroup group) { 98 } 100 101 public void printSummary(SummaryProcessor processor) { 102 if (includeSummary) { 103 writer.println("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="); 104 writer.println("Summary:"); 105 writer.println("Number of changes: " + processor.getCommitCount()); 106 writer.print("Developers: "); 107 String [] users = processor.getUserList(); 108 for (int i = 0; i < users.length; i++) { 109 if (i < users.length) { 110 writer.println(users[i] + ", "); 111 } else { 112 writer.println(users[i]); 113 } 114 } 115 writer.println(); 116 String [] mostChanged = processor.getMostChangedFiles(); 117 writer.println("Most frequently changed files:"); 118 for (int j = 0; j < mostChanged.length; j++) { 119 writer.println(mostChanged[j]); 120 } 121 writer.println(); 122 writer.println("Most active developers (based on number of commits):"); 123 String [] mostActive= processor.getMostActiveUsers(); 124 for (int k = 0; k < mostActive.length; k++) { 125 writer.println(mostActive[k]); 126 } 127 writer.println(); 128 } 129 } 130 131 public void printFooter(ChangeLogProcessor processor) { 132 } 134 135 } 136 | Popular Tags |