From dfde8d8f86597c0cf94f964de459f62becf243b0 Mon Sep 17 00:00:00 2001 From: TruongQuangSB Date: Thu, 8 Jan 2026 16:13:22 +0100 Subject: [PATCH 1/3] Modify CompareCellContent --- .../cacheservice/CacheServiceImpl.java | 15 +- .../set/core/services/cache/CacheService.java | 12 +- .../core/services/cache/NoCacheService.java | 7 +- .../export/pdf/TableToTableDocument.xtend | 21 +- .../pt1/sskp/SskpTransformationService.java | 24 +- .../MixedStringCellComparatorTest.xtend | 5 +- .../table/diff/TableProjectDiffService.java | 27 +- .../table/diff/TableStateDiffService.java | 38 ++- ...ntent_newValue_CompareStateCellContent.gif | Bin 0 -> 223 bytes ...ntent_newValue_CompareTableCellContent.gif | Bin 0 -> 223 bytes ...Content_newValue_MultiColorCellContent.gif | Bin 0 -> 223 bytes ...CellContent_newValue_StringCellContent.gif | Bin 0 -> 223 bytes ...ntent_oldValue_CompareStateCellContent.gif | Bin 0 -> 223 bytes ...ntent_oldValue_CompareTableCellContent.gif | Bin 0 -> 223 bytes ...Content_oldValue_MultiColorCellContent.gif | Bin 0 -> 223 bytes ...CellContent_oldValue_StringCellContent.gif | Bin 0 -> 223 bytes ...lanCellContent_CompareStateCellContent.gif | Bin 0 -> 223 bytes ...lanCellContent_CompareStateCellContent.gif | Bin 0 -> 223 bytes ...leCell_content_CompareStateCellContent.gif | Bin 0 -> 223 bytes .../full/obj16/CompareStateCellContent.gif | Bin 0 -> 129 bytes .../plugin.properties | 3 + .../CompareCellContentItemProvider.java | 161 ---------- .../CompareStateCellContentItemProvider.java | 214 +++++++++++++ .../CompareTableCellContentItemProvider.java | 4 +- .../provider/TableCellItemProvider.java | 2 +- .../TablemodelItemProviderAdapterFactory.java | 20 +- .../extensions/CellContentExtensionsTest.java | 15 +- .../extensions/CellContentExtensions.xtend | 38 ++- .../model/tablemodel.ecore | 18 +- .../model/tablemodel.genmodel | 6 +- .../model/tablemodel/CompareCellContent.java | 61 ---- .../tablemodel/CompareStateCellContent.java | 85 ++++++ .../model/tablemodel/TablemodelFactory.java | 6 +- .../model/tablemodel/TablemodelPackage.java | 106 ++++--- .../impl/CompareCellContentImpl.java | 192 ------------ .../impl/CompareStateCellContentImpl.java | 284 ++++++++++++++++++ .../impl/TablemodelFactoryImpl.java | 10 +- .../impl/TablemodelPackageImpl.java | 56 ++-- .../util/TablemodelAdapterFactory.java | 19 +- .../tablemodel/util/TablemodelSwitch.java | 14 +- .../extensions/StellBereichExtensions.java | 4 +- .../extensions/UrObjectExtensions.xtend | 5 +- .../TableModelInstanceBodyDataProvider.java | 36 ++- .../set/utils/table/TableSpanUtils.java | 25 +- .../sorting/AbstractCellComparator.xtend | 15 +- 45 files changed, 885 insertions(+), 663 deletions(-) create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_newValue_CompareStateCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_newValue_CompareTableCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_newValue_MultiColorCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_newValue_StringCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_oldValue_CompareStateCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_oldValue_CompareTableCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_oldValue_MultiColorCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_oldValue_StringCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareTableCellContent_comparePlanCellContent_CompareStateCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareTableCellContent_mainPlanCellContent_CompareStateCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateTableCell_content_CompareStateCellContent.gif create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/obj16/CompareStateCellContent.gif delete mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/CompareCellContentItemProvider.java create mode 100644 java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/CompareStateCellContentItemProvider.java delete mode 100644 java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/CompareCellContent.java create mode 100644 java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/CompareStateCellContent.java delete mode 100644 java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/CompareCellContentImpl.java create mode 100644 java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/CompareStateCellContentImpl.java diff --git a/java/bundles/org.eclipse.set.application/src/org/eclipse/set/application/cacheservice/CacheServiceImpl.java b/java/bundles/org.eclipse.set.application/src/org/eclipse/set/application/cacheservice/CacheServiceImpl.java index 2614f7b78a..1ea6c6c53e 100644 --- a/java/bundles/org.eclipse.set.application/src/org/eclipse/set/application/cacheservice/CacheServiceImpl.java +++ b/java/bundles/org.eclipse.set.application/src/org/eclipse/set/application/cacheservice/CacheServiceImpl.java @@ -8,9 +8,11 @@ */ package org.eclipse.set.application.cacheservice; +import java.util.Arrays; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; import org.eclipse.e4.core.services.events.IEventBroker; import org.eclipse.set.basis.IModelSession; @@ -58,10 +60,8 @@ public Cache getCache(final PlanPro_Schnittstelle schnittstelle, @Override public Cache getCache(final PlanPro_Schnittstelle schnittstelle, - final String cacheId, final String containerCacheId) - throws IllegalArgumentException { - return getCache(getSessionRole(schnittstelle), cacheId, - containerCacheId); + final String... cacheId) throws IllegalArgumentException { + return getCache(getSessionRole(schnittstelle), cacheId); } private void invalidate(final ToolboxFileRole role) { @@ -126,9 +126,10 @@ public Cache getCache(final ToolboxFileRole role, final String cacheId) } @Override - public Cache getCache(final ToolboxFileRole role, final String cacheId, - final String containerCacheId) throws IllegalArgumentException { - final String cacheKey = cacheId + "/" + containerCacheId; //$NON-NLS-1$ + public Cache getCache(final ToolboxFileRole role, final String... cacheId) + throws IllegalArgumentException { + final String cacheKey = Arrays.stream(cacheId) + .collect(Collectors.joining("/")); //$NON-NLS-1$ return getCache(role, cacheKey); } diff --git a/java/bundles/org.eclipse.set.core.services/src/org/eclipse/set/core/services/cache/CacheService.java b/java/bundles/org.eclipse.set.core.services/src/org/eclipse/set/core/services/cache/CacheService.java index 9d7b1a2929..ae74323d16 100644 --- a/java/bundles/org.eclipse.set.core.services/src/org/eclipse/set/core/services/cache/CacheService.java +++ b/java/bundles/org.eclipse.set.core.services/src/org/eclipse/set/core/services/cache/CacheService.java @@ -38,15 +38,13 @@ public Cache getCache(PlanPro_Schnittstelle schnittstelle, String cacheId) * the {@link PlanPro_Schnittstelle} * @param cacheId * the id for the cache - * @param containerCacheId - * the id for the container to consider * @return the container cache * * @throws IllegalArgumentException * if no cache for the given id is found */ - public Cache getCache(PlanPro_Schnittstelle schnittstelle, String cacheId, - String containerCacheId) throws IllegalArgumentException; + public Cache getCache(PlanPro_Schnittstelle schnittstelle, + String... cacheId) throws IllegalArgumentException; /** * check if already storage cache @@ -80,15 +78,13 @@ public Cache getCache(ToolboxFileRole role, String cacheId) * {@link ToolboxFileRole} * @param cacheId * the id for the cache - * @param containerCacheId - * the id for the container to consider * @return the container cache * * @throws IllegalArgumentException * if no cache for the given id is found */ - public Cache getCache(ToolboxFileRole role, String cacheId, - String containerCacheId) throws IllegalArgumentException; + public Cache getCache(ToolboxFileRole role, String... cacheId) + throws IllegalArgumentException; /** * check if already storage cache diff --git a/java/bundles/org.eclipse.set.core.services/src/org/eclipse/set/core/services/cache/NoCacheService.java b/java/bundles/org.eclipse.set.core.services/src/org/eclipse/set/core/services/cache/NoCacheService.java index 478a17e92c..feb874ebc9 100644 --- a/java/bundles/org.eclipse.set.core.services/src/org/eclipse/set/core/services/cache/NoCacheService.java +++ b/java/bundles/org.eclipse.set.core.services/src/org/eclipse/set/core/services/cache/NoCacheService.java @@ -36,8 +36,7 @@ public Cache getCache(final PlanPro_Schnittstelle schnittStellle, @Override public Cache getCache(final PlanPro_Schnittstelle schnittStellle, - final String cacheId, final String containerCacheId) - throws IllegalArgumentException { + final String... cacheId) throws IllegalArgumentException { return new NoCache(); } @@ -54,8 +53,8 @@ public Cache getCache(final ToolboxFileRole role, final String cacheId) } @Override - public Cache getCache(final ToolboxFileRole role, final String cacheId, - final String containerCacheId) throws IllegalArgumentException { + public Cache getCache(final ToolboxFileRole role, final String... cacheId) + throws IllegalArgumentException { return new NoCache(); } diff --git a/java/bundles/org.eclipse.set.feature.export/src/org/eclipse/set/feature/export/pdf/TableToTableDocument.xtend b/java/bundles/org.eclipse.set.feature.export/src/org/eclipse/set/feature/export/pdf/TableToTableDocument.xtend index 99bb47388c..3ec54f07c6 100644 --- a/java/bundles/org.eclipse.set.feature.export/src/org/eclipse/set/feature/export/pdf/TableToTableDocument.xtend +++ b/java/bundles/org.eclipse.set.feature.export/src/org/eclipse/set/feature/export/pdf/TableToTableDocument.xtend @@ -17,13 +17,16 @@ import javax.imageio.ImageIO import javax.xml.parsers.DocumentBuilderFactory import javax.xml.parsers.ParserConfigurationException import org.eclipse.set.basis.FreeFieldInfo +import org.eclipse.set.basis.constants.ToolboxConstants import org.eclipse.set.model.tablemodel.CellContent -import org.eclipse.set.model.tablemodel.CompareCellContent import org.eclipse.set.model.tablemodel.CompareFootnoteContainer +import org.eclipse.set.model.tablemodel.CompareStateCellContent import org.eclipse.set.model.tablemodel.CompareTableCellContent +import org.eclipse.set.model.tablemodel.CompareTableFootnoteContainer import org.eclipse.set.model.tablemodel.FootnoteContainer import org.eclipse.set.model.tablemodel.MultiColorCellContent import org.eclipse.set.model.tablemodel.MultiColorContent +import org.eclipse.set.model.tablemodel.PlanCompareRow import org.eclipse.set.model.tablemodel.SimpleFootnoteContainer import org.eclipse.set.model.tablemodel.Table import org.eclipse.set.model.tablemodel.TableContent @@ -41,15 +44,12 @@ import org.w3c.dom.Document import org.w3c.dom.Element import static extension org.eclipse.set.model.tablemodel.extensions.CellContentExtensions.* +import static extension org.eclipse.set.model.tablemodel.extensions.TableCellExtensions.* import static extension org.eclipse.set.model.tablemodel.extensions.TableContentExtensions.* import static extension org.eclipse.set.model.tablemodel.extensions.TableExtensions.* -import static extension org.eclipse.set.model.tablemodel.extensions.TableCellExtensions.* import static extension org.eclipse.set.model.tablemodel.extensions.TableRowExtensions.* import static extension org.eclipse.set.utils.StringExtensions.* import static extension org.eclipse.set.utils.export.xsl.siteplan.SiteplanXSL.pxToMilimeter -import org.eclipse.set.basis.constants.ToolboxConstants -import org.eclipse.set.model.tablemodel.PlanCompareRow -import org.eclipse.set.model.tablemodel.CompareTableFootnoteContainer /** * Transformation from {@link Table} to TableDocument {@link Document}. @@ -343,12 +343,12 @@ class TableToTableDocument { } } - private def dispatch Element createContent(CompareCellContent content, + private def dispatch Element createContent(CompareStateCellContent content, FootnoteContainer fc, int columnNumber, boolean isRemarkColumn) { val element = doc.createElement("DiffContent") formatCompareContent( - content.oldValue, - content.newValue, + content.oldValue.stringValueIterable, + content.newValue.stringValueIterable, [doc.createElement("OldValue")], [doc.createElement("UnchangedValue")], [doc.createElement("NewValue")], @@ -487,8 +487,9 @@ class TableToTableDocument { private def Element addContentToElement(String content, Element element, int columnNumber, boolean isRemarkColumn) { val checkOutput = content.checkForTestOutput(columnNumber) - element.textContent = isRemarkColumn ? checkOutput : checkOutput. - intersperseWithZeroSpacesSC + element.textContent = isRemarkColumn + ? checkOutput + : checkOutput.intersperseWithZeroSpacesSC return element } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskp/SskpTransformationService.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskp/SskpTransformationService.java index c2948ebe66..8fbe58c1d6 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskp/SskpTransformationService.java +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskp/SskpTransformationService.java @@ -26,18 +26,20 @@ import org.eclipse.set.model.planpro.Basisobjekte.Punkt_Objekt; import org.eclipse.set.model.planpro.PZB.PZB_Element; import org.eclipse.set.model.tablemodel.ColumnDescriptor; -import org.eclipse.set.model.tablemodel.CompareCellContent; +import org.eclipse.set.model.tablemodel.CompareStateCellContent; import org.eclipse.set.model.tablemodel.MultiColorCellContent; import org.eclipse.set.model.tablemodel.MultiColorContent; import org.eclipse.set.model.tablemodel.RowGroup; import org.eclipse.set.model.tablemodel.RowMergeMode; import org.eclipse.set.model.tablemodel.StringCellContent; import org.eclipse.set.model.tablemodel.TableCell; +import org.eclipse.set.model.tablemodel.extensions.CellContentExtensions; import org.eclipse.set.ppmodel.extensions.PZBElementExtensions; import org.eclipse.set.ppmodel.extensions.utils.TableNameInfo; import org.eclipse.set.utils.table.ColumnDescriptorModelBuilder; import org.eclipse.set.utils.table.sorting.ComparatorBuilder.CellComparatorType; import org.eclipse.set.utils.table.sorting.TableRowGroupComparator; +import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.event.EventAdmin; @@ -91,15 +93,19 @@ private static String getCellContent(final TableCell cell) { if (cell.getContent() instanceof final StringCellContent cellContent) { return getFirstOrNull(cellContent.getValue()); } - if (cell.getContent() instanceof final CompareCellContent cellContent) { - if (cellContent.getNewValue().isEmpty() - || cellContent.getOldValue().isEmpty()) { - return Optional - .ofNullable(getFirstOrNull(cellContent.getNewValue())) - .orElse(getFirstOrNull(cellContent.getOldValue())); + if (cell.getContent() instanceof final CompareStateCellContent cellContent) { + final List oldValues = IterableExtensions + .toList(CellContentExtensions + .getStringValueIterable(cellContent.getOldValue())); + final List newValues = IterableExtensions + .toList(CellContentExtensions + .getStringValueIterable(cellContent.getNewValue())); + if (oldValues.isEmpty() || newValues.isEmpty()) { + return Optional.ofNullable(getFirstOrNull(newValues)) + .orElse(getFirstOrNull(oldValues)); } - return cellContent.getNewValue().get(0) + cellContent.getSeparator() - + cellContent.getOldValue().get(0); + return newValues.get(0) + cellContent.getSeparator() + + oldValues.get(0); } if (cell.getContent() instanceof final MultiColorCellContent cellContent) { final MultiColorContent firstOrNull = getFirstOrNull( diff --git a/java/bundles/org.eclipse.set.feature.table.test/src/org/eclipse/set/feature/table/sorting/MixedStringCellComparatorTest.xtend b/java/bundles/org.eclipse.set.feature.table.test/src/org/eclipse/set/feature/table/sorting/MixedStringCellComparatorTest.xtend index e467dc3fa9..3461290aaf 100644 --- a/java/bundles/org.eclipse.set.feature.table.test/src/org/eclipse/set/feature/table/sorting/MixedStringCellComparatorTest.xtend +++ b/java/bundles/org.eclipse.set.feature.table.test/src/org/eclipse/set/feature/table/sorting/MixedStringCellComparatorTest.xtend @@ -14,6 +14,7 @@ import org.eclipse.set.utils.table.sorting.MixedStringCellComparator import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import static org.eclipse.set.model.tablemodel.extensions.CellContentExtensions.createStringCellContent import static org.hamcrest.MatcherAssert.assertThat import static org.hamcrest.core.Is.* import static org.junit.jupiter.api.Assertions.* @@ -35,8 +36,8 @@ class MixedStringCellComparatorTest { @Test def void testMixedCells() { val cell1 = TablemodelFactory.eINSTANCE.createTableCell - val content1 = TablemodelFactory.eINSTANCE.createCompareCellContent - content1.newValue.add("86W9") + val content1 = TablemodelFactory.eINSTANCE.createCompareStateCellContent + content1.newValue = createStringCellContent("86W9") cell1.content = content1 val cell2 = TablemodelFactory.eINSTANCE.createTableCell diff --git a/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableProjectDiffService.java b/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableProjectDiffService.java index 238880ae23..a7543331ed 100644 --- a/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableProjectDiffService.java +++ b/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableProjectDiffService.java @@ -10,6 +10,7 @@ */ package org.eclipse.set.feature.table.diff; +import static org.eclipse.set.model.tablemodel.extensions.CellContentExtensions.getStringValueList; import static org.eclipse.set.ppmodel.extensions.EObjectExtensions.getNullableObject; import java.util.ArrayList; @@ -23,7 +24,7 @@ import org.eclipse.set.core.services.session.SessionService; import org.eclipse.set.model.tablemodel.CellContent; import org.eclipse.set.model.tablemodel.ColumnDescriptor; -import org.eclipse.set.model.tablemodel.CompareCellContent; +import org.eclipse.set.model.tablemodel.CompareStateCellContent; import org.eclipse.set.model.tablemodel.CompareTableCellContent; import org.eclipse.set.model.tablemodel.CompareTableFootnoteContainer; import org.eclipse.set.model.tablemodel.FootnoteContainer; @@ -270,7 +271,7 @@ protected boolean isSameValue(final CellContent first, return switch (first) { case final StringCellContent stringContent -> isSameValue( stringContent, second); - case final CompareCellContent compareContent -> isSameValue( + case final CompareStateCellContent compareContent -> isSameValue( compareContent, second); case final MultiColorCellContent multiColorContent -> isSameValue( multiColorContent, second); @@ -311,7 +312,8 @@ private static CompareTableFootnoteContainer createCompareTableFootnoteContainer * the {@link CellContent} * @return true, if the table cell haven same value */ - protected boolean isSameValue(final CompareCellContent firstCellContent, + protected boolean isSameValue( + final CompareStateCellContent firstCellContent, final CellContent secondCellContent) { // Compare between CompareCellContent with another cell content is only // in compare table between two Project available. @@ -323,10 +325,10 @@ protected boolean isSameValue(final CompareCellContent firstCellContent, .createStringCellContent(); if (tableType == TableType.INITIAL) { compareCellStringContent.getValue() - .addAll(firstCellContent.getOldValue()); + .addAll(getStringValueList(firstCellContent.getOldValue())); } else { compareCellStringContent.getValue() - .addAll(firstCellContent.getNewValue()); + .addAll(getStringValueList(firstCellContent.getNewValue())); } return isSameValue(compareCellStringContent, secondCellContent); } @@ -384,17 +386,18 @@ protected boolean isSameValue(final StringCellContent firstCellContent, .collect(Collectors.toSet()); yield firstValues.equals(secondValues); } - case final CompareCellContent compareContent -> { + case final CompareStateCellContent compareContent -> { final TableType tableType = getSessionService() .getLoadedSession(ToolboxFileRole.SESSION) .getTableType(); final Set values = switch (tableType) { - case TableType.INITIAL -> compareContent.getOldValue() - .stream() - .filter(value -> value != null - && !value.trim().isEmpty()) - .collect(Collectors.toSet()); - default -> compareContent.getNewValue() + case TableType.INITIAL -> getStringValueList( + compareContent.getOldValue()) + .stream() + .filter(value -> value != null + && !value.trim().isEmpty()) + .collect(Collectors.toSet()); + default -> getStringValueList(compareContent.getNewValue()) .stream() .filter(value -> value != null && !value.trim().isEmpty()) diff --git a/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableStateDiffService.java b/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableStateDiffService.java index be30f68bed..351e3a471a 100644 --- a/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableStateDiffService.java +++ b/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableStateDiffService.java @@ -10,6 +10,7 @@ */ package org.eclipse.set.feature.table.diff; +import static org.eclipse.set.model.tablemodel.extensions.CellContentExtensions.createStringCellContent; import static org.eclipse.set.model.tablemodel.extensions.TableCellExtensions.getIterableStringValue; import java.util.Collections; @@ -17,12 +18,12 @@ import org.eclipse.set.core.services.session.SessionService; import org.eclipse.set.model.tablemodel.CellContent; -import org.eclipse.set.model.tablemodel.CompareCellContent; +import org.eclipse.set.model.tablemodel.CompareStateCellContent; import org.eclipse.set.model.tablemodel.MultiColorCellContent; +import org.eclipse.set.model.tablemodel.StringCellContent; import org.eclipse.set.model.tablemodel.TableCell; import org.eclipse.set.model.tablemodel.TablemodelFactory; import org.eclipse.set.model.tablemodel.extensions.CellContentExtensions; -import org.eclipse.set.model.tablemodel.extensions.TableCellExtensions; import org.eclipse.set.ppmodel.extensions.EObjectExtensions; import org.eclipse.set.services.table.TableDiffService; import org.osgi.service.component.annotations.Component; @@ -52,16 +53,23 @@ CellContent createDiffContent(final TableCell oldCell, return oldCell.getContent(); } + if (!StringCellContent.class.isInstance(oldCell.getContent()) + || newCell != null && !StringCellContent.class + .isInstance(newCell.getContent())) { + throw new IllegalArgumentException( + "Can create CompareStateCellContent only from StringCellContent"); //$NON-NLS-1$ + } + final Set oldValues = getIterableStringValue(oldCell); final Set newValues = newCell == null ? Collections.emptySet() : getIterableStringValue(newCell); if (oldValues.equals(newValues)) { return null; } - final CompareCellContent compareContent = TablemodelFactory.eINSTANCE - .createCompareCellContent(); - compareContent.getOldValue().addAll(oldValues); - compareContent.getNewValue().addAll(newValues); + final CompareStateCellContent compareContent = TablemodelFactory.eINSTANCE + .createCompareStateCellContent(); + compareContent.setOldValue(createStringCellContent(oldValues)); + compareContent.setNewValue(createStringCellContent(newValues)); compareContent.setSeparator(EObjectExtensions .getNullableObject(oldCell, c -> c.getContent().getSeparator()) .orElse(null)); @@ -85,17 +93,19 @@ private static void createMultiColorDiffCotent(final TableCell oldCell, // Convert to CompareCellContent, when give different between // initial // and final state - final CompareCellContent compareCellContent = TablemodelFactory.eINSTANCE - .createCompareCellContent(); + final CompareStateCellContent compareCellContent = TablemodelFactory.eINSTANCE + .createCompareStateCellContent(); oldCellContent.getValue() - .forEach(colorContent -> compareCellContent.getOldValue() - .add(String.format(colorContent.getStringFormat(), - colorContent.getMultiColorValue()))); + .forEach(colorContent -> compareCellContent + .setOldValue(createStringCellContent(String.format( + colorContent.getStringFormat(), + colorContent.getMultiColorValue())))); newCellContent.getValue() - .forEach(colorContent -> compareCellContent.getNewValue() - .add(String.format(colorContent.getStringFormat(), - colorContent.getMultiColorValue()))); + .forEach(colorContent -> compareCellContent + .setNewValue(createStringCellContent(String.format( + colorContent.getStringFormat(), + colorContent.getMultiColorValue())))); oldCell.setContent(compareCellContent); } } diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_newValue_CompareStateCellContent.gif b/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_newValue_CompareStateCellContent.gif new file mode 100644 index 0000000000000000000000000000000000000000..a47b32b7d9b44ea2d815901ae43becbeeedfca1e GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6?0NB`=jP3{GiMwQ9Qgk~etx|D|NHh0 z4GqZRyQZrF(bh@I>$>EZHc8E^6q{Kh{O|93Ao~0HJP`ePzWDduW}s;hp!k!85ya8~ z5g+&ksNMH=u@DGqnEfK*!=jVzObZj-MmLCOy}(CuxeQ_e&*b zItOaZUVegIq)%(ksgrJ23_5D}yf*NMONcgbmWINNs1ULB`Ej71uwNAfG&u7S~ OX-aKu%2rimum%9!dt-S3 literal 0 HcmV?d00001 diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_newValue_MultiColorCellContent.gif b/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_newValue_MultiColorCellContent.gif new file mode 100644 index 0000000000000000000000000000000000000000..5a20caaa7157853274e799c0bbe34f2685272dae GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6yx8;NX3xztX=e^N9Qgk~etx|D|NHh0 z4GnuUm4mOV*ROub(! zIny~%WA^eB>>_3tK1kH}_2{@ihKy(sM0)lBSq?zf^Lj zbD+lTg4sA2Ytgb#~OwlghEaFf5$Qgb_3>-5X?e1@Ew Nrqsr!Y*j@DYXID%Vjchh literal 0 HcmV?d00001 diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_oldValue_CompareStateCellContent.gif b/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_oldValue_CompareStateCellContent.gif new file mode 100644 index 0000000000000000000000000000000000000000..a47b32b7d9b44ea2d815901ae43becbeeedfca1e GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6?0NB`=jP3{GiMwQ9Qgk~etx|D|NHh0 z4GqZRyQZrF(bh@I>$>EZHc8E^6q{Kh{O|93Ao~0HJP`ePzWDduW}s;hp!k!85ya8~ z5g+&ksNMH=u@DGqnEfK*!=jVzObZj-MmLCOy}(CuxeQ_e&*b zItOaZUVegIq)%(ksgrJ23_5D}yf*NMONcgbmWINNs1ULB`Ej71uwNAfG&u7S~ OX-aKu%2rimum%9!dt-S3 literal 0 HcmV?d00001 diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_oldValue_MultiColorCellContent.gif b/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareStateCellContent_oldValue_MultiColorCellContent.gif new file mode 100644 index 0000000000000000000000000000000000000000..5a20caaa7157853274e799c0bbe34f2685272dae GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6yx8;NX3xztX=e^N9Qgk~etx|D|NHh0 z4GnuUm4mOV*ROub(! zIny~%WA^eB>>_3tK1kH}_2{@ihKy(sM0)lBSq?zf^Lj zbD+lTg4sA2Ytgb#~OwlghEaFf5$Qgb_3>-5X?e1@Ew Nrqsr!Y*j@DYXID%Vjchh literal 0 HcmV?d00001 diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareTableCellContent_comparePlanCellContent_CompareStateCellContent.gif b/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareTableCellContent_comparePlanCellContent_CompareStateCellContent.gif new file mode 100644 index 0000000000000000000000000000000000000000..d6ef26260ca3cd812a2910c14b6c650030166327 GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6?0NB`=jP3{GiMwQ9Qgk~etx|D|NHh0 z4Gjkl9GEj_4v-Oi?AWg9YCyDglJdGP`K3)#^D4z=mI(j*`yPn?em)OGf1WS?eYY8C z8U!f*WMKrcbU*~iP6pN(1%MmLCOy}(CuxeQ_e&*b zItOaZUVegIq)%(ksgrJ23_5D}yf*NMONcgbmWINNs1ULB`Ej71uwNAfG&u7S~ OX-aKu%2rimum%A3b7Oe` literal 0 HcmV?d00001 diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareTableCellContent_mainPlanCellContent_CompareStateCellContent.gif b/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateCompareTableCellContent_mainPlanCellContent_CompareStateCellContent.gif new file mode 100644 index 0000000000000000000000000000000000000000..d6ef26260ca3cd812a2910c14b6c650030166327 GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6?0NB`=jP3{GiMwQ9Qgk~etx|D|NHh0 z4Gjkl9GEj_4v-Oi?AWg9YCyDglJdGP`K3)#^D4z=mI(j*`yPn?em)OGf1WS?eYY8C z8U!f*WMKrcbU*~iP6pN(1%MmLCOy}(CuxeQ_e&*b zItOaZUVegIq)%(ksgrJ23_5D}yf*NMONcgbmWINNs1ULB`Ej71uwNAfG&u7S~ OX-aKu%2rimum%A3b7Oe` literal 0 HcmV?d00001 diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateTableCell_content_CompareStateCellContent.gif b/java/bundles/org.eclipse.set.model.tablemodel.edit/icons/full/ctool16/CreateTableCell_content_CompareStateCellContent.gif new file mode 100644 index 0000000000000000000000000000000000000000..88d8844103d0fb748775ce56a9fbe63061b24999 GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6?0NB`=jP3{GiMwQ9Qgk~etx|D|NHh0 z4Gq7)etmQF=>7TgFI86Vnyv;!TPG>6>ylsEBsH&6Y-Wk@zrXK+=;I&}kR~x;L)6}k- WmG`XF - * - * @generated - */ -public class CompareCellContentItemProvider extends CellContentItemProvider { - /** - * This constructs an instance from a factory and a notifier. - * - * @generated - */ - public CompareCellContentItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. - * - * @generated - */ - @Override - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addOldValuePropertyDescriptor(object); - addNewValuePropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Old Value feature. - * - * @generated - */ - protected void addOldValuePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor( - ((ComposeableAdapterFactory) adapterFactory) - .getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_CompareCellContent_oldValue_feature"), - getString("_UI_PropertyDescriptor_description", - "_UI_CompareCellContent_oldValue_feature", - "_UI_CompareCellContent_type"), - TablemodelPackage.Literals.COMPARE_CELL_CONTENT__OLD_VALUE, - true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, null)); - } - - /** - * This adds a property descriptor for the New Value feature. - * - * @generated - */ - protected void addNewValuePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor( - ((ComposeableAdapterFactory) adapterFactory) - .getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_CompareCellContent_newValue_feature"), - getString("_UI_PropertyDescriptor_description", - "_UI_CompareCellContent_newValue_feature", - "_UI_CompareCellContent_type"), - TablemodelPackage.Literals.COMPARE_CELL_CONTENT__NEW_VALUE, - true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, - null, null)); - } - - /** - * This returns CompareCellContent.gif. - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, - getResourceLocator().getImage("full/obj16/CompareCellContent")); - } - - /** - * This returns the label text for the adapted class. - * - * @generated - */ - @Override - public String getText(Object object) { - String label = ((CompareCellContent) object).getSeparator(); - return label == null || label.length() == 0 - ? getString("_UI_CompareCellContent_type") - : getString("_UI_CompareCellContent_type") + " " + label; - } - - /** - * This handles model notifications by calling {@link #updateChildren} to - * update any cached children and by creating a viewer notification, which - * it passes to {@link #fireNotifyChanged}. - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(CompareCellContent.class)) { - case TablemodelPackage.COMPARE_CELL_CONTENT__OLD_VALUE: - case TablemodelPackage.COMPARE_CELL_CONTENT__NEW_VALUE: - fireNotifyChanged(new ViewerNotification(notification, - notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing the children that can be created under this object. - * - * @generated - */ - @Override - protected void collectNewChildDescriptors( - Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - -} diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/CompareStateCellContentItemProvider.java b/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/CompareStateCellContentItemProvider.java new file mode 100644 index 0000000000..cf810fb14c --- /dev/null +++ b/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/CompareStateCellContentItemProvider.java @@ -0,0 +1,214 @@ +/** + * Copyright (c) 2022 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.model.tablemodel.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import org.eclipse.set.model.tablemodel.CompareStateCellContent; +import org.eclipse.set.model.tablemodel.TablemodelFactory; +import org.eclipse.set.model.tablemodel.TablemodelPackage; + +/** + * This is the item provider adapter for a + * {@link org.eclipse.set.model.tablemodel.CompareStateCellContent} object. + * + * @generated + */ +public class CompareStateCellContentItemProvider + extends CellContentItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public CompareStateCellContentItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This specifies how to implement {@link #getChildren} and is used to + * deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, + * {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in + * {@link #createCommand}. + * + * @generated + */ + @Override + public Collection getChildrenFeatures( + Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__OLD_VALUE); + childrenFeatures.add( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__NEW_VALUE); + } + return childrenFeatures; + } + + /** + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper + // feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns CompareStateCellContent.gif. + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator() + .getImage("full/obj16/CompareStateCellContent")); + } + + /** + * This returns the label text for the adapted class. + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((CompareStateCellContent) object).getSeparator(); + return label == null || label.length() == 0 + ? getString("_UI_CompareStateCellContent_type") + : getString("_UI_CompareStateCellContent_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to + * update any cached children and by creating a viewer notification, which + * it passes to {@link #fireNotifyChanged}. + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(CompareStateCellContent.class)) { + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE: + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE: + fireNotifyChanged(new ViewerNotification(notification, + notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s + * describing the children that can be created under this object. + * + * @generated + */ + @Override + protected void collectNewChildDescriptors( + Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(createChildParameter( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__OLD_VALUE, + TablemodelFactory.eINSTANCE.createStringCellContent())); + + newChildDescriptors.add(createChildParameter( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__OLD_VALUE, + TablemodelFactory.eINSTANCE.createCompareStateCellContent())); + + newChildDescriptors.add(createChildParameter( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__OLD_VALUE, + TablemodelFactory.eINSTANCE.createMultiColorCellContent())); + + newChildDescriptors.add(createChildParameter( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__OLD_VALUE, + TablemodelFactory.eINSTANCE.createCompareTableCellContent())); + + newChildDescriptors.add(createChildParameter( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__NEW_VALUE, + TablemodelFactory.eINSTANCE.createStringCellContent())); + + newChildDescriptors.add(createChildParameter( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__NEW_VALUE, + TablemodelFactory.eINSTANCE.createCompareStateCellContent())); + + newChildDescriptors.add(createChildParameter( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__NEW_VALUE, + TablemodelFactory.eINSTANCE.createMultiColorCellContent())); + + newChildDescriptors.add(createChildParameter( + TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__NEW_VALUE, + TablemodelFactory.eINSTANCE.createCompareTableCellContent())); + } + + /** + * This returns the label text for + * {@link org.eclipse.emf.edit.command.CreateChildCommand}. + * + * @generated + */ + @Override + public String getCreateChildText(Object owner, Object feature, Object child, + Collection selection) { + Object childFeature = feature; + Object childObject = child; + + boolean qualify = childFeature == TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__OLD_VALUE + || childFeature == TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT__NEW_VALUE; + + if (qualify) { + return getString("_UI_CreateChild_text2", + new Object[] { getTypeText(childObject), + getFeatureText(childFeature), getTypeText(owner) }); + } + return super.getCreateChildText(owner, feature, child, selection); + } + +} diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/CompareTableCellContentItemProvider.java b/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/CompareTableCellContentItemProvider.java index 02e66c93d5..1d08bf5419 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/CompareTableCellContentItemProvider.java +++ b/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/CompareTableCellContentItemProvider.java @@ -160,7 +160,7 @@ protected void collectNewChildDescriptors( newChildDescriptors.add(createChildParameter( TablemodelPackage.Literals.COMPARE_TABLE_CELL_CONTENT__MAIN_PLAN_CELL_CONTENT, - TablemodelFactory.eINSTANCE.createCompareCellContent())); + TablemodelFactory.eINSTANCE.createCompareStateCellContent())); newChildDescriptors.add(createChildParameter( TablemodelPackage.Literals.COMPARE_TABLE_CELL_CONTENT__MAIN_PLAN_CELL_CONTENT, @@ -176,7 +176,7 @@ protected void collectNewChildDescriptors( newChildDescriptors.add(createChildParameter( TablemodelPackage.Literals.COMPARE_TABLE_CELL_CONTENT__COMPARE_PLAN_CELL_CONTENT, - TablemodelFactory.eINSTANCE.createCompareCellContent())); + TablemodelFactory.eINSTANCE.createCompareStateCellContent())); newChildDescriptors.add(createChildParameter( TablemodelPackage.Literals.COMPARE_TABLE_CELL_CONTENT__COMPARE_PLAN_CELL_CONTENT, diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/TableCellItemProvider.java b/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/TableCellItemProvider.java index c8647fc333..17ef503c07 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/TableCellItemProvider.java +++ b/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/TableCellItemProvider.java @@ -186,7 +186,7 @@ protected void collectNewChildDescriptors( newChildDescriptors.add(createChildParameter( TablemodelPackage.Literals.TABLE_CELL__CONTENT, - TablemodelFactory.eINSTANCE.createCompareCellContent())); + TablemodelFactory.eINSTANCE.createCompareStateCellContent())); newChildDescriptors.add(createChildParameter( TablemodelPackage.Literals.TABLE_CELL__CONTENT, diff --git a/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/TablemodelItemProviderAdapterFactory.java b/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/TablemodelItemProviderAdapterFactory.java index 567a13c9ff..5e105833f8 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/TablemodelItemProviderAdapterFactory.java +++ b/java/bundles/org.eclipse.set.model.tablemodel.edit/src/org/eclipse/set/model/tablemodel/provider/TablemodelItemProviderAdapterFactory.java @@ -261,28 +261,28 @@ public Adapter createStringCellContentAdapter() { /** * This keeps track of the one adapter used for all - * {@link org.eclipse.set.model.tablemodel.CompareCellContent} instances. - * + * {@link org.eclipse.set.model.tablemodel.CompareStateCellContent} + * instances. * * @generated */ - protected CompareCellContentItemProvider compareCellContentItemProvider; + protected CompareStateCellContentItemProvider compareStateCellContentItemProvider; /** * This creates an adapter for a - * {@link org.eclipse.set.model.tablemodel.CompareCellContent}. * * @generated */ @Override - public Adapter createCompareCellContentAdapter() { - if (compareCellContentItemProvider == null) { - compareCellContentItemProvider = new CompareCellContentItemProvider( + public Adapter createCompareStateCellContentAdapter() { + if (compareStateCellContentItemProvider == null) { + compareStateCellContentItemProvider = new CompareStateCellContentItemProvider( this); } - return compareCellContentItemProvider; + return compareStateCellContentItemProvider; } /** @@ -612,8 +612,8 @@ public void dispose() { tableCellItemProvider.dispose(); if (stringCellContentItemProvider != null) stringCellContentItemProvider.dispose(); - if (compareCellContentItemProvider != null) - compareCellContentItemProvider.dispose(); + if (compareStateCellContentItemProvider != null) + compareStateCellContentItemProvider.dispose(); if (cellAnnotationItemProvider != null) cellAnnotationItemProvider.dispose(); if (multiColorCellContentItemProvider != null) diff --git a/java/bundles/org.eclipse.set.model.tablemodel.extensions.test/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensionsTest.java b/java/bundles/org.eclipse.set.model.tablemodel.extensions.test/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensionsTest.java index 7af4f88317..e2747275b3 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.extensions.test/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensionsTest.java +++ b/java/bundles/org.eclipse.set.model.tablemodel.extensions.test/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensionsTest.java @@ -12,7 +12,7 @@ import static org.hamcrest.core.Is.is; import org.eclipse.set.model.tablemodel.CellContent; -import org.eclipse.set.model.tablemodel.CompareCellContent; +import org.eclipse.set.model.tablemodel.CompareStateCellContent; import org.eclipse.set.model.tablemodel.StringCellContent; import org.eclipse.set.model.tablemodel.TableCell; import org.eclipse.set.model.tablemodel.TablemodelFactory; @@ -26,12 +26,12 @@ @SuppressWarnings("nls") public class CellContentExtensionsTest { - private static CompareCellContent createCompareCellContent( + private static CompareStateCellContent createCompareCellContent( final String oldValue, final String newValue) { - final CompareCellContent content = TablemodelFactory.eINSTANCE - .createCompareCellContent(); - content.getOldValue().add(oldValue); - content.getNewValue().add(newValue); + final CompareStateCellContent content = TablemodelFactory.eINSTANCE + .createCompareStateCellContent(); + content.setOldValue(createStringCellContent(oldValue)); + content.setNewValue(createStringCellContent(newValue)); final TableCell tableCell = TablemodelFactory.eINSTANCE .createTableCell(); tableCell.setContent(content); @@ -43,9 +43,6 @@ private static StringCellContent createStringCellContent( final StringCellContent content = TablemodelFactory.eINSTANCE .createStringCellContent(); content.getValue().add(value); - final TableCell tableCell = TablemodelFactory.eINSTANCE - .createTableCell(); - tableCell.setContent(content); return content; } diff --git a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensions.xtend b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensions.xtend index a986735f66..33d68ccfb3 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensions.xtend +++ b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensions.xtend @@ -14,8 +14,8 @@ import java.util.function.BiFunction import java.util.function.Function import org.eclipse.set.model.planpro.Basisobjekte.Bearbeitungsvermerk import org.eclipse.set.model.tablemodel.CellContent -import org.eclipse.set.model.tablemodel.CompareCellContent import org.eclipse.set.model.tablemodel.CompareFootnoteContainer +import org.eclipse.set.model.tablemodel.CompareStateCellContent import org.eclipse.set.model.tablemodel.CompareTableCellContent import org.eclipse.set.model.tablemodel.CompareTableFootnoteContainer import org.eclipse.set.model.tablemodel.FootnoteContainer @@ -24,12 +24,14 @@ import org.eclipse.set.model.tablemodel.MultiColorContent import org.eclipse.set.model.tablemodel.SimpleFootnoteContainer import org.eclipse.set.model.tablemodel.StringCellContent import org.eclipse.set.model.tablemodel.TableCell +import org.eclipse.set.model.tablemodel.TablemodelFactory import org.eclipse.set.utils.ToolboxConfiguration import static org.eclipse.set.model.tablemodel.extensions.Utils.* import static extension org.eclipse.set.model.tablemodel.extensions.TableCellExtensions.* import static extension org.eclipse.set.utils.StringExtensions.* +import java.util.List /** * Extensions for {@link CellContent}. @@ -69,10 +71,11 @@ class CellContentExtensions { »«content.valueFormat»

''' } - static def dispatch String getRichTextValue(CompareCellContent content) { + static def dispatch String getRichTextValue( + CompareStateCellContent content) { val result = formatCompareContent( - content.oldValue, - content.newValue, + content.oldValue.stringValueIterable, + content.newValue.stringValueIterable, [WARNING_MARK_YELLOW], [WARNING_MARK_BLACK], [WARNING_MARK_RED], @@ -184,8 +187,9 @@ class CellContentExtensions { return content.value.iterableToString(content.separator) } - static def dispatch String getPlainStringValue(CompareCellContent content) { - return '''«content.oldValue»/«content.newValue»''' + static def dispatch String getPlainStringValue( + CompareStateCellContent content) { + return '''«content.oldValue.plainStringValue»/«content.newValue.plainStringValue»''' } static def dispatch String getPlainStringValue( @@ -217,6 +221,10 @@ class CellContentExtensions { return content.value } + static def List getStringValueList(CellContent content) { + return content.stringValueIterable.toList + } + /** * @param text the text * @@ -311,9 +319,10 @@ class CellContentExtensions { content.value.filterNull.toSet.toList.map [ postFormatter.apply(it, commonFormatter.apply(it)) ] - CompareCellContent: - formatCompareContent(content.oldValue, content.newValue, - oldFormatter, commonFormatter, newFormatter, postFormatter) + CompareStateCellContent: + formatCompareContent(content.oldValue.stringValueIterable, + content.newValue.stringValueIterable, oldFormatter, + commonFormatter, newFormatter, postFormatter) CompareTableCellContent: formatCompareContent(content.mainPlanCellContent, oldFormatter, commonFormatter, newFormatter, postFormatter) @@ -430,4 +439,15 @@ class CellContentExtensions { def static boolean isEqual(CellContent content, CellContent other) { return content.plainStringValue.equals(other.plainStringValue) } + + def static StringCellContent createStringCellContent(String value) { + return createStringCellContent(#[value]) + } + + def static StringCellContent createStringCellContent( + Iterable value) { + val cellContent = TablemodelFactory.eINSTANCE.createStringCellContent + cellContent.value.addAll(value) + return cellContent + } } diff --git a/java/bundles/org.eclipse.set.model.tablemodel/model/tablemodel.ecore b/java/bundles/org.eclipse.set.model.tablemodel/model/tablemodel.ecore index 03148d0b6e..d2ceb384bb 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel/model/tablemodel.ecore +++ b/java/bundles/org.eclipse.set.model.tablemodel/model/tablemodel.ecore @@ -154,22 +154,14 @@ - +
- - -
- - - - -
- - + + diff --git a/java/bundles/org.eclipse.set.model.tablemodel/model/tablemodel.genmodel b/java/bundles/org.eclipse.set.model.tablemodel/model/tablemodel.genmodel index 5903ab4377..55db599a75 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel/model/tablemodel.genmodel +++ b/java/bundles/org.eclipse.set.model.tablemodel/model/tablemodel.genmodel @@ -63,9 +63,9 @@ - - - + + + diff --git a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/CompareCellContent.java b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/CompareCellContent.java deleted file mode 100644 index 70861e00c9..0000000000 --- a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/CompareCellContent.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) 2022 DB Netz AG and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v2.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v20.html - */ -package org.eclipse.set.model.tablemodel; - -import org.eclipse.emf.common.util.EList; - -/** - * A representation of the model object 'Compare - * Cell Content'. - * - * Result of a compare operation between two cells. - * - * - *

- * The following features are supported: - *

- *
    - *
  • {@link org.eclipse.set.model.tablemodel.CompareCellContent#getOldValue - * Old Value}
  • - *
  • {@link org.eclipse.set.model.tablemodel.CompareCellContent#getNewValue - * New Value}
  • - *
- * - * @see org.eclipse.set.model.tablemodel.TablemodelPackage#getCompareCellContent() - * @model - * @generated - */ -public interface CompareCellContent extends CellContent { - /** - * Returns the value of the 'Old Value' attribute list. The - * list contents are of type {@link java.lang.String}. The old value - * - * @return the value of the 'Old Value' attribute list. - * @see org.eclipse.set.model.tablemodel.TablemodelPackage#getCompareCellContent_OldValue() - * @model - * @generated - */ - EList getOldValue(); - - /** - * Returns the value of the 'New Value' attribute list. The - * list contents are of type {@link java.lang.String}. The new value - * - * @return the value of the 'New Value' attribute list. - * @see org.eclipse.set.model.tablemodel.TablemodelPackage#getCompareCellContent_NewValue() - * @model - * @generated - */ - EList getNewValue(); - -} // CompareCellContent diff --git a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/CompareStateCellContent.java b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/CompareStateCellContent.java new file mode 100644 index 0000000000..6216ae66d6 --- /dev/null +++ b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/CompareStateCellContent.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2022 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.model.tablemodel; + +/** + * A representation of the model object 'Compare + * State Cell Content'. + * + * Result of a compare operation between two cells. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.set.model.tablemodel.CompareStateCellContent#getOldValue + * Old Value}
  • + *
  • {@link org.eclipse.set.model.tablemodel.CompareStateCellContent#getNewValue + * New Value}
  • + *
+ * + * @see org.eclipse.set.model.tablemodel.TablemodelPackage#getCompareStateCellContent() + * @model + * @generated + */ +public interface CompareStateCellContent extends CellContent { + /** + * Returns the value of the 'Old Value' containment + * reference. + * + * @return the value of the 'Old Value' containment reference. + * @see #setOldValue(CellContent) + * @see org.eclipse.set.model.tablemodel.TablemodelPackage#getCompareStateCellContent_OldValue() + * @model containment="true" + * @generated + */ + CellContent getOldValue(); + + /** + * Sets the value of the + * '{@link org.eclipse.set.model.tablemodel.CompareStateCellContent#getOldValue + * Old Value}' containment reference. + * + * @param value + * the new value of the 'Old Value' containment + * reference. + * @see #getOldValue() + * @generated + */ + void setOldValue(CellContent value); + + /** + * Returns the value of the 'New Value' containment + * reference. + * + * @return the value of the 'New Value' containment reference. + * @see #setNewValue(CellContent) + * @see org.eclipse.set.model.tablemodel.TablemodelPackage#getCompareStateCellContent_NewValue() + * @model containment="true" + * @generated + */ + CellContent getNewValue(); + + /** + * Sets the value of the + * '{@link org.eclipse.set.model.tablemodel.CompareStateCellContent#getNewValue + * New Value}' containment reference. + * + * @param value + * the new value of the 'New Value' containment + * reference. + * @see #getNewValue() + * @generated + */ + void setNewValue(CellContent value); + +} // CompareStateCellContent diff --git a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/TablemodelFactory.java b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/TablemodelFactory.java index 4e06d84410..837e2cbcc1 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/TablemodelFactory.java +++ b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/TablemodelFactory.java @@ -91,13 +91,13 @@ public interface TablemodelFactory extends EFactory { StringCellContent createStringCellContent(); /** - * Returns a new object of class 'Compare Cell Content'. * - * @return a new object of class 'Compare Cell Content'. + * @return a new object of class 'Compare State Cell Content'. * @generated */ - CompareCellContent createCompareCellContent(); + CompareStateCellContent createCompareStateCellContent(); /** * Returns a new object of class 'Cell Annotation'. * - * @see org.eclipse.set.model.tablemodel.impl.CompareCellContentImpl - * @see org.eclipse.set.model.tablemodel.impl.TablemodelPackageImpl#getCompareCellContent() + * @see org.eclipse.set.model.tablemodel.impl.CompareStateCellContentImpl + * @see org.eclipse.set.model.tablemodel.impl.TablemodelPackageImpl#getCompareStateCellContent() * @generated */ - int COMPARE_CELL_CONTENT = 8; + int COMPARE_STATE_CELL_CONTENT = 8; /** * The feature id for the 'Separator' attribute. + * The feature id for the 'Old Value' containment reference. + * * * @generated * @ordered */ - int COMPARE_CELL_CONTENT__OLD_VALUE = CELL_CONTENT_FEATURE_COUNT + 0; + int COMPARE_STATE_CELL_CONTENT__OLD_VALUE = CELL_CONTENT_FEATURE_COUNT + 0; /** - * The feature id for the 'New Value' attribute list. + * The feature id for the 'New Value' containment reference. + * * * @generated * @ordered */ - int COMPARE_CELL_CONTENT__NEW_VALUE = CELL_CONTENT_FEATURE_COUNT + 1; + int COMPARE_STATE_CELL_CONTENT__NEW_VALUE = CELL_CONTENT_FEATURE_COUNT + 1; /** - * The number of structural features of the 'Compare Cell Content' - * class. + * The number of structural features of the 'Compare State Cell + * Content' class. * * @generated * @ordered */ - int COMPARE_CELL_CONTENT_FEATURE_COUNT = CELL_CONTENT_FEATURE_COUNT + 2; + int COMPARE_STATE_CELL_CONTENT_FEATURE_COUNT = CELL_CONTENT_FEATURE_COUNT + + 2; /** - * The number of operations of the 'Compare Cell Content' class. - * + * The number of operations of the 'Compare State Cell Content' + * class. * * @generated * @ordered */ - int COMPARE_CELL_CONTENT_OPERATION_COUNT = CELL_CONTENT_OPERATION_COUNT + 0; + int COMPARE_STATE_CELL_CONTENT_OPERATION_COUNT = CELL_CONTENT_OPERATION_COUNT + + 0; /** * The meta object id for the @@ -1448,38 +1450,41 @@ public interface TablemodelPackage extends EPackage { /** * Returns the meta object for class - * '{@link org.eclipse.set.model.tablemodel.CompareCellContent Compare - * Cell Content}'. + * '{@link org.eclipse.set.model.tablemodel.CompareStateCellContent + * Compare State Cell Content}'. * - * @return the meta object for class 'Compare Cell Content'. - * @see org.eclipse.set.model.tablemodel.CompareCellContent + * @return the meta object for class 'Compare State Cell Content'. + * @see org.eclipse.set.model.tablemodel.CompareStateCellContent * @generated */ - EClass getCompareCellContent(); + EClass getCompareStateCellContent(); /** - * Returns the meta object for the attribute list - * '{@link org.eclipse.set.model.tablemodel.CompareCellContent#getOldValue + * Returns the meta object for the containment reference + * '{@link org.eclipse.set.model.tablemodel.CompareStateCellContent#getOldValue * Old Value}'. * - * @return the meta object for the attribute list 'Old Value'. - * @see org.eclipse.set.model.tablemodel.CompareCellContent#getOldValue() - * @see #getCompareCellContent() + * @return the meta object for the containment reference 'Old + * Value'. + * @see org.eclipse.set.model.tablemodel.CompareStateCellContent#getOldValue() + * @see #getCompareStateCellContent() * @generated */ - EAttribute getCompareCellContent_OldValue(); + EReference getCompareStateCellContent_OldValue(); /** - * Returns the meta object for the attribute list - * '{@link org.eclipse.set.model.tablemodel.CompareCellContent#getNewValue + * Returns the meta object for the containment reference + * '{@link org.eclipse.set.model.tablemodel.CompareStateCellContent#getNewValue * New Value}'. * - * @return the meta object for the attribute list 'New Value'. - * @see org.eclipse.set.model.tablemodel.CompareCellContent#getNewValue() - * @see #getCompareCellContent() + * @return the meta object for the containment reference 'New + * Value'. + * @see org.eclipse.set.model.tablemodel.CompareStateCellContent#getNewValue() + * @see #getCompareStateCellContent() * @generated */ - EAttribute getCompareCellContent_NewValue(); + EReference getCompareStateCellContent_NewValue(); /** * Returns the meta object for class @@ -2121,33 +2126,36 @@ interface Literals { /** * The meta object literal for the - * '{@link org.eclipse.set.model.tablemodel.impl.CompareCellContentImpl - * Compare Cell Content}' class. + * '{@link org.eclipse.set.model.tablemodel.impl.CompareStateCellContentImpl + * Compare State Cell Content}' class. + * * - * @see org.eclipse.set.model.tablemodel.impl.CompareCellContentImpl - * @see org.eclipse.set.model.tablemodel.impl.TablemodelPackageImpl#getCompareCellContent() + * @see org.eclipse.set.model.tablemodel.impl.CompareStateCellContentImpl + * @see org.eclipse.set.model.tablemodel.impl.TablemodelPackageImpl#getCompareStateCellContent() * @generated */ - EClass COMPARE_CELL_CONTENT = eINSTANCE.getCompareCellContent(); + EClass COMPARE_STATE_CELL_CONTENT = eINSTANCE + .getCompareStateCellContent(); /** - * The meta object literal for the 'Old Value' attribute - * list feature. + * The meta object literal for the 'Old Value' + * containment reference feature. * * @generated */ - EAttribute COMPARE_CELL_CONTENT__OLD_VALUE = eINSTANCE - .getCompareCellContent_OldValue(); + EReference COMPARE_STATE_CELL_CONTENT__OLD_VALUE = eINSTANCE + .getCompareStateCellContent_OldValue(); /** - * The meta object literal for the 'New Value' attribute - * list feature. + * The meta object literal for the 'New Value' + * containment reference feature. * * @generated */ - EAttribute COMPARE_CELL_CONTENT__NEW_VALUE = eINSTANCE - .getCompareCellContent_NewValue(); + EReference COMPARE_STATE_CELL_CONTENT__NEW_VALUE = eINSTANCE + .getCompareStateCellContent_NewValue(); /** * The meta object literal for the diff --git a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/CompareCellContentImpl.java b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/CompareCellContentImpl.java deleted file mode 100644 index 7328d8c8f1..0000000000 --- a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/CompareCellContentImpl.java +++ /dev/null @@ -1,192 +0,0 @@ -/** - * Copyright (c) 2022 DB Netz AG and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v2.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v20.html - */ -package org.eclipse.set.model.tablemodel.impl; - -import java.util.Collection; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; -import org.eclipse.set.model.tablemodel.CompareCellContent; -import org.eclipse.set.model.tablemodel.TablemodelPackage; - -/** - * An implementation of the model object 'Compare - * Cell Content'. - *

- * The following features are implemented: - *

- *
    - *
  • {@link org.eclipse.set.model.tablemodel.impl.CompareCellContentImpl#getOldValue - * Old Value}
  • - *
  • {@link org.eclipse.set.model.tablemodel.impl.CompareCellContentImpl#getNewValue - * New Value}
  • - *
- * - * @generated - */ -public class CompareCellContentImpl extends CellContentImpl - implements CompareCellContent { - /** - * The cached value of the '{@link #getOldValue() Old Value}' - * attribute list. - * - * @see #getOldValue() - * @generated - * @ordered - */ - protected EList oldValue; - - /** - * The cached value of the '{@link #getNewValue() New Value}' - * attribute list. - * - * @see #getNewValue() - * @generated - * @ordered - */ - protected EList newValue; - - /** - * - * - * @generated - */ - protected CompareCellContentImpl() { - super(); - } - - /** - * - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return TablemodelPackage.Literals.COMPARE_CELL_CONTENT; - } - - /** - * - * - * @generated - */ - @Override - public EList getOldValue() { - if (oldValue == null) { - oldValue = new EDataTypeUniqueEList(String.class, this, - TablemodelPackage.COMPARE_CELL_CONTENT__OLD_VALUE); - } - return oldValue; - } - - /** - * - * - * @generated - */ - @Override - public EList getNewValue() { - if (newValue == null) { - newValue = new EDataTypeUniqueEList(String.class, this, - TablemodelPackage.COMPARE_CELL_CONTENT__NEW_VALUE); - } - return newValue; - } - - /** - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TablemodelPackage.COMPARE_CELL_CONTENT__OLD_VALUE: - return getOldValue(); - case TablemodelPackage.COMPARE_CELL_CONTENT__NEW_VALUE: - return getNewValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TablemodelPackage.COMPARE_CELL_CONTENT__OLD_VALUE: - getOldValue().clear(); - getOldValue().addAll((Collection) newValue); - return; - case TablemodelPackage.COMPARE_CELL_CONTENT__NEW_VALUE: - getNewValue().clear(); - getNewValue().addAll((Collection) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case TablemodelPackage.COMPARE_CELL_CONTENT__OLD_VALUE: - getOldValue().clear(); - return; - case TablemodelPackage.COMPARE_CELL_CONTENT__NEW_VALUE: - getNewValue().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case TablemodelPackage.COMPARE_CELL_CONTENT__OLD_VALUE: - return oldValue != null && !oldValue.isEmpty(); - case TablemodelPackage.COMPARE_CELL_CONTENT__NEW_VALUE: - return newValue != null && !newValue.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuilder result = new StringBuilder(super.toString()); - result.append(" (oldValue: "); - result.append(oldValue); - result.append(", newValue: "); - result.append(newValue); - result.append(')'); - return result.toString(); - } - -} // CompareCellContentImpl diff --git a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/CompareStateCellContentImpl.java b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/CompareStateCellContentImpl.java new file mode 100644 index 0000000000..fcaa5bea05 --- /dev/null +++ b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/CompareStateCellContentImpl.java @@ -0,0 +1,284 @@ +/** + * Copyright (c) 2022 DB Netz AG and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + */ +package org.eclipse.set.model.tablemodel.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.set.model.tablemodel.CellContent; +import org.eclipse.set.model.tablemodel.CompareStateCellContent; +import org.eclipse.set.model.tablemodel.TablemodelPackage; + +/** + * An implementation of the model object 'Compare + * State Cell Content'. + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.set.model.tablemodel.impl.CompareStateCellContentImpl#getOldValue + * Old Value}
  • + *
  • {@link org.eclipse.set.model.tablemodel.impl.CompareStateCellContentImpl#getNewValue + * New Value}
  • + *
+ * + * @generated + */ +public class CompareStateCellContentImpl extends CellContentImpl + implements CompareStateCellContent { + /** + * The cached value of the '{@link #getOldValue() Old Value}' + * containment reference. + * + * @see #getOldValue() + * @generated + * @ordered + */ + protected CellContent oldValue; + + /** + * The cached value of the '{@link #getNewValue() New Value}' + * containment reference. + * + * @see #getNewValue() + * @generated + * @ordered + */ + protected CellContent newValue; + + /** + * + * + * @generated + */ + protected CompareStateCellContentImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return TablemodelPackage.Literals.COMPARE_STATE_CELL_CONTENT; + } + + /** + * + * + * @generated + */ + @Override + public CellContent getOldValue() { + return oldValue; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetOldValue(CellContent newOldValue, + NotificationChain msgs) { + CellContent oldOldValue = oldValue; + oldValue = newOldValue; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, + Notification.SET, + TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE, + oldOldValue, newOldValue); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + @Override + public void setOldValue(CellContent newOldValue) { + if (newOldValue != oldValue) { + NotificationChain msgs = null; + if (oldValue != null) + msgs = ((InternalEObject) oldValue).eInverseRemove(this, + EOPPOSITE_FEATURE_BASE + - TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE, + null, msgs); + if (newOldValue != null) + msgs = ((InternalEObject) newOldValue).eInverseAdd(this, + EOPPOSITE_FEATURE_BASE + - TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE, + null, msgs); + msgs = basicSetOldValue(newOldValue, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE, + newOldValue, newOldValue)); + } + + /** + * + * + * @generated + */ + @Override + public CellContent getNewValue() { + return newValue; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetNewValue(CellContent newNewValue, + NotificationChain msgs) { + CellContent oldNewValue = newValue; + newValue = newNewValue; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, + Notification.SET, + TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE, + oldNewValue, newNewValue); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + @Override + public void setNewValue(CellContent newNewValue) { + if (newNewValue != newValue) { + NotificationChain msgs = null; + if (newValue != null) + msgs = ((InternalEObject) newValue).eInverseRemove(this, + EOPPOSITE_FEATURE_BASE + - TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE, + null, msgs); + if (newNewValue != null) + msgs = ((InternalEObject) newNewValue).eInverseAdd(this, + EOPPOSITE_FEATURE_BASE + - TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE, + null, msgs); + msgs = basicSetNewValue(newNewValue, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE, + newNewValue, newNewValue)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, + int featureID, NotificationChain msgs) { + switch (featureID) { + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE: + return basicSetOldValue(null, msgs); + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE: + return basicSetNewValue(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE: + return getOldValue(); + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE: + return getNewValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE: + setOldValue((CellContent) newValue); + return; + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE: + setNewValue((CellContent) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE: + setOldValue((CellContent) null); + return; + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE: + setNewValue((CellContent) null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__OLD_VALUE: + return oldValue != null; + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT__NEW_VALUE: + return newValue != null; + } + return super.eIsSet(featureID); + } + +} // CompareStateCellContentImpl diff --git a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/TablemodelFactoryImpl.java b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/TablemodelFactoryImpl.java index 5884444a05..437c2b1cb4 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/TablemodelFactoryImpl.java +++ b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/TablemodelFactoryImpl.java @@ -78,8 +78,8 @@ public EObject create(EClass eClass) { return createTableCell(); case TablemodelPackage.STRING_CELL_CONTENT: return createStringCellContent(); - case TablemodelPackage.COMPARE_CELL_CONTENT: - return createCompareCellContent(); + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT: + return createCompareStateCellContent(); case TablemodelPackage.CELL_ANNOTATION: return createCellAnnotation(); case TablemodelPackage.MULTI_COLOR_CELL_CONTENT: @@ -227,9 +227,9 @@ public StringCellContent createStringCellContent() { * @generated */ @Override - public CompareCellContent createCompareCellContent() { - CompareCellContentImpl compareCellContent = new CompareCellContentImpl(); - return compareCellContent; + public CompareStateCellContent createCompareStateCellContent() { + CompareStateCellContentImpl compareStateCellContent = new CompareStateCellContentImpl(); + return compareStateCellContent; } /** diff --git a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/TablemodelPackageImpl.java b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/TablemodelPackageImpl.java index 37e0965751..3b6e398821 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/TablemodelPackageImpl.java +++ b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/impl/TablemodelPackageImpl.java @@ -22,8 +22,8 @@ import org.eclipse.set.model.tablemodel.CellContent; import org.eclipse.set.model.tablemodel.ColumnDescriptor; import org.eclipse.set.model.tablemodel.ColumnWidthMode; -import org.eclipse.set.model.tablemodel.CompareCellContent; import org.eclipse.set.model.tablemodel.CompareFootnoteContainer; +import org.eclipse.set.model.tablemodel.CompareStateCellContent; import org.eclipse.set.model.tablemodel.CompareTableCellContent; import org.eclipse.set.model.tablemodel.CompareTableFootnoteContainer; import org.eclipse.set.model.tablemodel.FootnoteContainer; @@ -137,7 +137,7 @@ public class TablemodelPackageImpl extends EPackageImpl * * @generated */ - private EClass compareCellContentEClass = null; + private EClass compareStateCellContentEClass = null; /** * @@ -660,8 +660,8 @@ public EAttribute getStringCellContent_Value() { * @generated */ @Override - public EClass getCompareCellContent() { - return compareCellContentEClass; + public EClass getCompareStateCellContent() { + return compareStateCellContentEClass; } /** @@ -670,8 +670,9 @@ public EClass getCompareCellContent() { * @generated */ @Override - public EAttribute getCompareCellContent_OldValue() { - return (EAttribute) compareCellContentEClass.getEStructuralFeatures() + public EReference getCompareStateCellContent_OldValue() { + return (EReference) compareStateCellContentEClass + .getEStructuralFeatures() .get(0); } @@ -681,8 +682,9 @@ public EAttribute getCompareCellContent_OldValue() { * @generated */ @Override - public EAttribute getCompareCellContent_NewValue() { - return (EAttribute) compareCellContentEClass.getEStructuralFeatures() + public EReference getCompareStateCellContent_NewValue() { + return (EReference) compareStateCellContentEClass + .getEStructuralFeatures() .get(1); } @@ -1029,11 +1031,12 @@ public void createPackageContents() { stringCellContentEClass = createEClass(STRING_CELL_CONTENT); createEAttribute(stringCellContentEClass, STRING_CELL_CONTENT__VALUE); - compareCellContentEClass = createEClass(COMPARE_CELL_CONTENT); - createEAttribute(compareCellContentEClass, - COMPARE_CELL_CONTENT__OLD_VALUE); - createEAttribute(compareCellContentEClass, - COMPARE_CELL_CONTENT__NEW_VALUE); + compareStateCellContentEClass = createEClass( + COMPARE_STATE_CELL_CONTENT); + createEReference(compareStateCellContentEClass, + COMPARE_STATE_CELL_CONTENT__OLD_VALUE); + createEReference(compareStateCellContentEClass, + COMPARE_STATE_CELL_CONTENT__NEW_VALUE); cellAnnotationEClass = createEClass(CELL_ANNOTATION); @@ -1123,7 +1126,8 @@ public void initializePackageContents() { // Add supertypes to classes stringCellContentEClass.getESuperTypes().add(this.getCellContent()); - compareCellContentEClass.getESuperTypes().add(this.getCellContent()); + compareStateCellContentEClass.getESuperTypes() + .add(this.getCellContent()); multiColorCellContentEClass.getESuperTypes().add(this.getCellContent()); compareFootnoteContainerEClass.getESuperTypes() .add(this.getFootnoteContainer()); @@ -1268,19 +1272,19 @@ public void initializePackageContents() { !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEClass(compareCellContentEClass, CompareCellContent.class, - "CompareCellContent", !IS_ABSTRACT, !IS_INTERFACE, + initEClass(compareStateCellContentEClass, CompareStateCellContent.class, + "CompareStateCellContent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getCompareCellContent_OldValue(), - ecorePackage.getEString(), "oldValue", null, 0, -1, - CompareCellContent.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); - initEAttribute(getCompareCellContent_NewValue(), - ecorePackage.getEString(), "newValue", null, 0, -1, - CompareCellContent.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); + initEReference(getCompareStateCellContent_OldValue(), + this.getCellContent(), null, "oldValue", null, 0, 1, + CompareStateCellContent.class, !IS_TRANSIENT, !IS_VOLATILE, + IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getCompareStateCellContent_NewValue(), + this.getCellContent(), null, "newValue", null, 0, 1, + CompareStateCellContent.class, !IS_TRANSIENT, !IS_VOLATILE, + IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(cellAnnotationEClass, CellAnnotation.class, "CellAnnotation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/util/TablemodelAdapterFactory.java b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/util/TablemodelAdapterFactory.java index 2f623acc1b..13dd464f93 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/util/TablemodelAdapterFactory.java +++ b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/util/TablemodelAdapterFactory.java @@ -113,8 +113,9 @@ public Adapter caseStringCellContent(StringCellContent object) { } @Override - public Adapter caseCompareCellContent(CompareCellContent object) { - return createCompareCellContentAdapter(); + public Adapter caseCompareStateCellContent( + CompareStateCellContent object) { + return createCompareStateCellContentAdapter(); } @Override @@ -312,17 +313,17 @@ public Adapter createStringCellContentAdapter() { /** * Creates a new adapter for an object of class - * '{@link org.eclipse.set.model.tablemodel.CompareCellContent Compare - * Cell Content}'. This default implementation - * returns null so that we can easily ignore cases; it's useful to ignore a - * case when inheritance will catch all the cases anyway. + * '{@link org.eclipse.set.model.tablemodel.CompareStateCellContent + * Compare State Cell Content}'. This + * default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases + * anyway. * * @return the new adapter. - * @see org.eclipse.set.model.tablemodel.CompareCellContent + * @see org.eclipse.set.model.tablemodel.CompareStateCellContent * @generated */ - public Adapter createCompareCellContentAdapter() { + public Adapter createCompareStateCellContentAdapter() { return null; } diff --git a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/util/TablemodelSwitch.java b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/util/TablemodelSwitch.java index 45dbf8f717..09cdbf68aa 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/util/TablemodelSwitch.java +++ b/java/bundles/org.eclipse.set.model.tablemodel/src/org/eclipse/set/model/tablemodel/util/TablemodelSwitch.java @@ -130,11 +130,11 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = defaultCase(theEObject); return result; } - case TablemodelPackage.COMPARE_CELL_CONTENT: { - CompareCellContent compareCellContent = (CompareCellContent) theEObject; - T result = caseCompareCellContent(compareCellContent); + case TablemodelPackage.COMPARE_STATE_CELL_CONTENT: { + CompareStateCellContent compareStateCellContent = (CompareStateCellContent) theEObject; + T result = caseCompareStateCellContent(compareStateCellContent); if (result == null) - result = caseCellContent(compareCellContent); + result = caseCellContent(compareStateCellContent); if (result == null) result = defaultCase(theEObject); return result; @@ -360,18 +360,18 @@ public T caseStringCellContent(StringCellContent object) { /** * Returns the result of interpreting the object as an instance of - * 'Compare Cell Content'. This + * 'Compare State Cell Content'. This * implementation returns null; returning a non-null result will terminate * the switch. * * @param object * the target of the switch. * @return the result of interpreting the object as an instance of - * 'Compare Cell Content'. + * 'Compare State Cell Content'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ - public T caseCompareCellContent(CompareCellContent object) { + public T caseCompareStateCellContent(CompareStateCellContent object) { return null; } diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/StellBereichExtensions.java b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/StellBereichExtensions.java index f4ca87f94a..e202802410 100644 --- a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/StellBereichExtensions.java +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/StellBereichExtensions.java @@ -30,8 +30,8 @@ import org.eclipse.set.model.planpro.Ansteuerung_Element.Uebertragungsweg; import org.eclipse.set.model.planpro.Bahnuebergang.BUE_Anlage; import org.eclipse.set.model.planpro.Bahnuebergang.BUE_Kante; -import org.eclipse.set.model.planpro.Basisobjekte.Basis_Objekt; import org.eclipse.set.model.planpro.Basisobjekte.Bereich_Objekt; +import org.eclipse.set.model.planpro.Basisobjekte.Ur_Objekt; import org.eclipse.set.model.planpro.Bedienung.Bedien_Bezirk; import org.eclipse.set.model.planpro.Bedienung.Bedien_Einrichtung_Oertlich; import org.eclipse.set.model.planpro.Bedienung.Bedien_Standort; @@ -206,7 +206,7 @@ public static List getWkrGspElement( * @return true, if the element belong to the area */ public static boolean isInControlArea(final Stell_Bereich area, - final Basis_Objekt object) { + final Ur_Objekt object) { if (object == null) { return false; } diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/UrObjectExtensions.xtend b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/UrObjectExtensions.xtend index 3c55891539..f6e69332cf 100644 --- a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/UrObjectExtensions.xtend +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/UrObjectExtensions.xtend @@ -12,13 +12,12 @@ import org.eclipse.emf.ecore.EObject import org.eclipse.set.basis.cache.Cache import org.eclipse.set.core.services.Services import org.eclipse.set.model.planpro.Ansteuerung_Element.Stell_Bereich -import org.eclipse.set.model.planpro.Basisobjekte.Basis_Objekt import org.eclipse.set.model.planpro.Basisobjekte.Ur_Objekt import org.eclipse.set.model.planpro.PlanPro.LST_Zustand import org.eclipse.set.model.planpro.PlanPro.PlanPro_Schnittstelle +import org.eclipse.set.utils.ToolboxConfiguration import static extension org.eclipse.set.ppmodel.extensions.StellBereichExtensions.* -import org.eclipse.set.utils.ToolboxConfiguration /** * Diese Klasse erweitert {@link Ur_Objekt}. @@ -97,7 +96,7 @@ class UrObjectExtensions extends BasisAttributExtensions { return planData.exists[wert == guid] } - def static Iterable filterObjectsInControlArea( + def static Iterable filterObjectsInControlArea( Iterable objects, Stell_Bereich area) { if (area === null) { return objects diff --git a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/TableModelInstanceBodyDataProvider.java b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/TableModelInstanceBodyDataProvider.java index 3133a9596e..27a0f48eb2 100644 --- a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/TableModelInstanceBodyDataProvider.java +++ b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/TableModelInstanceBodyDataProvider.java @@ -28,7 +28,7 @@ import org.eclipse.set.core.services.session.SessionService; import org.eclipse.set.model.planpro.PlanPro.PlanPro_Schnittstelle; import org.eclipse.set.model.tablemodel.CellContent; -import org.eclipse.set.model.tablemodel.CompareCellContent; +import org.eclipse.set.model.tablemodel.CompareStateCellContent; import org.eclipse.set.model.tablemodel.CompareTableCellContent; import org.eclipse.set.model.tablemodel.StringCellContent; import org.eclipse.set.model.tablemodel.TableCell; @@ -36,6 +36,7 @@ import org.eclipse.set.model.tablemodel.TablemodelFactory; import org.eclipse.set.model.tablemodel.extensions.CellContentExtensions; import org.eclipse.set.model.tablemodel.extensions.TableRowExtensions; +import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -177,7 +178,7 @@ private CellContent getNewContent(final CellContent oldContent, return switch (oldContent) { case final StringCellContent stringContent -> getNewContent( stringContent, properties); - case final CompareCellContent compareContent -> getNewContent( + case final CompareStateCellContent compareContent -> getNewContent( compareContent, properties); case final CompareTableCellContent compareTableContent -> getNewContent( compareTableContent, properties); @@ -212,24 +213,27 @@ private static CellContent getNewContent(final StringCellContent oldContent, } private static CellContent getNewContent( - final CompareCellContent oldContent, + final CompareStateCellContent oldContent, final Pt1TableChangeProperties properties) { final ContainerType containerType = properties.getContainerType(); + final List oldValues = IterableExtensions + .toList(CellContentExtensions + .getStringValueIterable(oldContent.getOldValue())); + final List newValues = IterableExtensions + .toList(CellContentExtensions + .getStringValueIterable(oldContent.getNewValue())); switch (containerType) { case FINAL: - if (!equalsValues(oldContent.getNewValue(), - properties.getNewValues())) { - return createCompareCellContent(oldContent.getOldValue(), + if (!equalsValues(newValues, properties.getNewValues())) { + return createCompareCellContent(oldValues, properties.getNewValues(), oldContent.getSeparator()); } break; case INITIAL: - if (!equalsValues(oldContent.getOldValue(), - properties.getNewValues())) { + if (!equalsValues(newValues, properties.getNewValues())) { return createCompareCellContent(properties.getNewValues(), - oldContent.getNewValue(), - oldContent.getSeparator()); + newValues, oldContent.getSeparator()); } break; default: @@ -286,13 +290,15 @@ private CellContent getNewContent(final CompareTableCellContent oldContent, : clone; } - private static CompareCellContent createCompareCellContent( + private static CompareStateCellContent createCompareCellContent( final List oldValues, final List newValues, final String separator) { - final CompareCellContent compareContent = TablemodelFactory.eINSTANCE - .createCompareCellContent(); - compareContent.getOldValue().addAll(oldValues); - compareContent.getNewValue().addAll(newValues); + final CompareStateCellContent compareContent = TablemodelFactory.eINSTANCE + .createCompareStateCellContent(); + compareContent.setOldValue( + CellContentExtensions.createStringCellContent(oldValues)); + compareContent.setNewValue( + CellContentExtensions.createStringCellContent(newValues)); compareContent.setSeparator(separator); return compareContent; } diff --git a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/TableSpanUtils.java b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/TableSpanUtils.java index 1ce2d4ea77..3b699cfdc3 100644 --- a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/TableSpanUtils.java +++ b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/TableSpanUtils.java @@ -8,17 +8,21 @@ */ package org.eclipse.set.utils.table; +import static org.eclipse.set.model.tablemodel.extensions.CellContentExtensions.getStringValueIterable; + import java.util.List; import org.eclipse.set.model.tablemodel.CellContent; import org.eclipse.set.model.tablemodel.ColumnDescriptor; -import org.eclipse.set.model.tablemodel.CompareCellContent; +import org.eclipse.set.model.tablemodel.CompareStateCellContent; import org.eclipse.set.model.tablemodel.RowMergeMode; import org.eclipse.set.model.tablemodel.StringCellContent; import org.eclipse.set.model.tablemodel.TableRow; import org.eclipse.set.model.tablemodel.extensions.CellContentExtensions; import org.eclipse.set.model.tablemodel.extensions.TableRowExtensions; +import com.google.common.collect.Streams; + /** * Helper class to calculate table spans * @@ -100,7 +104,7 @@ private static boolean isEqual(final CellContent cellContentA, return switch (cellContentA) { case final StringCellContent stringCellContentA -> isEqual( stringCellContentA, cellContentB); - case final CompareCellContent compareCellContentA -> isEqual( + case final CompareStateCellContent compareCellContentA -> isEqual( compareCellContentA, cellContentB); default -> CellContentExtensions.isEqual(cellContentA, cellContentB); @@ -115,16 +119,16 @@ private static boolean isEqual(final StringCellContent stringCellContentA, // compare cell content with the another cell. Because when the row // in Final was removed/added will be COmpareCellContent and by // normal compare the row can't be merged - case final CompareCellContent compareCellContentB -> { - final List oldValuesB = compareCellContentB - .getOldValue() - .stream() + case final CompareStateCellContent compareCellContentB -> { + final List oldValuesB = Streams + .stream(getStringValueIterable( + compareCellContentB.getOldValue())) .map(String::trim) .filter(v -> !v.isEmpty() && !v.isBlank()) .toList(); - final List newValuesB = compareCellContentB - .getNewValue() - .stream() + final List newValuesB = Streams + .stream(getStringValueIterable( + compareCellContentB.getNewValue())) .map(String::trim) .filter(v -> !v.isEmpty() && !v.isBlank()) .toList(); @@ -139,7 +143,8 @@ private static boolean isEqual(final StringCellContent stringCellContentA, }; } - private static boolean isEqual(final CompareCellContent compareCellContentA, + private static boolean isEqual( + final CompareStateCellContent compareCellContentA, final CellContent cellContentB) { return switch (cellContentB) { case final StringCellContent stringCellContentB -> isEqual( diff --git a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/sorting/AbstractCellComparator.xtend b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/sorting/AbstractCellComparator.xtend index 89737e4f9c..8d76063f78 100644 --- a/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/sorting/AbstractCellComparator.xtend +++ b/java/bundles/org.eclipse.set.utils.table/src/org/eclipse/set/utils/table/sorting/AbstractCellComparator.xtend @@ -12,7 +12,7 @@ import java.util.Comparator import java.util.List import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum import org.eclipse.set.model.tablemodel.CellContent -import org.eclipse.set.model.tablemodel.CompareCellContent +import org.eclipse.set.model.tablemodel.CompareStateCellContent import org.eclipse.set.model.tablemodel.StringCellContent import org.eclipse.set.model.tablemodel.TableCell @@ -61,8 +61,8 @@ package abstract class AbstractCellComparator implements Comparator { } private def dispatch int compareDispatch( - CompareCellContent c1, - CompareCellContent c2 + CompareStateCellContent c1, + CompareStateCellContent c2 ) { // To avoid compare error, the compare cell shouldn't separate compare new/old value return c1.compareCellContentString.compareCell( @@ -79,13 +79,13 @@ package abstract class AbstractCellComparator implements Comparator { private def dispatch int compareDispatch( StringCellContent c1, - CompareCellContent c2 + CompareStateCellContent c2 ) { return c1.value.compareCell(c2.compareCellContentString) } private def dispatch int compareDispatch( - CompareCellContent c1, + CompareStateCellContent c1, StringCellContent c2 ) { return c1.compareCellContentString.compareCell(c2.value) @@ -107,8 +107,9 @@ package abstract class AbstractCellComparator implements Comparator { } private def Iterable compareCellContentString( - CompareCellContent content) { - return #[content.newValue, content.oldValue].flatten.toSet + CompareStateCellContent content) { + return #[content.newValue.stringValueIterable, + content.oldValue.stringValueIterable].flatten.toSet } private def boolean isInteger(String text) { From 5fd4d2be01ae618bfcdba871d566de9d43c2db78 Mon Sep 17 00:00:00 2001 From: TruongQuangSB Date: Thu, 8 Jan 2026 18:27:55 +0100 Subject: [PATCH 2/3] fix unit test --- .../model/tablemodel/extensions/CellContentExtensionsTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/bundles/org.eclipse.set.model.tablemodel.extensions.test/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensionsTest.java b/java/bundles/org.eclipse.set.model.tablemodel.extensions.test/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensionsTest.java index e2747275b3..6966b2531f 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.extensions.test/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensionsTest.java +++ b/java/bundles/org.eclipse.set.model.tablemodel.extensions.test/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensionsTest.java @@ -43,6 +43,9 @@ private static StringCellContent createStringCellContent( final StringCellContent content = TablemodelFactory.eINSTANCE .createStringCellContent(); content.getValue().add(value); + final TableCell tableCell = TablemodelFactory.eINSTANCE + .createTableCell(); + tableCell.setContent(content); return content; } From ba051e5a75b5172f74d00797d64ee7bbeb897274 Mon Sep 17 00:00:00 2001 From: TruongQuangSB Date: Thu, 8 Jan 2026 19:11:31 +0100 Subject: [PATCH 3/3] fix unit test --- .../set/feature/table/diff/TableStateDiffService.java | 5 +++-- .../model/tablemodel/extensions/CellContentExtensions.xtend | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableStateDiffService.java b/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableStateDiffService.java index 351e3a471a..59c6e6eabd 100644 --- a/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableStateDiffService.java +++ b/java/bundles/org.eclipse.set.feature.table/src/org/eclipse/set/feature/table/diff/TableStateDiffService.java @@ -54,8 +54,9 @@ CellContent createDiffContent(final TableCell oldCell, } if (!StringCellContent.class.isInstance(oldCell.getContent()) - || newCell != null && !StringCellContent.class - .isInstance(newCell.getContent())) { + || newCell != null && newCell.getContent() != null + && !StringCellContent.class + .isInstance(newCell.getContent())) { throw new IllegalArgumentException( "Can create CompareStateCellContent only from StringCellContent"); //$NON-NLS-1$ } diff --git a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensions.xtend b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensions.xtend index 33d68ccfb3..a4eb2207af 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensions.xtend +++ b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/CellContentExtensions.xtend @@ -189,7 +189,7 @@ class CellContentExtensions { static def dispatch String getPlainStringValue( CompareStateCellContent content) { - return '''«content.oldValue.plainStringValue»/«content.newValue.plainStringValue»''' + return '''«content.oldValue.stringValueIterable»/«content.newValue.stringValueIterable»''' } static def dispatch String getPlainStringValue(