Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-01-08 17:43:26 +0000
committervincent lorenzo2016-02-09 15:06:57 +0000
commitaa593b9a2870da6662ac032b7b3dd0e779374952 (patch)
tree2133c4e25a94675cc9f1bd529d8b77fd080dfa31 /plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInsertInNattableManager.java
parentadd5530b1037779fe0c8a40ba2db902dfe4ad670 (diff)
downloadorg.eclipse.papyrus-aa593b9a2870da6662ac032b7b3dd0e779374952.tar.gz
org.eclipse.papyrus-aa593b9a2870da6662ac032b7b3dd0e779374952.tar.xz
org.eclipse.papyrus-aa593b9a2870da6662ac032b7b3dd0e779374952.zip
Bug 481310: [Table] Paste in table with several categories for the same
depth and all categories hidden https://bugs.eclipse.org/bugs/show_bug.cgi?id=481310 The max depth is calculated before the check of paste configuration to check only the needed ones. Change-Id: I42cf00039b732379682e195ce744e7a84bda12ab Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInsertInNattableManager.java')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInsertInNattableManager.java80
1 files changed, 43 insertions, 37 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInsertInNattableManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInsertInNattableManager.java
index 33605280376..b8dcbec2a6f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInsertInNattableManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/AbstractPasteImportInsertInNattableManager.java
@@ -464,55 +464,61 @@ public abstract class AbstractPasteImportInsertInNattableManager {
*
* @param manager
* The nattable model manager.
+ * @param maxDepth The maximum depth to check.
* @return The status of the check.
*/
- protected IStatus checkTreeTableConfiguration(final INattableModelManager manager) {
+ protected IStatus checkTreeTableConfiguration(final INattableModelManager manager, final int maxDepth) {
IStatus status = Status.OK_STATUS;
// we check than there is only one categories by hidden depth
final List<Integer> hiddenCategories = StyleUtils.getHiddenDepths(manager);
for (final Integer current : hiddenCategories) {
- final int size = FillingConfigurationUtils.getAllTreeFillingConfigurationForDepth(manager.getTable(), current.intValue()).size();
- if (size > 1) {
- status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__MORE_THAN_ONE_CATEGORY_FOR_A_HIDDEN_DEPTH,
- NLS.bind(Messages.AbstractPasteImportInsertInNattableManager_YouHaveMoreThan1Category, current.intValue()), null);
+ if(current <= maxDepth){
+ final int size = FillingConfigurationUtils.getAllTreeFillingConfigurationForDepth(manager.getTable(), current.intValue()).size();
+ if (size > 1) {
+ status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__MORE_THAN_ONE_CATEGORY_FOR_A_HIDDEN_DEPTH,
+ NLS.bind(Messages.AbstractPasteImportInsertInNattableManager_YouHaveMoreThan1Category, current.intValue()), null);
+ }
}
}
if (status.isOK()) {
for (final TreeFillingConfiguration current : FillingConfigurationUtils.getAllTreeFillingConfiguration(manager.getTable())) {
- final PasteEObjectConfiguration conf = current.getPasteConfiguration();
- if (conf == null) {
- // TODO : add detail of the error in message
- status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__NO_PASTE_CONFIGURATION,
- Messages.AbstractPasteImportInsertInNattableManager_ThereIsNoPasteConfgurationForATreeFillingConfiguration,
- null);
- } else {
-
- final String elementTypeId = conf.getPastedElementId();
- if (elementTypeId == null || elementTypeId.isEmpty()) {
- status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__NO_ELEMENT_TYPE_IN_PASTE_CONFIGURATION,
- Messages.AbstractPasteImportInsertInNattableManager_ThereIsNoElementIdDefinedInThePasteConfiguration, null);
- } else if (!ElementTypeUtils.getAllExistingElementTypesIds().contains(elementTypeId)) {
- status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__UNKNOWN_ELEMENT_TYPE,
- String.format(Messages.AbstractPasteImportInsertInNattableManager_TheElementTypeIsUnknown, elementTypeId), null);
- }
-
-
- if (status.isOK()) {
- final EStructuralFeature feature = conf.getPasteElementContainementFeature();
- if (feature == null) {
- final IAxis axis = current.getAxisUsedAsAxisProvider();
- final NatTable natTable = manager.getAdapter(NatTable.class);
- final LabelProviderContextElementWrapper wrapper = new LabelProviderContextElementWrapper();
- wrapper.setObject(axis);
- wrapper.setConfigRegistry(natTable.getConfigRegistry());
- final LabelProviderService serv = natTable.getConfigRegistry().getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
- ILabelProvider p = serv.getLabelProvider(wrapper);
- p = serv.getLabelProvider(Constants.HEADER_LABEL_PROVIDER_CONTEXT);
- final String categoryName = p.getText(axis);
- status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__NO_CONTAINMENT_FEATURE,
- String.format(Messages.AbstractPasteImportInsertInNattableManager_PasteConfigurationFeatureHasNotBeenSet, categoryName, current.getDepth()), null);
+ if(current.getDepth() <= maxDepth){
+
+ final PasteEObjectConfiguration conf = current.getPasteConfiguration();
+ if (conf == null) {
+ // TODO : add detail of the error in message
+ status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__NO_PASTE_CONFIGURATION,
+ Messages.AbstractPasteImportInsertInNattableManager_ThereIsNoPasteConfgurationForATreeFillingConfiguration,
+ null);
+ } else {
+
+ final String elementTypeId = conf.getPastedElementId();
+ if (elementTypeId == null || elementTypeId.isEmpty()) {
+ status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__NO_ELEMENT_TYPE_IN_PASTE_CONFIGURATION,
+ Messages.AbstractPasteImportInsertInNattableManager_ThereIsNoElementIdDefinedInThePasteConfiguration, null);
+ } else if (!ElementTypeUtils.getAllExistingElementTypesIds().contains(elementTypeId)) {
+ status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__UNKNOWN_ELEMENT_TYPE,
+ String.format(Messages.AbstractPasteImportInsertInNattableManager_TheElementTypeIsUnknown, elementTypeId), null);
+ }
+
+
+ if (status.isOK()) {
+ final EStructuralFeature feature = conf.getPasteElementContainementFeature();
+ if (feature == null) {
+ final IAxis axis = current.getAxisUsedAsAxisProvider();
+ final NatTable natTable = manager.getAdapter(NatTable.class);
+ final LabelProviderContextElementWrapper wrapper = new LabelProviderContextElementWrapper();
+ wrapper.setObject(axis);
+ wrapper.setConfigRegistry(natTable.getConfigRegistry());
+ final LabelProviderService serv = natTable.getConfigRegistry().getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+ ILabelProvider p = serv.getLabelProvider(wrapper);
+ p = serv.getLabelProvider(Constants.HEADER_LABEL_PROVIDER_CONTEXT);
+ final String categoryName = p.getText(axis);
+ status = new PapyrusNattableStatus(IPapyrusNattableStatus.PASTE_CONFIGURATiON_ERROR, Activator.PLUGIN_ID, PasteSeverityCode.PASTE_ERROR__NO_CONTAINMENT_FEATURE,
+ String.format(Messages.AbstractPasteImportInsertInNattableManager_PasteConfigurationFeatureHasNotBeenSet, categoryName, current.getDepth()), null);
+ }
}
}
}

Back to the top