Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanh Liem PHAN2017-06-21 14:51:48 +0000
committervincent lorenzo2017-08-03 10:47:25 +0000
commit2615453cdf642d0810a2e6d65c87d088e6eff429 (patch)
tree823a8ab54d1aaae0a77467f3ce37533b89a63b9a /plugins/infra/nattable
parentf0c5a25e069b8cecf3bf7677ae6b2932e23d3a72 (diff)
downloadorg.eclipse.papyrus-2615453cdf642d0810a2e6d65c87d088e6eff429.tar.gz
org.eclipse.papyrus-2615453cdf642d0810a2e6d65c87d088e6eff429.tar.xz
org.eclipse.papyrus-2615453cdf642d0810a2e6d65c87d088e6eff429.zip
Bug 515806: [Table] Provide a preference to choose the string to display
instead of N/A https://bugs.eclipse.org/bugs/show_bug.cgi?id=515806 - Create a cell preference page in which a string can be defined for the cell content of non supported column - Replace the usage of final var ICellManager.NOT_AVALABLE by the method CellHelper.getUnsupportedColumnCellText, which allows the modification of string immediately without having to restart Papyrus - JUnit Test Change-Id: I0ddf37889caf9a7a504a39b16a4df85a1a3a992c Signed-off-by: Thanh Liem PHAN <thanhliem.phan@all4tec.net> Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/infra/nattable')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF78
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF2
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/filter/configuration/EEnumFilterCellEditorFilterConfiguration.java48
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java15
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFOperationValueCellManager.java15
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF44
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java19
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml21
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml20
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/TreeTableCellLabelProviderComparator.java13
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/BooleanMatcherEditor.java10
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanComboBoxCellEditorFilterConfiguration.java22
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanFilterRowComboBoxCellEditorFilterConfiguration.java23
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/BooleanFilterDataValidator.java14
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/EnumFilterDataValidator.java20
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java447
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java387
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/StringResolutionProblemWrapperCellManager.java13
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java15
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/initializers/CellPreferenceInitializer.java48
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/pages/CellPreferencePage.java58
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/pages/NattablePreferencePage.java44
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellHelper.java23
26 files changed, 818 insertions, 588 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF
index c5c7983caa7..427e5eb56a0 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.customization.nattableconfiguration/META-INF/MANIFEST.MF
@@ -1,39 +1,39 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-SymbolicName: org.eclipse.papyrus.customization.nattableconfiguration;singleton:=true
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.customization.nattableconfiguration.Activator
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf.transaction;bundle-version="1.9.0",
- org.eclipse.ui.forms,
- org.eclipse.jface,
- org.eclipse.swt,
- org.eclipse.emf.common.ui,
- org.eclipse.emf.edit.ui,
- org.eclipse.ui.ide,
- org.eclipse.pde.ui,
- org.eclipse.nebula.widgets.nattable.core;bundle-version="1.5.0",
- org.eclipse.gmf.runtime.emf.type.core,
- org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.nattable.model;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.nattable.model.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.ui.emf;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.customization.nattableconfiguration,
- org.eclipse.papyrus.customization.nattableconfiguration.edition,
- org.eclipse.papyrus.customization.nattableconfiguration.handlers,
- org.eclipse.papyrus.customization.nattableconfiguration.helper,
- org.eclipse.papyrus.customization.nattableconfiguration.messages,
- org.eclipse.papyrus.customization.nattableconfiguration.pages,
- org.eclipse.papyrus.customization.nattableconfiguration.utils
-Bundle-Vendor: %Bundle-Vendor
-Bundle-Description: %Bundle-Description
-Bundle-Localization: plugin
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.customization.nattableconfiguration;singleton:=true
+Bundle-Version: 2.0.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.customization.nattableconfiguration.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.transaction;bundle-version="1.9.0",
+ org.eclipse.ui.forms,
+ org.eclipse.jface,
+ org.eclipse.swt,
+ org.eclipse.emf.common.ui,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.pde.ui,
+ org.eclipse.nebula.widgets.nattable.core;bundle-version="1.5.0",
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.nattable;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.nattable.model.edit;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.ui.emf;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.customization.nattableconfiguration,
+ org.eclipse.papyrus.customization.nattableconfiguration.edition,
+ org.eclipse.papyrus.customization.nattableconfiguration.handlers,
+ org.eclipse.papyrus.customization.nattableconfiguration.helper,
+ org.eclipse.papyrus.customization.nattableconfiguration.messages,
+ org.eclipse.papyrus.customization.nattableconfiguration.pages,
+ org.eclipse.papyrus.customization.nattableconfiguration.utils
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Description: %Bundle-Description
+Bundle-Localization: plugin
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF
index 2ad172d32b7..6c467f46875 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF
@@ -10,7 +10,7 @@ Export-Package: org.eclipse.papyrus.infra.emf.nattable,
org.eclipse.papyrus.infra.emf.nattable.registry,
org.eclipse.papyrus.infra.emf.nattable.selection,
org.eclipse.papyrus.infra.emf.nattable.validator
-Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[3.1.0,4.0.0)";visibility:=reexport,
+Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/filter/configuration/EEnumFilterCellEditorFilterConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/filter/configuration/EEnumFilterCellEditorFilterConfiguration.java
index 6567838df2b..41849b530c1 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/filter/configuration/EEnumFilterCellEditorFilterConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/filter/configuration/EEnumFilterCellEditorFilterConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2017 CEA LIST 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
@@ -9,7 +9,7 @@
* Contributors:
* Vincent LORENZO (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 497571
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.nattable.filter.configuration;
@@ -44,7 +44,6 @@ import org.eclipse.papyrus.infra.nattable.filter.IPapyrusMatcherEditorFactory;
import org.eclipse.papyrus.infra.nattable.filter.configuration.AbstractFilterValueToMatchManager;
import org.eclipse.papyrus.infra.nattable.filter.configuration.IFilterConfiguration;
import org.eclipse.papyrus.infra.nattable.filter.validator.EnumFilterDataValidator;
-import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NamedStyle;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
@@ -52,6 +51,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.Nattables
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StringListValueStyle;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StringValueStyle;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import ca.odell.glazedlists.BasicEventList;
@@ -87,7 +87,7 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
}
/**
- *
+ *
* @param axis
* an axis
* @return
@@ -120,7 +120,7 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
List<Enumerator> literals = getLiteral(configRegistry, columnElement);
final List<Object> valuesToProposed = new ArrayList<Object>(literals);
- valuesToProposed.add(0, ICellManager.NOT_AVALAIBLE);
+ valuesToProposed.add(0, CellHelper.getUnsupportedCellContentsText());
ICellEditor editor = new FilterRowComboBoxCellEditor(new ListComboBoxDataProvider(valuesToProposed));
IPapyrusMatcherEditorFactory<Object> factory = createPapyrusMatcherFactory();
@@ -134,7 +134,7 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
/**
* This allows to create the papyrus matcher factory.
- *
+ *
* @return The create papyrus matcher factory.
*/
protected IPapyrusMatcherEditorFactory<Object> createPapyrusMatcherFactory() {
@@ -150,7 +150,7 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
}
/**
- *
+ *
* @param filterConfiguration
* the id of the filter configuration used for the managed axis
* @param literals
@@ -164,14 +164,14 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
/**
* This allows to get the data validator to use.
- *
+ *
* @param configRegistry
* The config registry.
* @param literals
* The list of authorized literals.
- *
+ *
* @return The data validator to use.
- *
+ *
* @since 3.0
*/
protected IDataValidator getDataValidator(final IConfigRegistry configRegistry, final List<Enumerator> literals) {
@@ -179,8 +179,8 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
}
/**
- *
- *
+ *
+ *
* @see org.eclipse.papyrus.infra.nattable.filter.configuration.IFilterConfiguration#getConfigurationId()
*
* @return
@@ -201,7 +201,7 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
}
/**
- *
+ *
* This class allows to save the state of the filter for column typed with enumeration
*
*/
@@ -241,12 +241,14 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
IAxis iaxis = (IAxis) axis;
NamedStyle style = getValueToMatchStyle(iaxis);
if (style != null) {
+ final String unsupportedColumnCellText = CellHelper.getUnsupportedCellContentsText();
+
if (style instanceof StringListValueStyle) {
List<Object> returnedValues = new ArrayList<Object>();
Collection<String> coll = ((StringListValueStyle) style).getStringListValue();
for (String string : coll) {
- if (string.equals(ICellManager.NOT_AVALAIBLE)) {
- returnedValues.add(ICellManager.NOT_AVALAIBLE);
+ if (string.equals(unsupportedColumnCellText)) {
+ returnedValues.add(unsupportedColumnCellText);
} else {
for (Enumerator tmp : literals) {
if (tmp.getName().equals(string)) {
@@ -260,8 +262,8 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
}
if (style instanceof StringValueStyle) {
String val = ((StringValueStyle) style).getStringValue();
- if (val.equals(ICellManager.NOT_AVALAIBLE)) {
- return ICellManager.NOT_AVALAIBLE;
+ if (val.equals(unsupportedColumnCellText)) {
+ return unsupportedColumnCellText;
}
for (Enumerator tmp : literals) {
if (tmp.getName().equals(val)) {
@@ -291,6 +293,8 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
IAxis iaxis = (IAxis) axis;
CompoundCommand cc = new CompoundCommand("Save Value To Match Command"); //$NON-NLS-1$
NamedStyle keyStyle = getValueToMatchStyle(iaxis);
+ final String unsupportedColumnCellText = CellHelper.getUnsupportedCellContentsText();
+
if (newValue instanceof Collection<?>) {
Collection<?> coll = (Collection<?>) newValue;
// we need to update the keystyle
@@ -309,11 +313,11 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
List<String> values = new ArrayList<String>();
for (Object tmp : coll) {
- Assert.isTrue(tmp instanceof Enumerator || ICellManager.NOT_AVALAIBLE.equals(tmp));
+ Assert.isTrue(tmp instanceof Enumerator || unsupportedColumnCellText.equals(tmp));
if (tmp instanceof Enumerator) {
values.add(((Enumerator) tmp).getName());
} else {
- values.add(ICellManager.NOT_AVALAIBLE);
+ values.add(unsupportedColumnCellText);
}
}
cc.append(SetCommand.create(domain, keyStyle, NattablestylePackage.eINSTANCE.getStringListValueStyle_StringListValue(), values));
@@ -330,7 +334,7 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
keyStyle.setName(FILTER_VALUE_TO_MATCH);
cc.append(AddCommand.create(domain, iaxis, NattablestylePackage.eINSTANCE.getNamedStyle(), keyStyle));
}
- Assert.isTrue(newValue instanceof Enumerator || ICellManager.NOT_AVALAIBLE.equals(newValue));
+ Assert.isTrue(newValue instanceof Enumerator || unsupportedColumnCellText.equals(newValue));
// we store the name of the literal and a reference to the literal, for 2 reasons :
// - for static profile we get enumerator and not EEnumLiteral
// - in case of redefinition of the profile, the reference would be not correct
@@ -338,7 +342,7 @@ public class EEnumFilterCellEditorFilterConfiguration implements IFilterConfigur
if (newValue instanceof Enumerator) {
name = ((Enumerator) newValue).getName();
} else {
- name = ICellManager.NOT_AVALAIBLE;
+ name = unsupportedColumnCellText;
}
cc.append(SetCommand.create(domain, keyStyle, NattablestylePackage.eINSTANCE.getStringValueStyle_StringValue(), name));
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java
index 2fa35cab29e..cdf93045aac 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2016 CEA LIST, Esterel Technologies SAS and others.
- *
+ * Copyright (c) 2012, 2017 CEA LIST, Esterel Technologies SAS and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,7 +10,7 @@
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 476618
* Alain Le Guennec (Esterel Technologies SAS) - Bug 497452
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.nattable.manager.cell;
@@ -94,7 +93,7 @@ public class EMFFeatureValueCellManager extends AbstractCellManager {
if (eobject.eClass().getEAllStructuralFeatures().contains(feature)) {
return eobject.eGet(feature);
}
- return NOT_AVALAIBLE;
+ return CellHelper.getUnsupportedCellContentsText();
}
/**
@@ -421,7 +420,7 @@ public class EMFFeatureValueCellManager extends AbstractCellManager {
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#getUnsetCellValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object,
* org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
*
@@ -443,10 +442,10 @@ public class EMFFeatureValueCellManager extends AbstractCellManager {
}
/**
- *
+ *
* @param domain
* the editing domain to use
- *
+ *
* @param elementToEdit
* the edited element
* @param editedFeature
@@ -495,7 +494,7 @@ public class EMFFeatureValueCellManager extends AbstractCellManager {
}
/**
- *
+ *
* @param domain
* the editing domain to use
* @param elementToEdit
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFOperationValueCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFOperationValueCellManager.java
index cfac394e00d..e2828b629a0 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFOperationValueCellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFOperationValueCellManager.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2017 CEA LIST 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
@@ -9,7 +9,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 465009 : Allow EOperation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.nattable.manager.cell;
@@ -24,13 +24,14 @@ import org.eclipse.emf.ecore.EOperation;
import org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
/**
- *
+ *
* Cell Manager which allows to get the value of an {@link EOperation} for an {@link EObject}
*
* @author Céline JANSSENS
- *
+ *
*/
public class EMFOperationValueCellManager extends AbstractCellManager {
@@ -76,7 +77,7 @@ public class EMFOperationValueCellManager extends AbstractCellManager {
return NOT_IMPLEMENTED_MESSAGE;
}
}
- return NOT_AVALAIBLE;
+ return CellHelper.getUnsupportedCellContentsText();
}
/**
@@ -88,7 +89,7 @@ public class EMFOperationValueCellManager extends AbstractCellManager {
* @param sharedMap
* a map with interesting informations
* @return
- * <code>null</code> or a list of 2 objects.
+ * <code>null</code> or a list of 2 objects.
* <ul>
* <li>the first element is the edited EObject</li>
* <li>the second one is the edited feature</li>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
index c0df15a123f..d04708a0c0b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
@@ -10,7 +10,7 @@ Export-Package: org.eclipse.papyrus.infra.nattable.common,
org.eclipse.papyrus.infra.nattable.common.utils,
org.eclipse.papyrus.infra.nattable.common.wizards,
org.eclipse.papyrus.infra.nattable.internal.common.commands;x-friends:="org.eclipse.papyrus.infra.nattable.gmfdiag"
-Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.nattable.model;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
index 5196ef686b6..6c9c29a49c3 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
@@ -1,22 +1,22 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.infra.nattable.properties.constraints,
- org.eclipse.papyrus.infra.nattable.properties.observable
-Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.infra.constraints;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
- org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)"
-Bundle-Vendor: %Bundle-Vendor
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.2.0.qualifier
-Bundle-Name: %Bundle-Name
-Bundle-Activator: org.eclipse.papyrus.infra.nattable.properties.Activator
-Bundle-ManifestVersion: 2
-Bundle-Description: %pluginDescription
-Bundle-SymbolicName: org.eclipse.papyrus.infra.nattable.properties;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.infra.nattable.properties.constraints,
+ org.eclipse.papyrus.infra.nattable.properties.observable
+Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.constraints;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.nattable;bundle-version="[4.0.0,5.0.0)"
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 2.2.0.qualifier
+Bundle-Name: %Bundle-Name
+Bundle-Activator: org.eclipse.papyrus.infra.nattable.properties.Activator
+Bundle-ManifestVersion: 2
+Bundle-Description: %pluginDescription
+Bundle-SymbolicName: org.eclipse.papyrus.infra.nattable.properties;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java
index 94391ac2a3d..06808ee2da1 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2013, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,7 +9,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.views.config.manager.cell;
@@ -30,6 +30,7 @@ import org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
import org.eclipse.papyrus.infra.nattable.views.config.utils.Utils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
@@ -124,7 +125,7 @@ public class ModelViewsCellManager extends AbstractCellManager {
if (Utils.VIEW_EDITOR_TYPE.equals(featureName)) {
return getEditorType(editor);
}
- return NOT_AVALAIBLE;
+ return CellHelper.getUnsupportedCellContentsText();
}
/**
@@ -134,7 +135,7 @@ public class ModelViewsCellManager extends AbstractCellManager {
* @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#isCellEditable(java.lang.Object, java.lang.Object, INattableModelManager)
*
* @return
- * <code>true</code> excepted if the edited feature is isOpen
+ * <code>true</code> excepted if the edited feature is isOpen
*/
@Override
public boolean isCellEditable(Object rowElement, Object columnElement, INattableModelManager tableManager) {
@@ -191,7 +192,7 @@ public class ModelViewsCellManager extends AbstractCellManager {
}
}
}
- return NOT_AVALAIBLE;
+ return CellHelper.getUnsupportedCellContentsText();
}
/**
@@ -199,7 +200,7 @@ public class ModelViewsCellManager extends AbstractCellManager {
* @param editor
* the editor
* @return
- * <code>true</code> if the current editor is open
+ * <code>true</code> if the current editor is open
*/
protected Object getEditorIsOpen(final Object editor) {
if (editor instanceof EObject) {
@@ -212,7 +213,7 @@ public class ModelViewsCellManager extends AbstractCellManager {
}
}
- return NOT_AVALAIBLE;
+ return CellHelper.getUnsupportedCellContentsText();
}
/**
@@ -230,7 +231,7 @@ public class ModelViewsCellManager extends AbstractCellManager {
return eobject.eGet(feature);
}
}
- return NOT_AVALAIBLE;
+ return CellHelper.getUnsupportedCellContentsText();
}
/**
@@ -243,7 +244,7 @@ public class ModelViewsCellManager extends AbstractCellManager {
protected Object getEditorContext(final Object editor) {
final Object result = Utils.getEditorContext(editor);
if (result == null) {
- return NOT_AVALAIBLE;
+ return CellHelper.getUnsupportedCellContentsText();
}
return result;
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
index 777282be8b9..8f6a8ee93ae 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
@@ -38,6 +38,7 @@ Export-Package: org.eclipse.papyrus.infra.nattable,
org.eclipse.papyrus.infra.nattable.parsers,
org.eclipse.papyrus.infra.nattable.paste,
org.eclipse.papyrus.infra.nattable.preferences,
+ org.eclipse.papyrus.infra.nattable.preferences.pages,
org.eclipse.papyrus.infra.nattable.provider,
org.eclipse.papyrus.infra.nattable.reorder,
org.eclipse.papyrus.infra.nattable.resource,
@@ -69,7 +70,7 @@ Require-Bundle: org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0
org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Bundle-Version: 3.1.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-Activator: org.eclipse.papyrus.infra.nattable.Activator
Bundle-ManifestVersion: 2
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
index 5e78232651b..8bab5deb5fe 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
@@ -1831,4 +1831,25 @@
</activeWhen>
</handler>
</extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
+ class="org.eclipse.papyrus.infra.nattable.preferences.pages.NattablePreferencePage"
+ id="org.eclipse.papyrus.infra.nattable.preferences.nattable"
+ name="NatTable">
+ </page>
+ <page
+ category="org.eclipse.papyrus.infra.nattable.preferences.nattable"
+ class="org.eclipse.papyrus.infra.nattable.preferences.pages.CellPreferencePage"
+ id="org.eclipse.papyrus.infra.nattable.preferences.nattable.cell"
+ name="Cell Preferences">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.papyrus.infra.nattable.preferences.initializers.CellPreferenceInitializer">
+ </initializer>
+ </extension>
</plugin>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml
index a710ce0e939..26ce2abdeed 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>org.eclipse.papyrus.infra-nattable</artifactId>
- <groupId>org.eclipse.papyrus</groupId>
- <version>0.0.1-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.papyrus.infra.nattable</artifactId>
- <version>3.1.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-nattable</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.nattable</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/TreeTableCellLabelProviderComparator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/TreeTableCellLabelProviderComparator.java
index 68212c28dbf..612bf8a7c97 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/TreeTableCellLabelProviderComparator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/comparator/TreeTableCellLabelProviderComparator.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2017 CEA LIST 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
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.comparator;
@@ -21,10 +21,10 @@ import org.eclipse.nebula.widgets.nattable.sort.ISortModel;
import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisComparator;
-import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
import org.eclipse.papyrus.infra.nattable.utils.Constants;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.nattable.utils.SortLabelProviderFullCellContextElementWrapper;
@@ -33,7 +33,7 @@ import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderSer
/**
* @author VL222926
- *
+ *
* The comparator used to sort the rows selecting column header in case of a TreeTable
*
*/
@@ -108,7 +108,8 @@ public class TreeTableCellLabelProviderComparator extends TableCellLabelProvider
final String txt1 = serv.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT).getText(sortWrapper1);
final String txt2 = serv.getLabelProvider(Constants.TABLE_LABEL_PROVIDER_CONTEXT).getText(sortWrapper2);
int res = -1;
- if (ICellManager.NOT_AVALAIBLE.equals(txt1) || ICellManager.NOT_AVALAIBLE.equals(txt2)) { // OR or AND ? I don't know
+ final String unsupportedColumnCellText = CellHelper.getUnsupportedCellContentsText();
+ if (unsupportedColumnCellText.equals(txt1) || unsupportedColumnCellText.equals(txt2)) { // OR or AND ? I don't know
res = comparator.compare(axis1, axis2);
if (direction == SortDirectionEnum.DESC) {
res = -res;// to preserve the order of the TreeFillingConfiguration declared in the model and of the unsortable object
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/BooleanMatcherEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/BooleanMatcherEditor.java
index 78e011df1d3..47d8d465fec 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/BooleanMatcherEditor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/BooleanMatcherEditor.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2017 CEA LIST 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
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.filter;
@@ -18,7 +18,7 @@ import java.util.Collection;
import org.eclipse.core.runtime.Assert;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IColumnAccessor;
-import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
import ca.odell.glazedlists.matchers.Matcher;
@@ -75,7 +75,7 @@ public class BooleanMatcherEditor extends AbstractPapyrusMatcherEditor {
public BooleanMatcher(IColumnAccessor<Object> accessor, Object wantedObject, int columnIndex) {
super(accessor, columnIndex, wantedObject);
Assert.isTrue(!(wantedObject instanceof Collection<?>));
- Assert.isTrue(wantedObject instanceof Boolean || wantedObject.equals(ICellManager.NOT_AVALAIBLE));
+ Assert.isTrue(wantedObject instanceof Boolean || wantedObject.equals(CellHelper.getUnsupportedCellContentsText()));
}
/**
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanComboBoxCellEditorFilterConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanComboBoxCellEditorFilterConfiguration.java
index 1f952c67ee8..a2fe64ab46d 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanComboBoxCellEditorFilterConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanComboBoxCellEditorFilterConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2017 CEA LIST 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
@@ -9,7 +9,7 @@
* Contributors:
* Vincent LORENZO (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 497571
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.filter.configuration;
@@ -28,7 +28,7 @@ import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.nattable.filter.BooleanMatcherEditorFactory;
import org.eclipse.papyrus.infra.nattable.filter.IPapyrusMatcherEditorFactory;
import org.eclipse.papyrus.infra.nattable.filter.validator.BooleanFilterDataValidator;
-import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
/**
@@ -38,9 +38,9 @@ import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
public abstract class AbstractBooleanComboBoxCellEditorFilterConfiguration implements IFilterConfiguration {
/**
- * the avalable values to boolean combo cell editor
+ * The available values for boolean combo cell editor.
*/
- protected static final List<?> availableValue = Arrays.asList(new Object[] { ICellManager.NOT_AVALAIBLE, Boolean.TRUE, Boolean.FALSE });
+ protected static final List<?> availableValue = Arrays.asList(new Object[] { CellHelper.getUnsupportedCellContentsText(), Boolean.TRUE, Boolean.FALSE });
/**
* @see org.eclipse.papyrus.infra.nattable.filter.configuration.IFilterConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String, List<Object>)
@@ -59,7 +59,7 @@ public abstract class AbstractBooleanComboBoxCellEditorFilterConfiguration imple
}
/**
- *
+ *
* @return
* a new matcher factory
*/
@@ -68,7 +68,7 @@ public abstract class AbstractBooleanComboBoxCellEditorFilterConfiguration imple
}
/**
- *
+ *
* @param configRegistry
* @param columnElement
* @param configLabel
@@ -81,12 +81,12 @@ public abstract class AbstractBooleanComboBoxCellEditorFilterConfiguration imple
/**
* This allows to get the data validator to use.
- *
+ *
* @param configRegistry
* The config registry.
- *
+ *
* @return The data validator to use.
- *
+ *
* @since 3.0
*/
protected IDataValidator getDataValidator(IConfigRegistry configRegistry) {
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanFilterRowComboBoxCellEditorFilterConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanFilterRowComboBoxCellEditorFilterConfiguration.java
index cb742c9fd1d..dfbc9832183 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanFilterRowComboBoxCellEditorFilterConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/AbstractBooleanFilterRowComboBoxCellEditorFilterConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2017 CEA LIST 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
@@ -9,7 +9,7 @@
* Contributors:
* Vincent LORENZO (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 497571
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.filter.configuration;
@@ -33,13 +33,13 @@ import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
import org.eclipse.nebula.widgets.nattable.filterrow.combobox.FilterRowComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.nattable.filter.IFilterValueToMatchManager;
-import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NamedStyle;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestyleFactory;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StringListValueStyle;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StringValueStyle;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.tools.util.TypeUtils;
@@ -98,6 +98,7 @@ public abstract class AbstractBooleanFilterRowComboBoxCellEditorFilterConfigurat
*
* @return
*/
+ @Override
public String getConfigurationDescription() {
return "This configuration provides an Combo with checkbox to filter boolean values. Known values are true, false and N/A"; // $//$NON-NLS-1$
}
@@ -128,12 +129,14 @@ public abstract class AbstractBooleanFilterRowComboBoxCellEditorFilterConfigurat
IAxis iaxis = (IAxis) axis;
NamedStyle style = getValueToMatchStyle(iaxis);
if (style != null) {
+ final String unsupportedColumnCellText = CellHelper.getUnsupportedCellContentsText();
+
if (style instanceof StringListValueStyle) {
List<Object> returnedValues = new ArrayList<Object>();
Collection<String> coll = ((StringListValueStyle) style).getStringListValue();
for (String string : coll) {
- if (string.equals(ICellManager.NOT_AVALAIBLE)) {
- returnedValues.add(ICellManager.NOT_AVALAIBLE);
+ if (string.equals(unsupportedColumnCellText)) {
+ returnedValues.add(unsupportedColumnCellText);
} else {
Assert.isTrue(TypeUtils.isBooleanValue(string));
returnedValues.add(Boolean.valueOf(string));
@@ -143,8 +146,8 @@ public abstract class AbstractBooleanFilterRowComboBoxCellEditorFilterConfigurat
}
if (style instanceof StringValueStyle) {
String val = ((StringValueStyle) style).getStringValue();
- if (val.equals(ICellManager.NOT_AVALAIBLE)) {
- return ICellManager.NOT_AVALAIBLE;
+ if (val.equals(unsupportedColumnCellText)) {
+ return unsupportedColumnCellText;
}
Assert.isTrue(TypeUtils.isBooleanValue(val));
return Boolean.valueOf(val);
@@ -189,7 +192,7 @@ public abstract class AbstractBooleanFilterRowComboBoxCellEditorFilterConfigurat
List<String> values = new ArrayList<String>();
for (Object tmp : coll) {
- Assert.isTrue(tmp instanceof Boolean || ICellManager.NOT_AVALAIBLE.equals(tmp));
+ Assert.isTrue(tmp instanceof Boolean || CellHelper.getUnsupportedCellContentsText().equals(tmp));
values.add(tmp.toString());
}
cc.append(SetCommand.create(domain, keyStyle, NattablestylePackage.eINSTANCE.getStringListValueStyle_StringListValue(), values));
@@ -206,7 +209,7 @@ public abstract class AbstractBooleanFilterRowComboBoxCellEditorFilterConfigurat
keyStyle.setName(FILTER_VALUE_TO_MATCH);
cc.append(AddCommand.create(domain, iaxis, NattablestylePackage.eINSTANCE.getNamedStyle(), keyStyle));
}
- Assert.isTrue(newValue instanceof Boolean || ICellManager.NOT_AVALAIBLE.equals(newValue));
+ Assert.isTrue(newValue instanceof Boolean || CellHelper.getUnsupportedCellContentsText().equals(newValue));
// we store the name of the literal and a reference to the literal, for 2 reasons :
// - for static profile we get enumerator and not EEnumLiteral
// - in case of redefinition of the profile, the reference would be not correct
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/BooleanFilterDataValidator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/BooleanFilterDataValidator.java
index aa3132f2b0e..e06024fd525 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/BooleanFilterDataValidator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/BooleanFilterDataValidator.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2017 CEA LIST 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
@@ -8,7 +8,7 @@
*
* Contributors:
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.filter.validator;
@@ -19,18 +19,18 @@ import java.util.Iterator;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
/**
* The validator used for boolean editor in the filter row header.
- *
+ *
* @since 3.0
*/
public class BooleanFilterDataValidator implements IDataValidator {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator#validate(int, int, java.lang.Object)
*/
@Override
@@ -40,7 +40,7 @@ public class BooleanFilterDataValidator implements IDataValidator {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator#validate(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object)
*/
@Override
@@ -50,7 +50,7 @@ public class BooleanFilterDataValidator implements IDataValidator {
}
if (newValue instanceof Boolean) {
return true;
- } else if (newValue instanceof String && newValue.equals(ICellManager.NOT_AVALAIBLE)) {
+ } else if (newValue instanceof String && newValue.equals(CellHelper.getUnsupportedCellContentsText())) {
return true;
} else if (newValue instanceof Collection<?>) {
boolean result = true;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/EnumFilterDataValidator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/EnumFilterDataValidator.java
index 961f4092b99..d722fab71ea 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/EnumFilterDataValidator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/validator/EnumFilterDataValidator.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2017 CEA LIST 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
@@ -8,7 +8,7 @@
*
* Contributors:
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.filter.validator;
@@ -21,20 +21,20 @@ import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
-import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
/**
* The validator used for enum editor in the filter row header.
- *
+ *
* @since 3.0
*/
public class EnumFilterDataValidator implements IDataValidator {
-
+
/**
* The list of authorized literals.
*/
final List<Enumerator> authorizedLiterals;
-
+
/**
* Constructor.
*
@@ -45,7 +45,7 @@ public class EnumFilterDataValidator implements IDataValidator {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator#validate(int, int, java.lang.Object)
*/
@Override
@@ -55,7 +55,7 @@ public class EnumFilterDataValidator implements IDataValidator {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator#validate(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object)
*/
@Override
@@ -63,9 +63,9 @@ public class EnumFilterDataValidator implements IDataValidator {
if (null == newValue) {
return true;
}
- if(newValue instanceof Enumerator && authorizedLiterals.contains(newValue)) {
+ if (newValue instanceof Enumerator && authorizedLiterals.contains(newValue)) {
return true;
- } else if (newValue instanceof String && newValue.equals(ICellManager.NOT_AVALAIBLE)) {
+ } else if (newValue instanceof String && newValue.equals(CellHelper.getUnsupportedCellContentsText())) {
return true;
} else if (newValue instanceof Collection<?>) {
boolean result = true;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java
index f9c2c46cfac..9e7df2c59d2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java
@@ -1,219 +1,228 @@
-/*****************************************************************************
- * Copyright (c) 2013 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.nattable.manager.cell;
-
-import java.util.Map;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter;
-import org.eclipse.papyrus.infra.ui.converter.ConvertedValueContainer;
-
-/**
- * The abstract class for the cell manager
- *
- * @author Vincent Lorenzo
- *
- */
-public abstract class AbstractCellManager implements ICellManager, IUnsetValueCellManager {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getValue(java.lang.Object, java.lang.Object, INattableModelManager)
- *
- * @param columnElement
- * @param rowElement
- * @param tableManager
- * @return
- * the value for the cell. The developer must override the method doGetValue
- */
- @Override
- public final Object getValue(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) {
- return doGetValue(columnElement, rowElement, tableManager);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getValue(java.lang.Object, java.lang.Object, INattableModelManager)
- *
- * @param columnElement
- * the column element
- * @param rowElement
- * the row element
- * @param tableManager
- * the table manager
- * @return
- */
- protected Object doGetValue(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) {
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#setValue(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.Object, INattableModelManager)
- *
- * @param domain
- * @param columnElement
- * @param rowElement
- * @param newValue
- * @param tableManager
- */
- @Override
- public void setValue(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager) {
- final Command cmd = getSetValueCommand(domain, columnElement, rowElement, newValue, tableManager);
- if (cmd != null && cmd.canExecute()) {
- domain.getCommandStack().execute(cmd);
- }
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#isCellEditable(java.lang.Object, java.lang.Object, INattableModelManager)
- *
- * @param columnElement
- * @param rowElement
- * @return
- */
- @Override
- public boolean isCellEditable(final Object columnElement, final Object rowElement, INattableModelManager tableManager) {
- return false;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getSetValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.Object,
- * org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
- *
- * @param domain
- * @param columnElement
- * @param rowElement
- * @param newValue
- * @param tableManager
- * @return
- */
- @Override
- public Command getSetValueCommand(TransactionalEditingDomain domain, Object columnElement, Object rowElement, Object newValue, INattableModelManager tableManager) {
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getSetStringValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.String,
- * org.eclipse.papyrus.infra.ui.converter.IStringValueConverter, INattableModelManager)
- *
- * @param domain
- * @param columnElement
- * @param rowElement
- * @param newValue
- * @param valueSolver
- * @param tableManager
- * @return
- */
- @Override
- public Command getSetStringValueCommand(TransactionalEditingDomain domain, Object columnElement, Object rowElement, String newValue, AbstractStringValueConverter valueSolver, INattableModelManager tableManager) {
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getOrCreateStringValueConverterClass(Map, String, INattableModelManager)
- *
- * @return
- */
- @Override
- public AbstractStringValueConverter getOrCreateStringValueConverterClass(Map<Class<? extends AbstractStringValueConverter>, AbstractStringValueConverter> existingConverters, String multiValueSeparator, INattableModelManager tableManager) {
- AbstractStringValueConverter converter = existingConverters.get(this.getClass());
- if (converter == null) {
- converter = new AbstractStringValueConverter() {
-
- @Override
- public void dispose() {
- // nothing to do
- }
-
- @Override
- protected ConvertedValueContainer<?> doDeduceValueFromString(Object type, String valueAsString) {
- // nothing to do
- return null;
- }
- };
- existingConverters.put(converter.getClass(), converter);
- }
- return converter;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#isCellEditable(java.lang.Object, java.lang.Object, java.util.Map, INattableModelManager)
- *
- * @param columnElement
- * @param rowElement
- * @param sharedMap
- * @return
- */
- @Override
- public boolean isCellEditable(final Object columnElement, final Object rowElement, final Map<?, ?> sharedMap, INattableModelManager tableManager) {
- return isCellEditable(columnElement, rowElement, tableManager);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#setStringValue(java.lang.Object, java.lang.Object, java.lang.String, org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter,
- * java.util.Map, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
- *
- * @param columnElement
- * @param rowElement
- * @param valueAsString
- * @param valueConverter
- * @param sharedMap
- * @param tableManager
- */
- @Override
- public void setStringValue(Object columnElement, Object rowElement, String valueAsString, AbstractStringValueConverter valueConverter, Map<?, ?> sharedMap, INattableModelManager tableManager) {
- // do nothing
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.IUnsetValueCellManager#unsetCellValue(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
- *
- * @param domain
- * @param columnElement
- * @param rowElement
- * @param tableManager
- */
- @Override
- public void unsetCellValue(TransactionalEditingDomain domain, Object columnElement, Object rowElement, INattableModelManager tableManager) {
- // nothing to do
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.manager.cell.IUnsetValueCellManager#getUnsetCellValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object,
- * org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
- *
- * @param domain
- * @param columnElement
- * @param rowElement
- * @param tableManager
- * @return
- */
- @Override
- public Command getUnsetCellValueCommand(TransactionalEditingDomain domain, Object columnElement, Object rowElement, INattableModelManager tableManager) {
- // nothing to do
- return null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 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.nattable.manager.cell;
+
+import java.util.Map;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
+import org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter;
+import org.eclipse.papyrus.infra.ui.converter.ConvertedValueContainer;
+
+/**
+ * The abstract class for the cell manager
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public abstract class AbstractCellManager implements ICellManager, IUnsetValueCellManager {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getValue(java.lang.Object, java.lang.Object, INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @param tableManager
+ * @return
+ * the value for the cell. The developer must override the method doGetValue
+ */
+ @Override
+ public final Object getValue(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) {
+ return doGetValue(columnElement, rowElement, tableManager);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getValue(java.lang.Object, java.lang.Object, INattableModelManager)
+ *
+ * @param columnElement
+ * the column element
+ * @param rowElement
+ * the row element
+ * @param tableManager
+ * the table manager
+ * @return
+ */
+ protected Object doGetValue(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#setValue(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.Object, INattableModelManager)
+ *
+ * @param domain
+ * @param columnElement
+ * @param rowElement
+ * @param newValue
+ * @param tableManager
+ */
+ @Override
+ public void setValue(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager) {
+ final Command cmd = getSetValueCommand(domain, columnElement, rowElement, newValue, tableManager);
+ if (cmd != null && cmd.canExecute()) {
+ domain.getCommandStack().execute(cmd);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#isCellEditable(java.lang.Object, java.lang.Object, INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @return
+ */
+ @Override
+ public boolean isCellEditable(final Object columnElement, final Object rowElement, INattableModelManager tableManager) {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getSetValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.Object,
+ * org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param domain
+ * @param columnElement
+ * @param rowElement
+ * @param newValue
+ * @param tableManager
+ * @return
+ */
+ @Override
+ public Command getSetValueCommand(TransactionalEditingDomain domain, Object columnElement, Object rowElement, Object newValue, INattableModelManager tableManager) {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getSetStringValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.String,
+ * org.eclipse.papyrus.infra.ui.converter.IStringValueConverter, INattableModelManager)
+ *
+ * @param domain
+ * @param columnElement
+ * @param rowElement
+ * @param newValue
+ * @param valueSolver
+ * @param tableManager
+ * @return
+ */
+ @Override
+ public Command getSetStringValueCommand(TransactionalEditingDomain domain, Object columnElement, Object rowElement, String newValue, AbstractStringValueConverter valueSolver, INattableModelManager tableManager) {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getOrCreateStringValueConverterClass(Map, String, INattableModelManager)
+ *
+ * @return
+ */
+ @Override
+ public AbstractStringValueConverter getOrCreateStringValueConverterClass(Map<Class<? extends AbstractStringValueConverter>, AbstractStringValueConverter> existingConverters, String multiValueSeparator, INattableModelManager tableManager) {
+ AbstractStringValueConverter converter = existingConverters.get(this.getClass());
+ if (converter == null) {
+ converter = new AbstractStringValueConverter() {
+
+ @Override
+ public void dispose() {
+ // nothing to do
+ }
+
+ @Override
+ protected ConvertedValueContainer<?> doDeduceValueFromString(Object type, String valueAsString) {
+ // nothing to do
+ return null;
+ }
+ };
+ existingConverters.put(converter.getClass(), converter);
+ }
+ return converter;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#isCellEditable(java.lang.Object, java.lang.Object, java.util.Map, INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @param sharedMap
+ * @return
+ */
+ @Override
+ public boolean isCellEditable(final Object columnElement, final Object rowElement, final Map<?, ?> sharedMap, INattableModelManager tableManager) {
+ return isCellEditable(columnElement, rowElement, tableManager);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#setStringValue(java.lang.Object, java.lang.Object, java.lang.String, org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter,
+ * java.util.Map, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @param valueAsString
+ * @param valueConverter
+ * @param sharedMap
+ * @param tableManager
+ */
+ @Override
+ public void setStringValue(Object columnElement, Object rowElement, String valueAsString, AbstractStringValueConverter valueConverter, Map<?, ?> sharedMap, INattableModelManager tableManager) {
+ // do nothing
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.IUnsetValueCellManager#unsetCellValue(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param domain
+ * @param columnElement
+ * @param rowElement
+ * @param tableManager
+ */
+ @Override
+ public void unsetCellValue(TransactionalEditingDomain domain, Object columnElement, Object rowElement, INattableModelManager tableManager) {
+ // nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.IUnsetValueCellManager#getUnsetCellValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object,
+ * org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param domain
+ * @param columnElement
+ * @param rowElement
+ * @param tableManager
+ * @return
+ */
+ @Override
+ public Command getUnsetCellValueCommand(TransactionalEditingDomain domain, Object columnElement, Object rowElement, INattableModelManager tableManager) {
+ // nothing to do
+ return null;
+ }
+
+ /**
+ * @return the text of cell to be displayed with unsupported column
+ * @since 4.0
+ */
+ @Override
+ public String getUnsupportedCellContentsText() {
+ return CellHelper.getUnsupportedCellContentsText();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java
index 9240f1e99ab..aaab6f1dcd0 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java
@@ -1,189 +1,198 @@
-/*****************************************************************************
- * Copyright (c) 2012 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
- * Vicnent Lorenzo (CEA LIST) Bugs 516247, 515806
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.manager.cell;
-
-import java.util.Map;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter;
-
-/**
- * The interface to implements for a cell manager
- *
- * @author Vincent Lorenzo
- *
- */
-public interface ICellManager {
-
- /**
- * The string displayed for Not_AVAILABLE
- */
- public static final String NOT_AVALAIBLE = Messages.ICellManager_NotAvailable;
-
- /**
- * the string used for <code>null</code> value
- */
- public static final String NULL_VALUE = "null"; //$NON-NLS-1$
-
- /**
- * empty string
- */
- public static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
- /**
- *
- * @param columnElement
- * the column element as described in the model (you must ignore the invert axis)
- * @param rowElement
- * the row element as described in the model (you must ignore the invert axis)
- * @param tableManager
- * the current table manager
- * @return
- * @since 3.0 : tableManager arguments added
- */
- public boolean handles(final Object columnElement, final Object rowElement, final INattableModelManager tableManager);
-
-
- /**
- *
- * @param columnElement
- * the column element as described in the model (you must ignore the invert axis)
- * @param rowElement
- * the row element as described in the model (you must ignore the invert axis)
- * @param tableManager
- * the table manager
- * @return
- * the value of the cell or {@value #NOT_AVALAIBLE} if the cell is meaningless for the couple of parameters
- *
- * THIS METHOD MUST NOT BE USED IN REPLACEMENT OF A SPECIFIC LABEL PROVIDER
- */
- public Object getValue(final Object columnElement, final Object rowElement, final INattableModelManager tableManager);
-
- /**
- * Set the newValue to the intersection of the 2 objects
- *
- * @param domain
- * the editing domain
- * @param columnElement
- * the column element as described in the model (so you must ignore the invert axis)
- * @param rowElement
- * the row element as described in the model (you must ignore the invert axis)
- * @param newValue
- * the new value
- * @param tableManager
- * the table manager
- */
- public void setValue(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager);
-
- /**
- *
- * @param columnElement
- * the column element as described in the model (you must ignore the invert axis)
- * @param rowElement
- * the row element as described in the model (you must ignore the invert axis)
- * @param tableManager
- * the current table manager
- * @return
- * <code>true</code> if the intersection of the 2 objects is editable
- * @since 3.0 tableManager arguments added
- */
- public boolean isCellEditable(final Object columnElement, final Object rowElement, final INattableModelManager tableManager);
-
- /**
- *
- * @param domain
- * the editing domain
- * @param columnElement
- * the column element as described in the model (you must ignore the invert axis)
- * @param rowElement
- * the row element as described in the model (you must ignore the invert axis)
- * @param newValue
- * the new value to set to the intersection of these 2 objects
- * @param tableManager
- * @return
- * the command to set the value or <code>null</code>
- */
- public Command getSetValueCommand(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager);
-
- /**
- *
- * @param domain
- * the editing domain
- * @param newValue
- * the newValue, represented by a String
- * @param valueConverter
- * the solver used to resolve values
- * @param columnElement
- * the columnElement
- * @param rowElement
- * the rowElement
- */
- public Command getSetStringValueCommand(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final String newValue, final AbstractStringValueConverter valueConverter, final INattableModelManager tableManager);
-
-
- /**
- *
- * @param existingConverters
- * a map with the existing converters, to avoid to create them too often
- * @param multiValueSeparator
- * the separator used for multi values
- * @param tableManager
- * the table manager
- * @return
- * the class to use to converter the string into values. If the method create them, the method must add it to the map existingConverters
- * @since 3.0 argument order changed
- */
- public AbstractStringValueConverter getOrCreateStringValueConverterClass(final Map<Class<? extends AbstractStringValueConverter>, AbstractStringValueConverter> existingConverters, final String multiValueSeparator, final INattableModelManager tableManager);
-
- /**
- * This method is used when we are pasting element in detached mode
- *
- * @param columnElement
- * the column element as described in the model (you must ignore the invert axis)
- * @param rowElement
- * the row element as described in the model (you must ignore the invert axis)
- * @param sharedMap
- * a map with shared elements
- * @param tableManager
- * the current table manager
- * @return
- * <code>true</code> if the intersection of the 2 objects is editable
- * @since 3.0 tableManager arguments added
- */
- public boolean isCellEditable(final Object columnElement, final Object rowElement, final Map<?, ?> sharedMap, final INattableModelManager tableManager);
-
- /**
- * This method is used when we are pasting elements in detached mode
- *
- * @param columnElement
- * the column element
- * @param rowElement
- * the row element
- * @param valueAsString
- * the value as string
- * @param valueConverter
- * the value converter to use
- * @param sharedMap
- * a map with shared elements. The method may read/add elements to the shared map. These contributions will be managed by a paste post
- * action or by the paste manager itself
- * @param tableManager
- * the table manager
- * @since 3.0 argument order changed
- *
- */
- public void setStringValue(final Object columnElement, final Object rowElement, final String valueAsString, final AbstractStringValueConverter valueConverter, final Map<?, ?> sharedMap, final INattableModelManager tableManager);
-}
+/*****************************************************************************
+ * Copyright (c) 2012 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
+ * Vicnent Lorenzo (CEA LIST) Bugs 516247, 515806
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.manager.cell;
+
+import java.util.Map;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.utils.CellHelper;
+import org.eclipse.papyrus.infra.ui.converter.AbstractStringValueConverter;
+
+/**
+ * The interface to implements for a cell manager
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public interface ICellManager {
+
+ /**
+ * The string displayed for Not_AVAILABLE
+ * @deprecated since 4.0
+ * use the method {@link CellHelper#getUnsupportedCellContentsText()} instead
+ */
+ public static final String NOT_AVALAIBLE = Messages.ICellManager_NotAvailable;
+
+ /**
+ * the string used for <code>null</code> value
+ */
+ public static final String NULL_VALUE = "null"; //$NON-NLS-1$
+
+ /**
+ * empty string
+ */
+ public static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ /**
+ *
+ * @param columnElement
+ * the column element as described in the model (you must ignore the invert axis)
+ * @param rowElement
+ * the row element as described in the model (you must ignore the invert axis)
+ * @param tableManager
+ * the current table manager
+ * @return
+ * @since 3.0 : tableManager arguments added
+ */
+ public boolean handles(final Object columnElement, final Object rowElement, final INattableModelManager tableManager);
+
+
+ /**
+ *
+ * @param columnElement
+ * the column element as described in the model (you must ignore the invert axis)
+ * @param rowElement
+ * the row element as described in the model (you must ignore the invert axis)
+ * @param tableManager
+ * the table manager
+ * @return
+ * the value of the cell or {@value #NOT_AVALAIBLE} if the cell is meaningless for the couple of parameters
+ *
+ * THIS METHOD MUST NOT BE USED IN REPLACEMENT OF A SPECIFIC LABEL PROVIDER
+ */
+ public Object getValue(final Object columnElement, final Object rowElement, final INattableModelManager tableManager);
+
+ /**
+ * Set the newValue to the intersection of the 2 objects
+ *
+ * @param domain
+ * the editing domain
+ * @param columnElement
+ * the column element as described in the model (so you must ignore the invert axis)
+ * @param rowElement
+ * the row element as described in the model (you must ignore the invert axis)
+ * @param newValue
+ * the new value
+ * @param tableManager
+ * the table manager
+ */
+ public void setValue(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager);
+
+ /**
+ *
+ * @param columnElement
+ * the column element as described in the model (you must ignore the invert axis)
+ * @param rowElement
+ * the row element as described in the model (you must ignore the invert axis)
+ * @param tableManager
+ * the current table manager
+ * @return
+ * <code>true</code> if the intersection of the 2 objects is editable
+ * @since 3.0 tableManager arguments added
+ */
+ public boolean isCellEditable(final Object columnElement, final Object rowElement, final INattableModelManager tableManager);
+
+ /**
+ *
+ * @param domain
+ * the editing domain
+ * @param columnElement
+ * the column element as described in the model (you must ignore the invert axis)
+ * @param rowElement
+ * the row element as described in the model (you must ignore the invert axis)
+ * @param newValue
+ * the new value to set to the intersection of these 2 objects
+ * @param tableManager
+ * @return
+ * the command to set the value or <code>null</code>
+ */
+ public Command getSetValueCommand(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager);
+
+ /**
+ *
+ * @param domain
+ * the editing domain
+ * @param newValue
+ * the newValue, represented by a String
+ * @param valueConverter
+ * the solver used to resolve values
+ * @param columnElement
+ * the columnElement
+ * @param rowElement
+ * the rowElement
+ */
+ public Command getSetStringValueCommand(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final String newValue, final AbstractStringValueConverter valueConverter, final INattableModelManager tableManager);
+
+
+ /**
+ *
+ * @param existingConverters
+ * a map with the existing converters, to avoid to create them too often
+ * @param multiValueSeparator
+ * the separator used for multi values
+ * @param tableManager
+ * the table manager
+ * @return
+ * the class to use to converter the string into values. If the method create them, the method must add it to the map existingConverters
+ * @since 3.0 argument order changed
+ */
+ public AbstractStringValueConverter getOrCreateStringValueConverterClass(final Map<Class<? extends AbstractStringValueConverter>, AbstractStringValueConverter> existingConverters, final String multiValueSeparator, final INattableModelManager tableManager);
+
+ /**
+ * This method is used when we are pasting element in detached mode
+ *
+ * @param columnElement
+ * the column element as described in the model (you must ignore the invert axis)
+ * @param rowElement
+ * the row element as described in the model (you must ignore the invert axis)
+ * @param sharedMap
+ * a map with shared elements
+ * @param tableManager
+ * the current table manager
+ * @return
+ * <code>true</code> if the intersection of the 2 objects is editable
+ * @since 3.0 tableManager arguments added
+ */
+ public boolean isCellEditable(final Object columnElement, final Object rowElement, final Map<?, ?> sharedMap, final INattableModelManager tableManager);
+
+ /**
+ * This method is used when we are pasting elements in detached mode
+ *
+ * @param columnElement
+ * the column element
+ * @param rowElement
+ * the row element
+ * @param valueAsString
+ * the value as string
+ * @param valueConverter
+ * the value converter to use
+ * @param sharedMap
+ * a map with shared elements. The method may read/add elements to the shared map. These contributions will be managed by a paste post
+ * action or by the paste manager itself
+ * @param tableManager
+ * the table manager
+ * @since 3.0 argument order changed
+ *
+ */
+ public void setStringValue(final Object columnElement, final Object rowElement, final String valueAsString, final AbstractStringValueConverter valueConverter, final Map<?, ?> sharedMap, final INattableModelManager tableManager);
+
+ /**
+ * @return the text of cell to be displayed with unsupported column
+ * @since 4.0
+ */
+ public String getUnsupportedCellContentsText();
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/StringResolutionProblemWrapperCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/StringResolutionProblemWrapperCellManager.java
index 161114dbae3..85f0f5ddab8 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/StringResolutionProblemWrapperCellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/StringResolutionProblemWrapperCellManager.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
+ * Copyright (c) 2015, 2017 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.cell;
@@ -271,4 +271,13 @@ public class StringResolutionProblemWrapperCellManager implements IUnsetValueCel
}
return null;
}
+
+ /**
+ * @return the text of cell to be displayed with unsupported column
+ * @since 4.0
+ */
+ @Override
+ public String getUnsupportedCellContentsText() {
+ return CellHelper.getUnsupportedCellContentsText();
+ }
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
index a7c441a628e..deb94c6a88e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
@@ -1,7 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012, 2017 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
@@ -9,10 +8,12 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 417095
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 417095, 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.messages;
+import javax.inject.Singleton;
+
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
@@ -496,6 +497,16 @@ public class Messages extends NLS {
public static String MatrixRelationshipDirectionLabelProvider_ColumnToRow;
+ /**
+ * @since 4.0
+ */
+ public static String CellPreferenceInitializer_NotAvailable;
+
+ /**
+ * @since 4.0
+ */
+ public static String CellPreferencePage_UnsupportedColumnCellLabel;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
index fbf2c43eae7..d3ac8c7f475 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
@@ -217,3 +217,5 @@ ExportTableDialog_OverrideConfirmMessasgeDialogText=Override confirmation
MatrixRelationshipDirectionLabelProvider_None=None
MatrixRelationshipDirectionLabelProvider_RowToColumn=From Row To Column
MatrixRelationshipDirectionLabelProvider_ColumnToRow=From Column To Row
+CellPreferenceInitializer_NotAvailable=N/A
+CellPreferencePage_UnsupportedColumnCellLabel=Define content of cell when its feature column is not supported \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/initializers/CellPreferenceInitializer.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/initializers/CellPreferenceInitializer.java
new file mode 100644
index 00000000000..dcfdd1ee59d
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/initializers/CellPreferenceInitializer.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.preferences.initializers;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.preferences.pages.CellPreferencePage;
+
+/**
+ * Initialize default preferences for cells of table.
+ *
+ * @since 4.0
+ */
+public class CellPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * The string displayed for Not_AVAILABLE
+ */
+ public static final String NOT_AVALAIBLE = Messages.CellPreferenceInitializer_NotAvailable;
+
+ /**
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = getPreferenceStore();
+ store.setDefault(CellPreferencePage.UNSUPPORTED_COLUMN_CELL_TEXT, NOT_AVALAIBLE);
+ }
+
+ /**
+ * Get the preference store.
+ */
+ protected IPreferenceStore getPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/pages/CellPreferencePage.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/pages/CellPreferencePage.java
new file mode 100644
index 00000000000..723a03ebf61
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/pages/CellPreferencePage.java
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.preferences.pages;
+
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * Preference page for configuring Papyrus NatTable cell.
+ *
+ * @since 4.0
+ */
+public class CellPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ /**
+ * Name of the Unsupported Column Cell Text preference.
+ */
+ public static final String UNSUPPORTED_COLUMN_CELL_TEXT = "unsupportedColumnCellText"; //$NON-NLS-1$
+
+ /**
+ * Default constructor.
+ */
+ public CellPreferencePage() {
+ super(GRID);
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("Papyrus cell configuration."); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void createFieldEditors() {
+ addField(new StringFieldEditor(UNSUPPORTED_COLUMN_CELL_TEXT, Messages.CellPreferencePage_UnsupportedColumnCellLabel, getFieldEditorParent()));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void init(final IWorkbench workbench) {
+ // Do nothing
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/pages/NattablePreferencePage.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/pages/NattablePreferencePage.java
new file mode 100644
index 00000000000..1172d3359a7
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/preferences/pages/NattablePreferencePage.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.preferences.pages;
+
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A preference page for options used in NatTable.
+ * @since 4.0
+ */
+public class NattablePreferencePage extends AbstractPapyrusPreferencePage {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage#createPageContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ // Do nothing - an empty page
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage#getBundleId()
+ */
+ @Override
+ protected String getBundleId() {
+ return Activator.PLUGIN_ID;
+ }
+}
+
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellHelper.java
index c549a514777..5a79ff198bf 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/CellHelper.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
+ * Copyright (c) 2014, 2017 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -7,9 +7,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.utils;
@@ -18,6 +17,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.ecore.EObject;
@@ -26,6 +26,8 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
@@ -42,6 +44,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.nattableproblem.StringR
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StyledElement;
import org.eclipse.papyrus.infra.nattable.paste.IValueSetter;
import org.eclipse.papyrus.infra.nattable.paste.ReferenceValueSetter;
+import org.eclipse.papyrus.infra.nattable.preferences.pages.CellPreferencePage;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.infra.ui.converter.ConvertedValueContainer;
@@ -154,7 +157,7 @@ public class CellHelper {
* @param valueContainer
* the converted value
* @return
- * the command to create a String resolution Problem
+ * the command to create a String resolution Problem
*/
public static final Command getCreateStringResolutionProblemCommand(final TransactionalEditingDomain domain, final INattableModelManager tableManager, final Object columnElement, final Object rowElement, final String pastedText,
final ConvertedValueContainer<?> valueContainer) {
@@ -265,7 +268,7 @@ public class CellHelper {
* @param tableManager
* the table manager
* @return
- * the command to use to destroy the string problem referenced by a cell
+ * the command to use to destroy the string problem referenced by a cell
*/
public static final Command getDestroyStringResolutionProblemCommand(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager) {
Cell cell = tableManager.getCell(columnElement, rowElement);
@@ -298,5 +301,11 @@ public class CellHelper {
return null;
}
-
+ /**
+ * @return the text of cell to be displayed with unsupported column
+ * @since 4.0
+ */
+ public static final String getUnsupportedCellContentsText() {
+ return Activator.getDefault().getPreferenceStore().getString(CellPreferencePage.UNSUPPORTED_COLUMN_CELL_TEXT);
+ }
}

Back to the top