mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 16:58:56 +00:00
[xbase] check for loaded status before inferring derived state.
This commit is contained in:
parent
c6e57b4a64
commit
4bc6ef20b1
2 changed files with 12 additions and 2 deletions
|
@ -104,7 +104,7 @@ public class DerivedStateAwareResource extends LazyLinkingResource {
|
|||
|
||||
|
||||
public void discardDerivedState() {
|
||||
if (fullyInitialized && !isInitializing) {
|
||||
if (isLoaded && fullyInitialized && !isInitializing) {
|
||||
try {
|
||||
isInitializing = true;
|
||||
if (derivedStateComputer != null)
|
||||
|
@ -118,6 +118,8 @@ public class DerivedStateAwareResource extends LazyLinkingResource {
|
|||
}
|
||||
|
||||
public void installDerivedState(boolean preIndexingPhase) {
|
||||
if (!isLoaded)
|
||||
throw new IllegalStateException("The resource must be loaded, before installDerivedState can be called.");
|
||||
if (!fullyInitialized && !isInitializing) {
|
||||
try {
|
||||
isInitializing = true;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.resource;
|
||||
|
||||
import static com.google.common.collect.Lists.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
|
@ -15,6 +15,7 @@ import org.eclipse.xtext.resource.impl.DefaultResourceDescription;
|
|||
import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager;
|
||||
import org.eclipse.xtext.resource.impl.EObjectDescriptionLookUp;
|
||||
import org.eclipse.xtext.util.IResourceScopeCache;
|
||||
import org.eclipse.xtext.util.RuntimeIOException;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
@ -36,6 +37,13 @@ public class DerivedStateAwareResourceDescriptionManager extends DefaultResource
|
|||
protected IResourceDescription internalGetResourceDescription(final Resource resource,
|
||||
IDefaultResourceDescriptionStrategy strategy) {
|
||||
DerivedStateAwareResource res = (DerivedStateAwareResource) resource;
|
||||
if (!res.isLoaded()) {
|
||||
try {
|
||||
res.load(res.getResourceSet().getLoadOptions());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeIOException(e);
|
||||
}
|
||||
}
|
||||
boolean isInitialized = res.fullyInitialized || res.isInitializing;
|
||||
try {
|
||||
if (!isInitialized) {
|
||||
|
|
Loading…
Reference in a new issue