Class WorkbenchAdvisor的部分译文

来源:互联网 发布:房产中介软件fangyou 编辑:程序博客网 时间:2024/04/27 20:41

org.eclipse.ui.application
Class WorkbenchAdvisor

java.lang.Object  extended byorg.eclipse.ui.application.WorkbenchAdvisor

public abstract class WorkbenchAdvisor
extends Object

Public base class for configuring the workbench.

注意,工作台引导器( workbench advisor)对象先于工作台( workbench )被创建。尽管如此,使用PlatformUI.getWorkbench 确保已经完全初始化。

创建并运行Workbench(在IPlatformRunnab中)的示例:

  public class MyApplication implements IPlatformRunnable {   public Object run(Object args) {     WorkbenchAdvisor workbenchAdvisor = new MyWorkbenchAdvisor();     Display display = PlatformUI.createDisplay();     int returnCode = PlatformUI.createAndRunWorkbench(display, workbenchAdvisor);     if (returnCode == PlatformUI.RETURN_RESTART) {        return IPlatformRunnable.EXIT_RESTART;     } else {        return IPlatformRunnable.EXIT_OK;   } }  

 

     应用程序应该继承自WorkbenchAdvisor类,并覆写方法使工作台的配置符合特殊应用的需求。
      以下的引导方法在工作台(workbench)的生命周期的关键点被调用(在动态调用PlatformUI.createAndRunWorkbench时,全部都触发.)

initialize – 在所有窗体之前最先调用,可用于注册实体。
preStartup – 在initialize之后但在第一个打开窗体之前调用,可用于在启动或恢复时临时禁用实体。
postStartup – 在preStartup之后但在第一个打开窗体之前调用,可用于重新启用上一步骤禁用的实体。
postRestore – 在工作台的窗体从先前保存的状态中恢复后调用。可用于调整恢复的工作台。
preWindowOpen – 在窗体打开之前调用,用于配置窗体的外貌除了工具条(菜单、工具条等)。
fillActionBars – 在preWindowOpen后调用,用来配置窗体的工具条。
postWindowRestore - 在窗体从先前保存的状态或从一个初始的状态中恢复后调用,用于调整窗体。
postWindowCreate – 在窗体从一个初始的状态或从一个恢复的状态中创建后调用,用于调整窗体。
openIntro – 打开窗体前调用,为了创建介绍组件。
postWindowOpen – 在窗体打开后调用,可用于调用窗体监听器或其他。
preWindowShellClose – 在窗体的Shell被用户关闭后调用,用来关闭屏幕窗体。
eventLoopException – 当事件循环(Event Loop)崩溃时用来操作异常事件,用来通知用户出现问题了。
eventLoopIdle – 当当前没有可以处理的事件时调用,用来执行其他工作或挂起直到新的时间进入了队列。
preShutdown – 在事件循环终止后窗体被关闭前调用,用来注销在初始化时注册的实体。
postShutdown –在事件循环终止且所有的窗体都被关闭后最后调用,用来注销在初始化时注册的实体。

Since:
3.0

字段摘要 static int FILL_COOL_BAR
          Deprecated. use instead static int FILL_MENU_BAR
          Deprecated. use instead static int FILL_PROXY
          Deprecated. use instead static int FILL_STATUS_LINE
          Deprecated. use instead   构造方法摘要 protected WorkbenchAdvisor()
          Creates and initializes a new workbench advisor instance.   方法摘要  void createWindowContents(IWorkbenchWindowConfigurer configurer, Shell shell)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.createWindowContents(Shell) instead  WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer)
          Creates a new workbench window advisor for configuring a new workbench window via the given workbench window configurer.  void eventLoopException(Throwable exception)
          Performs arbitrary actions when the event loop crashes (the code that handles a UI event throws an exception that is not caught).  void eventLoopIdle(Display display)
          Performs arbitrary work or yields when there are no events to be processed.  void fillActionBars(IWorkbenchWindow window, IActionBarConfigurer configurer, int flags)
          Deprecated. since 3.1, override ActionBarAdvisor.fillActionBars(int) instead  IAdaptable getDefaultPageInput()
          Returns the default input for newly created workbench pages when the input is not explicitly specified. abstract  String getInitialWindowPerspectiveId()
          Returns the id of the perspective to use for the initial workbench window, or null if no initial perspective should be shown in the initial workbench window.  String getMainPreferencePageId()
          Returns the id of the preference page that should be presented most prominently. protected  IWorkbenchConfigurer getWorkbenchConfigurer()
          Returns the workbench configurer for the advisor.  void initialize(IWorkbenchConfigurer configurer)
          Performs arbitrary initialization before the workbench starts running.  void internalBasicInitialize(IWorkbenchConfigurer configurer)
          Remembers the configurer and calls initialize.  boolean isApplicationMenu(IWorkbenchWindowConfigurer configurer, String menuId)
          Deprecated. since 3.1, override ActionBarAdvisor.isApplicationMenu(String) instead  void openIntro(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.openIntro() instead  boolean openWindows()
          Opens the workbench windows on startup.  void postShutdown()
          Performs arbitrary finalization after the workbench stops running.  void postStartup()
          Performs arbitrary actions after the workbench windows have been opened (or restored), but before the main event loop is run.  void postWindowClose(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.postWindowClose() instead  void postWindowCreate(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.postWindowCreate() instead  void postWindowOpen(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.postWindowOpen() instead  void postWindowRestore(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.postWindowRestore() instead  boolean preShutdown()
          Performs arbitrary finalization before the workbench is about to shut down.  void preStartup()
          Performs arbitrary actions just before the first workbench window is opened (or restored).  void preWindowOpen(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.preWindowOpen() instead  boolean preWindowShellClose(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.preWindowShellClose() instead  IStatus restoreState(IMemento memento)
          Restores arbitrary application-specific state information for this workbench advisor.  IStatus saveState(IMemento memento)
          Saves arbitrary application-specific state information for this workbench advisor.