/** * Remove all references to this schema, and all schemas built in the same resource set It is * important to call this method for every dynamic schema created that is not needed anymore, * because references in the static schema's will otherwise keep it alive forever */ public void dispose() { if (schema != null) { ResourceSet rs = schema.eResource().getResourceSet(); for (Resource r : rs.getResources()) { if (r instanceof XSDResourceImpl) { Schemas.dispose(((XSDResourceImpl) r).getSchema()); } } schema = null; } } }
@Override public Collection<?> getChildren(Object object) { ResourceSet resourceSet = (ResourceSet)object; synchronized (resourceSet) { return new ArrayList<Resource>(resourceSet.getResources()); } }
/** * 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)); } }
public NotificationChain call() throws Exception { return ((InternalEList<Resource>)oldResourceSet.getResources()).basicRemove(this, finalNotifications); } });
public Boolean call() throws Exception { resourceSet.getResources().remove(CDOResourceImpl.this); return true; } });
public NotificationChain call() throws Exception { return ((InternalEList<Resource>)oldResourceSet.getResources()).basicRemove(this, finalNotifications); } });
public Boolean call() throws Exception { resourceSet.getResources().remove(CDOResourceImpl.this); return true; } });
private <Type extends Object> void each(final ResourceSet resourceSet, final Class<Type> type, final Procedure1<? super Type> strategy) { for (int i = 0; (i < resourceSet.getResources().size()); i++) { { final Resource resource = resourceSet.getResources().get(i); final Consumer<Type> _function = (Type it) -> { strategy.apply(it); }; Iterables.<Type>filter(resource.getContents(), type).forEach(_function); } } }
private List<EObject> getResourceElements(ResourceSet[] resourceSets) { List<EObject> list = new ArrayList<>(); for (ResourceSet rs : resourceSets) { EList<Resource> resources = rs.getResources(); for (Resource resource : resources) { list.addAll(resource.getContents()); } } return list; }
/** * Process resources that have already been loaded. */ protected void processLoadedResources() { List loaded = getResourceSet().getResources(); if (!loaded.isEmpty()) processResourcesIfInterrested(loaded); }
public Boolean call() throws Exception { EList<Resource> resources = getResourceSet().getResources(); resources.remove(object); return true; } });
/** * @since 2.3 */ protected Resource createResource(java.net.URI uri) { ResourceSet resourceSet = getResourceSet(null); URI emfUri = URI.createURI(uri.toString()); configureResourceSet(resourceSet, emfUri); XtextResource resource = (XtextResource) resourceFactory.createResource(emfUri); resourceSet.getResources().add(resource); resource.setValidationDisabled(true); return resource; }
public Resource resource(InputStream in, URI uriToUse, Map<?, ?> options, ResourceSet resourceSet) { Resource resource = resourceFactory.createResource(uriToUse); resourceSet.getResources().add(resource); try { resource.load(in, options); return resource; } catch (IOException e) { throw new WrappedException(e); } }
/** * @see Archive */ public void addOrReplaceMofResource(Resource aResource) { Resource existingResource = getResourceSet().getResource(aResource.getURI(), false); if (existingResource != null) getResourceSet().getResources().remove(existingResource); getResourceSet().getResources().add(aResource); }
public void dispose() { Resource resource = eResource(); ResourceSet resourceSet = resource.getResourceSet(); resourceSet.getResources().remove(resource); }
public static Set<DataView> getNameSpaceDataViewsFromModel(Model model) { if (null == model) return getSortByDataViewNameAscSetInstance(); return extractNameSpaceDataViews(model.eResource().getResourceSet().getResources().iterator(), model.getName()); }
private void modify(ProgressMonitor progressMonitor, Resource modelResource) { ArrayList<Resource> resources = Lists.newArrayList(modelResource.getResourceSet().getResources()); for (Resource resource : resources) { if (shouldBeModified(resource)) { progressMonitor.subTask(" - pre-process model " + resource.getURI().lastSegment()); logger.info("Pre-process model '" + resource.getURI().lastSegment() + "'"); getConfiguration().getModelModifier().modifyModel((Model) resource.getEObject("/")); EObjectPropertiesAdapter.setProperty(resource, GeneratorConstants.MODIFIED_MODEL, Boolean.TRUE); } } }
public void delete(Map<?, ?> options) throws IOException { getURIConverter().delete(getURI(), mergeMaps(options, defaultDeleteOptions)); unload(); ResourceSet resourceSet = getResourceSet(); if (resourceSet != null) { resourceSet.getResources().remove(this); } }
public static void createDeploymentDescriptor(IProject project, int version) { EnterpriseArtifactEdit earEdit = new EARArtifactEdit(project, false, true); try { earEdit.createModelRoot(version); earEdit.save(null); } finally { // Make sure new resource is removed - the uri used for creation shouldn't be cached Resource newRes = earEdit.getDeploymentDescriptorResource(); WorkbenchResourceHelperBase.getResourceSet(project).getResources().remove(newRes); newRes.unload(); earEdit.dispose(); } }
public static void createDeploymentDescriptor(IProject project, int version) { AppClientArtifactEdit appClientEdit = new AppClientArtifactEdit(project,false,true); try { appClientEdit.createModelRoot(version); appClientEdit.save(null); } finally { // Make sure new resource is removed - the uri used for creation shouldn't be cached Resource newRes = appClientEdit.getDeploymentDescriptorResource(); WorkbenchResourceHelperBase.getResourceSet(project).getResources().remove(newRes); newRes.unload(); appClientEdit.dispose(); } } public IModelProvider create(IProject project) {