1 11 package org.eclipse.core.internal.registry; 12 13 import java.util.*; 14 import org.eclipse.core.runtime.IExtension; 15 import org.eclipse.core.runtime.IExtensionDelta; 16 17 20 public class RegistryDelta { 21 private Set extensionDeltas = new HashSet(); private IObjectManager objectManager; 24 RegistryDelta() { 25 } 27 28 public int getExtensionDeltasCount() { 29 return extensionDeltas.size(); 30 } 31 32 public IExtensionDelta[] getExtensionDeltas() { 33 return (IExtensionDelta[]) extensionDeltas.toArray(new ExtensionDelta[extensionDeltas.size()]); 34 } 35 36 public IExtensionDelta[] getExtensionDeltas(String extensionPoint) { 37 Collection selectedExtDeltas = new LinkedList(); 38 for (Iterator extDeltasIter = extensionDeltas.iterator(); extDeltasIter.hasNext();) { 39 IExtensionDelta extensionDelta = (IExtensionDelta) extDeltasIter.next(); 40 if (extensionDelta.getExtension().getExtensionPointUniqueIdentifier().equals(extensionPoint)) 41 selectedExtDeltas.add(extensionDelta); 42 } 43 return (IExtensionDelta[]) selectedExtDeltas.toArray(new IExtensionDelta[selectedExtDeltas.size()]); 44 } 45 46 50 public IExtensionDelta getExtensionDelta(String extensionPointId, String extensionId) { 51 for (Iterator extDeltasIter = extensionDeltas.iterator(); extDeltasIter.hasNext();) { 52 IExtensionDelta extensionDelta = (IExtensionDelta) extDeltasIter.next(); 53 IExtension extension = extensionDelta.getExtension(); 54 if (extension.getExtensionPointUniqueIdentifier().equals(extensionPointId) && extension.getUniqueIdentifier() != null && extension.getUniqueIdentifier().equals(extensionId)) 55 return extensionDelta; 56 } 57 return null; 58 } 59 60 void addExtensionDelta(IExtensionDelta extensionDelta) { 61 this.extensionDeltas.add(extensionDelta); 62 ((ExtensionDelta) extensionDelta).setContainingDelta(this); 63 } 64 65 public String toString() { 66 return "\n\tHost " + ": " + extensionDeltas; } 68 69 void setObjectManager(IObjectManager objectManager) { 70 this.objectManager = objectManager; 71 } 73 74 public IObjectManager getObjectManager() { 75 return objectManager; 76 } 77 } 78 | Popular Tags |