Bug 496063: Generically filter SMV according to Papyrus Model Explorer
* Filters match elements from the SMV whose sides are not displayed in
the Papyrus Model Explorer
* Adds all children of filtered elements to their new parents
Change-Id: Ib093e3442277a047f773e1e31a0e942cc8847edf
Also-by: Philip Langer <planger@eclipsesource.com>
Signed-off-by: Stefan Dirix <sdirix@eclipsesource.com>
Signed-off-by: Philip Langer <planger@eclipsesource.com>
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/META-INF/MANIFEST.MF b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/META-INF/MANIFEST.MF
index 3c2dd00..16c44b7 100644
--- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/META-INF/MANIFEST.MF
+++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/META-INF/MANIFEST.MF
@@ -15,5 +15,10 @@
org.eclipse.papyrusrt.umlrt.profile;bundle-version="[0.8.0,1.0.0)",
org.eclipse.papyrusrt.umlrt.core;bundle-version="[0.8.0,1.0.0)",
org.eclipse.emf.compare.uml2;bundle-version="[2.4.0,3.0.0)",
- com.google.guava;bundle-version="[11.0.0,16.0.0)"
-Export-Package: org.eclipse.papyrusrt.umlrt.tooling.compare.internal.ui;x-internal:=true
+ com.google.guava;bundle-version="[11.0.0,16.0.0)",
+ org.eclipse.emf.compare.rcp;bundle-version="[2.4.0,3.0.0)",
+ org.eclipse.emf.compare.edit;bundle-version="[4.2.0,5.0.0)",
+ org.eclipse.papyrus.emf.facet.custom.metamodel;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.uml.tools;bundle-version="[2.0.1,3.0.0)",
+ org.eclipse.uml2.uml.edit;bundle-version="[5.1.100,6.0.0)"
+Export-Package: org.eclipse.papyrusrt.umlrt.tooling.compare.ui.internal;x-internal:=true
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/plugin.xml b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/plugin.xml
index 53a17da..149adae 100644
--- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/plugin.xml
+++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/plugin.xml
@@ -5,9 +5,14 @@
point="org.eclipse.emf.compare.rcp.ui.filters">
<filter
activeByDefault="true"
- class="org.eclipse.papyrusrt.umlrt.tooling.compare.internal.ui.UMLRTElementsFilter"
+ class="org.eclipse.papyrusrt.umlrt.tooling.compare.ui.internal.UMLRTElementsFilter"
label="UMLRT Elements Filter">
</filter>
</extension>
-
+ <extension
+ point="org.eclipse.emf.compare.rcp.ui.differenceGroupExtender">
+ <differenceGroupExtender
+ class="org.eclipse.papyrusrt.umlrt.tooling.compare.ui.internal.differenceGroup.PapyrusFilteringDifferenceGroupExtender">
+ </differenceGroupExtender>
+ </extension>
</plugin>
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/internal/ui/UMLRTElementsFilter.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/UMLRTElementsFilter.java
similarity index 97%
rename from plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/internal/ui/UMLRTElementsFilter.java
rename to plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/UMLRTElementsFilter.java
index 6a36e98..5cb093d 100644
--- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/internal/ui/UMLRTElementsFilter.java
+++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/UMLRTElementsFilter.java
@@ -9,7 +9,7 @@
* Alexandra Buzila - initial API and implementation
*******************************************************************************/
-package org.eclipse.papyrusrt.umlrt.tooling.compare.internal.ui;
+package org.eclipse.papyrusrt.umlrt.tooling.compare.ui.internal;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Diff;
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/differenceGroup/AbstractFilteringGroupExtender.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/differenceGroup/AbstractFilteringGroupExtender.java
new file mode 100644
index 0000000..889423c
--- /dev/null
+++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/differenceGroup/AbstractFilteringGroupExtender.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2016 EclipseSource Services GmbH
+ * *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Stefan Dirix (EclipseSource) - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrusrt.umlrt.tooling.compare.ui.internal.differenceGroup;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
+import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.tree.TreeNode;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+/**
+ * @author Stefan Dirix
+ */
+public abstract class AbstractFilteringGroupExtender implements IDifferenceGroupExtender {
+
+ /**
+ * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender#addChildren(org.eclipse.emf.edit.tree.TreeNode)
+ *
+ * @param treeNode
+ */
+ @Override
+ public void addChildren(TreeNode treeNode) {
+ final AdapterFactory adapterFactory = getAdapterFactory();
+ final Builder<TreeNode> collectedGrandChildren = ImmutableList.builder();
+ final Iterator<TreeNode> iterator = treeNode.getChildren().iterator();
+ while (iterator.hasNext()) {
+ final TreeNode childTreeNode = iterator.next();
+ if (shouldFilter(childTreeNode, adapterFactory)) {
+ collectedGrandChildren.addAll(childTreeNode.getChildren());
+ iterator.remove();
+ }
+ }
+ treeNode.getChildren().addAll(collectedGrandChildren.build());
+ if (IDisposable.class.isInstance(adapterFactory)) {
+ IDisposable.class.cast(adapterFactory).dispose();
+ }
+ }
+
+ /**
+ * Indicates whether the given {@code treeNode} shall be filtered.
+ *
+ * @param treeNode
+ * the {@link TreeNode} for which it is to be determined if it shall be filtered.
+ * @param adapterFactory
+ * the {@link AdapterFactory} which is returned by {@link #getAdapterFactory()}.
+ * @return
+ * {@code true} if the given {@code treeNode} shall be filtered, {@code false} otherwise.
+ */
+ protected abstract boolean shouldFilter(TreeNode treeNode, AdapterFactory adapterFactory);
+
+ /**
+ * The {@link AdapterFactory} which is used in the {@link #shouldFilter(TreeNode, AdapterFactory)} method.
+ *
+ * The default implementation returns the registry used by EMFCompare.
+ *
+ * @return the {@link AdapterFactory} to use.
+ */
+ protected AdapterFactory getAdapterFactory() {
+ ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(EMFCompareRCPPlugin.getDefault()
+ .createFilteredAdapterFactoryRegistry());
+ return adapterFactory;
+ }
+
+}
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/differenceGroup/PapyrusFilteringDifferenceGroupExtender.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/differenceGroup/PapyrusFilteringDifferenceGroupExtender.java
new file mode 100644
index 0000000..a6c3dd7
--- /dev/null
+++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/differenceGroup/PapyrusFilteringDifferenceGroupExtender.java
@@ -0,0 +1,170 @@
+/*****************************************************************************
+ * Copyright (c) 2016 EclipseSource Services GmbH
+ * *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Philip Langer (EclipseSource) - Initial API and implementation
+ * Stefan Dirix (EclipseSource) - Modify for the general case
+ *****************************************************************************/
+package org.eclipse.papyrusrt.umlrt.tooling.compare.ui.internal.differenceGroup;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.tree.TreeNode;
+import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement;
+import org.eclipse.papyrusrt.umlrt.tooling.compare.ui.internal.facet.PapyrusFacetContentProviderWrapperAdapterFactory;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * Filters matches in the SMV if they are not shown in Papyrus Model Explorer.
+ *
+ * @author Philip Langer
+ */
+public class PapyrusFilteringDifferenceGroupExtender extends AbstractFilteringGroupExtender {
+
+ /**
+ * Unwraps the {@link EObject}s which are returned by the Papyrus Facet ContentProvider.
+ */
+ private static final Function<Object, EObject> UN_WRAP = new Function<Object, EObject>() {
+ @Override
+ public EObject apply(Object input) {
+ if (EObjectTreeElement.class.isInstance(input)) {
+ return EObjectTreeElement.class.cast(input).getEObject();
+ }
+ return null;
+ }
+ };
+
+ /**
+ * Constructor.
+ */
+ public PapyrusFilteringDifferenceGroupExtender() {
+ super();
+ }
+
+ @Override
+ public boolean handle(TreeNode treeNode) {
+ return true;
+ }
+
+ @Override
+ protected boolean shouldFilter(TreeNode treeNode, AdapterFactory adapterFactory) {
+ if (Match.class.isInstance(treeNode.getData())
+ && Match.class.isInstance(treeNode.getParent().getData())) {
+ final Collection<Match> contentProviderSubmatches;
+ if (Match.class.isInstance(treeNode.getParent().getData())) {
+ final Match parentMatch = Match.class.cast(treeNode.getParent().getData());
+ contentProviderSubmatches = getContentProviderSubmatches(parentMatch, adapterFactory);
+ } else {
+ contentProviderSubmatches = Collections.emptyList();
+ }
+ final Match match = Match.class.cast(treeNode.getData());
+
+ return !contentProviderSubmatches.contains(match);
+ }
+ return false;
+ }
+
+ /**
+ * Determines all submatches of the given {@link Match} by:
+ * <ul>
+ * <li>Collecting all sides of the given {@code match}.
+ * <li>Determining the children of the sides via {@link ITreeItemContentProvider}
+ * <li>Collecting the matches of the determined children
+ * </ul>
+ *
+ * @param match
+ * the {@link Match} which's submatches are to be determined.
+ * @param adapterFactory
+ * the {@link AdapterFactory} to adapt to {@link ITreeItemContentProvider}.
+ * @return a collection of submatches provided via the {@link ITreeItemContentProvider} children of the
+ * given {@code match}'s sides. An empty collection if there are no children or matches.
+ */
+ private Collection<Match> getContentProviderSubmatches(Match match, AdapterFactory adapterFactory) {
+ final List<Match> matches = Lists.newArrayList();
+ for (EObject eObject : getElementsOfMatch(match)) {
+ matches.addAll(getMatchChildren(eObject, match.getComparison(), adapterFactory));
+ }
+ return matches;
+ }
+
+ /**
+ * Returns the left, right and origin side of the given {@link Match} which are not {@code null}.
+ *
+ * @param match
+ * the {@link Match} from which the sides are extracted.
+ * @return an {@link Iterable} over the non-{@code null} sides of the given {@code match}.
+ */
+ private static Iterable<EObject> getElementsOfMatch(final Match match) {
+ return Iterables.filter(Lists.newArrayList(match.getLeft(), match.getRight(), match.getOrigin()), Predicates.notNull());
+ }
+
+ /**
+ * Determines all matches of the children of the given {@link EObject}.
+ *
+ * @param object
+ * the {@link EObject} for which the children are determined.
+ * @param comparison
+ * the {@link Comparison} used to determine the matches.
+ * @param adapterFactory
+ * the {@link AdapterFactory} to adapt to {@link ITreeItemContentProvider}.
+ * @return A collection of matches of the children of the given {@code object}. An empty collection if
+ * there are none.
+ */
+ private Collection<Match> getMatchChildren(EObject object, Comparison comparison,
+ AdapterFactory adapterFactory) {
+ final List<Match> matches = Lists.newArrayList();
+ for (EObject child : Iterables.filter(Iterables.transform(getChildren(object, adapterFactory), UN_WRAP), Predicates.notNull())) {
+ matches.add(comparison.getMatch(child));
+ }
+ return matches;
+ }
+
+ /**
+ * Determines all children of the given {@link EObject} by adapting to {@link ITreeItemContentProvider}.
+ *
+ * @param object
+ * the {@link EObject} whose children are to be determined.
+ * @param adapterFactory
+ * the {@link AdapterFactory} to adapt to {@link ITreeItemContentProvider}.
+ * @return The collection of children. An empty collection if there are none.
+ */
+ private Collection<?> getChildren(EObject object, AdapterFactory adapterFactory) {
+ final Adapter adapter = adapterFactory.adapt(object, ITreeItemContentProvider.class);
+ if (adapter != null) {
+ return ITreeItemContentProvider.class.cast(adapter).getChildren(object);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * Returns the {@link AdapterFactory}. The caller should also dispose it.
+ *
+ * @return the {@link AdapterFactory}.
+ */
+ @Override
+ protected AdapterFactory getAdapterFactory() {
+ final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(EMFCompareRCPPlugin.getDefault()
+ .createFilteredAdapterFactoryRegistry());
+ adapterFactory.addAdapterFactory(new PapyrusFacetContentProviderWrapperAdapterFactory());
+ return adapterFactory;
+ }
+
+}
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/facet/PapyrusFacetContentProviderWrapper.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/facet/PapyrusFacetContentProviderWrapper.java
new file mode 100644
index 0000000..dd18b1e
--- /dev/null
+++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/facet/PapyrusFacetContentProviderWrapper.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2016 EclipseSource Muenchen GmbH and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Dirix - initial API and implementation
+ *******************************************************************************/
+
+/**
+ * XXX: Copied from the org.eclipse.emf.compare.diagram.ide.ui.papyrus bundle
+ * of EMFCompare because it is not (yet) available in the target platform
+ */
+
+package org.eclipse.papyrusrt.umlrt.tooling.compare.ui.internal.facet;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.papyrus.uml.tools.providers.SemanticUMLContentProvider;
+
+/**
+ * Wraps the Papyrus Facet content provider in an EMF {@link ItemProviderAdapter}.
+ *
+ * @author Stefan Dirix
+ *
+ */
+public class PapyrusFacetContentProviderWrapper extends ItemProviderAdapter implements ITreeItemContentProvider {
+
+ /**
+ * The Papyrus Facet Content Provider.
+ */
+ private SemanticUMLContentProvider facetContentProvider;
+
+ /**
+ * Constructor.
+ *
+ * @param adapterFactory
+ * the {@link AdapterFactory}.
+ * @param resourceSet
+ * the {@ResourceSet} for Papyrus Facet.
+ */
+ public PapyrusFacetContentProviderWrapper(AdapterFactory adapterFactory, ResourceSet resourceSet) {
+ super(adapterFactory);
+ facetContentProvider = new SemanticUMLContentProvider(resourceSet);
+
+ }
+
+ @Override
+ public Collection<?> getElements(Object object) {
+ return Arrays.asList(facetContentProvider.getElements(object));
+ }
+
+ @Override
+ public Collection<?> getChildren(Object object) {
+ return Arrays.asList(facetContentProvider.getChildren(object));
+ }
+
+ @Override
+ public boolean hasChildren(Object object) {
+ return facetContentProvider.hasChildren(object);
+ }
+
+ @Override
+ public Object getParent(Object object) {
+ return facetContentProvider.getParent(object);
+ }
+
+}
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/facet/PapyrusFacetContentProviderWrapperAdapterFactory.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/facet/PapyrusFacetContentProviderWrapperAdapterFactory.java
new file mode 100644
index 0000000..f665364
--- /dev/null
+++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.compare.ui/src/org/eclipse/papyrusrt/umlrt/tooling/compare/ui/internal/facet/PapyrusFacetContentProviderWrapperAdapterFactory.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2016 EclipseSource Muenchen GmbH and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Dirix - initial API and implementation
+ *******************************************************************************/
+
+/**
+ * XXX: Copied from the org.eclipse.emf.compare.diagram.ide.ui.papyrus bundle
+ * of EMFCompare because it is not (yet) available in the target platform
+ */
+
+package org.eclipse.papyrusrt.umlrt.tooling.compare.ui.internal.facet;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.provider.Disposable;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
+
+/**
+ * Couples the Papyrus Facet mechanism with the AdapterFactory approach of EMFCompare.
+ *
+ * @author Stefan Dirix <sdirix@eclipsesource.com>
+ */
+public class PapyrusFacetContentProviderWrapperAdapterFactory extends UMLItemProviderAdapterFactory {
+
+ /**
+ * Collects and disposes associated adapters.
+ */
+ private Disposable disposable = new Disposable();
+
+ /**
+ * Constructor.
+ */
+ public PapyrusFacetContentProviderWrapperAdapterFactory() {
+ super();
+ // Only support content types
+ supportedTypes.clear();
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ }
+
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ ResourceSet resourceSet = getResourceSet(target);
+ if (resourceSet != null) {
+ return new PapyrusFacetContentProviderWrapper(this, resourceSet);
+ }
+ return super.createAdapter(target);
+ }
+
+ /**
+ * Determines the {@link ResourceSet} of the given {@code target}.
+ *
+ * @param target
+ * The {@Notifier} for which a {@link ResourceSet} is to be determined.
+ * @return The {@link ResourceSet} for the given {@code target} if there is one, {@code null} otherwise.
+ */
+ private ResourceSet getResourceSet(Notifier target) {
+ if (EObject.class.isInstance(target)) {
+ EObject object = EObject.class.cast(target);
+ return object.eResource().getResourceSet();
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see NotationItemProviderAdapterFactory#dispose()
+ */
+ @Override
+ public void dispose() {
+ disposable.dispose();
+ super.dispose();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see NotationItemProviderAdapterFactory#associate(Adapter adapter, Notifier target)
+ */
+ @Override
+ protected void associate(Adapter adapter, Notifier target) {
+ super.associate(adapter, target);
+ if (adapter != null) {
+ disposable.add(adapter);
+ }
+ }
+}