@Override public void uploadFailed(TernDoc doc) { synchronized (toRefresh) { for (JsonValue val : doc.getFiles()) { if (val instanceof TernFile) { toRefresh.add(((TernFile) val).getName()); } } } }
@Override public void request(TernDoc doc) { if (doc.hasFiles()) { synchronized (files) { for (JsonValue val : doc.getFiles().values()) { if (val instanceof TernFile) { TernFile file = (TernFile) val; files.remove(file.getName()); files.put(file.getName(), file); } } schedule(); } } }
private void updateSentFiles(TernDoc doc) { for (JsonValue value : doc.getFiles()) { if (value instanceof TernFile) { TernFile file = (TernFile) value; if (file.isType(FileType.full)) { String contents = file.getText(); if (StringUtils.isEmpty(contents)) { // treat file with empty contents as removed sentFiles.remove(file.getName()); } else { sentFiles.put(file.getName(), contents); } } } } }
protected void addHTMLFile(TernDoc doc, ITernFile file) throws IOException { TernQuery query = doc.getQuery(); TernFile tf = file.toTernServerFile(getProject()); doc.addFile(tf); query.set("file", "#" + (doc.getFiles().size() - 1)); // $NON-NLS-1$ //$NON-NLS-2$ }