|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public static interface MetaModelManager.Factory
An OrphanClient adapts an EObject with an eReference to an OrphanServer within the domina of a TypeCache. Changes to eContainer and eReference cause the eReference to be activated and deactivated accordingly so that the OrphanServer is aware of how many active clients there are. public static class OrphanClient implements Adapter { protected final TypeCaches typeCache; protected final EObject target; protected final EReference eReference; private OrphanServer orphanServer; public OrphanClient(TypeCaches typeCache, EObject target, EReference eReference) { this.typeCache = typeCache; this.target = target; this.eReference = eReference; this.orphanServer = null; target.eAdapters().add(this); } protected void activate(NamedElement pivotElement) { orphanServer = null; // W I P typeCache.getOrphanServer(pivotElement); if (orphanServer != null) { orphanServer.addClient(this); } } protected void deActivate() { if (orphanServer != null) { orphanServer.removeClient(this); orphanServer = null; } } public Notifier getTarget() { return target; } public boolean isAdapterForType(Object type) { return type == OrphanClient.class; } public void notifyChanged(Notification notification) { if (notification.getNotifier() == target) { int eventType = notification.getEventType(); switch (eventType) { case Notification.SET: { Object oldValue = notification.getOldValue(); Object newValue = notification.getNewValue(); if (newValue != oldValue) { Object feature = notification.getFeature(); if (feature == eReference) { if (oldValue != null) { deActivate(); } if (newValue instanceof NamedElement) { activate((NamedElement) newValue); } } else if (feature == target.eContainmentFeature()) { if (oldValue != null) { deActivate(); } if (newValue != null) { assert target == newValue; Object orphan = target.eGet(eReference); if (orphan instanceof NamedElement) { activate((NamedElement) orphan); } } } } } } } } public void setTarget(Notifier newTarget) { assert (newTarget == null) || (newTarget == target); } }
Method Summary | |
---|---|
boolean |
canHandle(org.eclipse.emf.ecore.resource.Resource resource)
Return true if this factory can handle creatio of a Pivot resource from the available resource. |
void |
configure(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Configure the MetaModelManager's external ResourceSet. |
org.eclipse.emf.common.util.URI |
getPackageURI(org.eclipse.emf.ecore.EObject eObject)
Return the URI of an eObject if it can be treated as a Package. |
Element |
importFromResource(MetaModelManager metaModelManager,
org.eclipse.emf.ecore.resource.Resource resource,
java.lang.String uriFragment)
Return the root element in the Pivot resource resulting from import of the available resource. |
Method Detail |
---|
boolean canHandle(org.eclipse.emf.ecore.resource.Resource resource)
void configure(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
resourceSet
- org.eclipse.emf.common.util.URI getPackageURI(org.eclipse.emf.ecore.EObject eObject)
Element importFromResource(MetaModelManager metaModelManager, org.eclipse.emf.ecore.resource.Resource resource, java.lang.String uriFragment)
uriFragment
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |