1 11 package org.eclipse.jface.wizard; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 28 public abstract class WizardSelectionPage extends WizardPage { 29 30 33 private IWizardNode selectedNode = null; 34 35 39 private List selectedWizardNodes = new ArrayList (); 40 41 47 protected WizardSelectionPage(String pageName) { 48 super(pageName); 49 setPageComplete(false); 51 } 52 53 59 private void addSelectedNode(IWizardNode node) { 60 if (node == null) { 61 return; 62 } 63 64 if (selectedWizardNodes.contains(node)) { 65 return; 66 } 67 68 selectedWizardNodes.add(node); 69 } 70 71 76 public boolean canFlipToNextPage() { 77 return selectedNode != null; 78 } 79 80 84 public void dispose() { 85 super.dispose(); 86 for (int i = 0; i < selectedWizardNodes.size(); i++) { 88 ((IWizardNode) selectedWizardNodes.get(i)).dispose(); 89 } 90 } 91 92 97 public IWizardPage getNextPage() { 98 if (selectedNode == null) { 99 return null; 100 } 101 102 boolean isCreated = selectedNode.isContentCreated(); 103 104 IWizard wizard = selectedNode.getWizard(); 105 106 if (wizard == null) { 107 setSelectedNode(null); 108 return null; 109 } 110 111 if (!isCreated) { 112 wizard.addPages(); 114 } 115 116 return wizard.getStartingPage(); 117 } 118 119 124 public IWizardNode getSelectedNode() { 125 return selectedNode; 126 } 127 128 133 protected void setSelectedNode(IWizardNode node) { 134 addSelectedNode(node); 135 selectedNode = node; 136 if (isCurrentPage()) { 137 getContainer().updateButtons(); 138 } 139 } 140 } 141 | Popular Tags |