如何在 Eclipse 中添加透视图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/627914/
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 Add Perspectives In Eclipse
提问by Joe
If I have two versions of Eclipse installed, how do I add a perspective that I've installed in one [version of eclipse] to the other? How do perspectives get added in the first place? I.e., where do they come from (don't tell me "the 'Open Perspective' dialog")?
如果我安装了两个版本的 Eclipse,如何将我在一个 [Eclipse 版本] 中安装的透视图添加到另一个?首先如何添加视角?即,它们来自哪里(不要告诉我“'Open Perspective' 对话框”)?
回答by VonC
Since the chosen answer is a little bit "poor" on the details on "where do the perspectives come from", here are some precisions:
由于所选择的答案在“视角从何而来”的细节上有点“糟糕”,因此这里有一些精确度:
A perspectivein Eclipse is really just a named organization of views, menus, and toolbars that can be saved and switched to - a unique tab of the application organized for a particular task or set of tasks.
Eclipse 中的透视图实际上只是可保存和切换到的视图、菜单和工具栏的命名组织 - 为特定任务或任务集组织的应用程序的唯一选项卡。
So a perspective comes either from:
所以一个观点来自:
- you: you can modify any perspective, adding view, removing menus, adding toolbars, ... and then saving the result (the current modified perspective) under a new name.
- 您:您可以修改任何透视图、添加视图、删除菜单、添加工具栏等,然后以新名称保存结果(当前修改的透视图)。
alt text http://www.javalobby.org/images/postings/rj/eclipse_perspective/1.gif
替代文字 http://www.javalobby.org/images/postings/rj/eclipse_perspective/1.gif
a plugin: for that, a plugin declares a extension point for perspective contribution: org.eclipse.ui.perspectives. A new perspective is added to the workbench by defining an extension for this point. In the example below a perspective extension is defined for the Test Perspective. This declaration contains the basic elements: id, name and class.
插件:为此,插件声明了透视贡献的扩展点: org.eclipse.ui.perspectives。通过为此点定义扩展,将新的透视图添加到工作台中。在下面的示例中,为测试透视定义了透视扩展。该声明包含基本元素:id、name 和 class。
A complete description of the extension point and the syntax are available in the developer documentation for org.eclipse.ui. The attributes are described as follows.
org.eclipse.ui的开发人员文档中提供了对扩展点和语法的完整描述。属性描述如下。
- id- a unique name that will be used to identify this perspective.
- name- a translatable name that will be used in the workbench window menu bar to represent this perspective.
- class– a fully qualified name of the class that implements org.eclipse.ui.IPerspectiveFactory interface.
- icon- a relative name of the icon that will be associated with this perspective.
- id- 将用于标识此透视图的唯一名称。
- name- 将在工作台窗口菜单栏中用于表示此透视图的可翻译名称。
- class– 实现 org.eclipse.ui.IPerspectiveFactory 接口的类的完全限定名称。
- icon- 将与此透视图关联的图标的相对名称。
This extension point is used to add perspective factories to the workbench.
A perspective factory is used to define the initial layout and visible action sets for a perspective. The user can select a perspective by invoking the "Open Perspective" submenu of the "Window" menu.
此扩展点用于向工作台添加透视工厂。
透视工厂用于定义透视的初始布局和可见操作集。用户可以通过调用“窗口”菜单的“打开透视图”子菜单来选择透视图。
This is why copying a plugin from one installation of eclipse into the dropin folder of the other eclipsewill make the perspective available to your second Eclipse installation.
(As the last link suggests, you could define a plugin bundle location in order for your two Eclipse to share a common bundle of plugins).
这就是为什么将插件从一个Eclipse 安装复制到另一个 Eclipse 的dropin 文件夹将使透视图可用于您的第二个 Eclipse 安装。
(正如最后一个链接所暗示的,您可以定义一个插件包位置,以便您的两个 Eclipse 共享一个公共插件包)。
More details on the transfer of plugins between diffent Eclipse (of different versions) in this SO question "How Do You Reinstall Installed Eclipse Plugins?".
在此 SO 问题“如何重新安装已安装的 Eclipse 插件?”中有关在不同 Eclipse(不同版本)之间传输插件的更多详细信息。
回答by Jan Jungnickel
Eclipse perspectives are usually defined by features / plugins. If you are missing a certain perspective check the list of installes features / plugins.
Eclipse 透视图通常由特性/插件定义。如果您缺少某个视角,请检查安装功能/插件列表。
回答by Can Berk Güder
Editors and other plug-ins might add their own perspectives. You can also create and save your own perspectives, but I believe you're asking about perspectives added by plug-ins.
编辑器和其他插件可能会添加他们自己的观点。您也可以创建和保存自己的透视图,但我相信您是在询问插件添加的透视图。
The solution is to install the same plug-ins.
解决方法是安装相同的插件。