public SingleDocumentDictionaryReportAction(Yoshikoder yk) {
super(yk, SingleDocumentDictionaryReportAction.class.getName());
}
public void actionPerformed(ActionEvent e) {
final YKDocument doc = yoshikoder.getSelectedDocument();
if (doc == null) return;
Node n = yoshikoder.getSelectedNode();
CategoryNode cnode = null;
if (n instanceof CategoryNode)
cnode = (CategoryNode)n;
else // patternnode
cnode = (CategoryNode)n.getParent();
final CategoryNode catnode = cnode;
TaskWorker tworker = new TaskWorker(yoshikoder){
YKDictionaryReportDialog dia;
protected void doWork() throws Exception {
TokenizationCache tcache = yoshikoder.getTokenizationCache();
TokenList tl = tcache.getTokenList(doc);
if (tl == null){
tl = TokenizationService.getTokenizationService().tokenize(doc);
tcache.putTokenList(doc, tl);
}
EntryFrequencyMap efm = new EntryFrequencyMap(catnode, tl);
DictionaryFrequencyReport catsAndPats =
new DictionaryFrequencyReport("Dictionary Entry Frequencies",
"Frequencies of each dictionary entry in " + doc.getTitle(),
yoshikoder.getDictionary().getName(),
doc, efm, true);
DictionaryFrequencyReport catsOnly =
new DictionaryFrequencyReport("Dictionary Entry Frequencies",
"Frequencies of each dictionary entry in " + doc.getTitle(),
yoshikoder.getDictionary().getName(),
doc, efm, false);
dia = new YKDictionaryReportDialog(yoshikoder, catsOnly, catsAndPats, onlyShowCats);
}