public void handleAnnotations( PanelReloader reloader, DwPanel panel, AutomaticRefreshMgr refreshMgr) { if (panel == null) return; WbTable tbl = panel.getTable(); DataStore ds = tbl.getDataStore(); if (ds == null) return; String sql = ds.getGeneratingSql(); if (StringUtil.isEmptyString(sql)) return; Set<String> keys = CollectionUtil.treeSet( WbAnnotation.getTag(ScrollAnnotation.ANNOTATION), WbAnnotation.getTag(MacroAnnotation.ANNOTATION), WbAnnotation.getTag(RefreshAnnotation.ANNOTATION)); List<WbAnnotation> annotations = WbAnnotation.readAllAnnotations(sql, keys); List<MacroAnnotation> macros = new ArrayList<>(); boolean scrollToEnd = false; int line = -1; MainWindow main = (MainWindow) SwingUtilities.getWindowAncestor(tbl); MacroStorage macroMgr = MacroManager.getInstance().getMacros(main.getMacroClientId()); for (WbAnnotation annotation : annotations) { if (annotation .getKeyWord() .equalsIgnoreCase(WbAnnotation.getTag(ScrollAnnotation.ANNOTATION))) { String scrollValue = annotation.getValue(); if (scrollValue != null) { scrollToEnd = ScrollAnnotation.scrollToEnd(scrollValue); line = ScrollAnnotation.scrollToLine(scrollValue); } } else if (refreshMgr != null && annotation .getKeyWord() .equalsIgnoreCase(WbAnnotation.getTag(RefreshAnnotation.ANNOTATION))) { String interval = annotation.getValue(); int milliSeconds = AutomaticRefreshMgr.parseInterval(interval); refreshMgr.addRefresh(reloader, panel, milliSeconds); } else { MacroAnnotation macro = new MacroAnnotation(); macro.setValue(annotation.getValue()); String macroName = macro.getMacroName(); if (macroName != null && macroMgr.getMacro(macroName) != null) { macros.add(macro); } } } if (macros.size() > 0 && tbl != null) { try { MacroMenuBuilder builder = new MacroMenuBuilder(); WbMenu menu = builder.buildDataMacroMenu(main, tbl, macros); tbl.addMacroMenu(menu); } catch (Exception ex) { // ignore } } if (scrollToEnd && tbl != null) { tbl.scrollToRow(tbl.getRowCount() - 1); } else if (line > 0) { tbl.scrollToRow(line - 1); } }