Grab current contents of the sketch window, advance the console, stop any other running sketches... not in that order. It's essential that this function be called by any Mode subclass, otherwise current edits may not be stored for getProgram().
()
| 2806 | * otherwise current edits may not be stored for getProgram(). |
| 2807 | */ |
| 2808 | public void prepareRun() { |
| 2809 | internalCloseRunner(); |
| 2810 | statusEmpty(); |
| 2811 | |
| 2812 | // do this to advance/clear the terminal window / dos prompt / etc |
| 2813 | for (int i = 0; i < 10; i++) System.out.println(); |
| 2814 | |
| 2815 | // clear the console on each run, unless the user doesn't want to |
| 2816 | if (Preferences.getBoolean("console.auto_clear")) { |
| 2817 | console.clear(); |
| 2818 | } |
| 2819 | |
| 2820 | // make sure the user didn't hide the sketch folder |
| 2821 | sketch.ensureExistence(); |
| 2822 | |
| 2823 | // make sure any edits have been stored |
| 2824 | //current.setProgram(editor.getText()); |
| 2825 | // Go through all tabs; Replace All, Rename or Undo could have changed them |
| 2826 | for (SketchCode sc : sketch.getCode()) { |
| 2827 | if (sc.getDocument() != null) { |
| 2828 | try { |
| 2829 | sc.setProgram(sc.getDocumentText()); |
| 2830 | } catch (BadLocationException e) { |
| 2831 | } |
| 2832 | } |
| 2833 | } |
| 2834 | |
| 2835 | // // if an external editor is being used, need to grab the |
| 2836 | // // latest version of the code from the file. |
| 2837 | // if (Preferences.getBoolean("editor.external")) { |
| 2838 | // sketch.reload(); |
| 2839 | // } |
| 2840 | } |
| 2841 | |
| 2842 | |
| 2843 | /** |
nothing calls this directly
no test coverage detected