本文整理匯總了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;
}