|
||||||||||
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); } }
Field Summary | |
---|---|
static int |
CAN_HANDLE
|
static int |
CANNOT_HANDLE
|
static int |
MAY_HANDLE
|
Method Summary | ||
---|---|---|
void |
configure(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Configure the MetaModelManager's external ResourceSet. |
|
int |
getHandlerPriority(org.eclipse.emf.ecore.EObject eObject)
Return a positive handler priority if this factory can handle creation of a Pivot type from the available object, negative if it cannot. |
|
int |
getHandlerPriority(org.eclipse.emf.ecore.resource.Resource resource)
Return a positive handler priority if this factory can handle creation of a Pivot resource from the available resource, negative if it cannot. |
|
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. |
|
|
getPivotOf(MetaModelManager metaModelManager,
java.lang.Class<T> pivotClass,
org.eclipse.emf.ecore.EObject eObject)
|
|
Element |
importFromResource(MetaModelManager metaModelManager,
org.eclipse.emf.ecore.resource.Resource resource,
org.eclipse.emf.common.util.URI uri)
Return the root element in the Pivot resource resulting from import of the available resource. |
Field Detail |
---|
static final int CANNOT_HANDLE
static final int MAY_HANDLE
static final int CAN_HANDLE
Method Detail |
---|
void configure(@NonNull org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
resourceSet
- int getHandlerPriority(@NonNull org.eclipse.emf.ecore.EObject eObject)
int getHandlerPriority(@NonNull org.eclipse.emf.ecore.resource.Resource resource)
@Nullable org.eclipse.emf.common.util.URI getPackageURI(@NonNull org.eclipse.emf.ecore.EObject eObject)
<T extends Element> T getPivotOf(@NonNull MetaModelManager metaModelManager, @NonNull java.lang.Class<T> pivotClass, @NonNull org.eclipse.emf.ecore.EObject eObject) throws ParserException
ParserException
@Nullable Element importFromResource(@NonNull MetaModelManager metaModelManager, @NonNull org.eclipse.emf.ecore.resource.Resource resource, @Nullable org.eclipse.emf.common.util.URI uri) throws ParserException
uriFragment
-
ParserException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |