Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-09-10 03:08:58 -0400
committervlorenzo2012-09-10 03:08:58 -0400
commit372f669563fcfe02bd0c630affeb4f459add1100 (patch)
tree1535de22f18e8bb029d1c4491dca8cc66ef9bf99 /plugins/infra
parentf3057b45f0cfb966fba80db5ca943572333e88af (diff)
downloadorg.eclipse.papyrus-372f669563fcfe02bd0c630affeb4f459add1100.tar.gz
org.eclipse.papyrus-372f669563fcfe02bd0c630affeb4f459add1100.tar.xz
org.eclipse.papyrus-372f669563fcfe02bd0c630affeb4f459add1100.zip
Share the new project oep.papyrus.infra.table.controlmode
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/.classpath7
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/.project28
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/META-INF/MANIFEST.MF21
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/about.html28
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/build.properties5
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/plugin.properties12
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/plugin.xml14
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/Activator.java30
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/handlers/PapyrusTableControlCommand.java51
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/handlers/PapyrusTableUncontrolCommand.java51
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/helpers/TableMoveHelper.java190
11 files changed, 437 insertions, 0 deletions
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/.classpath b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/.project b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/.project
new file mode 100644
index 00000000000..ff00eace11e
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.table.controlmode</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/META-INF/MANIFEST.MF b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..894ee7b19a7
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.table.controlmode;singleton:=true
+Bundle-Version: 0.9.1.qualifier
+Bundle-Activator: org.eclipse.papyrus.infra.table.controlmode.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.services.controlmode,
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.uml2.uml,
+ org.eclipse.uml2.uml.edit,
+ org.eclipse.emf.facet.widgets.nattable.instance,
+ org.eclipse.papyrus.infra.core,
+ org.eclipse.papyrus.infra.services.resourceloading.preferences,
+ org.eclipse.papyrus.uml.service.types,
+ org.eclipse.papyrus.infra.table.instance,
+ org.eclipse.papyrus.views.modelexplorer,
+ com.google.guava
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/about.html b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/build.properties b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/build.properties
new file mode 100644
index 00000000000..6f20375d6c7
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/plugin.properties b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/plugin.properties
new file mode 100644
index 00000000000..300c952e6b7
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/plugin.properties
@@ -0,0 +1,12 @@
+#/*****************************************************************************
+# * Copyright (c) 2009 Atos Origin.
+# *
+# *
+# * 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
+# *
+# *****************************************************************************/
+pluginName=Control Mode extension for tables (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/plugin.xml b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/plugin.xml
new file mode 100644
index 00000000000..ba5d987ba15
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/plugin.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.services.controlmode.customControlCommand">
+ <customControlCommand
+ controlCommand="org.eclipse.papyrus.infra.table.controlmode.handlers.PapyrusTableControlCommand">
+ </customControlCommand>
+ <customUncontrolCommand
+ uncontrolCommand="org.eclipse.papyrus.infra.table.controlmode.handlers.PapyrusTableUncontrolCommand">
+ </customUncontrolCommand>
+ </extension>
+
+</plugin>
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/Activator.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/Activator.java
new file mode 100644
index 00000000000..833d9e8d7ee
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/Activator.java
@@ -0,0 +1,30 @@
+package org.eclipse.papyrus.infra.table.controlmode;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/handlers/PapyrusTableControlCommand.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/handlers/PapyrusTableControlCommand.java
new file mode 100644
index 00000000000..51340a0b406
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/handlers/PapyrusTableControlCommand.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2012 Atos.
+ *
+ *
+ * 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:
+ * Olivier Melois (ATOS) olivier.melois@atos.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.controlmode.handlers;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
+import org.eclipse.papyrus.infra.services.controlmode.commands.IControlCommand;
+import org.eclipse.papyrus.infra.table.controlmode.helpers.TableMoveHelper;
+
+
+/**
+ * ControlCommand in charge of moving the tables when controlling a package.
+ *
+ */
+public class PapyrusTableControlCommand implements IControlCommand {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void control(EditingDomain domain, EObject selection, STATE_CONTROL state, Resource source, Resource target, CompoundCommand commandToModify) {
+ switch(state) {
+ case POST_DI:
+ TableMoveHelper.addAllTableMoveCommands(domain, selection, target, commandToModify);
+ break;
+ default:
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean provides(EObject selection, STATE_CONTROL state, Resource source, Resource target) {
+ return DiModel.DI_FILE_EXTENSION.equals(target.getURI().fileExtension());
+ }
+
+
+}
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/handlers/PapyrusTableUncontrolCommand.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/handlers/PapyrusTableUncontrolCommand.java
new file mode 100644
index 00000000000..743a9f18c9d
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/handlers/PapyrusTableUncontrolCommand.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2012 Atos.
+ *
+ *
+ * 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:
+ * Olivier Melois (ATOS) olivier.melois@atos.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.controlmode.handlers;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
+import org.eclipse.papyrus.infra.services.controlmode.commands.IUncontrolCommand;
+import org.eclipse.papyrus.infra.table.controlmode.helpers.TableMoveHelper;
+
+
+/**
+ * Does the exact same thing as PapyrusTableControlCommand, but moves the tables back
+ * to the resource they were initially created in.
+ *
+ */
+public class PapyrusTableUncontrolCommand implements IUncontrolCommand {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void uncontrol(EditingDomain domain, EObject selection, STATE_CONTROL state, Resource source, Resource target, CompoundCommand commandToModify) {
+ switch(state) {
+ case POST_MODEL:
+ TableMoveHelper.addAllTableMoveCommands(domain, selection, target, commandToModify);
+ break;
+ default:
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean provides(EObject selection, STATE_CONTROL state, Resource source, Resource target) {
+ return DiModel.DI_FILE_EXTENSION.equals(target.getURI().fileExtension());
+ }
+
+}
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/helpers/TableMoveHelper.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/helpers/TableMoveHelper.java
new file mode 100644
index 00000000000..23c3486f540
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/helpers/TableMoveHelper.java
@@ -0,0 +1,190 @@
+/*****************************************************************************
+ * Copyright (c) 2012 Atos.
+ *
+ *
+ * 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:
+ * Olivier Melois (ATOS) olivier.melois@atos.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.controlmode.helpers;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableInstance;
+import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableinstancePackage;
+import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance2.TableInstance2;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+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.commands.MoveOpenableCommand;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Sets;
+
+/**
+ * Helper used to move the tables into the right resources when controlling a package.
+ */
+public class TableMoveHelper {
+
+ /**
+ * Adds commands to move every table that descend from the selection to the target resource.
+ */
+ public static void addAllTableMoveCommands(EditingDomain domain, EObject selection, Resource target, CompoundCommand commandToModify) {
+ /*
+ * All the tables in the tables that descend from the selection.
+ */
+ Iterable<EObject> allDescendingPapyrusTables = createDescendantTablesIterable(selection);
+
+ /*
+ * Making sure the editing domain is transactional.
+ */
+ if(!(domain instanceof TransactionalEditingDomain)) {
+ throw new RuntimeException("Unable to retrieve the transactional editing domain");////$NON-NLS-1$
+ }
+ TransactionalEditingDomain editingDomain = (TransactionalEditingDomain)domain;
+
+ /*
+ * Moving every table from the new resource.
+ */
+ for(EObject descendant : allDescendingPapyrusTables) {
+ if(descendant instanceof PapyrusTableInstance) {
+ PapyrusTableInstance papyrusTable = (PapyrusTableInstance)descendant;
+ addMoveTableCommand(editingDomain, papyrusTable, target, commandToModify);
+ }
+ }
+ }
+
+
+ /**
+ * Adds a command to move a papyrus table and the matching table2 instance, to the compound command.
+ */
+ protected static void addMoveTableCommand(TransactionalEditingDomain editingDomain, PapyrusTableInstance papyrusTable, Resource target, CompoundCommand commandToModify) {
+ //The command has to move both the table and its table2.
+ TableInstance2 papyrusTable2 = papyrusTable.getTable();
+
+ /*
+ * Has the target resource been loaded, and is it in read only mode ?
+ */
+ if(editingDomain.isReadOnly(target)) {
+ return;
+ }
+
+ /*
+ * Moving both the table instance and the table2 instance.
+ */
+ if(target != null) {
+ MoveOpenableCommand mvTabCmd = new MoveOpenableCommand(editingDomain, "moving table", papyrusTable, target);//$NON-NLS-1$
+ if(mvTabCmd != null && mvTabCmd.canExecute()) {
+ commandToModify.append(new GMFtoEMFCommandWrapper(mvTabCmd));
+ }
+
+ MoveOpenableCommand mvTab2Cmd = new MoveOpenableCommand(editingDomain, "moving table2", papyrusTable2, target);//$NON-NLS-1$
+ if(mvTab2Cmd != null && mvTab2Cmd.canExecute()) {
+ commandToModify.append(new GMFtoEMFCommandWrapper(mvTab2Cmd));
+ }
+ }
+ }
+
+ /**
+ * Creates an iterable containing all the Papyrus Tables that are descending from the context.
+ *
+ * @author olivier melois (Atos)
+ */
+ public static Iterable<EObject> createDescendantTablesIterable(EObject context) {
+
+ Set<EObject> result = Sets.newHashSet();
+
+ TreeIterator<EObject> eAllContents = EcoreUtil.getAllProperContents(context, true); // was context.eAllContents().
+ Iterator<EObject> contextAndDescendants = Iterators.concat(eAllContents, Iterators.singletonIterator(context));
+
+ final Predicate<Setting> keepPapyrusTableInstances = new Predicate<Setting>() {
+
+ public boolean apply(Setting setting) {
+ boolean result = true;
+ if(setting != null) {
+ EObject settingEObject = setting.getEObject();
+ result &= settingEObject instanceof PapyrusTableInstance;
+ result &= PapyrustableinstancePackage.Literals.PAPYRUS_TABLE_INSTANCE__TABLE == setting.getEStructuralFeature();
+ } else {
+ result = false;
+ }
+ return result;
+ }
+ };
+
+ /*
+ * Predicate used to keep the usages which are PapyrusTableInstances
+ */
+ Predicate<Setting> keepTableInstances = new Predicate<Setting>() {
+
+ public boolean apply(Setting setting) {
+ boolean result = true;
+ if(setting != null) {
+ EObject settingEObject = setting.getEObject();
+ result &= settingEObject instanceof TableInstance;
+ result &= setting.getEStructuralFeature() == TableinstancePackage.Literals.TABLE_INSTANCE__CONTEXT;
+
+ Collection<Setting> references = PapyrusEcoreUtils.getUsages(settingEObject);
+ Iterable<Setting> papyrusTableInstances = Iterables.filter(references, keepPapyrusTableInstances);
+ //Veryfing that there is at least one papyrusTableInstance
+ result = result && !Iterables.isEmpty(papyrusTableInstances);
+
+ } else {
+ result = false;
+ }
+ return result;
+ }
+ };
+
+ /*
+ * Function to get the eObject from a setting
+ */
+ Function<Setting, EObject> getEObject = new Function<Setting, EObject>() {
+
+ public EObject apply(Setting input) {
+ EObject settingEObject = input.getEObject();
+ Collection<Setting> references = PapyrusEcoreUtils.getUsages(settingEObject);
+ Iterable<Setting> papyrusTableInstances = Iterables.filter(references, keepPapyrusTableInstances);
+ //Getting the eobject of thie first element of this iterable.
+ return Iterables.get(papyrusTableInstances, 0).getEObject();
+ }
+
+ };
+
+ /*
+ * For the context and his descendants :
+ */
+ while(contextAndDescendants.hasNext()) {
+ EObject current = contextAndDescendants.next();
+ //Usages
+ Iterable<Setting> usages = PapyrusEcoreUtils.getUsages(current);
+ //Filtering to keep only papyrus table instances.
+ Iterable<Setting> tableInstanceSettings = Iterables.filter(usages, keepTableInstances);
+ //Getting the eObjects
+ Iterable<EObject> papyrusTableInstances = Iterables.transform(tableInstanceSettings, getEObject);
+ //Adding all the kept usages.
+ Iterables.addAll(result, papyrusTableInstances);
+ }
+
+ return result;
+ }
+}

Back to the top