gpt4 book ai didi

java - 我可以在退出时让 Eclipse 关闭所有项目吗?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:16:54 24 4
gpt4 key购买 nike

我希望在退出工作区之前让 Eclipse(3.5,如果重要的话)关闭所有打开的项目。这可能吗?

编辑 我忘了提到这些项目是远程存储的,出于这个原因也很好。

最佳答案

2011 年更新:

要在退出时真正关闭所有项目,您需要一个类似于 mentioned in this thread 的插件:

I have implemented shutdown() of my plugin to close all the project and save the workspace.

注意:今天,您将实现 stop() method of an AbstractUIPlugin ,因为 shutdown() 已在 Eclipse3.0+ 中弃用。
在其中,你会 call IProject.close() .

但是你还需要设置org.eclipse.ui.IWorkbenchPreferenceConstants.CLOSE_EDITORS_ON_EXIT preference (我最初在下面引用的那个)让 Eclipse 在您再次重新启动 Eclipse 时不会尝试恢复这些编辑器。
如果你不这样做,你会得到一些异常(exception),比如:

 Could not restore workbench layout
Unable to restore editor -
createElement returned null for input element factory:
org.eclipse.ui.part.FileEditorInputFactory.

2010 年的原始答案;)

此首选项接近您的需要(来自 this JavaTips)——它不会关闭项目,但至少会清理您的工作区:

> General > Editors > Close editors automatically

When any workspace of the eclipse is closed without closing all its editors and again opens the same workspace, it opens all the editors again which were opened at the time of closing.
This might cause slow down the starting of the eclipse.
So it is better to close all the opened editors before closing the workspace.

All open editors can be closed automatically with the closing of the eclipse workspace.

Close Editors Automatically

关于java - 我可以在退出时让 Eclipse 关闭所有项目吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2006020/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com