(String message)
| 1366 | } |
| 1367 | |
| 1368 | void error(String message) { |
| 1369 | errorMessage = message; |
| 1370 | if (ignoreErrors) |
| 1371 | return; |
| 1372 | errorCount++; |
| 1373 | boolean showMessage = !done; |
| 1374 | String[] variables = showMessage?getVariables():null; |
| 1375 | token = EOF; |
| 1376 | tokenString = ""; |
| 1377 | IJ.showStatus(""); |
| 1378 | IJ.showProgress(0, 0); |
| 1379 | batchMode = false; |
| 1380 | imageTable = imageActivations = null; |
| 1381 | WindowManager.setTempCurrentImage(null); |
| 1382 | wasError = true; |
| 1383 | if (!evaluating) |
| 1384 | instance = null; |
| 1385 | if (showMessage && message!=null) { |
| 1386 | String line = getErrorLine(); |
| 1387 | String originalLine = line; |
| 1388 | done = true; |
| 1389 | int max = 90; |
| 1390 | int len = line.length(); |
| 1391 | if (len>max) { |
| 1392 | StringBuilder sb = new StringBuilder(len+50); |
| 1393 | int count = 0; |
| 1394 | for (int i=0; i<len; i++){ |
| 1395 | sb.append(line.charAt(i)); |
| 1396 | count++; |
| 1397 | if (count>=max && i<len-7) { |
| 1398 | sb.append("\n "); |
| 1399 | count = 0; |
| 1400 | } |
| 1401 | } |
| 1402 | line = sb.toString(); |
| 1403 | } |
| 1404 | Frame f = WindowManager.getFrame("Debug"); |
| 1405 | TextPanel panel = null; |
| 1406 | if (showVariables && f!=null && (f instanceof TextWindow)) { //clear previous content |
| 1407 | TextWindow debugWindow = (TextWindow) f; |
| 1408 | if (debugWindow != null) { |
| 1409 | panel = debugWindow.getTextPanel(); |
| 1410 | panel.clear(); |
| 1411 | } |
| 1412 | } |
| 1413 | String calledFrom = ""; |
| 1414 | if (callDepth > 0 && callStack != null) { |
| 1415 | for (int jj = callDepth - 1; jj >= 0; jj--) { |
| 1416 | int theline = callStack[jj]; |
| 1417 | calledFrom += "\t\t(called from line " + theline +")\n"; |
| 1418 | } |
| 1419 | } |
| 1420 | showError("Macro Error", message+" in line "+lineNumber +"\n" + calledFrom +" \n"+line, variables); |
| 1421 | f = WindowManager.getFrame("Debug"); |
| 1422 | if (showVariables && f!=null && (f instanceof TextWindow)) { |
| 1423 | TextWindow debugWindow = (TextWindow)f; |
| 1424 | debugWindow.append("\n---\t\t---\nError:\t\t" + message + " in line "+lineNumber + ":"); |
| 1425 | debugWindow.append(calledFrom + "\t\t"); |
no test coverage detected