01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.ui.templates;
11:
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 extends
25: AbstractNewPluginTemplateWizard {
26: private ITemplateSection[] sections;
27:
28: /**
29: * Creates a new template wizard.
30: */
31: public NewPluginTemplateWizard() {
32: sections = createTemplateSections();
33: }
34:
35: /**
36: * Subclasses are required to implement this method by creating templates
37: * that will appear in this wizard.
38: *
39: * @return an array of template sections that will appear in this wizard.
40: */
41: public abstract ITemplateSection[] createTemplateSections();
42:
43: /**
44: * Returns templates that appear in this section.
45: *
46: * @return an array of templates
47: */
48: public final ITemplateSection[] getTemplateSections() {
49: return sections;
50: }
51:
52: /**
53: * Implemented by asking templates in this wizard to contribute pages.
54: *
55: */
56: protected final void addAdditionalPages() {
57: // add template pages
58: for (int i = 0; i < sections.length; i++) {
59: sections[i].addPages(this);
60: }
61: }
62: }
|