当前位置: 首页>>代码示例>>Java>>正文


Java InternalEObject.eSetProxyURI方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.InternalEObject.eSetProxyURI方法的典型用法代码示例。如果您正苦于以下问题:Java InternalEObject.eSetProxyURI方法的具体用法?Java InternalEObject.eSetProxyURI怎么用?Java InternalEObject.eSetProxyURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.InternalEObject的用法示例。


在下文中一共展示了InternalEObject.eSetProxyURI方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadFromDescription

import org.eclipse.emf.ecore.InternalEObject; //导入方法依赖的package包/类
/**
 * Populate the contents list from the serialized type data of an {@link IEObjectDescription}. See
 * {@link #isLoadedFromDescription()} for details on resources that are being loaded from a description.
 *
 * @param description
 *            the description that carries the type data in its user data
 */
public boolean loadFromDescription(IResourceDescription description) {
	if (isLoaded)
		throw new IllegalStateException("Resource was already loaded");

	TModule deserializedModule = null;
	Iterable<IEObjectDescription> modules = description.getExportedObjectsByType(TypesPackage.Literals.TMODULE);
	for (IEObjectDescription module : modules) {
		deserializedModule = UserdataMapper.getDeserializedModuleFromDescription(module, getURI());
		if (deserializedModule != null) {
			break;
		}
	}
	if (deserializedModule != null) {
		boolean wasDeliver = eDeliver();
		try {
			eSetDeliver(false);
			ModuleAwareContentsList theContents = (ModuleAwareContentsList) getContents();
			if (!theContents.isEmpty())
				throw new IllegalStateException("There is already something in the contents list: " + theContents);
			InternalEObject astProxy = (InternalEObject) N4JSFactory.eINSTANCE.createScript();
			astProxy.eSetProxyURI(URI.createURI("#" + AST_PROXY_FRAGMENT));
			theContents.sneakyAdd(astProxy);
			theContents.sneakyAdd(deserializedModule);
			fullyInitialized = true;
			// TModule loaded from index had been fully post-processed prior to serialization
			fullyPostProcessed = true;
		} finally {
			eSetDeliver(wasDeliver);
		}
		return true;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:41,代码来源:N4JSResource.java

示例2: discardAST

import org.eclipse.emf.ecore.InternalEObject; //导入方法依赖的package包/类
/**
 * Discard the AST and proxify all referenced nodes. Does nothing if the AST is already unloaded.
 */
private void discardAST() {
	EObject script = getScript();
	if (script != null && !script.eIsProxy()) {

		// Create a proxy for the AST.
		InternalEObject scriptProxy = (InternalEObject) EcoreUtil.create(script.eClass());
		scriptProxy.eSetProxyURI(EcoreUtil.getURI(script));

		TModule module = null;
		ModuleAwareContentsList theContents = (ModuleAwareContentsList) contents;
		if (isFullyInitialized()) {
			module = getModule();
			if (module != null && !module.eIsProxy()) {
				proxifyASTReferences(module);
				module.setAstElement(scriptProxy);
			}
		}

		// Unload the AST.
		unloadElements(theContents.subList(0, 1));

		theContents.sneakyClear();

		if (module != null) {
			theContents.sneakyAdd(scriptProxy);
			theContents.sneakyAdd(module);
		} else {
			// there was no module (not even a proxy)
			// -> don't add the script proxy
			// (i.e. transition from resource load state "Loaded" to "Created", not to "Loaded from Description")
		}

		// Clear AST meta cache and Xtext cache
		this.setASTMetaInfoCache(null);
		getCache().clear(this);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:41,代码来源:N4JSResource.java

示例3: proxifyASTReferences

import org.eclipse.emf.ecore.InternalEObject; //导入方法依赖的package包/类
private void proxifyASTReferences(EObject object) {
	if (object instanceof SyntaxRelatedTElement) {
		SyntaxRelatedTElement element = (SyntaxRelatedTElement) object;
		EObject astElement = element.getAstElement();
		if (astElement != null && !astElement.eIsProxy()) {
			InternalEObject proxy = (InternalEObject) EcoreUtil.create(astElement.eClass());
			proxy.eSetProxyURI(EcoreUtil.getURI(astElement));
			element.setAstElement(proxy);
		}
	}

	for (EObject child : object.eContents()) {
		proxifyASTReferences(child);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:N4JSResource.java

示例4: unload

import org.eclipse.emf.ecore.InternalEObject; //导入方法依赖的package包/类
private void unload(ObjectToFragment element, URI resourceURI) {
	InternalEObject eObject = (InternalEObject) element.object;
	if (eObject instanceof SyntaxRelatedTElement) {
		SyntaxRelatedTElement casted = (SyntaxRelatedTElement) eObject;
		EObject astElementOrProxy = (EObject) casted.eGet(
				TypesPackage.Literals.SYNTAX_RELATED_TELEMENT__AST_ELEMENT, false);
		if (astElementOrProxy != null && !astElementOrProxy.eIsProxy()) {
			// release the reference to the AST
			casted.eSetDeliver(false);
			casted.setAstElement(null);
		}
	}
	eObject.eSetProxyURI(resourceURI.appendFragment(element.fragment));
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:N4JSUnloader.java

示例5: constructType

import org.eclipse.emf.ecore.InternalEObject; //导入方法依赖的package包/类
private EObject constructType(final ParserRuleContext context, final EObject superType) {
    final EObject declaredType;
    final Token nameToken = context.getStart();
    final Optional<BuiltinType> optionalBuiltinType = BuiltinType.of(nameToken.getText());
    if (optionalBuiltinType.isPresent() || superType == null || !superType.eIsProxy()) {
        final EClass eClass = optionalBuiltinType
                .map(builtinType -> builtinType.getScopedMetaType(scope))
                .orElseGet(() -> superType == null ? BuiltinType.STRING.getScopedMetaType(scope) : superType.eClass());
        declaredType = create(eClass, context);
        final Scope typeScope = scope.with(declaredType);

        final String name = nameToken.getText();
        typeScope.with(declaredType.eClass().getEStructuralFeature("name"))
                .setValue(name, nameToken);
        if (!optionalBuiltinType.isPresent()) {
            typeScope.with(declaredType.eClass().getEStructuralFeature("type"))
                    .setValue(superType, nameToken);
        }
    } else {
        final InternalEObject proxy = (InternalEObject) EcoreUtil.create(superType.eClass());
        final String uriFragment = scope.getUriFragment(nameToken.getText());
        proxy.eSetProxyURI(scope.getResource().getURI().appendFragment(uriFragment));
        declaredType = proxy;
    }
    scope.setValue(declaredType, nameToken);
    return declaredType;
}
 
开发者ID:vrapio,项目名称:rest-modeling-framework,代码行数:28,代码来源:TypeDeclarationResolver.java


注:本文中的org.eclipse.emf.ecore.InternalEObject.eSetProxyURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。