/** * @deprecated use getResourceSet() */ public ResourceSet getXmiResourceSet() { return getResourceSet(); }
/** * Shutdown the EMF nature * * * @since 1.0.0 */ public void shutdown() { if (getResourceSet() != null) ((ProjectResourceSet) getResourceSet()).release(); }
/** * Create the resource for this uri. It will use the resource set of the project to create it. * * @param uri * @return resource * * @since 1.0.0 */ public Resource createResource(URI uri) { return getResourceSet().createResource(uri); }
/** * Get WorkbenchURIConverter for this project. * <p> * This method assumes the URIConverter on the ResourceSet is the one that was created for the ResourceSet on behalf of this nature runtime. * </p> * * @return * * @since 1.0.0 */ protected WorkbenchURIConverter getWorkbenchURIConverter() { return (WorkbenchURIConverter) getResourceSet().getURIConverter(); }
/** * Get the resource for this uri. It will use the resource set of the project to find it. It will load if not already loaded. * * @param uri * @return resource or <code>null</code> if resource is not found. * * @since 1.0.0 */ public Resource getResource(URI uri) { try { return getResourceSet().getResource(uri, true); } catch (WrappedException ex) { if (!WorkbenchResourceHelperBase.isResourceNotFound(ex)) throw ex; } return null; }
protected boolean flushPrimaryKeyClass(JavaClass primaryKeyClass) { // ensure the primary key class is flushed and reloaded to get latest // content IProject p = ProjectUtilities.getProject(primaryKeyClass); try { List natures = EMFNature.getRegisteredRuntimes(p); EMFNature nature = null; for (int i = 0; i < natures.size(); i++) { if (natures.get(i) instanceof EMFNature) nature = (EMFNature) natures.get(i); } List adapterFactories = nature.getResourceSet().getAdapterFactories(); AdapterFactory factory = EcoreUtil.getAdapterFactory(adapterFactories, ReadAdaptor.TYPE_KEY); if (factory instanceof JavaJDOMAdapterFactory) { JavaJDOMAdapterFactory javaFactory = (JavaJDOMAdapterFactory) factory; javaFactory.flushReflectionNoNotification(primaryKeyClass.getQualifiedName()); return true; } } catch (Exception e) { // We don't really care what the exception was, we'll just bail out // and return false; } return false; } }