Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java20
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaReplacement.java3
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaSynchronizer.java6
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaUpdateMessage.java6
4 files changed, 29 insertions, 6 deletions
diff --git a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java
index 57a75e865..0a567dd35 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java
+++ b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/DocShare.java
@@ -27,6 +27,7 @@ import org.eclipse.ecf.datashare.IChannelContainerAdapter;
import org.eclipse.ecf.datashare.events.IChannelDisconnectEvent;
import org.eclipse.ecf.internal.docshare.*;
import org.eclipse.ecf.internal.provisional.docshare.cola.ColaSynchronizer;
+import org.eclipse.ecf.internal.provisional.docshare.cola.ColaUpdateMessage;
import org.eclipse.ecf.internal.provisional.docshare.messages.*;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.*;
@@ -109,7 +110,24 @@ public class DocShare extends AbstractShare {
Trace.trace(Activator.PLUGIN_ID, NLS.bind("{0}.documentChanged[{1}]", DocShare.this, event)); //$NON-NLS-1$
UpdateMessage msg = new UpdateMessage(event.getOffset(), event.getLength(), event.getText());
UpdateMessage colaMsg = sync.registerOutgoingMessage(msg);
- sendUpdateMsg(colaMsg);
+
+ //TODO breaking DocShare & strategy independence, bad design, fix when refactoring for API
+ if (((ColaUpdateMessage) colaMsg).isReplacement()) {
+ //this necessitates splitting up the replacement op into two distinct ops, del and ins
+ UpdateMessage delMsg = new UpdateMessage(event.getOffset(), event.getLength(), "");
+ UpdateMessage colaDelMsg = sync.registerOutgoingMessage(delMsg);
+ sendUpdateMsg(colaDelMsg);
+
+ int lengthOfNoDeletion = 0;
+ UpdateMessage insMsg = new UpdateMessage(event.getOffset(), lengthOfNoDeletion, event.getText());
+ UpdateMessage colaInsMsg = sync.registerOutgoingMessage(insMsg);
+ sendUpdateMsg(colaInsMsg);
+
+ Assert.isTrue(((ColaUpdateMessage) colaDelMsg).getRemoteOperationsCount() == ((ColaUpdateMessage) colaInsMsg).getRemoteOperationsCount(), "remote counters diverge - i.e. document has been modified during separation of replacement");
+ } else {
+ //standard case
+ sendUpdateMsg(colaMsg);
+ }
}
};
diff --git a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaReplacement.java b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaReplacement.java
index ecc538083..1f6959253 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaReplacement.java
+++ b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaReplacement.java
@@ -15,6 +15,7 @@ import org.eclipse.ecf.core.util.Trace;
import org.eclipse.ecf.internal.docshare.Activator;
import org.eclipse.ecf.internal.docshare.DocshareDebugOptions;
+//TODO make this to be something like a marker interface, does not need to be a class
public class ColaReplacement implements TransformationStrategy {
private static final long serialVersionUID = -7295023855308474804L;
@@ -35,8 +36,6 @@ public class ColaReplacement implements TransformationStrategy {
public ColaUpdateMessage getOperationalTransform(ColaUpdateMessage remoteMsg, ColaUpdateMessage appliedLocalMsg, boolean localMsgHighPrio) {
Trace.entering(Activator.PLUGIN_ID, DocshareDebugOptions.METHODS_ENTERING, this.getClass(), "getOperationalTransform", new Object[] {remoteMsg, appliedLocalMsg, new Boolean(localMsgHighPrio)}); //$NON-NLS-1$
- // TODO Auto-generated method stub
-
Trace.exiting(Activator.PLUGIN_ID, DocshareDebugOptions.METHODS_EXITING, this.getClass(), "getOperationalTransform", null); //$NON-NLS-1$
return null;
diff --git a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaSynchronizer.java b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaSynchronizer.java
index 3935802c3..a8243bae6 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaSynchronizer.java
+++ b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaSynchronizer.java
@@ -53,8 +53,10 @@ public class ColaSynchronizer implements SynchronizationStrategy {
public UpdateMessage registerOutgoingMessage(UpdateMessage localMsg) {
Trace.entering(Activator.PLUGIN_ID, DocshareDebugOptions.METHODS_ENTERING, this.getClass(), "registerOutgoingMessage", localMsg); //$NON-NLS-1$
final ColaUpdateMessage colaMsg = new ColaUpdateMessage(localMsg, localOperationsCount, remoteOperationsCount);
- unacknowledgedLocalOperations.add(colaMsg);
- localOperationsCount++;
+ if (!colaMsg.isReplacement()) {
+ unacknowledgedLocalOperations.add(colaMsg);
+ localOperationsCount++;
+ }
Trace.exiting(Activator.PLUGIN_ID, DocshareDebugOptions.METHODS_EXITING, this.getClass(), "registerOutgoingMessage", colaMsg); //$NON-NLS-1$
return colaMsg;
}
diff --git a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaUpdateMessage.java b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaUpdateMessage.java
index dd0c4add5..ad3d7975a 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaUpdateMessage.java
+++ b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/internal/provisional/docshare/cola/ColaUpdateMessage.java
@@ -49,7 +49,7 @@ public class ColaUpdateMessage extends UpdateMessage {
// replacement op
trafoStrat = ColaReplacement.getInstance();
//TODO this has not been implemented yet
- throw new IllegalArgumentException("Replacement Handling not implemented yet! Known Bug.");
+ //throw new IllegalArgumentException("Replacement Handling not implemented yet! Known Bug.");
}
}
}
@@ -62,6 +62,10 @@ public class ColaUpdateMessage extends UpdateMessage {
return (this.trafoStrat instanceof ColaDeletion);
}
+ public boolean isReplacement() {
+ return (this.trafoStrat instanceof ColaReplacement);
+ }
+
public long getLocalOperationsCount() {
return this.localOperationsCount;
}

Back to the top