Defining the actions

The primary customization provided by the BrowserAdvisor in the browser example is the designation of the action bar content for the workbench window:

    public void fillActionBars(IWorkbenchWindow window, IActionBarConfigurer configurer, int flags) {
        ...
        BrowserActionBuilder builder = new BrowserActionBuilder(window);
        getWorkbenchConfigurer().getWindowConfigurer(window).setData(BUILDER_KEY, builder); 
        builder.fillActionBars(configurer, flags);
    }
Let's take a closer look at how these actions are defined in the BrowserActionBuilder. In particular, let's look at the actions that are handled by the browser view.
private void makeActions() {
        ...                
        backAction = new RetargetAction("back", "&Back");  
        backAction.setToolTipText("Back");
        backAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
        window.getPartService().addPartListener(backAction);
        
        forwardAction = new RetargetAction("forward", "&Forward");  
        forwardAction.setToolTipText("Forward");
        forwardAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
        window.getPartService().addPartListener(forwardAction);
        
        stopAction = new RetargetAction("stop", "Sto&p"); 
        stopAction.setToolTipText("Stop");
        window.getPartService().addPartListener(stopAction);
        
        refreshAction = new RetargetAction("refresh", "&Refresh");  
        refreshAction.setToolTipText("Refresh");
        window.getPartService().addPartListener(refreshAction);
        ...
    }
The actions are defined as retargetable actions so that individual views can implement the handler actions. The BrowserView associates its handler actions with the window's retargetable actions when it creates the controls for the view:
    private Browser createBrowser(Composite parent, final IActionBars actionBars) {
        
        ...
        actionBars.setGlobalActionHandler("back", backAction); 
        actionBars.setGlobalActionHandler("forward", forwardAction); 
        actionBars.setGlobalActionHandler("stop", stopAction); 
        actionBars.setGlobalActionHandler("refresh", refreshAction); 
        ...
    }
These actions are created when the view is first created.
    private Action backAction = new Action("Back") {
        public void run() {
            browser.back();
        }
    };
See Retargetable actions for a complete discussion of retargetable actions and how they are defined and implemented.