From 514176a0eee9da85ce0f391b0045b4989b568880 Mon Sep 17 00:00:00 2001 From: Zoltan Ujhelyi Date: Fri, 16 Aug 2019 18:08:34 +0200 Subject: [PATCH] Revert "Experiments with ignoring duplicate removeAdapter events #26" This reverts commit 1d9b3987b7e3fc7c14b50bb9814e4cc60f7a58e3 because the Base index internals cannot be overridden appropriately. --- .../MagicDrawProjectNavigationHelper.java | 17 ++++++++-- .../V4MDNavigationHelperContentAdapter.java | 31 ------------------- 2 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 com.incquerylabs.v4md/src/main/org/eclipse/viatra/query/runtime/base/core/V4MDNavigationHelperContentAdapter.java diff --git a/com.incquerylabs.v4md/src/main/com/incquerylabs/v4md/internal/MagicDrawProjectNavigationHelper.java b/com.incquerylabs.v4md/src/main/com/incquerylabs/v4md/internal/MagicDrawProjectNavigationHelper.java index 933cef1..eb0eb68 100644 --- a/com.incquerylabs.v4md/src/main/com/incquerylabs/v4md/internal/MagicDrawProjectNavigationHelper.java +++ b/com.incquerylabs.v4md/src/main/com/incquerylabs/v4md/internal/MagicDrawProjectNavigationHelper.java @@ -14,8 +14,8 @@ import org.eclipse.viatra.query.runtime.base.api.BaseIndexOptions; import org.eclipse.viatra.query.runtime.base.api.filters.IBaseIndexObjectFilter; import org.eclipse.viatra.query.runtime.base.api.filters.IBaseIndexResourceFilter; +import org.eclipse.viatra.query.runtime.base.core.NavigationHelperContentAdapter; import org.eclipse.viatra.query.runtime.base.core.NavigationHelperImpl; -import org.eclipse.viatra.query.runtime.base.core.V4MDNavigationHelperContentAdapter; import org.eclipse.viatra.query.runtime.base.exception.ViatraBaseException; import com.nomagic.uml2.ext.jmi.EventSupport; @@ -53,7 +53,20 @@ public void error(Object message) { public MagicDrawProjectNavigationHelper(Notifier emfRoot, BaseIndexOptions options, EventSupport eventSupport, Logger logger) { super(emfRoot, options, new WrappedLogger(logger)); this.logger = logger; - this.contentAdapter = new V4MDNavigationHelperContentAdapter(this); + // TODO While this change helps avoiding some duplicate notifications, it causes + // a regression when adding a new project usage to a local project: when the + // usage is added, event firing is turned off, resulting in the added profile + // not available in the index of the project +// this.contentAdapter = new NavigationHelperContentAdapter(this) { +// +// @Override +// public void notifyChanged(Notification notification) { +// if (eventSupport.isEnableEventFiring()) { +// super.notifyChanged(notification); +// } +// } +// +// }; } Set getModelRoots() { diff --git a/com.incquerylabs.v4md/src/main/org/eclipse/viatra/query/runtime/base/core/V4MDNavigationHelperContentAdapter.java b/com.incquerylabs.v4md/src/main/org/eclipse/viatra/query/runtime/base/core/V4MDNavigationHelperContentAdapter.java deleted file mode 100644 index 157578b..0000000 --- a/com.incquerylabs.v4md/src/main/org/eclipse/viatra/query/runtime/base/core/V4MDNavigationHelperContentAdapter.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.eclipse.viatra.query.runtime.base.core; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.viatra.query.runtime.base.core.NavigationHelperContentAdapter; -import org.eclipse.viatra.query.runtime.base.core.NavigationHelperImpl; - -/* - * TODO this is a temporary workaround about visibilities in VIATRA - */ -public final class V4MDNavigationHelperContentAdapter extends NavigationHelperContentAdapter { - public V4MDNavigationHelperContentAdapter(NavigationHelperImpl navigationHelper) { - super(navigationHelper); - } - - @Override - protected void removeAdapter(Notifier notifier) { - if (notifier.eAdapters().contains(this)) { - super.removeAdapter(notifier); - } - } - - @Override - void removeAdapter(Notifier notifier, boolean additionalObjectContainerPossible, - boolean additionalResourceContainerPossible) { - if (notifier.eAdapters().contains(this)) { - super.removeAdapter(notifier, additionalObjectContainerPossible, additionalResourceContainerPossible); - } - } - - -} \ No newline at end of file