Examples of IDocumentChange


Examples of org.eclipse.ecf.sync.doc.IDocumentChange

  public IModelChangeMessage[] registerLocalChange(IModelChange localChange) {
    List results = new ArrayList();
    Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_ENTERING,
        this.getClass(), "registerLocalChange", localChange); //$NON-NLS-1$
    if (localChange instanceof IDocumentChange) {
      final IDocumentChange docChange = (IDocumentChange) localChange;
      final ColaDocumentChangeMessage colaMsg = new ColaDocumentChangeMessage(
          new DocumentChangeMessage(docChange.getOffset(),
              docChange.getLengthOfReplacedText(),
              docChange.getText()), localOperationsCount,
          remoteOperationsCount);
      // If not replacement, we simply add to
      // unacknowledgedLocalOperations and add message
      // to results
      if (!colaMsg.isReplacement()) {
        unacknowledgedLocalOperations.add(colaMsg);
        localOperationsCount++;
        results.add(colaMsg);
      } else {
        // It *is a replacement message, so we add both a delete and an
        // insert message
        // First create/add a delete message (text set to "")...
        ColaDocumentChangeMessage delMsg = new ColaDocumentChangeMessage(
            new DocumentChangeMessage(docChange.getOffset(),
                docChange.getLengthOfReplacedText(), ""),
            localOperationsCount, remoteOperationsCount);
        unacknowledgedLocalOperations.add(delMsg);
        localOperationsCount++;
        results.add(delMsg);
        // Then create/add the insert message (length set to 0)
        ColaDocumentChangeMessage insMsg = new ColaDocumentChangeMessage(
            new DocumentChangeMessage(docChange.getOffset(), 0,
                docChange.getText()), localOperationsCount,
            remoteOperationsCount);
        unacknowledgedLocalOperations.add(insMsg);
        localOperationsCount++;
        results.add(insMsg);
      }
View Full Code Here

Examples of org.eclipse.ecf.sync.doc.IDocumentChange

  /* (non-Javadoc)
   * @see org.eclipse.ecf.sync.doc.IDocumentSynchronizationStrategy#registerLocalChange(org.eclipse.ecf.sync.doc.IDocumentChange)
   */
  public IModelChangeMessage[] registerLocalChange(IModelChange localChange) {
    if (localChange instanceof IDocumentChange) {
      IDocumentChange docChange = (IDocumentChange) localChange;
      return new IModelChangeMessage[] {new DocumentChangeMessage(docChange.getOffset(), docChange.getLengthOfReplacedText(), docChange.getText())};
    } else return new IModelChangeMessage[0];
  }
View Full Code Here

Examples of org.eclipse.ecf.sync.doc.IDocumentChange

 
  public void run() {
    for (int i = 0; i < 10; i++) {
      IModelChangeMessage [] changes = queue.get();
      for (int j = 0; j < changes.length; j++) {
        IDocumentChange docs[] = (IDocumentChange[])receiver.transformRemoteChange((IModelChange) changes[j]);
        for (int k = 0; k < docs.length; k++) {
          String text = fDocument.get();
          String newText = ">";
          text = text.concat(newText);
          fDocument.set(text);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.