1 11 package org.eclipse.pde.internal.ui.wizards; 12 13 import org.eclipse.core.runtime.IPath; 14 import org.eclipse.core.runtime.Path; 15 import org.eclipse.pde.internal.ui.elements.ElementList; 16 import org.eclipse.ui.IPluginContribution; 17 18 19 20 public class WizardCollectionElement extends ElementList implements IPluginContribution { 21 private WizardCollectionElement parent; 22 private ElementList wizards = new ElementList("wizards"); private String id; 24 25 public static String P_WIZARDS = "org.eclipse.pde.ui.wizards"; 28 public WizardCollectionElement(String id, String name, WizardCollectionElement parent) { 29 super(name, null, parent); 30 this.id = id; 31 } 32 public WizardCollectionElement findChildCollection(IPath searchPath) { 33 String searchString = searchPath.segment(0); 34 35 Object [] children = getChildren(); 36 for (int i=0; i<children.length; i++) { 37 WizardCollectionElement currentCategory = (WizardCollectionElement)children[i]; 38 if (currentCategory.getLabel().equals(searchString)) { 39 if (searchPath.segmentCount() == 1) 40 return currentCategory; 41 42 return currentCategory.findChildCollection(searchPath.removeFirstSegments(1)); 43 } 44 } 45 46 return null; 47 } 48 public WizardElement findWizard(String searchId) { 49 Object [] children = getWizards().getChildren(); 50 51 for (int i=0; i<children.length; i++) { 52 WizardElement currentWizard = (WizardElement)children[i]; 53 if (currentWizard.getID().equals(searchId)) 54 return currentWizard; 55 } 56 return null; 57 } 58 public String getId() { 59 return id; 60 } 61 public IPath getPath() { 62 if (parent == null) 63 return new Path(""); 65 return parent.getPath().append(getLabel()); 66 } 67 public ElementList getWizards() { 68 return wizards; 69 } 70 public void setId(java.lang.String newId) { 71 id = newId; 72 } 73 public void setWizards(ElementList value) { 74 wizards = value; 75 } 76 79 public String getLocalId() { 80 return getId(); 81 } 82 85 public String getPluginId() { 86 return null; 87 } 88 } 89 | Popular Tags |