Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Barbin2016-10-19 14:38:28 +0000
committerFlorian Barbin2016-10-21 10:19:17 +0000
commit23c6be2da7215b3cf300eac31470b62635f59a5c (patch)
tree833031e0135dad417ba2bcc20d0dc9aa8a365ccb
parentd431d14a15a11360f81a84bd12b9ebd7b1bba890 (diff)
downloadorg.eclipse.sirius-23c6be2da7215b3cf300eac31470b62635f59a5c.tar.gz
org.eclipse.sirius-23c6be2da7215b3cf300eac31470b62635f59a5c.tar.xz
org.eclipse.sirius-23c6be2da7215b3cf300eac31470b62635f59a5c.zip
[505945] Handle multi-valued attribute in Sirius Table
* This commit is a minimal fix to handle multi-valued editing on the branch v3.1.x. We should delegate to ItemPropertyDescriptor to retrieve the value in DCell. The CellEditor creation should be delegate to PropertyDescriptor. Bug: 505945 Change-Id: I6e95c9b38e213e5a749987f1ec795ac541763e14 Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html57
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile6
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DFeatureColumnEditingSupport.java46
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DTableColumnLabelProvider.java8
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/helper/TableHelper.java26
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java17
6 files changed, 109 insertions, 51 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index 67bc9035c9..e122737038 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -13,6 +13,14 @@
<a href="#ReleaseNotesforSirius">Release Notes for Sirius</a>
<ol style="list-style: disc;">
<li>
+ <a href="#sirius3.1.7">Changes in Sirius 3.1.7</a>
+ <ol style="list-style: disc;">
+ <li>
+ <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a>
+ </li>
+ </ol>
+ </li>
+ <li>
<a href="#sirius3.1.6">Changes in Sirius 3.1.6</a>
<ol style="list-style: disc;">
<li>
@@ -41,7 +49,7 @@
<a href="#SpecifierVisibleChanges2">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -52,7 +60,7 @@
<a href="#SpecifierVisibleChanges3">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -66,7 +74,7 @@
<a href="#SpecifierVisibleChanges4">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges4">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -80,7 +88,7 @@
<a href="#SpecifierVisibleChanges5">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges4">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges5">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -104,6 +112,13 @@
<p>This document contains the release notes for recent major releases of Sirius. See also
<a href="Release_Notes_Previous.html">the release notes from previous versions</a> for details about older releases.
</p>
+ <h2 id="sirius3.1.7">Changes in Sirius 3.1.7</h2>
+ <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3>
+ <ul>
+ <li><span class="label label-success">Added</span>
+ <code>org.eclipse.sirius.table.business.api.helper.TableHelper.getEStructuralFeature(DLine, DColumn)</code> method has been added to retrieve the EStructuralFeature associated to a table column.
+ </li>
+ </ul>
<h2 id="sirius3.1.6">Changes in Sirius 3.1.6</h2>
<h3 id="UserVisibleChanges">User-Visible Changes</h3>
<ul>
@@ -139,7 +154,7 @@
<code>BorderSizeComputationExpression</code> migration has been corrected to recursively handle the sub container mappings. VSM created or migrated with Sirius 3.1 (3.1.0, 3.1.1 or 3.1.2) might require a manual modification for the style descriptions of sub container mappings with border size computation equals to 0 as we cannot determine if they were added (or updated) after or before the migration: starting with Sirius 3.1.0, no border will be displayed for a 0 pixel value whereas with older version container alwyas had at least a 1 pixel border.
</li>
</ul>
- <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3>
<h4 id="Changesinorg.eclipse.sirius.ext.emf.ui">Changes in
<code>org.eclipse.sirius.ext.emf.ui</code>
</h4>
@@ -167,7 +182,7 @@
<ul>
<li><span class="label label-info">Modified</span> The use of type literals in operations like filter() or oclIsKindOf() requires to explicitly add the domain meta-models plug-ins to the dependencies of the Viewpoint Specification Project. The documentation has been modified to recommend this.</li>
</ul>
- <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3>
<h4 id="Changesinorg.eclipse.sirius">Changes in
<code>org.eclipse.sirius</code>
</h4>
@@ -272,9 +287,9 @@
<code>IPermissionAuthority</code>) of the potential to delete objects. This is the reverse order of what was done before, and can have performance impacts if the precondition is slow. The specifier will to take care to ensure a good performance for the precondition expression of the delete tool.
</li>
</ul>
- <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges4">Developer-Visible Changes</h3>
<h4 id="Partialsupportforinternationalization">Partial support for internationalization</h4>
- <p>Sirius 3.1 introduces partial support for internationalization: all literal strings from the runtime part of Sirius are now externalized and can be localized by third parties by providing the appropriate &#171;language packs&#187; as OSGi fragments. Note that this does not concern the VSM editor&#8217;s UI, the VSMs themselves, or the parts of the UI inherited from Eclipse/EMF/GEF/GMF and other libraries and frameworks used by Sirius.</p>
+ <p>Sirius 3.1 introduces partial support for internationalization: all literal strings from the runtime part of Sirius are now externalized and can be localized by third parties by providing the appropriate &#8220;language packs&#8221; as OSGi fragments. Note that this does not concern the VSM editor&#8217;s UI, the VSMs themselves, or the parts of the UI inherited from Eclipse/EMF/GEF/GMF and other libraries and frameworks used by Sirius.</p>
<p>Some API changes were required to enable this. While technically breaking changes if interpreting strictly the OSGi versioning rules, the major version number of the impacted bundles was not incremented as the changes only concern classes that should not impact the vast majority of users. Most breaking changes concern the plug-in/activator classes from each bundle. They are:</p>
<ul>
<li><span class="label label-success">Added</span>
@@ -743,7 +758,7 @@
</li>
<li><span class="label label-success">Added</span> On diagrams, it is now possible to set a custom background image on list containers.</li>
<li><span class="label label-info">Modified</span> In the
- <em>Viewpoint Selection</em> dialog and wizard page, the &#171;plug-in&#187; decorator for viewpoints loaded from plug-ins is removed, and a &#171;Folder&#187; decorator for viewpoints loaded from the current workspace has been added. This makes the icons more visible in the most common where viewpoints come from installed plug-ins.
+ <em>Viewpoint Selection</em> dialog and wizard page, the &#8220;plug-in&#8221; decorator for viewpoints loaded from plug-ins is removed, and a &#8220;Folder&#8221; decorator for viewpoints loaded from the current workspace has been added. This makes the icons more visible in the most common where viewpoints come from installed plug-ins.
</li>
</ul>
<h3 id="SpecifierVisibleChanges5">Specifier-Visible Changes</h3>
@@ -766,12 +781,12 @@
<li><span class="label label-success">Added</span> Compressed SVG images (
<code>*.svgz</code>) are now supported everywhere normal SVG images were supported.
</li>
- <li><span class="label label-success">Added</span> When developing a modeler in &#171;live mode&#187;, with the VSM in the same workspace as the sample session(s) which use it, VSM expressions which use
+ <li><span class="label label-success">Added</span> When developing a modeler in &#8220;live mode&#8221;, with the VSM in the same workspace as the sample session(s) which use it, VSM expressions which use
<code>service:</code> or
<code>aql:</code> can now invoke Java services which are defined in the workspace (with no need to launch a separate runtime).
</li>
<li><span class="label label-success">Added</span> A quick outline is now accessible in the VSM editor by using the shortcut <kbd>Ctrl+o</kbd>. It supports filtering on both an element&#8217;s name and properties for quick, keyboard-only navigation in complex VSMs.</li>
- <li><span class="label label-success">Added</span> The &#171;hide label by default capability&#187; has been added to the container styles.</li>
+ <li><span class="label label-success">Added</span> The &#8220;hide label by default capability&#8221; has been added to the container styles.</li>
<li><span class="label label-success">Added</span> In addition to
<em>Bold</em> and
<em>Italic</em>,
@@ -804,7 +819,7 @@
</li>
<li><span class="label label-success">Improved</span> The precision of the VSM validation, especially regarding the typing of computed expressions, has been greatly improved. Other validation rules like static image paths have also been added or improved.</li>
<li><span class="label label-info">Modified</span> In the VSM editor, the context menu entries (categories and items) have been reorganized to put most common actions/items first.</li>
- <li><span class="label label-info">Modified</span> In diagrams, the style previously named &#171;Lozenge&#187; is now called &#171;Diamond&#187;.</li>
+ <li><span class="label label-info">Modified</span> In diagrams, the style previously named &#8220;Lozenge&#8221; is now called &#8220;Diamond&#8221;.</li>
<li><span class="label label-info">Modified</span> In the
<em>Open</em> menu on a representation, the menu is computed from the navigation tool&#8217;s label instead of its name/id.
</li>
@@ -821,7 +836,7 @@
<em>EStructuralFeature</em> (inherited or with same name).
</li>
</ul>
- <h3 id="DeveloperVisibleChanges4">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges5">Developer-Visible Changes</h3>
<p>The most important and impacting changes in this release are (details below in plug-in specific sections):</p>
<ul>
<li><span class="label label-success">Added</span> The new extension point
@@ -1687,13 +1702,13 @@
<img border="0" src="images/containerResize-changedBehavior.gif"/>
</p>
<ul>
- <li>The &#171;snap to shapes&#187; is now enabled by default (see
+ <li>The &#8220;snap to shapes&#8221; is now enabled by default (see
<em>Sirius &gt; Sirius Diagram &gt; Rulers and Grid</em> preference page). This is true only for new diagrams. The existing diagrams are not impacted.
</li>
- <li>The &#171;Navigate&#187; top-level contextual menu entry with mixed actions for creating new representations and opening existing ones has been changed by two top-level menus:
+ <li>The &#8220;Navigate&#8221; top-level contextual menu entry with mixed actions for creating new representations and opening existing ones has been changed by two top-level menus:
<ul>
- <li>One named &#171;New&#187;, which lists only the available actions to create new representations on the selected element.</li>
- <li>One named &#171;Open&#187;, which lists only the existing representations on the selected element. </li>
+ <li>One named &#8220;New&#8221;, which lists only the available actions to create new representations on the selected element.</li>
+ <li>One named &#8220;Open&#8221;, which lists only the existing representations on the selected element. </li>
</ul>
</li>
<li>When a shape is resized (no matter the direction), the edge(s) connection location (toward or from this one) is kept. Before that, edges connections moved according to the ratio of the resizing.</li>
@@ -1718,19 +1733,19 @@
<li>Distribute centers vertically</li>
</ul>
</li>
- <li>The end user can now remove all bend-points between the two edge ends. This action is available on edge context menu &#171;Remove Bend-points&#187; or by using the shortcut &#171;Ctrl&#187; + &#171;Shift&#187; + &#171;-&#187;.</li>
+ <li>The end user can now remove all bend-points between the two edge ends. This action is available on edge context menu &#8220;Remove Bend-points&#8221; or by using the shortcut &#8220;Ctrl&#8221; + &#8220;Shift&#8221; + &#8220;-&#8221;.</li>
<li>Reconnection of an edge will only now move the minimum necessary bendpoints instead of reseting it to default.</li>
<li>A new action has been added to reset the diagram (or container) origin: the diagram (or container) bounds (the rectangle formed by the highest, the leftmost, the lowest and the rightmost children elements) can have a negative origin or can be shifted toward the bottom-right with a blank zone at the top-left. This action aims to move all diagram (or container) elements so that the it retrieves its origin while keeping elements layout.</li>
</ul>
<h3 id="SpecifierVisibleChanges6">Specifier-Visible Changes</h3>
<ul>
- <li>The specifier can now choose to hold the edge ends toward the center of the source, target or both. New fields within the &#171;advance&#187; tab of EdgeStyle description have been added to choose for which source or target mappings an edge should be centered. See
+ <li>The specifier can now choose to hold the edge ends toward the center of the source, target or both. New fields within the &#8220;advance&#8221; tab of EdgeStyle description have been added to choose for which source or target mappings an edge should be centered. See
<a href="specifier/diagrams/Diagrams.html#edges_styles">Edges Styles &gt; Edge Centering</a> in the specifier manual for more details.
</li>
<li>When creating a new Viewpoint Specification Project using the supplied wizard:
- <em>New &gt; Viewpoint Specification Project</em>, the VSM name is now given according to the project name. If the project name is suffixed with &#171;design&#187;, the VSM name is provided by the last word before this suffix. Otherwise, the VSM name is given by the last word of the project name.
+ <em>New &gt; Viewpoint Specification Project</em>, the VSM name is now given according to the project name. If the project name is suffixed with &#8220;design&#8221;, the VSM name is provided by the last word before this suffix. Otherwise, the VSM name is given by the last word of the project name.
</li>
- <li>&#171;Lozenge&#187; is replaced by &#171;Diamond&#187; in diagram style.</li>
+ <li>&#8220;Lozenge&#8221; is replaced by &#8220;Diamond&#8221; in diagram style.</li>
</ul>
<h3 id="APIChanges">API Changes</h3>
<h4 id="Changesinorg.eclipse.sirius4">Changes in
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index d30fc831cd..91a867b6c0 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -4,6 +4,12 @@ h1. Release Notes for Sirius
This document contains the release notes for recent major releases of Sirius. See also "the release notes from previous versions":Release_Notes_Previous.html for details about older releases.
+h2(#sirius3.1.7). Changes in Sirius 3.1.7
+
+h3. Developer-Visible Changes
+
+* <span class="label label-success">Added</span> @org.eclipse.sirius.table.business.api.helper.TableHelper.getEStructuralFeature(DLine, DColumn)@ method has been added to retrieve the EStructuralFeature associated to a table column.
+
h2(#sirius3.1.6). Changes in Sirius 3.1.6
h3. User-Visible Changes
diff --git a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DFeatureColumnEditingSupport.java b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DFeatureColumnEditingSupport.java
index fd02288844..097844f22b 100644
--- a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DFeatureColumnEditingSupport.java
+++ b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DFeatureColumnEditingSupport.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES.
+ * Copyright (c) 2008, 2016 THALES GLOBAL SERVICES.
* 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
@@ -33,6 +33,7 @@ import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.emf.edit.ui.provider.PropertyDescriptor;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.viewers.CellEditor;
@@ -200,7 +201,7 @@ public class DFeatureColumnEditingSupport extends EditingSupport {
result = getAccessor().eGet(featureParent, getFeatureName());
}
- if (!isEReference(featureParent) || directEdit) {
+ if ((!isEReference(featureParent) && !isMany(featureParent)) || directEdit) {
// If the type of the value is a EEnum and the cellEditor is
// not an ExtendedComboBoxCellEditor, we must return the
// index of the ComboBox
@@ -248,21 +249,23 @@ public class DFeatureColumnEditingSupport extends EditingSupport {
final EObject featureParent = editedCell.getTarget();
final EClassifier eClassifier = getEClassifier(featureParent);
Object tempValue = value;
- if (eClassifier instanceof EEnum) {
- if (value instanceof Enumerator) {
- tempValue = ((Enumerator) value).getValue();
- } else if (value != null) {
- tempValue = ((EEnum) eClassifier).getELiterals().get(((Integer) value).intValue()).getValue();
- }
- } else if (value instanceof String && eClassifier != null) {
- try {
- if (eClassifier instanceof EDataType) {
- tempValue = eClassifier.getEPackage().getEFactoryInstance().createFromString((EDataType) eClassifier, (String) value);
- } else if ("UnlimitedNatural".equals(eClassifier.getName())) { //$NON-NLS-1$
- tempValue = Integer.valueOf((String) value);
+ if (!isMany(featureParent)) {
+ if (eClassifier instanceof EEnum) {
+ if (value instanceof Enumerator) {
+ tempValue = ((Enumerator) value).getValue();
+ } else if (value != null) {
+ tempValue = ((EEnum) eClassifier).getELiterals().get(((Integer) value).intValue()).getValue();
+ }
+ } else if (value instanceof String && eClassifier != null) {
+ try {
+ if (eClassifier instanceof EDataType) {
+ tempValue = eClassifier.getEPackage().getEFactoryInstance().createFromString((EDataType) eClassifier, (String) value);
+ } else if ("UnlimitedNatural".equals(eClassifier.getName())) { //$NON-NLS-1$
+ tempValue = Integer.valueOf((String) value);
+ }
+ } catch (final NumberFormatException e) {
+ tempValue = null;
}
- } catch (final NumberFormatException e) {
- tempValue = null;
}
}
try {
@@ -369,7 +372,12 @@ public class DFeatureColumnEditingSupport extends EditingSupport {
}
} else {
if (eClassifier != null) {
- if (eClassifier instanceof EDataType && ("Boolean".equals(((EDataType) eClassifier).getName()) || "EBoolean".equals(((EDataType) eClassifier).getName()))) { //$NON-NLS-1$ //$NON-NLS-2$
+ // In case of multi-valued attribute, we delegate to the
+ // PropertyDescriptor.
+ if (iItemPropertyDescriptor != null && iItemPropertyDescriptor.isMany(element)) {
+ PropertyDescriptor descriptor = new PropertyDescriptor(element, iItemPropertyDescriptor);
+ result = descriptor.createPropertyEditor(tree);
+ } else if (eClassifier instanceof EDataType && ("Boolean".equals(((EDataType) eClassifier).getName()) || "EBoolean".equals(((EDataType) eClassifier).getName()))) { //$NON-NLS-1$ //$NON-NLS-2$
result = new CheckboxCellEditor(tree);
} else if (eClassifier instanceof EEnum) {
final Object genericFeature = iItemPropertyDescriptor.getFeature(element);
@@ -382,7 +390,9 @@ public class DFeatureColumnEditingSupport extends EditingSupport {
if (result == null) {
result = new ComboBoxCellEditor(tree, getValues((EEnum) eClassifier).toArray(new String[0]), SWT.READ_ONLY);
}
- } else {
+ }
+
+ else {
int style = SWT.SINGLE;
if (iItemPropertyDescriptor != null && iItemPropertyDescriptor.isMultiLine(element)) {
style = SWT.WRAP | SWT.MULTI;
diff --git a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DTableColumnLabelProvider.java b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DTableColumnLabelProvider.java
index 19a0ccb8b2..691b2209ed 100644
--- a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DTableColumnLabelProvider.java
+++ b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/provider/DTableColumnLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES.
* 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
@@ -16,6 +16,7 @@ import java.util.List;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.ColumnLabelProvider;
@@ -173,8 +174,11 @@ public class DTableColumnLabelProvider extends ColumnLabelProvider implements IS
} else if (element instanceof DLine) {
line = (DLine) element;
}
+ EStructuralFeature feature = TableHelper.getEStructuralFeature(line, column);
final EClassifier eClassifier = TableHelper.getEClassifier(line, column);
- if (eClassifier instanceof EDataType && ("Boolean".equals(((EDataType) eClassifier).getName()) || "EBoolean".equals(((EDataType) eClassifier).getName()))) { //$NON-NLS-1$ //$NON-NLS-2$
+ // We do not display the check box for multi-valued feature.
+ boolean isNotMany = feature != null && !feature.isMany();
+ if (isNotMany && eClassifier instanceof EDataType && ("Boolean".equals(((EDataType) eClassifier).getName()) || "EBoolean".equals(((EDataType) eClassifier).getName()))) { //$NON-NLS-1$ //$NON-NLS-2$
Option<DCell> optionalCell = TableHelper.getCell(line, column);
if (optionalCell.some()) {
return getImage(Boolean.parseBoolean(optionalCell.get().getLabel()));
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/helper/TableHelper.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/helper/TableHelper.java
index 2021dbfc59..eb7196f6d3 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/helper/TableHelper.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/helper/TableHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES 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
@@ -217,13 +217,29 @@ public final class TableHelper {
* column type
*/
public static EClassifier getEClassifier(final DLine line, final DColumn column) {
+ EStructuralFeature feature = getEStructuralFeature(line, column);
+ if (feature != null) {
+ return feature.getEType();
+ }
+ return null;
+ }
+
+ /**
+ * Get the {@link EStructuralFeature} of the column. The column must be a
+ * DFeatureColumn
+ *
+ * @param line
+ * The line for getting the column of the table
+ * @param column
+ * The column
+ * @return The {@link EStructuralFeature} or null if not found or wrong
+ * column type
+ */
+ public static EStructuralFeature getEStructuralFeature(final DLine line, final DColumn column) {
if (column instanceof DFeatureColumn) {
final Option<DCell> cellOption = TableHelper.getCell(line, column);
if (cellOption.some() && cellOption.get().getTarget() != null) {
- final EStructuralFeature structuralFeature = cellOption.get().getTarget().eClass().getEStructuralFeature(((DFeatureColumn) column).getFeatureName());
- if (structuralFeature != null) {
- return structuralFeature.getEType();
- }
+ return cellOption.get().getTarget().eClass().getEStructuralFeature(((DFeatureColumn) column).getFeatureName());
}
}
return null;
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java
index 355cb76551..5a49a63530 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java
@@ -506,12 +506,18 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl
// objects
if (featureObject instanceof EList<?>) {
List<String> texts = Lists.newArrayList();
- for (EObject obj : (EList<EObject>) featureObject) {
- texts.add(getText(obj));
+ for (Object obj : (EList<?>) featureObject) {
+ String text;
+ if (obj instanceof EObject) {
+ text = getText((EObject) obj);
+ } else {
+ text = obj.toString();
+ }
+ texts.add(text);
}
label = texts.toString();
} else if (featureObject instanceof EObject) {
- label = getText(featureObject);
+ label = getText((EObject) featureObject);
} else {
label = featureObject.toString();
}
@@ -752,7 +758,8 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl
* TODO : TBD <BR>
* The first conditional background style of the cell (with predicate
* expression that returns true). In this case the backgroundStyleOrigin
- * references the intersection mapping and the defaultStyle is equal false. <BR>
+ * references the intersection mapping and the defaultStyle is equal false.
+ * <BR>
* Otherwise the first conditional background style of the column (with
* predicate expression that returns true). In this case the
* backgroundStyleOrigin references the column mapping and the defaultStyle
@@ -1140,7 +1147,7 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl
}
}
- private String getText(final Object element) {
+ private String getText(final EObject element) {
String text = null;
ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(element, IItemLabelProvider.class);

Back to the top