Skip to content

Commit

Permalink
Avoids adding packages to the scope that are already added #26
Browse files Browse the repository at this point in the history
This avoids _some_ duplicate addition/deletion events, but there are
still more issues that need further debugging to avoid.
  • Loading branch information
ujhelyiz committed Mar 1, 2019
1 parent fc3fa24 commit d668958
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.viatra.query.runtime.emf.EMFScope;

import com.nomagic.magicdraw.core.Project;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Package;

public class MagicDrawProjectScope extends EMFScope {

Expand All @@ -34,7 +35,8 @@ public class MagicDrawProjectScope extends EMFScope {
.withStrictNotificationMode(false);

static Stream<? extends Notifier> getProjectModels(Project projectModel) {
return projectModel.getModels().stream();
Package primaryModel = projectModel.getPrimaryModel();
return projectModel.getModels().stream().filter(pkg -> pkg == primaryModel || !EcoreUtil.isAncestor(primaryModel, pkg));
}

static Stream<Notifier> getCustomNotifiers(Notifier... notifiers) {
Expand Down

0 comments on commit d668958

Please sign in to comment.