Mercurial > hg > RemoteEditor > Eclipse
changeset 1:c5c8358a14f3
add sample package
author | yabiku |
---|---|
date | Sun, 22 Oct 2006 14:22:06 +0900 |
parents | cf13bdba762b |
children | 4bc1dad743f0 |
files | bin/remoteeditor/editors/RemoteEditor$1.class bin/remoteeditor/editors/RemoteEditor.class bin/remoteeditor/network/REP.class bin/remoteeditor/ui/CommitDialog$TextBox.class src/remoteeditor/editors/RemoteEditor.java src/remoteeditor/network/REP.java |
diffstat | 6 files changed, 9 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/src/remoteeditor/editors/RemoteEditor.java Sun Oct 22 00:26:53 2006 +0900 +++ b/src/remoteeditor/editors/RemoteEditor.java Sun Oct 22 14:22:06 2006 +0900 @@ -1,33 +1,19 @@ package remoteeditor.editors; -import java.io.IOException; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextListener; import org.eclipse.jface.text.TextEvent; -import org.eclipse.jface.text.TextViewer; import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.editors.text.TextEditor; -import remoteeditor.MyDialog; import remoteeditor.network.REP; import remoteeditor.network.RSocketEvent; import remoteeditor.network.RSocketListener; -import remoteeditor.ui.RepInputDialog; -import remoteeditor.ui.TestDialog; public class RemoteEditor extends TextEditor implements ITextListener, RSocketListener{ - - private ColorManager colorManager; private ISourceViewer viewer; private IDocument document; @@ -38,26 +24,9 @@ public RemoteEditor() throws Exception { super(); - colorManager = new ColorManager(); - setSourceViewerConfiguration(new XMLConfiguration(colorManager)); - setDocumentProvider(new XMLDocumentProvider()); - - //Shell shell = new Shell(); - //MyDialog dialog = new MyDialog(shell); - //dialog.open(); - - //Shell shell = new Shell(); - //TestDialog dialog = new TestDialog(shell); - //dialog.open(); - - //Shell shell = new Shell(); - //RepInputDialog dialog = new RepInputDialog(shell, "REP", "host", "localhost", null); - //dialog.open(); rep = new REP(); rep.addSocketListener(this); - - } public void createPartControl(Composite parent) { @@ -69,7 +38,6 @@ } public void dispose() { - colorManager.dispose(); rep.dispose(); super.dispose(); } @@ -77,16 +45,20 @@ // TODO Auto-generated method stub String replacedText = event.getReplacedText(); String inputText = event.getText(); + + // ページ先頭からの文字数(改行を含む)による座標 textOffset = event.getOffset(); System.out.println("replace = " + replacedText); System.out.println("input = " + inputText); + try { rep.insert(event.getOffset(), event.getLength(), inputText); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } + Byte. }
--- a/src/remoteeditor/network/REP.java Sun Oct 22 00:26:53 2006 +0900 +++ b/src/remoteeditor/network/REP.java Sun Oct 22 14:22:06 2006 +0900 @@ -32,8 +32,8 @@ byte REP_QUIT_CMD = 53; byte REP_QUIT_ACK_CMD = 54; - static ByteBuffer buffer = ByteBuffer.allocateDirect(1024); - static byte[] readbyte = new byte[1024]; + ByteBuffer buffer = ByteBuffer.allocateDirect(1024); + byte[] readbyte = new byte[1024]; String string; private RSocketListener socketListener; @@ -41,15 +41,14 @@ public REP() throws Exception { String host = "localhost"; - int port = 55555; - String filename = "/Users/pin/Desktop/test.java"; + int port = 8080; InputDialog dialog = new InputDialog(shell, "REP", "host", "localhost", null); if(dialog.open() == Window.OK){ host = dialog.getValue(); } - dialog = new InputDialog(shell, "REP", "port", "55555", null); + dialog = new InputDialog(shell, "REP", "port", "8080", null); if (dialog.open() == Window.OK) { try { port = Integer.parseInt(dialog.getValue());