MCPcopy Index your code
hub / github.com/processing/processing / setCode

Method setCode

java/src/processing/mode/java/JavaEditor.java:2203–2243  ·  view source on GitHub ↗

Event handler called when switching between tabs. Loads all line background colors set for the tab. @param code tab to switch to

(SketchCode code)

Source from the content-addressed store, hash-verified

2201 * @param code tab to switch to
2202 */
2203 @Override
2204 public void setCode(SketchCode code) {
2205 Document oldDoc = code.getDocument();
2206
2207 //System.out.println("tab switch: " + code.getFileName());
2208 // set the new document in the textarea, etc. need to do this first
2209 super.setCode(code);
2210
2211 Document newDoc = code.getDocument();
2212 if (oldDoc != newDoc && pdex != null) {
2213 pdex.documentChanged(newDoc);
2214 }
2215
2216 // set line background colors for tab
2217 final JavaTextArea ta = getJavaTextArea();
2218 // can be null when setCode is called the first time (in constructor)
2219 if (ta != null) {
2220 // clear all gutter text
2221 ta.clearGutterText();
2222 // first paint breakpoints
2223 if (breakpointedLines != null) {
2224 for (LineHighlight hl : breakpointedLines) {
2225 if (isInCurrentTab(hl.getLineID())) {
2226 hl.paint();
2227 }
2228 }
2229 }
2230 // now paint current line (if any)
2231 if (currentLine != null) {
2232 if (isInCurrentTab(currentLine.getLineID())) {
2233 currentLine.paint();
2234 }
2235 }
2236 }
2237 if (getDebugger() != null && getDebugger().isStarted()) {
2238 getDebugger().startTrackingLineChanges();
2239 }
2240 if (errorColumn != null) {
2241 errorColumn.repaint();
2242 }
2243 }
2244
2245
2246 /**

Callers 4

setTabContentsMethod · 0.95
stopTweakModeMethod · 0.95
initEditorCodeMethod · 0.95
loadSavedCodeMethod · 0.95

Calls 11

getJavaTextAreaMethod · 0.95
isInCurrentTabMethod · 0.95
getDebuggerMethod · 0.95
clearGutterTextMethod · 0.80
getLineIDMethod · 0.80
isStartedMethod · 0.80
repaintMethod · 0.80
getDocumentMethod · 0.45
documentChangedMethod · 0.45
paintMethod · 0.45

Tested by

no test coverage detected