private ComposedAdapterFactoryImpl(Registry adapterFactoryDescriptorRegistry) { super(adapterFactoryDescriptorRegistry); changeNotifier = new ChangeNotifier() { @Override public void fireNotifyChanged(Notification notification) { int size = size(); INotifyChangedListener[] listeners = new INotifyChangedListener[size]; toArray(listeners); int expectedModCount = modCount; for (int i = 0; i < size; ++i) { INotifyChangedListener notifyChangedListener = listeners[i]; if (notifyChangedListener == null) { continue; } if (expectedModCount == modCount || this.contains(notifyChangedListener)) { notifyChangedListener.notifyChanged(notification); } } } }; }
public static TransactionalEditingDomain createTransactionEditingDomain(boolean addListener, Map<?, ?> txOptions) { ComposedAdapterFactory composedAdapterFactory = new ComposedAdapterFactoryImpl(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); FixedTransactionEditingDomain domain = EDITING_DOMAIN_FACTORY.createEditingDomain(composedAdapterFactory); domain.setDefaultTransactionOptions(txOptions); if (addListener) { ExtensionPointResourceSetListener.addListener(domain); } ResourceSet resourceSet = domain.getResourceSet(); resourceSet.getAdapterFactories().add(composedAdapterFactory); return domain; }
/** * This constructor will create a consistency only resource set. * * @param ePackage * @param defaultResourceFactory * @return ResourceSet */ public static ResourceSet createTransactionResourceSet(EPackage ePackage, Resource.Factory defaultResourceFactory) { ComposedAdapterFactory composedAdapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); TransactionalEditingDomain domain = EDITING_DOMAIN_FACTORY.createEditingDomain(composedAdapterFactory); ExtensionPointResourceSetListener.addListener(domain, true); ResourceSet resourceSet = domain.getResourceSet(); resourceSet.getAdapterFactories().add(composedAdapterFactory); resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, defaultResourceFactory); resourceSet.getPackageRegistry().put(ePackage.getNsURI(), ePackage); return resourceSet; }
@Inject public InjectableAdapterFactory(Registry adapterFactoryDescriptorRegistry) { super(adapterFactoryDescriptorRegistry); }
public EnsembleEditingDomain() { super(new ComposedAdapterFactory(Registry.INSTANCE), new BasicCommandStack(), new EnsembleEditingDomainResourceSet()); resourceToReadOnlyMap = new HashMap<Resource, Boolean>(); ((EnsembleEditingDomainResourceSet)getResourceSet()).setEditingDomain(this); initializePackageRegistry(); }