Eclipse Wizard to implement dynamic pages and tree topologies
This article first analyzes the implementation of the Eclipse Wizard mechanism, including page loading and logoff, page Verification, wizard execution Process, wizard target operation, and so on. Currently, the content of the Eclipse Wizard page is fixed, and the contents and order of the wizard cannot be changed once it is created. In the real world, however, the logic we face is often complex, and the fixed sequence of the Eclipse wizards often fails to meet the needs of the user, so the article extends the current Eclipse Wizard mechanism in two ways: an Eclipse Wizard with dynamic pages and a tree-like topology Eclipse Wizard. The Extended Eclipse Wizard can be easily reused by developers to improve development efficiency.
Introduction
The article will extend a series of existing Eclipse wizard mechanisms and provide a reference implementation that allows users to quickly create more complex eclipse wizards by adding their own business logic on an extended basis.
Without special instructions, the default development and operating environment for this article is: IBM JDK 1.6,eclipse 3.4.x
Introduction to the Eclipse Wizard mechanism
In Eclipse, wizards are a good mechanism for assisting user actions, often to guide users through specific business operations, such as creating a Java project, importing a file, exporting a JAR file, and so on, and having a corresponding wizard-assisted user in Eclipse. In addition, wizards are very common in Eclipse plug-in development, and the wizard framework provided by Eclipse can help users quickly create their own wizards.
Wizard basic operation and operation mechanism
Before we begin, let's take a look at the implementation mechanism of the Eclipse Wizard. A reasonable extension is possible only if you have an in-depth understanding of the implementation mechanism of the Eclipse Wizard. The Eclipse Wizard consists of a series of wizard pages, where the user's actions are dispersed across the wizard pages, each of which is used to configure information on one aspect of the operation, and when all the wizard pages have been configured, the entire wizard can perform the final action and end. In addition, in the wizard design, the user needs to fill out all the necessary information for the current wizard page, and the "next" button will take effect before entering the next wizard page. When the contents of all the wizard pages are populated and the last wizard page is reached, the Finish button of the wizard is available, and then clicking the Finish button starts the wizard's target operation.
Taking the wizard in eclipse to create a project as an example, open the Eclipse development environment and select "File->new->project" to pop up a wizard that creates a new project, as shown in Figure 1. As you can see, there are two pages in the wizard, and the first page is used to select the type of project you want to create, and we select project in general to create an Eclipse common project, which is used to configure the information needed to create Eclipse General engineering: including the project name, The project location and the working set to which the project belongs. The "Next" button works only if you select the type of project you want to create on the first page, and then you go to the second page, and when all the required information is filled in on the second page, the Finish button is available, and clicking on it will begin the process of creating an Eclipse project.
Figure 1. Create Common Engineering Wizard in Eclipse