KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > ui > templates > NewPluginTemplateWizard


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.ui.templates;
12 /**
13  * This wizard should be used as a base class for wizards that generate plug-in
14  * content using a closed set of templates. These wizards are loaded during new
15  * plug-in or fragment creation and are used to provide initial content (Java
16  * classes, directories/files and extensions).
17  * <p>
18  * The list of templates is fixed. It must be known in advance so that the
19  * required wizard pages can be created. Upon finish, the template sections are
20  * executed in the order of creation.
21  *
22  * @since 2.0
23  */

24 public abstract class NewPluginTemplateWizard
25         extends
26             AbstractNewPluginTemplateWizard {
27     private ITemplateSection[] sections;
28     /**
29      * Creates a new template wizard.
30      */

31     public NewPluginTemplateWizard() {
32         sections = createTemplateSections();
33     }
34     /**
35      * Subclasses are required to implement this method by creating templates
36      * that will appear in this wizard.
37      *
38      * @return an array of template sections that will appear in this wizard.
39      */

40     public abstract ITemplateSection[] createTemplateSections();
41     /**
42      * Returns templates that appear in this section.
43      *
44      * @return an array of templates
45      */

46     public final ITemplateSection[] getTemplateSections() {
47         return sections;
48     }
49     /**
50      * Implemented by asking templates in this wizard to contribute pages.
51      *
52      */

53     protected final void addAdditionalPages() {
54         // add template pages
55
for (int i = 0; i < sections.length; i++) {
56             sections[i].addPages(this);
57         }
58     }
59 }
60
Popular Tags