(List<List<Handle>> handles)
| 1937 | |
| 1938 | |
| 1939 | protected void initEditorCode(List<List<Handle>> handles) { |
| 1940 | SketchCode[] sketchCode = sketch.getCode(); |
| 1941 | for (int tab=0; tab<baseCode.length; tab++) { |
| 1942 | // beautify the numbers |
| 1943 | int charInc = 0; |
| 1944 | String code = baseCode[tab]; |
| 1945 | |
| 1946 | for (Handle n : handles.get(tab)) { |
| 1947 | int s = n.startChar + charInc; |
| 1948 | int e = n.endChar + charInc; |
| 1949 | String newStr = n.strNewValue; |
| 1950 | code = replaceString(code, s, e, newStr); |
| 1951 | n.newStartChar = n.startChar + charInc; |
| 1952 | charInc += n.strNewValue.length() - n.strValue.length(); |
| 1953 | n.newEndChar = n.endChar + charInc; |
| 1954 | } |
| 1955 | |
| 1956 | sketchCode[tab].setProgram(code); |
| 1957 | /* Wild Hack: set document to null so the text editor will refresh |
| 1958 | the program contents when the document tab is being clicked */ |
| 1959 | sketchCode[tab].setDocument(null); |
| 1960 | } |
| 1961 | |
| 1962 | // this will update the current code |
| 1963 | setCode(sketch.getCurrentCode()); |
| 1964 | } |
| 1965 | |
| 1966 | |
| 1967 | private void loadSavedCode() { |
no test coverage detected