Use Navigation History in Eclipse RCP

后端 未结 3 2084
一个人的身影
一个人的身影 2021-01-13 07:26

I like to use the navigation history provided by Eclipse in my RCP Application. Unfortunately this feature isn\'t well documented. In fact I only found this Wiki entry: http

3条回答
  •  广开言路
    2021-01-13 08:06

    I have found the solution. In order to use the Navigation History in your Eclipse RCP application you have to add the following lines of code to your ApplicationActionBarAdvisor.

    /**
     * Fills the cool bar with the main toolbars for the window.
     * 

    * The default implementation does nothing. Subclasses may override. *

    * * @param coolBar * the cool bar manager */ protected void fillCoolBar( ICoolBarManager coolBar ) { IToolBarManager navigation = new ToolBarManager( SWT.FLAT ); IAction backward = getAction( IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY ); IAction forward = getAction( IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY ); navigation.add( backward ); navigation.add( forward ); coolBar.add( navigation ); } /** * Instantiates the actions used in the fill methods. Use * {@link #register(IAction)} to register the action with the key binding * service and add it to the list of actions to be disposed when the window * is closed. * * @param window * the window containing the action bars */ protected void makeActions( IWorkbenchWindow window ) { IAction backward = ActionFactory.BACKWARD_HISTORY.create( window ); backward.setId( IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY ); IAction forward = ActionFactory.FORWARD_HISTORY.create( window ); forward.setId( IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY ); register( backward ); register( forward ); }

提交回复
热议问题