# HG changeset patch # User pin # Date 1220102486 -32400 # Node ID e9d711e1663363bf493ef44036675c059ac000ab # Parent 48542404f832eb65a1869adc7c31c87bd0fcdf8c *** empty log message *** diff -r 48542404f832 -r e9d711e16633 src/remoteeditor/action/RemoteEditorAction.java --- a/src/remoteeditor/action/RemoteEditorAction.java Sat Aug 30 19:23:30 2008 +0900 +++ b/src/remoteeditor/action/RemoteEditorAction.java Sat Aug 30 22:21:26 2008 +0900 @@ -13,7 +13,14 @@ //import org.eclipse.core.runtime.CoreException; //import org.eclipse.core.runtime.IPath; //import org.eclipse.core.runtime.Path; +import org.eclipse.core.filebuffers.FileBuffers; +import org.eclipse.core.filebuffers.ITextFileBuffer; +import org.eclipse.core.filebuffers.ITextFileBufferManager; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; import org.eclipse.jface.action.IAction; +import org.eclipse.jface.text.IDocument; import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorInput; @@ -49,6 +56,8 @@ public void run(IAction action) { + + System.out.println(action.getId()); if(action.getId().equals("EclipseRemoteEditor.action1")){ IWorkbench workbench = PlatformUI.getWorkbench(); @@ -58,6 +67,19 @@ IEditorPart editorPart = workbenchPage.getActiveEditor(); //System.out.println(editorPart.getEditorInput().toString()); IEditorInput editorinput = editorPart.getEditorInput(); + + + //エディタの外からファイルバッファへアクセスする方法 +// IPath path = new Path(editorinput.getName()); +// ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); +// try { +// manager.connect(path, null); +// } catch (CoreException e1) { +// e1.printStackTrace(); +// } +// ITextFileBuffer buffer = manager.getTextFileBuffer(path); +// IDocument document = buffer.getDocument(); + workbenchPage.closeEditor(editorPart, true); try { editorPart = workbenchPage.openEditor(editorinput, "remoteeditor.editors.RemoteEditor"); @@ -141,7 +163,6 @@ } catch (PartInitException e) { e.printStackTrace(); }*/ - }