获得IEditorPart和IDocument

IWorkbench workbench=PlatformUI.getWorkbench();
IEditorPart editor=workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
 AbstractTextEditor temEditor=(AbstractTextEditor)editor;
IDocumentProvider provider=temEditor.getDocumentProvider();
IEditorInput input=editor.getEditorInput();
doc=provider.getDocument(input);

你可能感兴趣的:(java)