1 11 package org.eclipse.ui.internal.ide.dialogs; 12 13 import org.eclipse.jface.viewers.CheckStateChangedEvent; 14 import org.eclipse.jface.viewers.ICheckStateListener; 15 import org.eclipse.jface.wizard.WizardPage; 16 import org.eclipse.swt.widgets.Composite; 17 import org.eclipse.ui.PlatformUI; 18 import org.eclipse.ui.internal.ide.Category; 19 import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; 20 import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; 21 import org.eclipse.ui.internal.ide.IIDEHelpContextIds; 22 import org.eclipse.ui.internal.ide.misc.ProjectCapabilitySelectionGroup; 23 import org.eclipse.ui.internal.ide.registry.Capability; 24 import org.eclipse.ui.internal.ide.registry.CapabilityRegistry; 25 26 38 public class WizardNewProjectCapabilityPage extends WizardPage { 39 private Capability[] initialProjectCapabilities; 41 42 private Category[] initialSelectedCategories; 43 44 private ProjectCapabilitySelectionGroup capabilityGroup; 46 47 52 public WizardNewProjectCapabilityPage(String pageName) { 53 super(pageName); 54 } 55 56 59 public boolean canFlipToNextPage() { 60 return isPageComplete(); 62 } 63 64 67 public void createControl(Composite parent) { 68 PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, 69 IIDEHelpContextIds.NEW_PROJECT_CAPABILITY_WIZARD_PAGE); 70 CapabilityRegistry reg = IDEWorkbenchPlugin.getDefault() 71 .getCapabilityRegistry(); 72 capabilityGroup = new ProjectCapabilitySelectionGroup( 73 initialSelectedCategories, initialProjectCapabilities, reg); 74 setControl(capabilityGroup.createContents(parent)); 75 76 capabilityGroup.setCheckStateListener(new ICheckStateListener() { 77 public void checkStateChanged(CheckStateChangedEvent event) { 78 getWizard().getContainer().updateButtons(); 79 } 80 }); 81 82 if (!reg.hasCapabilities()) 83 setMessage( 84 IDEWorkbenchMessages.WizardNewProjectCapabilityPage_noCapabilities, WARNING); 85 } 86 87 94 Capability[] getSelectedCapabilities() { 95 return capabilityGroup.getSelectedCapabilities(); 96 } 97 98 103 void setInitialSelectedCategories(Category[] categories) { 104 initialSelectedCategories = categories; 105 } 106 107 112 void setInitialProjectCapabilities(Capability[] capabilities) { 113 initialProjectCapabilities = capabilities; 114 } 115 } 116 | Popular Tags |