Mercurial > hg > RemoteEditor > Eclipse
changeset 143:7218ba447b7a
*** empty log message ***
author | pin |
---|---|
date | Fri, 15 Feb 2008 13:00:07 +0900 |
parents | 75034fcaa1f1 |
children | 5e3d915219b8 |
files | src/remoteeditor/editors/RemoteEditor.java src/remoteeditor/network/REP.java |
diffstat | 2 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/remoteeditor/editors/RemoteEditor.java Tue Feb 05 19:46:29 2008 +0900 +++ b/src/remoteeditor/editors/RemoteEditor.java Fri Feb 15 13:00:07 2008 +0900 @@ -372,7 +372,7 @@ case REP.REPCMD_REPLACE: try { if(command.eid == myeid) break;//mergerを導入する時に消す - if(command.seq > 0) repsend.send(command); + //if(command.seq > 0) repsend.send(command); changeText(command.cmd, command.lineno, command.len, command.string); } catch (Exception e1) { e1.printStackTrace(); @@ -405,11 +405,27 @@ e.printStackTrace(); } break; + case REP.SMCMD_GET_UNDO: + try { + String text = getTextByLineNo(command.lineno); + sendCommand = new REPCommand(REP.REPCMD_READ, mysid, myeid, 0, command.lineno, 0, text); + } catch (BadLocationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + break; } } + private String getTextByLineNo(int lineno) throws BadLocationException { + int offset = document.getLineOffset(lineno-1); + int length = document.getLineLength(lineno-1); + String text = document.get(offset, length); + return text; + } + private void read(REPCommand command) throws BadLocationException { final int offset = document.getLineOffset(command.lineno); final String string = command.string;
--- a/src/remoteeditor/network/REP.java Tue Feb 05 19:46:29 2008 +0900 +++ b/src/remoteeditor/network/REP.java Fri Feb 15 13:00:07 2008 +0900 @@ -34,5 +34,6 @@ public static final int SMCMD_SM_JOIN_ACK = 63; public static final int SMCMD_UPDATE = 65; public static final int SMCMD_UPDATE_ACK = 66; + public static final int SMCMD_GET_UNDO = 71; }