在Eclipse中,如何在退出时关闭打开的文件(编辑器)而不在下次启动时自动加载
一个问题困扰了我好几天。想在这里找到答案...先谢谢了!
我在 Eclipse 中开发了一个插件。当它启动时,它将打开上次退出时留下的文件(使用我们开发的特定编辑器)。我想知道是否可以在代码中禁用此自动启动?
顺便说一句,我尝试过选项“窗口 - >首选项 - >常规 - >编辑器 - >自动关闭编辑器”,但是,结果无用。
感谢您的建议!
a problem troubled me for several days. Would like to find the answer here... Thanks ahead!
I developed a plugin in Eclipse. When it starts up, it will open the files (with specific editors we developed) left at the last exiting. I wonder whether I can disable this auto-starting in code?
BTW, I have tried the option "Window->Preferences->General->Editors->Close editors automatically", however, with useless result.
Thanks for your advices!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过“启动时恢复编辑器状态”?
Have you tried the 'Restore editor state on statup'?
如果您已经在创建自己的
WorkbenchAdvisor
(如果您正在创建 RCP 应用程序),则可以访问工作台配置器,该配置器可以更改此属性:对于非 RCP 应用程序(即:仅插件),不建议这样做,因为它是一个全局设置,会影响所有编辑器。不过,它仍然可以完成:
如果您想手动执行此操作,可以按照 Eclipse 在哪里保存启动时打开的文件列表? 删除工作台用于存储此信息的文件。
If you're already creating your own
WorkbenchAdvisor
(if you're creating an RCP application), you have access to the workbench configurer which can change this property:For a non-RCP application (ie: just a plugin), it's not recommended to do this since it is a global setting that will affect all editors. It can still be done though:
If you want to do it manually, you can follow Where does Eclipse save the list of files to open on startup? to delete the file the workbench uses to store this information.