MCPcopy Index your code
hub / github.com/benfry/processing4 / setCurrentCode

Method setCurrentCode

app/src/processing/app/Sketch.java:1548–1569  ·  view source on GitHub ↗

Change what file is currently being edited. Changes the current tab index. store the String for the text of the current file. retrieve the String for the text of the new file. change the text that's visible in the text area

(int which)

Source from the content-addressed store, hash-verified

1546 * </OL>
1547 */
1548 public void setCurrentCode(int which) {
1549 // if current is null, then this is the first setCurrent(0)
1550 if (which < 0 || which >= codeCount ||
1551 ((currentIndex == which) && (current == code[currentIndex]))) {
1552 return;
1553 }
1554
1555 // get the text currently being edited
1556 if (current != null) {
1557 current.setState(editor.getText(),
1558 editor.getSelectionStart(),
1559 editor.getSelectionStop(),
1560 editor.getScrollPosition());
1561 }
1562
1563 current = code[which];
1564 currentIndex = which;
1565 current.visited = System.currentTimeMillis();
1566
1567 editor.setCode(current);
1568 editor.repaintHeader();
1569 }
1570
1571
1572 /**

Callers 15

loadMethod · 0.95
nameCodeMethod · 0.95
handleDeleteCodeMethod · 0.95
handlePrevCodeMethod · 0.95
handleNextCodeMethod · 0.95
addFileMethod · 0.95
mousePressedMethod · 0.95
findMethod · 0.95
switchToTabMethod · 0.95
checkFilesMethod · 0.80
statusErrorMethod · 0.80
highlightMethod · 0.80

Calls 10

setStateMethod · 0.80
repaintHeaderMethod · 0.80
getTextMethod · 0.45
getSelectionStartMethod · 0.45
getSelectionStopMethod · 0.45
getScrollPositionMethod · 0.45
setCodeMethod · 0.45
equalsMethod · 0.45
getFileNameMethod · 0.45
getPrettyNameMethod · 0.45

Tested by

no test coverage detected