Search in sources :

Example 6 with ResourceStorageLoadable

use of org.eclipse.xtext.resource.persistence.ResourceStorageLoadable in project xtext-core by eclipse.

the class StorageAwareResource method load.

@Override
public void load(final Map<?, ?> options) throws IOException {
    if (((((!this.isLoaded) && (!this.isLoading)) && (this.resourceStorageFacade != null)) && this.resourceStorageFacade.shouldLoadFromStorage(this))) {
        boolean _isDebugEnabled = StorageAwareResource.LOG.isDebugEnabled();
        if (_isDebugEnabled) {
            URI _uRI = this.getURI();
            String _plus = ("Loading " + _uRI);
            String _plus_1 = (_plus + " from storage.");
            StorageAwareResource.LOG.debug(_plus_1);
        }
        try {
            final ResourceStorageLoadable in = this.resourceStorageFacade.getOrCreateResourceStorageLoadable(this);
            this.loadFromStorage(in);
            return;
        } catch (final Throwable _t) {
            if (_t instanceof IOException) {
                this.contents.clear();
                this.eAdapters.clear();
                this.unload();
            } else {
                throw Exceptions.sneakyThrow(_t);
            }
        }
    }
    super.load(options);
}
Also used : ResourceStorageLoadable(org.eclipse.xtext.resource.persistence.ResourceStorageLoadable) IOException(java.io.IOException) URI(org.eclipse.emf.common.util.URI)

Aggregations

ResourceStorageLoadable (org.eclipse.xtext.resource.persistence.ResourceStorageLoadable)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 EObject (org.eclipse.emf.ecore.EObject)4 Resource (org.eclipse.emf.ecore.resource.Resource)4 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)4 StorageAwareResource (org.eclipse.xtext.resource.persistence.StorageAwareResource)4 Test (org.junit.Test)4 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)3 InMemoryURIConverter (org.eclipse.xtend.core.tests.util.InMemoryURIConverter)3 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)3 JvmGenericType (org.eclipse.xtext.common.types.JvmGenericType)3 IResourceStorageFacade (org.eclipse.xtext.resource.persistence.IResourceStorageFacade)3 ResourceStorageFacade (org.eclipse.xtext.resource.persistence.ResourceStorageFacade)3 BatchLinkableResource (org.eclipse.xtext.xbase.resource.BatchLinkableResource)3 JvmField (org.eclipse.xtext.common.types.JvmField)2 JvmMember (org.eclipse.xtext.common.types.JvmMember)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URI (org.eclipse.emf.common.util.URI)1