/** * A new state id should be created whenever the text content is changed. The client must know * the correct state id in order to send proper requests. If a request with an outdated state id * is received by the server, the request is rejected. */ @Override public void createNewStateId() { long _modificationStamp = this.resource.getModificationStamp(); final long newStateId = (_modificationStamp + 1); this.resource.setModificationStamp(newStateId); }
/** * @since 2.4 */ protected void doReconcile(IRegion region) { if (resource == null) { if (log.isDebugEnabled()) log.debug("Resource is null in XtextReconcilerUnitOfWork."); return; } if (log.isDebugEnabled()) log.debug("Preparing reconciliation."); try { if (!(region instanceof ReconcilerReplaceRegion)) { throw new IllegalArgumentException("Region to be reconciled must be a ReplaceRegion"); } ReconcilerReplaceRegion replaceRegionToBeProcessed = (ReconcilerReplaceRegion) region; if (log.isTraceEnabled()) { log.trace("Parsing replace region '" + replaceRegionToBeProcessed + "'."); } resource.update(replaceRegionToBeProcessed.getOffset(), replaceRegionToBeProcessed.getLength(), replaceRegionToBeProcessed.getText()); resource.setModificationStamp(replaceRegionToBeProcessed.getModificationStamp()); } catch (RuntimeException exc) { log.error("Parsing in reconciler failed.", exc); throw exc; } } }