RCP ApplicationProgramThe default appearance is a blank window. Generally, we need to customize the interface through a workbenchadvisor class. Workbenchadvisor has many callback methods. You can set menus, toolbar, status bar, progress bar, and perspective switching tools in the prewindowopen () method. For details, see fillactionbars () add menu items and toolbar items in the method, and specify the preferred perspective in the getinitialwindowperspectiveid () method.
By default, the perspective switching tool is located in the upper-left corner of the window. In eclipse, you can change its position through window-> preferences-> workbench-> appearance. How can you use a program to control it? There are two methods. The first method is to use the followingCodeSet the variables in ipreferencestore:
Ipreferencestore apistore =Prefutil. getapipreferencestore (); apistore. setvalue (iworkbenchpreferenceconstants. dock_perspective_bar, iworkbenchpreferenceconstants. top_right );
Another method is to create a file named plugin_customization.ini in the directory where the plugin is located, and write the following content:
Your. plugin. ID/dock_perspective_bar = topright
Other preference values related to plugin can be set in the same way.
Update: in the latest version of eclipse 3.1m5a, the customization method for the RCP Application menu and toolbar has changed. You should use the newly added actionbaradvisor class to complete this work.