/** * Visits all proxies in the resource set and tries to resolve them. * @param resourceSet the objects to visit. */ public static void resolveAll(ResourceSet resourceSet) { List<Resource> resources = resourceSet.getResources(); for (int i = 0; i < resources.size(); ++i) { resolveAll(resources.get(i)); } }
@Override protected void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException { super.doLoad(inputStream, options); if (options != null && Boolean.TRUE.equals(options.get(OPTION_RESOLVE_ALL))) EcoreUtil.resolveAll(this); }
/** * Visits all proxies in the resource and tries to resolve them. * @param resource the objects to visit. */ public static void resolveAll(Resource resource) { for (EObject eObject : resource.getContents()) { resolveAll(eObject); } }
/** * Visits all proxies in the resource set and tries to resolve them. * @param resourceSet the objects to visit. */ public static void resolveAll(ResourceSet resourceSet) { List<Resource> resources = resourceSet.getResources(); for (int i = 0; i < resources.size(); ++i) { resolveAll(resources.get(i)); } }
/** * Visits all proxies in the resource and tries to resolve them. * @param resource the objects to visit. */ public static void resolveAll(Resource resource) { for (EObject eObject : resource.getContents()) { resolveAll(eObject); } }
protected org.eclipse.uml2.uml.Package load(URI uri) { org.eclipse.uml2.uml.Package package_; Resource resource = this.RESOURCE_SET.getResource(uri, true); EcoreUtil.resolveAll(this.RESOURCE_SET); EcoreUtil.resolveAll(resource); package_ = (org.eclipse.uml2.uml.Package) resource.getContents().get(0); return package_; }
@Override public void accept(EObject entity) { EObject toSerialize = EmfUtils.clone(entity); if (resolveReferences) { EcoreUtil.resolveAll(toSerialize); } resource.getContents().add(toSerialize); } });
@Override public void internalSetIdentifier(String identifier) { if (this.identifier != null && identifier == null) { if (eResource() != null) { EcoreUtil.resolveAll(this); } } super.internalSetIdentifier(identifier); }
@Override public void internalSetIdentifier(String identifier) { if (this.identifier != null && identifier == null) { if (eResource() != null) { EcoreUtil.resolveAll(this); } } super.internalSetIdentifier(identifier); }
@Override protected void doLinking() { super.doLinking(); if (isEagerLinking()) EcoreUtil.resolveAll(this); }
public void beginRecording(IChangeSerializer serializer, Resource resource) { this.serializer = serializer; this.snapshot = snapshotProvider.createResourceSnapshot(resource, serializer.isUpdateCrossReferences()); EcoreUtil.resolveAll(resource); }
private void ensureLinked() { if (!linked) { Resource resource = eResource(); if (resource != null) { if (resource instanceof BatchLinkableResource) { ((BatchLinkableResource) resource).resolveLazyCrossReferences(null); } else { EcoreUtil.resolveAll(resource); } linked = true; } } }
@Override public String serializeCrossRef(EObject context, CrossReference grammarElement, final EObject target, INode node) { String serializedCrossRef = super.serializeCrossRef(context, grammarElement, target, node); if (null == serializedCrossRef && target instanceof Type) { serializedCrossRef = ((Type) target).getName(); } if (null == serializedCrossRef && target instanceof Service) { EcoreUtil.resolveAll(context); serializedCrossRef = ((Service) target).getName(); } return serializedCrossRef; } }
protected XtextResource doGetResource(InputStream in, URI uri) throws Exception { XtextResourceSet rs = get(XtextResourceSet.class); rs.setClasspathURIContext(getClass()); XtextResource resource = (XtextResource) getResourceFactory().createResource(uri); rs.getResources().add(resource); resource.load(in, null); if (resource instanceof LazyLinkingResource) { ((LazyLinkingResource) resource).resolveLazyCrossReferences(CancelIndicator.NullImpl); } else { EcoreUtil.resolveAll(resource); } return resource; }
protected XtextResource doGetResource(InputStream in, URI uri) throws Exception { XtextResourceSet rs = get(XtextResourceSet.class); rs.setClasspathURIContext(getClass()); XtextResource resource = (XtextResource) getResourceFactory().createResource(uri); rs.getResources().add(resource); resource.load(in, null); if (resource instanceof LazyLinkingResource) { ((LazyLinkingResource) resource).resolveLazyCrossReferences(CancelIndicator.NullImpl); } else { EcoreUtil.resolveAll(resource); } return resource; }
protected XtextResource doGetResource(InputStream in, URI uri) throws Exception { XtextResourceSet rs = get(XtextResourceSet.class); rs.setClasspathURIContext(getClass()); XtextResource resource = (XtextResource) getResourceFactory().createResource(uri); rs.getResources().add(resource); resource.load(in, null); if (resource instanceof LazyLinkingResource) { ((LazyLinkingResource) resource).resolveLazyCrossReferences(CancelIndicator.NullImpl); } else { EcoreUtil.resolveAll(resource); } return resource; }
public ITextRegionDiffBuilder beginRecording(IChangeSerializer serializer, XtextResource resource) { this.serializer = serializer; this.snapshot = snapshotProvider.createResourceSnapshot(resource, serializer.isUpdateCrossReferences()); this.document = new StringBasedTextRegionAccessDiffBuilder(this.snapshot.getRegions()); EcoreUtil.resolveAll(resource); this.recorder = createChangeRecorder(resource); return this.document; }
public void createDeclarationUpdates(String newName, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { Resource targetResource = resourceSet.getResource(getTargetElementOriginalURI().trimFragment(), false); EcoreUtil.resolveAll(targetResource); applyDeclarationChange(newName, resourceSet); try { changeUtil.addSaveAsUpdate(targetResource, updateAcceptor); } catch (IOException exc) { updateAcceptor.getRefactoringStatus().add(ERROR, exc.getMessage()); } }
public void addModification(final RenameChange change, final IChangeSerializer.IModification<EObject> modification) { final EObject target = this.resourceSet.getEObject(change.getTargetURI(), true); if ((target instanceof EObject)) { EcoreUtil.resolveAll(target.eResource()); this.changeSerializer.<EObject>addModification(target, modification); } else { this.issues.add(RefactoringIssueAcceptor.Severity.ERROR, "Element cannot be found", change.getTargetURI()); } }
@Override public void processFile(String data) throws Exception { XtextResourceSet resourceSet = new XtextResourceSet(); NoOpClassLoader classLoader = new NoOpClassLoader(); resourceSet.setClasspathURIContext(classLoader); ClasspathTypeProviderFactory factory = new ClasspathTypeProviderFactory(classLoader, typeResourceServices); factory.createTypeProvider(resourceSet); EObject parsed = parseHelperNoJRE.parse(data, resourceSet); EcoreUtil.resolveAll(parsed); checkNoErrorsInValidator(data, (XtextResource) parsed.eResource()); }