diff options
Diffstat (limited to 'sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedTables.java')
-rw-r--r-- | sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedTables.java | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedTables.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedTables.java deleted file mode 100644 index b9f5d7ed764..00000000000 --- a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedTables.java +++ /dev/null @@ -1,87 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * - * 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.infra.table.modelexplorer.queries; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EStructuralFeature.Setting; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableInstance; -import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableinstancePackage; -import org.eclipse.papyrus.infra.core.utils.PapyrusEcoreUtils; -import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance; -import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrustableinstancePackage; -import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery; - -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; - -/** - * Get the collection of all contained tables - * - * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel. - * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels - * */ -@Deprecated -//FIXME this query is declared using Element in the querySet -> change into EObject when the EMF-Facet bug will be corrected 365744 -public class GetContainedTables extends AbstractEditorContainerQuery implements IJavaModelQuery<EObject, Collection<PapyrusTableInstance>> { - - /** - * {@inheritDoc} - */ - public Collection<PapyrusTableInstance> evaluate(final EObject context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Predicate<EStructuralFeature.Setting> p = new Predicate<EStructuralFeature.Setting>() { - - public boolean apply(EStructuralFeature.Setting setting) { - return setting.getEObject() instanceof TableInstance && setting.getEStructuralFeature() == TableinstancePackage.Literals.TABLE_INSTANCE__CONTEXT; - } - }; - Function<EStructuralFeature.Setting, PapyrusTableInstance> f = new Function<EStructuralFeature.Setting, PapyrusTableInstance>() { - - public PapyrusTableInstance apply(EStructuralFeature.Setting setting) { - Collection<Setting> references = PapyrusEcoreUtils.getUsages(setting.getEObject()); - Predicate<Setting> p2 = new Predicate<EStructuralFeature.Setting>() { - - public boolean apply(Setting setting) { - return setting.getEObject() instanceof PapyrusTableInstance && PapyrustableinstancePackage.Literals.PAPYRUS_TABLE_INSTANCE__TABLE == setting.getEStructuralFeature(); - } - }; - Iterator<Setting> iterator = Iterables.filter(references, p2).iterator(); - if(iterator.hasNext()) { - return (PapyrusTableInstance)iterator.next().getEObject(); - } - return null; - } - - }; - - Iterable<PapyrusTableInstance> transform = Iterables.transform(Iterables.filter(PapyrusEcoreUtils.getUsages(context), p), f); - transform = Iterables.filter(transform, new Predicate<PapyrusTableInstance>() { - - public boolean apply(PapyrusTableInstance table) { - return table != null; - } - }); - return Sets.newHashSet(transform); - } - -} |