简体   繁体   中英

Eclipse Plugin: Check if File in the Editor is Saved?

I'm building an Eclipse Plug-in and I would like to check to see if the current file in the editor has un-saved changes in it. Does anyone know how to do this? I've tried looking around and I assume it has something to do with:

 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

Yup, you just keep going:

IWorkbenchPage page =  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart editorPart = page.getActiveEditor();
if (editorPart.isDirty())
 ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM