Skip to content
Snippets Groups Projects
Commit d2636ce4 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

PersistencyService is now aware of running tutorial.

refs 2567
parent 76ad70a8
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@ package org.fortiss.tooling.kernel.internal;
import static java.util.Collections.emptyList;
import static java.util.Collections.unmodifiableList;
import static org.conqat.lib.commons.collections.CollectionUtils.asUnmodifiable;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.getBundle;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.getConfigurationElements;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.loadClass;
......@@ -30,8 +31,8 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.conqat.lib.commons.collections.CollectionUtils;
import org.conqat.lib.commons.collections.UnmodifiableList;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
......@@ -51,6 +52,7 @@ import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService
import org.fortiss.tooling.kernel.introspection.items.PersistencyServiceIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.service.ILibraryService;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.service.ITutorialService;
import org.fortiss.tooling.kernel.service.listener.IPersistencyServiceListener;
import org.osgi.framework.Bundle;
......@@ -111,7 +113,14 @@ public class PersistencyService implements IPersistencyService, IIntrospectiveKe
/** {@inheritDoc} */
@Override
public synchronized UnmodifiableList<ITopLevelElement> getTopLevelElements() {
return CollectionUtils.asUnmodifiable(elementCache);
if(ITutorialService.INSTANCE.isTutorialActive()) {
EObject activeRootElement =
ITutorialService.INSTANCE.getActiveTutorial().getRootElement();
return asUnmodifiable(elementCache.stream()
.filter(t -> t.getRootModelElement() == activeRootElement)
.collect(Collectors.toList()));
}
return asUnmodifiable(elementCache);
}
/** {@inheritDoc} */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment