1 11 package org.eclipse.pde.ui.templates; 12 13 import java.util.ArrayList ; 14 15 import org.eclipse.jface.dialogs.Dialog; 16 import org.eclipse.jface.wizard.IWizard; 17 import org.eclipse.jface.wizard.WizardPage; 18 import org.eclipse.swt.SWT; 19 import org.eclipse.swt.layout.GridLayout; 20 import org.eclipse.swt.widgets.Composite; 21 import org.eclipse.ui.PlatformUI; 22 23 31 32 public class OptionTemplateWizardPage extends WizardPage { 33 private BaseOptionTemplateSection section; 34 private ArrayList options; 35 private String helpContextId; 36 37 47 public OptionTemplateWizardPage(BaseOptionTemplateSection section, 48 ArrayList options, String helpContextId) { 49 super(""); this.section = section; 51 this.options = options; 52 this.helpContextId = helpContextId; 53 } 54 60 public void createControl(Composite composite) { 61 Composite container = new Composite(composite, SWT.NULL); 62 GridLayout layout = new GridLayout(); 63 layout.numColumns = 2; 64 layout.verticalSpacing = 9; 65 container.setLayout(layout); 66 67 for (int i = 0; i < options.size(); i++) { 68 TemplateOption option = (TemplateOption) options.get(i); 69 option.createControl(container, 2); 70 } 71 if (helpContextId != null) 72 PlatformUI.getWorkbench().getHelpSystem().setHelp(container, helpContextId); 73 setControl(container); 74 Dialog.applyDialogFont(container); 75 } 76 82 public void setVisible(boolean visible) { 83 if (visible && section.isDependentOnParentWizard()) { 84 IWizard wizard = getWizard(); 85 if (wizard instanceof AbstractNewPluginTemplateWizard) { 86 AbstractNewPluginTemplateWizard templateWizard = (AbstractNewPluginTemplateWizard) wizard; 87 section.initializeFields(templateWizard.getData()); 88 } 89 } 90 super.setVisible(visible); 91 } 92 } 93 | Popular Tags |