Eclipse RCP publishes and creates classic documentation

Source: Internet
Author: User
Tags documentation
Simply put, an RCP application is an Eclipse plug-in that can run independently of the Eclispe IDE development environment. Let's start with a simple example of our RCP journey. first, the new plug-in project Since the RCP application itself is a Eclispe plugin, start with a new Eclispe plug-in project. 1) Start Eclispe, create a plug-in project from the Eclispe File menu: File->new->project->plug-in development->plug-in P roject Click Next to enter the NEW plug-in Project plug-in wizard: Enter the project name in Project name: Simplebrowser (preferably lowercase). Tick "Create an OSGi bundle mainfest" To use the OSGi packaging checklist. OSGi is the standard for dynamically loading plug-ins in Eclipse 3.0 and above, which is not required in Eclipse 2.1. It's best to select it. Click the Next button. Modify the plug-in ID and other plug-in property values. Here is the default value, in the "Rich client Application" column, "Would you like to create a Rich client application?" A selection of "Yes" settings created by the plug For RCP applications. Click Next. Select the most basic Hello RCP template in the template and click the "Finish" button, Eclispe will create a simple RCP application and automatically open the main page of the plugin manifest editor. Here you can conveniently configure your RCP application, eliminating the hassle of manually writing and modifying configuration files. On the overview page of the plugin manifest editor, click on the "Launch an Eclipse application" link to see what your RCP application will look like when it runs. 2) After the project is created, Eclipse will automatically generate the following: application class applicationactionbaradvisor class applicationworkbenchadvisor class app Licationworkbenchwindowadvisor Class simplebrowserplugin class perspective class plugin.xmL File build.properties file   a) Application classThe application class is the main program for RCP applications and is equivalent to the controller for the entire RCP application. The responsibility of the application class is to create a workbench (Workbench) and then add a Workstation Advisor Class (Workbenchadvisior). It is the first program that starts the RCP application to run. This class implements the Iplatformrunnable interface for Eclipse. For the vast majority of RCP applications, the code for this class is not modified. The Workbench (Workbench) is part of the RCP framework, and an RCP application can have only one workbench, but there are multiple workbench Windows (Workbenchadvisior). The structure of the workbench is as follows: b) Advisor classThe three classes of Applicationactionbaradvisor, Applicationworkbenchadvisor and Applicationworkbenchwindowadvisor are the three cores of RCP applications Advisor class. They all inherit from the corresponding abstract Advisor parent class. is a very important three class in the RCP application life cycle. Applicationworkbenchadvisor The Applicationworkbenchadvisor class is referenced in the run () method of the main program application class. This Workbench Advisor class configures the appearance of the Workbench. Applicationworkbenchadvisor inherits the Workbenchwindowadvisor abstract class, and the plug-in Engineering Wizard automatically populates the Createworkbenchwindowadvisor and Getinitialwindowperspectiveid method Body, we can also overwrite (override) Other methods of the parent class. This class of methods is called by the RCP platform at various critical moments in the life cycle of the Workbench. is one of the most important Advisor classes. Here is a brief description of several important methods in the Workbench Advisor class:
Method Description
Initialize Initialize before starting the work station (Workbench). This method has only one parameter: Iworkbenchconfigurer
Prestartup Called before opening the first window after initialization is complete, where you can set the initialization parameters for the open editor and view.
Poststartup Called before all windows are opened or resumed before the event loop is started. Here you can do some sort of automated batch work.
Preshutdown After the event loop ends, any window is closed before it is called
Postshutdown Called before closing the work station (Workbench) after all windows have been closed, can be used to save the state of the current app, and to clean up the content created by the Initialize method
Now we don't need to make any changes to this class. ApplicationworkbenchwindowadvisorApplicationworkbenchwindowadvisor inherits the Workbenchwindowadvisor class, which is primarily responsible for controlling the Worbench window, such as the status bar, toolbars, headings, window sizes, etc. 。 The methods in this class play an important role in the life cycle of the Workbench Window.
Method Description
Prewindowopen Called in the constructor of the WorkBench window to set some characteristics of the windows, such as whether the status bar is displayed. However, no form controls have been created at this time, so they cannot be referenced here.
Postwindowrestore After the window is restored to a previously saved state, calling this method before opening the window will not be invoked in the case of a new window, the first run of the Workbench, and without saving the window state. Here you can call the Iworkbench.close () method to close the Workbench and all open Workbench windows.
Postwindowcreate After the window is created, the previous call is opened. Or, after the window is restored to a previously saved state, it is called after the Postwindowrestore method is executed
Openintro Intro is what you see the first time you open Eclispe, the default implementation of this method is: If the Iworkbenchpreferences.show_intro property is set to True , the first time you open the window will Call this method and the property will be set to False after Intro has been displayed. Later, this method is called only when the Workbenchconfigurer.getsaveandrestore () method returns True and intro still appears when the window is closed.
Postwindowopen Called after the Workbench window is opened, you can open/close (Tweak) Form controls here, such as setting the Title, changing the window size, and so on.
prewindowshellclose
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.