Eclipse Workbench Structure分析

来源:互联网 发布:淘宝帐号登录 编辑:程序博客网 时间:2024/06/16 17:27
IWorkbench
public interface IWorkbench
extends IAdaptable, IServiceLocator

A workbench is the root object for the Eclipse Platform user interface.

A workbench has one or more main windows which present to the end user information based on some underlying model, typically on resources in an underlying workspace. A workbench usually starts with a single open window, and automatically closes when its last window closes.

Each workbench window has a collection ofpages; the active page is the one that is being presented to the end user; at most one page is active in a window at a time.

Each workbench page has a collection of workbench parts, of which there are two kinds: views and editors. A page's parts are arranged (tiled or stacked) for presentation on the screen. The arrangement is not fixed; the user can arrange the parts as they see fit. A perspectiveis a template for a page, capturing a collection of parts and their arrangement.

The platform creates a workbench when the workbench plug-in is activated; since this happens at most once during the life of the running platform, there is only one workbench instance. Due to its singular nature, it is commonly referred to asthe workbench.

如上文注释所说,一个Workbench包含一个或多个WorkbenchWindow(这个应该很好理解),一个WorkbenchWindow包含众多的WorkbenchPage,一个WorkbenchPage包括众多的WorkbenchPart(Editor或View)。Perspective相当于而已管理器,用来为WorkbenchPage布局的,同时也控制着诸如一ActionSets,NewWizardShortcut,ViewShortcut,PerspectiveShortcut的显示。

IWorkbenchWindow
public interface IWorkbenchWindow
extends IPageService, IRunnableContext, IServiceLocator, IShellProvider

A workbench window is a top level window in a workbench. Visually, a workbench window has a menubar, a toolbar, a status bar, and a main area for displaying a single page consisting of a collection of views and editors.

Each workbench window has a collection of 0 or more pages; the active page is the one that is being presented to the end user; at most one page is active in a window at a time.

注释说明:一个WorkbenchWindow包括0或多个WorkbenchPage。另外,根据我的测试,一个WorkbenchWindow最多只包括1个WorkbenchPage。

IWorkbenchPage

public interface IWorkbenchPage

extends IPartService, ISelectionService, org.eclipse.ui.internal.ICompatibleWorkbenchPage

A workbench page consists of an arrangement of views and editors intended to be presented together to the user in a single workbench window.

A page can contain 0 or more views and 0 or more editors. These views and editors are contained wholly within the page and are not shared with other pages. The layout and visible action set for the page is defined by a perspective.

注释:一个Workbench包含0或N(N>0)个View(或Editor)。

至于Perspective,我个人觉得它应该是属于WorkbenchPage中的内容,这个在WorkbenchPage的源码可以印证,WorkbenchPage中有这样的变量声明"private PerspectiveList perspList = new PerspectiveList();"。

下面这张图应该可以较好的说明Eclipse Workbench Structure.

 

原创粉丝点击