Class WorkbenchAdvisor的部分译文

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 intFILL_COOL_BAR
          Deprecated. use instead
static intFILL_MENU_BAR
          Deprecated. use instead
static intFILL_PROXY
          Deprecated. use instead
static intFILL_STATUS_LINE
          Deprecated. use instead
 
构造方法摘要
protected WorkbenchAdvisor()
          Creates and initializes a new workbench advisor instance.
 
方法摘要
 voidcreateWindowContents(IWorkbenchWindowConfigurer configurer, Shell shell)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.createWindowContents(Shell) instead
 WorkbenchWindowAdvisorcreateWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer)
          Creates a new workbench window advisor for configuring a new workbench window via the given workbench window configurer.
 voideventLoopException(Throwable exception)
          Performs arbitrary actions when the event loop crashes (the code that handles a UI event throws an exception that is not caught).
 voideventLoopIdle(Display display)
          Performs arbitrary work or yields when there are no events to be processed.
 voidfillActionBars(IWorkbenchWindow window, IActionBarConfigurer configurer, int flags)
          Deprecated. since 3.1, override ActionBarAdvisor.fillActionBars(int) instead
 IAdaptablegetDefaultPageInput()
          Returns the default input for newly created workbench pages when the input is not explicitly specified.
abstract  StringgetInitialWindowPerspectiveId()
          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.
 StringgetMainPreferencePageId()
          Returns the id of the preference page that should be presented most prominently.
protected  IWorkbenchConfigurergetWorkbenchConfigurer()
          Returns the workbench configurer for the advisor.
 voidinitialize(IWorkbenchConfigurer configurer)
          Performs arbitrary initialization before the workbench starts running.
 voidinternalBasicInitialize(IWorkbenchConfigurer configurer)
          Remembers the configurer and calls initialize.
 booleanisApplicationMenu(IWorkbenchWindowConfigurer configurer, String menuId)
          Deprecated. since 3.1, override ActionBarAdvisor.isApplicationMenu(String) instead
 voidopenIntro(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.openIntro() instead
 booleanopenWindows()
          Opens the workbench windows on startup.
 voidpostShutdown()
          Performs arbitrary finalization after the workbench stops running.
 voidpostStartup()
          Performs arbitrary actions after the workbench windows have been opened (or restored), but before the main event loop is run.
 voidpostWindowClose(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.postWindowClose() instead
 voidpostWindowCreate(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.postWindowCreate() instead
 voidpostWindowOpen(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.postWindowOpen() instead
 voidpostWindowRestore(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.postWindowRestore() instead
 booleanpreShutdown()
          Performs arbitrary finalization before the workbench is about to shut down.
 voidpreStartup()
          Performs arbitrary actions just before the first workbench window is opened (or restored).
 voidpreWindowOpen(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.preWindowOpen() instead
 booleanpreWindowShellClose(IWorkbenchWindowConfigurer configurer)
          Deprecated. since 3.1, override WorkbenchWindowAdvisor.preWindowShellClose() instead
 IStatusrestoreState(IMemento memento)
          Restores arbitrary application-specific state information for this workbench advisor.
 IStatussaveState(IMemento memento)
          Saves arbitrary application-specific state information for this workbench advisor.
    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值