()
| 42 | } |
| 43 | |
| 44 | public void show() throws Exception { |
| 45 | // tokenize so we can highlight tokens |
| 46 | String originalText = testDoc.content; |
| 47 | original_tokens = Tool.tokenize(originalText, lexerClass); |
| 48 | formatted_tokens = Tool.tokenize(formattedText, lexerClass); |
| 49 | |
| 50 | realFormattedTokens = Trainer.getRealTokens(formatted_tokens); |
| 51 | |
| 52 | // show spaces as dots |
| 53 | // originalText = originalText.replace(' ','\u00B7'); |
| 54 | // formattedText = formattedText.replace(' ','\u00B7'); |
| 55 | |
| 56 | // set text and font |
| 57 | Font docFont = new Font("Monaco", Font.PLAIN, 14); |
| 58 | scope.getOrigTextPane().putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); |
| 59 | scope.getOrigTextPane().setFont(docFont); |
| 60 | scope.getFormattedTextPane().putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); |
| 61 | scope.getFormattedTextPane().setFont(docFont); |
| 62 | scope.getOrigTextPane().setText(originalText); |
| 63 | scope.getFormattedTextPane().setText(formattedText); |
| 64 | |
| 65 | scope.injectNLConsole.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); |
| 66 | scope.injectNLConsole.setFont(docFont); |
| 67 | scope.alignConsole.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); |
| 68 | scope.alignConsole.setFont(docFont); |
| 69 | |
| 70 | JFrame frame = new JFrame("CodeBuff Scope"); |
| 71 | frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); |
| 72 | frame.getContentPane().add(scope.$$$getRootComponent$$$(), BorderLayout.CENTER); |
| 73 | |
| 74 | scope.getFormattedTextPane().addCaretListener(new HighlightTokenListener()); |
| 75 | |
| 76 | frame.pack(); |
| 77 | frame.setVisible(true); |
| 78 | } |
| 79 | |
| 80 | // public static Token getTokenAtCharIndex(List<Token> tokens, int index) { |
| 81 | // for (int i=0; i<tokens.size(); i++) { |
no test coverage detected