【问题标题】:Eclipse Plugin: Check if File in the Editor is Saved?Eclipse 插件:检查编辑器中的文件是否已保存?
【发布时间】:2024-05-03 06:55:03
【问题描述】:

我正在构建一个 Eclipse 插件,我想检查编辑器中的当前文件是否有未保存的更改。有谁知道如何做到这一点?我试过环顾四周,我认为它与以下内容有关:

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

【问题讨论】:

    标签: eclipse plugins editor


    【解决方案1】:

    是的,你继续前进:

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

    【讨论】:

      最近更新 更多