changeset 53:2f6190300fdb

*** empty log message ***
author pin
date Fri, 06 Apr 2007 05:45:36 +0900
parents ec0bdbd7a8cf
children 520bf354a2ac
files bin/remoteeditor/editors/RemoteEditor.class src/remoteeditor/editors/RemoteEditor.java
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
Binary file bin/remoteeditor/editors/RemoteEditor.class has changed
--- a/src/remoteeditor/editors/RemoteEditor.java	Fri Apr 06 05:36:21 2007 +0900
+++ b/src/remoteeditor/editors/RemoteEditor.java	Fri Apr 06 05:45:36 2007 +0900
@@ -221,6 +221,13 @@
 					e1.printStackTrace();
 				}
 			break;
+		case REP.REP_DELETE_CMD:
+			try {
+					textDelete(command.lineno, command.len, command.string);
+				} catch (BadLocationException e1) {
+					e1.printStackTrace();
+				}
+			break;
 		case REP.REPCMD_READ:
 			try {
 					receiveReadCMD();
@@ -231,6 +238,28 @@
 		}
 	}
 
+
+
+	private void textDelete(int lineNo, int len, String string) throws BadLocationException {
+		final int offset = document.getLineOffset(lineNo-1);
+		//final String changedText = string;
+
+			final int replaceLength = document.getLineLength(lineNo-1);
+		
+		viewer.getTextWidget().getDisplay().syncExec(new Runnable() {
+			public void run() {
+				try {
+					lock = true;
+					//document.replace(offset, replaceLength, changedText);
+					document.replace(offset, replaceLength, "");
+					lock = false;
+				} catch (BadLocationException e) {
+					e.printStackTrace();
+				}
+			}
+		});
+	}
+
 	private void textInsert(int lineNo, int j, String text) throws BadLocationException {
 		final int offset = document.getLineOffset(lineNo);
 		final String changedText = text;