mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 16:58:56 +00:00
[xtend / jvmtypes] made JvmDeclaredTypeImplCustom lazy initializable. Used by Xtend for now (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=457681)
Change-Id: I22e834000214b99f448081ecb0274c0b46c2811d
This commit is contained in:
parent
9f674e43c3
commit
f5eca686e3
2 changed files with 36 additions and 0 deletions
|
@ -326,6 +326,14 @@ public class IResourcesSetupUtil {
|
|||
}
|
||||
} while (wasInterrupted);
|
||||
}
|
||||
|
||||
public static void waitForBuild(IProgressMonitor monitor) {
|
||||
try {
|
||||
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
|
||||
} catch (CoreException e) {
|
||||
throw new OperationCanceledException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void cleanWorkspace() throws CoreException {
|
||||
IProject[] visibleProjects = root().getProjects();
|
||||
|
|
|
@ -8,17 +8,22 @@
|
|||
package org.eclipse.xtext.resource;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.emf.common.util.BasicEList;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.emf.ecore.InternalEObject;
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.resource.persistence.StorageAwareResource;
|
||||
import org.eclipse.xtext.util.IAcceptor;
|
||||
import org.eclipse.xtext.util.IResourceScopeCache;
|
||||
import org.eclipse.xtext.util.OnChangeEvictingCache;
|
||||
import org.eclipse.xtext.util.Triple;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.inject.Inject;
|
||||
|
@ -217,4 +222,27 @@ public class DerivedStateAwareResource extends StorageAwareResource {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the given acceptor with a fresh linking context and with eDeliver turned off.
|
||||
*
|
||||
* @since 2.8
|
||||
*/
|
||||
public void runLateInitialization(IAcceptor<DerivedStateAwareResource> runnable) {
|
||||
boolean wasDeliver = eDeliver();
|
||||
LinkedHashSet<Triple<EObject, EReference, INode>> before = resolving;
|
||||
try {
|
||||
eSetDeliver(false);
|
||||
if (!before.isEmpty()) {
|
||||
resolving = new LinkedHashSet<Triple<EObject, EReference, INode>>();
|
||||
}
|
||||
runnable.accept(this);
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
if (!before.isEmpty()) {
|
||||
resolving = before;
|
||||
}
|
||||
eSetDeliver(wasDeliver);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue