1 11 package org.eclipse.pde.internal.ui.model.plugin; 12 13 import java.util.*; 14 15 import org.eclipse.core.runtime.*; 16 import org.eclipse.pde.core.*; 17 import org.eclipse.pde.core.plugin.*; 18 import org.eclipse.pde.internal.ui.model.*; 19 20 public class PluginParentNode extends PluginObjectNode implements IPluginParent { 21 22 private static final long serialVersionUID = 1L; 23 24 27 public void add(int index, IPluginObject child) throws CoreException { 28 addChildNode((IDocumentNode)child, index); 29 fireStructureChanged(child, IModelChangedEvent.INSERT); 30 } 31 34 public void add(IPluginObject child) throws CoreException { 35 add(getChildCount(), child); 36 child.setInTheModel(true); 37 ((PluginObjectNode)child).setModel(getModel()); 38 } 39 42 public int getChildCount() { 43 return getChildNodes().length; 44 } 45 48 public int getIndexOf(IPluginObject child) { 49 return indexOf((IDocumentNode)child); 50 } 51 54 public void swap(IPluginObject child1, IPluginObject child2) 55 throws CoreException { 56 swap((IDocumentNode)child1, (IDocumentNode)child2); 57 firePropertyChanged(this, P_SIBLING_ORDER, child1, child2); 58 } 59 62 public IPluginObject[] getChildren() { 63 ArrayList result = new ArrayList(); 64 IDocumentNode[] nodes = getChildNodes(); 65 for (int i = 0; i < nodes.length; i++) 66 result.add(nodes[i]); 67 68 return (IPluginObject[])result.toArray(new IPluginObject[result.size()]); 69 } 70 73 public void remove(IPluginObject child) throws CoreException { 74 removeChildNode((IDocumentNode)child); 75 child.setInTheModel(false); 76 fireStructureChanged(child, IModelChangedEvent.REMOVE); 77 } 78 } 79 | Popular Tags |