-
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 of
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.
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 perspective
is 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 as
the 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.