public static DefaultedAdapterImpl retrieveAdapterFor(Defaultable notifier) { return (DefaultedAdapterImpl)EcoreUtil.getExistingAdapter(notifier,ADAPTER_KEY); } public static EObject retrieveDefaultContainerFor(Defaultable notifier) {
private static FileAdapter getFileAdapter(ReferencedResource res) { FileAdapter adapter = (FileAdapter) EcoreUtil.getExistingAdapter(res, FileAdapter.ADAPTER_KEY); return adapter == null ? createFileAdapter(res) : adapter; }
/** * Looks for an {@link OCLExpressionCacheAdapter} attached to <code>modelElement</code>. * If such an adapter is found, its cached expression is returned. The cached expression * may be a reserved expression indicating that no OCL expression exists and that an * unsuccessful attempt to obtain one has been made before. * {@link #isNoOCLDefinition(OCLExpression)} should be used to check for the reserved expression. * null is returned if no cached expression is available. */ public static OCLExpression getCachedOCLExpression(EModelElement modelElement) { Adapter a = EcoreUtil.getExistingAdapter(modelElement, ExpressionCacheAdapter.class); if (a != null) { return ((ExpressionCacheAdapter) a).getExpression(); } else { return null; } }
/** * Looks for an {@link OCLInvariantCacheAdapter} attached to <code>cls</code>. * If such an adapter is found, a cached expression for <code>constraintName</code> is returned. * The cached expression may be a reserved expression indicating that no OCL expression exists * and that an unsuccessful attempt to obtain one has been made before. * {@link #isNoOCLDefinition(OCLExpression)} should be used to check for the reserved expression. * null is returned if no cached expression is available. * * @since 3.1 */ public OCLExpression getCachedOCLExpression(EClassifier cls, String constraintName) { Adapter a = EcoreUtil.getExistingAdapter(cls, InvariantCacheAdapter.class); if (a != null) { return ((InvariantCacheAdapter) a).get(constraintName); } else { return null; } }
public static void initialize(ResourceSet rset) { if (EcoreUtil.getExistingAdapter(rset, IInstantiationHandlerFactoryAdapter.ADAPTER_KEY) == null) rset.eAdapters().add(new JavaInstantiationHandlerFactoryAdapter()); } }
/** * @return */ private boolean isMigrating() { EJBJar jar = ((ContainerManagedEntity) getTarget()).getEjbJar(); if (jar != null) return EcoreUtil.getExistingAdapter(jar, J2EE_PROJ_MIGRATION_ADAPTER) != null; return false; }
public EList getKeyAttributes() { if(keyAttributes == null) { CMPKeySynchronizationAdapter syncAdapter = (CMPKeySynchronizationAdapter) EcoreUtil.getExistingAdapter(this, CMPKeySynchronizationAdapter.ADAPTER_TYPE); if(syncAdapter != null) syncAdapter.initializeKeyAttributes(); } return getKeyAttributesGen(); }
private void setRootNodeAdapterNotificationEnabled(boolean b) { EObject root = resource.getRootObject(); if (root != null) { EMF2DOMAdapter adapter = (EMF2DOMAdapter) EcoreUtil.getExistingAdapter(root, EMF2DOMAdapter.ADAPTER_CLASS); if (adapter != null) { adapter.setNotificationEnabled(b); if (b) adapter.updateDOM(); } } }
public static ImportAdapter get(final EObject eObject) { ImportAdapter _xblockexpression = null; { Resource _eResource = eObject.eResource(); final ResourceSet notifier = _eResource.getResourceSet(); Adapter _existingAdapter = EcoreUtil.getExistingAdapter(notifier, ImportAdapter.class); ImportAdapter adapter = ((ImportAdapter) _existingAdapter); boolean _equals = Objects.equal(adapter, null); if (_equals) { ImportAdapter _importAdapter = new ImportAdapter(); adapter = _importAdapter; EList<Adapter> _eAdapters = notifier.eAdapters(); _eAdapters.add(adapter); } _xblockexpression = (adapter); } return _xblockexpression; }
public boolean hasCachedReflectionSource() { ArrayType jh = (ArrayType) getTarget(); JavaHelpers fc = jh.getFinalComponentType(); if(fc.isPrimitive()) return true; else { JavaReflectionAdaptor reflectionAdaptor = (JavaReflectionAdaptor) EcoreUtil.getExistingAdapter(fc, ReflectionAdaptor.TYPE_KEY); return (reflectionAdaptor != null) ? reflectionAdaptor.hasCachedReflectionSource() : false; } }
protected IInstantiationHandler getInstantiationHandler() { if (!retrievedHandler) { // Need to retrieve handler lazily because when factory is created it does not yet know what ResourceSet it is in. // Can't know that until the first time we need a handler. ResourceSet rset = getEPackage().eResource().getResourceSet(); if (rset != null) { retrievedHandler = true; IInstantiationHandlerFactoryAdapter factory = (IInstantiationHandlerFactoryAdapter) EcoreUtil.getExistingAdapter(rset, IInstantiationHandlerFactoryAdapter.ADAPTER_KEY); if (factory != null) instantiationHandler = factory.getInstantiationHandler(this); } } return instantiationHandler; }
public void setColumnForXml(XmlColumn newColumnForXml) { setColumnForXmlGen(newColumnForXml); if (newColumnForXml == null) { ((XmlColumn) getColumn()).unsetAllAttributes(); //Bug 191067 more translators hackery. Remove their listener since it is not getting removed by them. //this will allow us to later add this tag back in to the xml. When we switch to the //resource model approach in 2.0, we shouldn't need the *forXml objects. Adapter adapter = EcoreUtil.getExistingAdapter(getColumn(), EMF2DOMAdapter.ADAPTER_CLASS); getColumn().eAdapters().remove(adapter); } }
public void setJoinTableForXml(XmlJoinTable newJoinTableForXml) { setJoinTableForXmlGen(newJoinTableForXml); if (newJoinTableForXml == null) { getJoinTableInternal().unsetAllAttributes(); //Bug 191067 more translators hackery. Remove their listener since it is not getting removed by them. //this will allow us to later add this tag back in to the xml. When we switch to the //resource model approach in 2.0, we shouldn't need the *forXml objects. Adapter adapter = EcoreUtil.getExistingAdapter(getJoinTableInternal(), EMF2DOMAdapter.ADAPTER_CLASS); getJoinTableInternal().eAdapters().remove(adapter); } }
public void setColumnForXml(XmlColumn newColumnForXml) { setColumnForXmlGen(newColumnForXml); if (newColumnForXml == null) { ((XmlColumn) getColumn()).unsetAllAttributes(); //Bug 191067 more translators hackery. Remove their listener since it is not getting removed by them. //this will allow us to later add this tag back in to the xml. When we switch to the //resource model approach in 2.0, we shouldn't need the *forXml objects. Adapter adapter = EcoreUtil.getExistingAdapter(getColumn(), EMF2DOMAdapter.ADAPTER_CLASS); getColumn().eAdapters().remove(adapter); } }
public void setDiscriminatorColumnForXml(XmlDiscriminatorColumn newDiscriminatorColumnForXml) { setDiscriminatorColumnForXmlGen(newDiscriminatorColumnForXml); if (newDiscriminatorColumnForXml == null) { getDiscriminatorColumnInternal().unsetAllAttributes(); //Bug 191067 more translators hackery. Remove their listener since it is not getting removed by them. //this will allow us to later add this tag back in to the xml. When we switch to the //resource model approach in 2.0, we shouldn't need the *forXml objects. Adapter adapter = EcoreUtil.getExistingAdapter(getDiscriminatorColumnInternal(), EMF2DOMAdapter.ADAPTER_CLASS); getDiscriminatorColumnInternal().eAdapters().remove(adapter); } }
public void setPersistenceUnitMetadataForXml(PersistenceUnitMetadataForXml newPersistenceUnitMetadataForXml) { setPersistenceUnitMetadataForXmlGen(newPersistenceUnitMetadataForXml); if (newPersistenceUnitMetadataForXml == null) { getPersistenceUnitMetadataInternal().unsetAllAttributes(); //Bug 191067 more translators hackery. Remove their listener since it is not getting removed by them. //this will allow us to later add this tag back in to the xml. When we switch to the //resource model approach in 2.0, we shouldn't need the *forXml objects. Adapter adapter = EcoreUtil.getExistingAdapter(getPersistenceUnitMetadataInternal(), EMF2DOMAdapter.ADAPTER_CLASS); getPersistenceUnitMetadataInternal().eAdapters().remove(adapter); } }
public void setColumnForXml(XmlColumn newColumnForXml) { setColumnForXmlGen(newColumnForXml); if (newColumnForXml == null) { ((XmlColumn) getColumn()).unsetAllAttributes(); //Bug 191067 more translators hackery. Remove their listener since it is not getting removed by them. //this will allow us to later add this tag back in to the xml. When we switch to the //resource model approach in 2.0, we shouldn't need the *forXml objects. Adapter adapter = EcoreUtil.getExistingAdapter(getColumn(), EMF2DOMAdapter.ADAPTER_CLASS); ((XmlColumn) getColumn()).eAdapters().remove(adapter); } }
public void setColumnForXml(XmlColumn newColumnForXml) { setColumnForXmlGen(newColumnForXml); if (newColumnForXml == null) { ((XmlColumn) getColumn()).unsetAllAttributes(); //Bug 191067 more translators hackery. Remove their listener since it is not getting removed by them. //this will allow us to later add this tag back in to the xml. When we switch to the //resource model approach in 2.0, we shouldn't need the *forXml objects. Adapter adapter = EcoreUtil.getExistingAdapter(getColumn(), EMF2DOMAdapter.ADAPTER_CLASS); getColumn().eAdapters().remove(adapter); } }
public void setPersistenceUnitDefaultsForXml(PersistenceUnitDefaultsForXml newPersistenceUnitDefaultsForXml) { setPersistenceUnitDefaultsForXmlGen(newPersistenceUnitDefaultsForXml); if (newPersistenceUnitDefaultsForXml == null) { getPersistenceUnitDefaultsInternal().unsetAllAttributes(); //Bug 191067 more translators hackery. Remove their listener since it is not getting removed by them. //this will allow us to later add this tag back in to the xml. When we switch to the //resource model approach in 2.0, we shouldn't need the *forXml objects. Adapter adapter = EcoreUtil.getExistingAdapter(getPersistenceUnitDefaultsInternal(), EMF2DOMAdapter.ADAPTER_CLASS); getPersistenceUnitDefaultsInternal().eAdapters().remove(adapter); } }
public Grammar getSuperGrammar(final Grammar grammar) { boolean _isEmpty = grammar.getUsedGrammars().isEmpty(); if (_isEmpty) { return null; } Adapter _existingAdapter = EcoreUtil.getExistingAdapter(grammar, SemanticSequencerExtensions.SuperGrammar.class); SemanticSequencerExtensions.SuperGrammar sg = ((SemanticSequencerExtensions.SuperGrammar) _existingAdapter); if ((sg != null)) { return sg.grammar; } final URI uri = IterableExtensions.<Grammar>head(grammar.getUsedGrammars()).eResource().getURI(); final Resource resource = this.cloneResourceSet(grammar.eResource().getResourceSet()).getResource(uri, true); EObject _head = IterableExtensions.<EObject>head(resource.getContents()); final Grammar result = ((Grammar) _head); EList<Adapter> _eAdapters = grammar.eAdapters(); SemanticSequencerExtensions.SuperGrammar _superGrammar = new SemanticSequencerExtensions.SuperGrammar(result); _eAdapters.add(_superGrammar); return result; }