本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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));
}
示例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;
}