Eclipse plug-in development customization wizard (Instructions)

Source: Internet
Author: User
Let's analyze this wizard. Open the invokatronwizard. Java file. Pay attention to how this class extends the wizard and implements the inewwizard interface. You should understand many methods in it. To customize the wizard, we simply call or reload some of the methods. The following are some important methods:

Lifecycle Method

We should reload these methods to initialize and destruction)CodeIn the insert Wizard:

·Constructor(Constructor): called when the Wizard is instantiated and before eclipse passes information to it. The general initialization Implementation of the wizard. You usually want to call the "beautification method" (described later) and set the default value of the dialog box.

·Init(Iworkbench workbench, istructuredselection editorselection): Eclipse calls it to provide workbench information for the wizard. Reload it to save iworkbench and object handles for future use. If it is an editor wizard rather than a new Wizard, we 'd better use the current editor option as the second parameter.

·Dispose(): Eclipse calls it to perform cleanup. Reload it to clear the resources used by the wizard.

·Finalize(): Clear the code, which may be replaced by dispose.

Beautification Method

These methods are used to decorate the wizard form.

·Setwindowtitle(String title): Set the title line string of the form.

·Setdefapagpageimagedescriptor(Imagedescriptor image): provides images displayed in the upper-right corner of all pages in the Wizard.

·Settitlebarcolor(RGB color): Specifies the color of the title bar.

Button Method

These methods control the practicality and behavior of the wizard button.

· BooleanCanfinish(): Reload it to specify whether the finish button is activated (depending on the wizard status ).

· BooleanPerformfinish(): Reload it to implement the basic business logic of the wizard. If the Wizard is not completed (the condition is incorrect), false is returned.

· BooleanPerformcancel(): Reload it and clear it when you click the "cancel" button. If the Wizard cannot be terminated, false is returned.

· BooleanIshelpavailable(): Reload it to specify whether the Help button is visible.

· BooleanNeedspreviousandnextbuttons(): Reload it to specify whether the previous (previous step) and next (next step) buttons are visible.

· BooleanNeedsprogressmonitor(): Reload it to specify whether the progress bar component is visible. When you click Finish to call the complete mfinish () method, it appears.

Page Method

These methods control the appearance of the page.

·Addpages(): Called when the Wizard is displayed. Reload it to insert a new page to the wizard.

·Createpagecontrols(Composite pagecontainer): Eclipse calls it to instantiate all the wizard pages (the pages already added using the addpages () method above ). Reload it to add continuously visible form widgets (parts other than pages) to the wizard ).

· IwizardpageGetstartingpage(): Reload it to check which page is the first page of the wizard.

· IwizardpageGetnextpage(Iwizardpage nextpage): by default, click Next to go to the next page in the array provided by addpages. You may want to access different pages based on your choice. Reload it to calculate the next page.

· IwizardpageGetpreviouspage(Iwizardpage previouspage): similar to getnextpage (), used to calculate the previous page.

· IntGetpagecount(): Retrieves the number of pages added by addpages. In typical cases, you do not need to reload it unless you want to display the number and form of pages.

Other useful methods

These are useful auxiliary methods:

·Setdialogsettings(Idialogsettings settings): You can load the status of the dialog box and set these values by calling this method in Init. In typical cases, these settings can be used as the default value of the wizard field. For more information, see the dialogsettings class.

· IdialogsettingsGetdialogsettings(): When we need data, we call this method to retrieve it. At the end of the complete mfinish () dialog box, you can save the data to the file again.

· IwizardcontainerGetcontainer(): It is very useful for retrieving shell, running background threads, and refreshing windows. Wizard Page Method

As you can see, the Wizard is composed of one or more pages. These pages extend the wizardpage class and implement the iwizardpage interface. To customize a separate page, you must understand many methods. The following are some important methods:

·Constructor: Used to instantiate a page.

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.