1 11 package org.eclipse.ui.internal.wizards; 12 13 import org.eclipse.ui.internal.dialogs.WizardCollectionElement; 14 import org.eclipse.ui.internal.dialogs.WorkbenchWizardElement; 15 import org.eclipse.ui.wizards.IWizardCategory; 16 import org.eclipse.ui.wizards.IWizardDescriptor; 17 import org.eclipse.ui.wizards.IWizardRegistry; 18 19 24 public abstract class AbstractWizardRegistry implements IWizardRegistry { 25 26 private boolean initialized = false; 27 28 private WorkbenchWizardElement[] primaryWizards; 29 30 private WizardCollectionElement wizardElements; 31 32 35 public AbstractWizardRegistry() { 36 super(); 37 } 38 39 42 public void dispose() { 43 primaryWizards = null; 44 wizardElements = null; 45 initialized = false; 46 } 47 48 52 protected abstract void doInitialize(); 53 54 59 public IWizardCategory findCategory(String id) { 60 initialize(); 61 return wizardElements.findCategory(id); 62 } 63 64 69 public IWizardDescriptor findWizard(String id) { 70 initialize(); 71 return wizardElements.findWizard(id, true); 72 } 73 74 79 public IWizardDescriptor[] getPrimaryWizards() { 80 initialize(); 81 return primaryWizards; 82 } 83 84 89 public IWizardCategory getRootCategory() { 90 initialize(); 91 return wizardElements; 92 } 93 94 99 protected WizardCollectionElement getWizardElements() { 100 initialize(); 101 return wizardElements; 102 } 103 104 107 protected final synchronized void initialize() { 108 if (isInitialized()) { 109 return; 110 } 111 112 initialized = true; 113 doInitialize(); 114 } 115 116 121 private boolean isInitialized() { 122 return initialized; 123 } 124 125 131 protected void setPrimaryWizards(WorkbenchWizardElement[] primaryWizards) { 132 this.primaryWizards = primaryWizards; 133 } 134 135 141 protected void setWizardElements(WizardCollectionElement wizardElements) { 142 this.wizardElements = wizardElements; 143 } 144 } 145 | Popular Tags |