Java 如何告诉 Eclipse 工作区?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4332943/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to tell Eclipse Workspace?
提问by jantox
Is there a way to tell what is the current Eclipse workspace you are currently working on?
有没有办法告诉您当前正在处理的当前 Eclipse 工作区是什么?
采纳答案by marcinj
For me it work to choose File->Switch Workspace->Other... and it shows the name of current workspace.
对我来说,选择 File->Switch Workspace->Other... 并显示当前工作区的名称。
I tried to confirm
我试着确认
"Actually, this shows the last workspace that was closed, not the current workspace. If you are opening and closing several, this is not dependable."
"实际上,这显示的是最后一个关闭的工作区,而不是当前工作区。如果您同时打开和关闭多个工作区,这不可靠。"
and I am not able to reproduce it. Each time I get the currently loaded workspace (I was testing on Juno). I also checked sources and in ChooseWorkspaceDialog.javaand ChooseWorkspaceData.java, and it looks like it manages simple list of last time opened workspaces which is stored as a RECENT_WORKSPACES key in org.eclipse.ui.ide.prefs file. The workspace name shown in this dialog is the first one from this list.
我无法重现它。每次我获得当前加载的工作区时(我在 Juno 上进行测试)。我还在ChooseWorkspaceDialog.java和ChooseWorkspaceData.java 中检查了源代码,看起来它管理上次打开的工作区的简单列表,这些列表存储为 org.eclipse.ui.ide.prefs 文件中的 RECENT_WORKSPACES 键。此对话框中显示的工作区名称是此列表中的第一个。
回答by Lukas Eder
Check the path of any resource in the resource's properties. Then you'll know. OR: Go to Preferences > General > Workspace and add a Workspace name (shown in window title)
检查资源属性中任何资源的路径。那你就知道了。或:转到首选项 > 常规 > 工作区并添加工作区名称(显示在窗口标题中)
回答by Aravind
Use the switch workspace from the file menu and you will know it
使用文件菜单中的切换工作区,你就会知道
回答by Daniel Engmann
File -> Switch Workspace
文件 -> 切换工作区
回答by JohnGray
If you want to switch wokspace, then File->Switch Workspace. Click "Other" and choose appropriate folder. Is that what you want? :)
如果要切换 wokspace,则 File->Switch Workspace。单击“其他”并选择合适的文件夹。那是你要的吗?:)
回答by Andreas Dolk
There's an environment variable called osgi.instance.area
. You can find it via "Help -> About Eclipse -> Installation Details -> Configuration" (for eclipse "Helios" 3.6)
有一个名为osgi.instance.area
. 您可以通过“帮助 -> 关于 Eclipse -> 安装详细信息 -> 配置”找到它(对于 eclipse“Helios”3.6)
Or, open the properties of any project, then select "Resource". You'll find a "Location" property which is structured like this:
或者,打开任何项目的属性,然后选择“资源”。您会找到一个“位置”属性,其结构如下:
<path-to-current-workspace>/<name-of-current-project>
<path-to-current-workspace>/<name-of-current-project>
Note - the "erased" procedure works in most cases but can not be used in general, because a project folder does not have to be located in the workspace folder. You can choose external locations during project creation. So if you never uncheck the "Use default location", the procedure is save. The first procedure is reliable.
注意 - “擦除”过程在大多数情况下都有效,但通常不能使用,因为项目文件夹不必位于工作区文件夹中。您可以在项目创建期间选择外部位置。因此,如果您从未取消选中“使用默认位置”,则该过程将被保存。第一个程序是可靠的。
回答by pgras
start eclipse with -showlocation
开始日食 -showlocation
Here are two interesting posts about it:
这里有两篇关于它的有趣帖子:
top-10-tips-for-new-eclipse-users (archived version)
回答by ingo
start eclipse with -data
开始日食 -data
example: c:\eclipse\eclipse.exe -data c:\workspaces\myWorkspace1
例子: c:\eclipse\eclipse.exe -data c:\workspaces\myWorkspace1
回答by Kelly S. French
File->Properties
文件->属性
Select a file in the workspace and then use the menu: "File->Properties". A dialog pops up and should show the 'location' of the file. Read the location from right to leftso you go through the class, package, folder, project, then you should see the workspace.
在工作区中选择一个文件,然后使用菜单:“文件->属性”。弹出一个对话框,应该显示文件的“位置”。从右到左阅读位置,以便您浏览类、包、文件夹、项目,然后您应该看到工作区。
回答by Dave L.
-showlocation is great, but it only changes the text at the end of the title bar, so it's often not visible in the taskbar.
-showlocation 很棒,但它只更改标题栏末尾的文本,因此它通常在任务栏中不可见。
If you want to change the beginning of the title bar, which shows the current Perspective, you can use Window -> Save Perspective As... and the new title will be visible in the Taskbar.
如果要更改显示当前透视图的标题栏的开头,可以使用窗口 -> 透视图另存为...,新标题将在任务栏中可见。