From 7493069c285e76058e50d6266395ac460c256568 Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Thu, 24 Aug 2023 16:33:01 +0200 Subject: [PATCH 01/11] Add simple UI to show Overwrite-Falg in SEI-Editor --- .../VirSatCefTreeLabelProvider.java | 15 ++++++- .../tableimpl/UiSnippetCefTreeTableImpl.java | 44 ++++++++++++++++++- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java index 2a3a6d90..d26a067f 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java @@ -32,6 +32,7 @@ import de.dlr.sc.virsat.model.extension.cefx.model.SystemMode; import de.dlr.sc.virsat.model.extension.cefx.model.SystemParameters; import de.dlr.sc.virsat.model.extension.cefx.model.Value; +import de.dlr.sc.virsat.model.extension.cefx.ui.snippet.tableimpl.UiSnippetCefTreeTableImpl; import de.dlr.sc.virsat.project.markers.VirSatProblemMarkerHelper; import de.dlr.sc.virsat.project.ui.labelProvider.VirSatTransactionalAdapterFactoryLabelProvider; import de.dlr.sc.virsat.uieingine.ui.DVLMEditorPlugin; @@ -55,6 +56,7 @@ public class VirSatCefTreeLabelProvider extends VirSatTransactionalAdapterFactor TreeViewerColumn colOne; TreeViewerColumn colTwo; TreeViewerColumn colThree; + TreeViewerColumn colOverwrite; /** @@ -66,10 +68,11 @@ public class VirSatCefTreeLabelProvider extends VirSatTransactionalAdapterFactor * @param colThree * @param emip */ - public VirSatCefTreeLabelProvider(AdapterFactory adapterFactory, ColumnViewer columnViewer, TreeViewerColumn colOne, TreeViewerColumn colTwo, TreeViewerColumn colThree, EsfMarkerImageProvider emip) { + public VirSatCefTreeLabelProvider(AdapterFactory adapterFactory, ColumnViewer columnViewer, TreeViewerColumn colOne, TreeViewerColumn colOverwrite, TreeViewerColumn colTwo, TreeViewerColumn colThree, EsfMarkerImageProvider emip) { super(adapterFactory); this.columnViewer = columnViewer; this.colOne = colOne; + this.colOverwrite = colOverwrite; this.colTwo = colTwo; this.colThree = colThree; this.emip = emip; @@ -84,6 +87,10 @@ public String getColumnText(Object object, int columnIndex) { CategoryAssignment ca = getCategoryAssignment(object); redirectNotification(ca, object); + if (ca.getSuperTis().isEmpty()) { + colOverwrite.getColumn().setWidth(0); + } + if (ca.getType().getFullQualifiedName().equals(Parameter.FULL_QUALIFIED_CATEGORY_NAME)) { Parameter parameterBean = new Parameter(ca); redirectNotification(parameterBean.getDefaultValueBean().getTypeInstance(), ca); @@ -94,7 +101,11 @@ public String getColumnText(Object object, int columnIndex) { } else if (column == colThree.getColumn()) { AUnit unit = parameterBean.getDefaultValueBean().getTypeInstance().getUnit(); return super.getText(unit); - } + } else if (column == colOverwrite.getColumn()) { + column.setWidth(UiSnippetCefTreeTableImpl.OVERRIDE_COLUMN_SIZE); + Boolean overwrite = parameterBean.getDefaultValueBean().getTypeInstance().isOverride(); + return overwrite.toString(); + } } else if (ca.getType().getFullQualifiedName().equals(Value.FULL_QUALIFIED_CATEGORY_NAME)) { Value valueBean = new Value(ca); redirectNotification(valueBean, ca, true); diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java index db16c89d..8bdd328f 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java @@ -18,8 +18,10 @@ import de.dlr.sc.virsat.model.dvlm.categories.CategoryAssignment; import de.dlr.sc.virsat.model.dvlm.categories.propertydefinitions.AProperty; +import de.dlr.sc.virsat.model.dvlm.categories.propertyinstances.ComposedPropertyInstance; import de.dlr.sc.virsat.model.dvlm.concepts.util.ActiveConceptHelper; import de.dlr.sc.virsat.model.dvlm.general.GeneralPackage; +import de.dlr.sc.virsat.model.dvlm.inheritance.InheritancePackage; import de.dlr.sc.virsat.model.extension.cefx.Activator; import de.dlr.sc.virsat.model.extension.cefx.model.Parameter; import de.dlr.sc.virsat.model.extension.cefx.model.Value; @@ -28,6 +30,7 @@ import de.dlr.sc.virsat.uiengine.ui.cellEditor.aproperties.MultiPropertyEditingSupport; import de.dlr.sc.virsat.uiengine.ui.cellEditor.aproperties.QudvUnitCellEditingSupport; import de.dlr.sc.virsat.uiengine.ui.cellEditor.aproperties.ValuePropertyCellEditingSupport; +import de.dlr.sc.virsat.uiengine.ui.cellEditor.emfattributes.EBooleanCellEditingSupport; import de.dlr.sc.virsat.uiengine.ui.cellEditor.emfattributes.EStringCellEditingSupport; import de.dlr.sc.virsat.uiengine.ui.editor.snippets.AUiSnippetGenericCategoryAssignmentTable; import de.dlr.sc.virsat.uiengine.ui.editor.snippets.AUiSnippetGenericTable; @@ -45,7 +48,10 @@ public class UiSnippetCefTreeTableImpl extends UiSnippetGenericTreeTableImpl { protected TreeViewerColumn colName; protected TreeViewerColumn colUnit; protected TreeViewerColumn colValue; + protected TreeViewerColumn colOverwrite; protected AUiSnippetGenericTable thisTable; + public static final int OVERRIDE_COLUMN_SIZE = 100; + public static final int NAME_COLUMN_SIZE = 300; /** * Constructor of the CEF Tree Table Implementation @@ -60,8 +66,8 @@ public UiSnippetCefTreeTableImpl(AUiSnippetGenericCategoryAssignmentTable generi protected void createTableColumns(EditingDomain editingDomain) { ColumnViewer columnViewer = getColumnViewer(); ActiveConceptHelper acHelper = getActiveConceptHelper(); - colName = (TreeViewerColumn) createDefaultColumn("Name"); + colName.getColumn().setWidth(NAME_COLUMN_SIZE); colName.setEditingSupport(new EStringCellEditingSupport(editingDomain, columnViewer, GeneralPackage.Literals.INAME__NAME) { @Override protected boolean canEdit(Object element) { @@ -71,6 +77,40 @@ protected boolean canEdit(Object element) { return false; } }); + + colOverwrite = (TreeViewerColumn) createDefaultColumn("Overwrite"); + colOverwrite.getColumn().setWidth(0); + colOverwrite.setEditingSupport(new EBooleanCellEditingSupport(editingDomain, columnViewer, InheritancePackage.Literals.IOVERRIDABLE_INHERITANCE_LINK__OVERRIDE) { + @Override + protected Object getValue(Object element) { + if (element instanceof ComposedPropertyInstance) { + Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); + return super.getValue(param.getDefaultValueBean().getTypeInstance()); + } + return super.getValue(element); + } + + @Override + protected void setValue(Object element, Object userInputValue) { + if (element instanceof ComposedPropertyInstance) { + Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); + super.setValue(param.getDefaultValueBean().getTypeInstance(), userInputValue); + } else { + super.setValue(element, userInputValue); + } + } + @Override + protected boolean canEdit(Object element) { + if (element instanceof ComposedPropertyInstance) { + Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); + if (param.getDefaultValueBean().getIsCalculated()) { + return false; + } + return super.canEdit(param.getDefaultValueBean().getTypeInstance()); + } + return false; + } + }); colValue = (TreeViewerColumn) createDefaultColumn("Value"); MultiPropertyEditingSupport editingSupportValue = new MultiPropertyEditingSupport(columnViewer); @@ -99,6 +139,6 @@ protected void fillContextMenuAdditions(EditingDomain editingDomain, IMenuManage protected ITableLabelProvider getTableLabelProvider() { ColumnViewer columnViewer = getColumnViewer(); ComposedAdapterFactory adapterFactory = getAdapterFactory(); - return new VirSatCefTreeLabelProvider(adapterFactory, columnViewer, colName, colValue, colUnit, emip); + return new VirSatCefTreeLabelProvider(adapterFactory, columnViewer, colName, colOverwrite, colValue, colUnit, emip); } } From 69416b021637a8d164b0ed7d4f3989f39c625183 Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Thu, 24 Aug 2023 17:05:33 +0200 Subject: [PATCH 02/11] Change naming to be more consistent --- .../ui/itemprovider/VirSatCefTreeLabelProvider.java | 10 +++++----- .../snippet/tableimpl/UiSnippetCefTreeTableImpl.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java index d26a067f..6a219c89 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java @@ -56,7 +56,7 @@ public class VirSatCefTreeLabelProvider extends VirSatTransactionalAdapterFactor TreeViewerColumn colOne; TreeViewerColumn colTwo; TreeViewerColumn colThree; - TreeViewerColumn colOverwrite; + TreeViewerColumn colOverrie; /** @@ -68,11 +68,11 @@ public class VirSatCefTreeLabelProvider extends VirSatTransactionalAdapterFactor * @param colThree * @param emip */ - public VirSatCefTreeLabelProvider(AdapterFactory adapterFactory, ColumnViewer columnViewer, TreeViewerColumn colOne, TreeViewerColumn colOverwrite, TreeViewerColumn colTwo, TreeViewerColumn colThree, EsfMarkerImageProvider emip) { + public VirSatCefTreeLabelProvider(AdapterFactory adapterFactory, ColumnViewer columnViewer, TreeViewerColumn colOne, TreeViewerColumn colOverride, TreeViewerColumn colTwo, TreeViewerColumn colThree, EsfMarkerImageProvider emip) { super(adapterFactory); this.columnViewer = columnViewer; this.colOne = colOne; - this.colOverwrite = colOverwrite; + this.colOverrie = colOverride; this.colTwo = colTwo; this.colThree = colThree; this.emip = emip; @@ -88,7 +88,7 @@ public String getColumnText(Object object, int columnIndex) { redirectNotification(ca, object); if (ca.getSuperTis().isEmpty()) { - colOverwrite.getColumn().setWidth(0); + colOverrie.getColumn().setWidth(0); } if (ca.getType().getFullQualifiedName().equals(Parameter.FULL_QUALIFIED_CATEGORY_NAME)) { @@ -101,7 +101,7 @@ public String getColumnText(Object object, int columnIndex) { } else if (column == colThree.getColumn()) { AUnit unit = parameterBean.getDefaultValueBean().getTypeInstance().getUnit(); return super.getText(unit); - } else if (column == colOverwrite.getColumn()) { + } else if (column == colOverrie.getColumn()) { column.setWidth(UiSnippetCefTreeTableImpl.OVERRIDE_COLUMN_SIZE); Boolean overwrite = parameterBean.getDefaultValueBean().getTypeInstance().isOverride(); return overwrite.toString(); diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java index 8bdd328f..05dc87e9 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java @@ -48,7 +48,7 @@ public class UiSnippetCefTreeTableImpl extends UiSnippetGenericTreeTableImpl { protected TreeViewerColumn colName; protected TreeViewerColumn colUnit; protected TreeViewerColumn colValue; - protected TreeViewerColumn colOverwrite; + protected TreeViewerColumn colOverride; protected AUiSnippetGenericTable thisTable; public static final int OVERRIDE_COLUMN_SIZE = 100; public static final int NAME_COLUMN_SIZE = 300; @@ -78,9 +78,9 @@ protected boolean canEdit(Object element) { } }); - colOverwrite = (TreeViewerColumn) createDefaultColumn("Overwrite"); - colOverwrite.getColumn().setWidth(0); - colOverwrite.setEditingSupport(new EBooleanCellEditingSupport(editingDomain, columnViewer, InheritancePackage.Literals.IOVERRIDABLE_INHERITANCE_LINK__OVERRIDE) { + colOverride = (TreeViewerColumn) createDefaultColumn("Override"); + colOverride.getColumn().setWidth(0); + colOverride.setEditingSupport(new EBooleanCellEditingSupport(editingDomain, columnViewer, InheritancePackage.Literals.IOVERRIDABLE_INHERITANCE_LINK__OVERRIDE) { @Override protected Object getValue(Object element) { if (element instanceof ComposedPropertyInstance) { @@ -139,6 +139,6 @@ protected void fillContextMenuAdditions(EditingDomain editingDomain, IMenuManage protected ITableLabelProvider getTableLabelProvider() { ColumnViewer columnViewer = getColumnViewer(); ComposedAdapterFactory adapterFactory = getAdapterFactory(); - return new VirSatCefTreeLabelProvider(adapterFactory, columnViewer, colName, colOverwrite, colValue, colUnit, emip); + return new VirSatCefTreeLabelProvider(adapterFactory, columnViewer, colName, colOverride, colValue, colUnit, emip); } } From d4486af988b7cde70343ed276063ee4036b111ff Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Thu, 24 Aug 2023 21:21:38 +0200 Subject: [PATCH 03/11] Property UI for overwrite and calculated values --- .../VirSatCefTreeLabelProvider.java | 20 +++++++--- .../tableimpl/UiSnippetCefTreeTableImpl.java | 37 ++++++++++--------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java index 6a219c89..967b6680 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java @@ -87,11 +87,14 @@ public String getColumnText(Object object, int columnIndex) { CategoryAssignment ca = getCategoryAssignment(object); redirectNotification(ca, object); - if (ca.getSuperTis().isEmpty()) { - colOverrie.getColumn().setWidth(0); + if (ca == null || ca.getType() == null) { + return null; } if (ca.getType().getFullQualifiedName().equals(Parameter.FULL_QUALIFIED_CATEGORY_NAME)) { + if (ca.getSuperTis().isEmpty()) { + colOverrie.getColumn().setWidth(0); + } Parameter parameterBean = new Parameter(ca); redirectNotification(parameterBean.getDefaultValueBean().getTypeInstance(), ca); if (column == colOne.getColumn()) { @@ -104,6 +107,9 @@ public String getColumnText(Object object, int columnIndex) { } else if (column == colOverrie.getColumn()) { column.setWidth(UiSnippetCefTreeTableImpl.OVERRIDE_COLUMN_SIZE); Boolean overwrite = parameterBean.getDefaultValueBean().getTypeInstance().isOverride(); + if (parameterBean.getDefaultValueBean().getIsCalculated()) { + return "<>"; + } return overwrite.toString(); } } else if (ca.getType().getFullQualifiedName().equals(Value.FULL_QUALIFIED_CATEGORY_NAME)) { @@ -197,13 +203,17 @@ private Image getColumnImageForParameter(CategoryAssignment ca, int columnIndex) if (problemImage != null) { return problemImage; } else { - PropertyInstanceHelper piHelper = new PropertyInstanceHelper(); - return piHelper.isCalculated(ca) ? imageCalculated : super.getColumnImage(ca, columnIndex); + return super.getColumnImage(ca, columnIndex); } } else if (columnIndex == 1) { APropertyInstance propertyInstance = ca.getPropertyInstances().get(0); + PropertyInstanceHelper piHelper = new PropertyInstanceHelper(); Image problemImage = mip.getProblemImageForEObject(propertyInstance); - return (problemImage != null) ? problemImage : null; + if (problemImage != null) { + return problemImage; + } else if (piHelper.isCalculated(ca)) { + return imageCalculated; + } } return null; } diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java index 05dc87e9..3c8d5b93 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java @@ -50,8 +50,10 @@ public class UiSnippetCefTreeTableImpl extends UiSnippetGenericTreeTableImpl { protected TreeViewerColumn colValue; protected TreeViewerColumn colOverride; protected AUiSnippetGenericTable thisTable; - public static final int OVERRIDE_COLUMN_SIZE = 100; + public static final int OVERRIDE_COLUMN_SIZE = 140; public static final int NAME_COLUMN_SIZE = 300; + public static final String NAME_OVERRIDE = "Override"; + public static final String DESCRIPTION_OVERRIDE = "Specifies if the property is inherited from the prodcut tree or overritten here"; /** * Constructor of the CEF Tree Table Implementation @@ -77,8 +79,25 @@ protected boolean canEdit(Object element) { return false; } }); + + colValue = (TreeViewerColumn) createDefaultColumn("Value"); + MultiPropertyEditingSupport editingSupportValue = new MultiPropertyEditingSupport(columnViewer); + + AProperty defaultValueProperty = acHelper.getProperty(Activator.PLUGIN_ID, Parameter.class.getSimpleName(), Parameter.PROPERTY_DEFAULTVALUE); //Parameter.class.getSimpleName() = non fully qualified name, e.g. "Parameter" + editingSupportValue.registerEditingSupport(new ValuePropertyCellEditingSupport(editingDomain, columnViewer, defaultValueProperty)); + + AProperty valueProperty = acHelper.getProperty(Activator.PLUGIN_ID, Value.class.getSimpleName(), Value.PROPERTY_VALUE); + editingSupportValue.registerEditingSupport(new ValuePropertyCellEditingSupport(editingDomain, columnViewer, valueProperty)); + colValue.setEditingSupport(editingSupportValue); + + colUnit = (TreeViewerColumn) createDefaultColumn("Unit"); + MultiPropertyEditingSupport editingSupportUnit = new MultiPropertyEditingSupport(columnViewer); + editingSupportUnit.registerEditingSupport(new QudvUnitCellEditingSupport(editingDomain, columnViewer, defaultValueProperty)); + editingSupportUnit.registerEditingSupport(new QudvUnitCellEditingSupport(editingDomain, columnViewer, valueProperty)); + colUnit.setEditingSupport(editingSupportUnit); colOverride = (TreeViewerColumn) createDefaultColumn("Override"); + colOverride.getColumn().setToolTipText(DESCRIPTION_OVERRIDE); colOverride.getColumn().setWidth(0); colOverride.setEditingSupport(new EBooleanCellEditingSupport(editingDomain, columnViewer, InheritancePackage.Literals.IOVERRIDABLE_INHERITANCE_LINK__OVERRIDE) { @Override @@ -111,22 +130,6 @@ protected boolean canEdit(Object element) { return false; } }); - - colValue = (TreeViewerColumn) createDefaultColumn("Value"); - MultiPropertyEditingSupport editingSupportValue = new MultiPropertyEditingSupport(columnViewer); - - AProperty defaultValueProperty = acHelper.getProperty(Activator.PLUGIN_ID, Parameter.class.getSimpleName(), Parameter.PROPERTY_DEFAULTVALUE); //Parameter.class.getSimpleName() = non fully qualified name, e.g. "Parameter" - editingSupportValue.registerEditingSupport(new ValuePropertyCellEditingSupport(editingDomain, columnViewer, defaultValueProperty)); - - AProperty valueProperty = acHelper.getProperty(Activator.PLUGIN_ID, Value.class.getSimpleName(), Value.PROPERTY_VALUE); - editingSupportValue.registerEditingSupport(new ValuePropertyCellEditingSupport(editingDomain, columnViewer, valueProperty)); - colValue.setEditingSupport(editingSupportValue); - - colUnit = (TreeViewerColumn) createDefaultColumn("Unit"); - MultiPropertyEditingSupport editingSupportUnit = new MultiPropertyEditingSupport(columnViewer); - editingSupportUnit.registerEditingSupport(new QudvUnitCellEditingSupport(editingDomain, columnViewer, defaultValueProperty)); - editingSupportUnit.registerEditingSupport(new QudvUnitCellEditingSupport(editingDomain, columnViewer, valueProperty)); - colUnit.setEditingSupport(editingSupportUnit); } @Override From b23ebf3e7784c0f451fbb853cc7631611288d8dd Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Thu, 24 Aug 2023 22:31:29 +0200 Subject: [PATCH 04/11] Some UI and code quality improvements --- .../resources/icons/Inherit.gif | Bin 0 -> 222 bytes .../resources/icons/Override.gif | Bin 0 -> 568 bytes .../model/extension/cefx/ui/Activator.java | 11 ++++++++ .../VirSatCefTreeLabelProvider.java | 25 +++++++++++++++--- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Inherit.gif create mode 100644 de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Override.gif diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Inherit.gif b/de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Inherit.gif new file mode 100644 index 0000000000000000000000000000000000000000..5643f5c53ab444cb9a8c5026462324ffa489cd2a GIT binary patch literal 222 zcmZ?wbhEHb6krfwC}3bv{K>+|z#zwmX_Am*3Qn(j*gD* z?(U|hrpCs`zP`RWbLLE+K7HD>Y3tUln>cae{Q2|OuV24n#fnv{R&C$DU0ht8larH$ zg@uicjggU&iHV7won1je0c1WHutqOX?~@alpuxqF`I@(7Hs2Z_p=MvPwrUQh7J&%@ zEDRnED;ijoCIuYj*y&-&U@5f8u}C2LL_0@Q&lZ&v2be4;nl2ED^?bQ1LT`q5+WM0@ S7Ag|5)v~Q^vQkQl4AuZg+(~W# literal 0 HcmV?d00001 diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Override.gif b/de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Override.gif new file mode 100644 index 0000000000000000000000000000000000000000..febd3b0f96bd9d1311c4e145403efe8d36cfb7fd GIT binary patch literal 568 zcmZ?wbhEHb6krfwC}3bv{K>+|z!1uy!vF*zu{J)#|BPz?*|h&NYy4+W`)?BTU)=J) ztlfVuz5jdn?hOqM)z;RwwziJWKF*-_mqG0xlg7W=3IETYJ;UWgrUo4vcrKF@-Sy`ExnYFaE z?%%)9srygG<^R*C&nhY^mM>p^=guATkpI#){|)^9gTi4z0sGX3(5B{=W(G#4)~--y z7Dm?Y7B&_Z_K7W1I9fQlxOtj+`S=9{n}vi$M8%rLB_yS!n`LC>T3F>3*cFwOn^aU= z)tJ?rG&GyEw3~Ev_0;qY3`32Kn@mib&CD$E+?2j#GqW*BG&~aA>hJGcs5M0H~6MF8}}l literal 0 HcmV?d00001 diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/Activator.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/Activator.java index 647ccf67..af85bd87 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/Activator.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/Activator.java @@ -10,6 +10,7 @@ package de.dlr.sc.virsat.model.extension.cefx.ui; import org.eclipse.core.runtime.Plugin; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -45,4 +46,14 @@ public void start(BundleContext context) throws Exception { public static Plugin getDefault() { return plugin; } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } } diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java index 967b6680..42f57476 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java @@ -10,6 +10,7 @@ package de.dlr.sc.virsat.model.extension.cefx.ui.itemprovider; import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; import org.eclipse.jface.viewers.ColumnViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewerColumn; @@ -32,6 +33,7 @@ import de.dlr.sc.virsat.model.extension.cefx.model.SystemMode; import de.dlr.sc.virsat.model.extension.cefx.model.SystemParameters; import de.dlr.sc.virsat.model.extension.cefx.model.Value; +import de.dlr.sc.virsat.model.extension.cefx.ui.Activator; import de.dlr.sc.virsat.model.extension.cefx.ui.snippet.tableimpl.UiSnippetCefTreeTableImpl; import de.dlr.sc.virsat.project.markers.VirSatProblemMarkerHelper; import de.dlr.sc.virsat.project.ui.labelProvider.VirSatTransactionalAdapterFactoryLabelProvider; @@ -50,8 +52,14 @@ public class VirSatCefTreeLabelProvider extends VirSatTransactionalAdapterFactor private MarkerImageProvider mip = new MarkerImageProvider(new VirSatProblemMarkerHelper()); private EsfMarkerImageProvider emip; private static final String NO_MODE_SELECTED = "[No Mode Selected]"; + private static final String CALCULATED_STRING = "<>"; + private static final String OVERRIDE_IMAGE_PATH = "resources/icons/Override.gif"; + private static final String INHERIT_IMAGE_PATH = "resources/icons/Inherit.gif"; + private static final int OVERRIDE_COLUMN = 3; private ColumnViewer columnViewer; private Image imageCalculated; + private Image imageOverride; + private Image imageInherited; TreeViewerColumn colOne; TreeViewerColumn colTwo; @@ -76,7 +84,8 @@ public VirSatCefTreeLabelProvider(AdapterFactory adapterFactory, ColumnViewer co this.colTwo = colTwo; this.colThree = colThree; this.emip = emip; - + imageOverride = ExtendedImageRegistry.INSTANCE.getImage(Activator.getImageDescriptor(OVERRIDE_IMAGE_PATH)); + imageInherited = ExtendedImageRegistry.INSTANCE.getImage(Activator.getImageDescriptor(INHERIT_IMAGE_PATH)); imageCalculated = DVLMEditorPlugin.getPlugin().getImageRegistry().get(DVLMEditorPlugin.IMAGE_CALCULATED); } @@ -108,7 +117,7 @@ public String getColumnText(Object object, int columnIndex) { column.setWidth(UiSnippetCefTreeTableImpl.OVERRIDE_COLUMN_SIZE); Boolean overwrite = parameterBean.getDefaultValueBean().getTypeInstance().isOverride(); if (parameterBean.getDefaultValueBean().getIsCalculated()) { - return "<>"; + return CALCULATED_STRING; } return overwrite.toString(); } @@ -198,6 +207,7 @@ private CategoryAssignment getCategoryAssignment(Object object) { * @return image problem image or null image */ private Image getColumnImageForParameter(CategoryAssignment ca, int columnIndex) { + PropertyInstanceHelper piHelper = new PropertyInstanceHelper(); if (columnIndex == 0) { Image problemImage = emip.getProblemImageForStructuralFeatureInEobject(ca, GeneralPackage.Literals.INAME__NAME); if (problemImage != null) { @@ -207,13 +217,22 @@ private Image getColumnImageForParameter(CategoryAssignment ca, int columnIndex) } } else if (columnIndex == 1) { APropertyInstance propertyInstance = ca.getPropertyInstances().get(0); - PropertyInstanceHelper piHelper = new PropertyInstanceHelper(); + Image problemImage = mip.getProblemImageForEObject(propertyInstance); if (problemImage != null) { return problemImage; } else if (piHelper.isCalculated(ca)) { return imageCalculated; } + } else if (columnIndex == OVERRIDE_COLUMN) { + if (ca.getType().getFullQualifiedName().equals(Parameter.FULL_QUALIFIED_CATEGORY_NAME)) { + Parameter parameterBean = new Parameter(ca); + Boolean override = parameterBean.getDefaultValueBean().getTypeInstance().isOverride(); + if (!piHelper.isCalculated(ca)) { + return (override) ? imageOverride : imageInherited; + } + } + } return null; } From 8c148af63c9c0493ea9368a99bff267ebc88f41c Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Thu, 24 Aug 2023 22:36:27 +0200 Subject: [PATCH 05/11] New icon --- .../resources/icons/Override.gif | Bin 568 -> 572 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Override.gif b/de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Override.gif index febd3b0f96bd9d1311c4e145403efe8d36cfb7fd..fba830badc1bd6f6cf3adde45695ae63a2724dec 100644 GIT binary patch delta 430 zcmV;f0a50AAk4(2mSy6`9-{15B3fBxS<>lshczCC$r`+7!`~d^*0}=lO z1o{93|5{qH9RXjHApw4W00007nSfP-gM@h5f+Z$`Cn$m`Dl054E-zIu zF@iEPgESWbHG?)cf;c(XBNsY5gFHPxft<8 delta 426 zcmV;b0agCI1h@o{AAb%p{{bfd1}pyqDE|N^|1?tn7dihOKK}|X|GmAvRaI3hD=RxY zJ6mhV04DtaCjJ5_{(X@D&CSgY4h{kW0v{hAG&D2?Dfa*+{s1NY02;G7JWEVWOc)p# zv9YlXF#iH4|AmaX0s{kAS64MPHD6y}5i<55I?^#QF%=aRK7T$wxVX3-9v}b)C?zaj z95lWF0t*rn5_5BN6B83kN=i33H!e;81}pvwF8(M;|05$KARr)zhld6R2AG(b3JMBb zTwL?>^F~HS1O*5J6LJ70`UENe8X6h}1qA~G11c&i-{0Q}E&e1#|K;W8czAfHr>ET9 z+&5JJ8$ACoP67XuApw4W00007m4H=(gM@gp>$`2?`4g zgAEQ35D|kC6BHE|gBKVX8XJQg9Ug=QA0P)IA|rw%C50vfCxR#`f+{P5EG;f3FEBAx zGBbiSHG?)cI5~qlJAynt*j1T>K0iQ$K|(`BMGr=TM@UIZONC4w4-ZXMPESyxD3U_y U!=*u#5*@5E1q28x2Lk~BJDT8yssI20 From 59b614d19c055f624b0fb918e13be4e72bef4b16 Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Thu, 24 Aug 2023 22:44:51 +0200 Subject: [PATCH 06/11] Fix visibility of override column --- .../ui/itemprovider/VirSatCefTreeLabelProvider.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java index 42f57476..fb828f90 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java @@ -100,10 +100,8 @@ public String getColumnText(Object object, int columnIndex) { return null; } + if (ca.getType().getFullQualifiedName().equals(Parameter.FULL_QUALIFIED_CATEGORY_NAME)) { - if (ca.getSuperTis().isEmpty()) { - colOverrie.getColumn().setWidth(0); - } Parameter parameterBean = new Parameter(ca); redirectNotification(parameterBean.getDefaultValueBean().getTypeInstance(), ca); if (column == colOne.getColumn()) { @@ -114,7 +112,11 @@ public String getColumnText(Object object, int columnIndex) { AUnit unit = parameterBean.getDefaultValueBean().getTypeInstance().getUnit(); return super.getText(unit); } else if (column == colOverrie.getColumn()) { - column.setWidth(UiSnippetCefTreeTableImpl.OVERRIDE_COLUMN_SIZE); + if (ca.getSuperTis().isEmpty()) { + column.setWidth(0); + } else { + column.setWidth(UiSnippetCefTreeTableImpl.OVERRIDE_COLUMN_SIZE); + } Boolean overwrite = parameterBean.getDefaultValueBean().getTypeInstance().isOverride(); if (parameterBean.getDefaultValueBean().getIsCalculated()) { return CALCULATED_STRING; From aad47db9828bcf1c8fab3cd304893d7f7064a723 Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Fri, 25 Aug 2023 12:53:53 +0200 Subject: [PATCH 07/11] Move editing support to seperate class + file --- .../OverrideFlagCellEditingSupport.java | 68 +++++++++++++++++++ .../tableimpl/UiSnippetCefTreeTableImpl.java | 34 +--------- 2 files changed, 69 insertions(+), 33 deletions(-) create mode 100644 de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/OverrideFlagCellEditingSupport.java diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/OverrideFlagCellEditingSupport.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/OverrideFlagCellEditingSupport.java new file mode 100644 index 00000000..ae004e8d --- /dev/null +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/OverrideFlagCellEditingSupport.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2008-2019 German Aerospace Center (DLR), Simulation and Software Technology, Germany. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package de.dlr.sc.virsat.model.extension.cefx.ui.snippet.tableimpl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.ComboBoxCellEditor; +import org.eclipse.swt.widgets.Composite; + +import de.dlr.sc.virsat.model.dvlm.categories.propertyinstances.ComposedPropertyInstance; +import de.dlr.sc.virsat.model.extension.cefx.model.Parameter; +import de.dlr.sc.virsat.uiengine.ui.cellEditor.emfattributes.EBooleanCellEditingSupport; + +public class OverrideFlagCellEditingSupport extends EBooleanCellEditingSupport { + + private CellEditor editor; + public static final String[] OVERRIDE_LITERALS = { "Inherited", "Override" }; + + public OverrideFlagCellEditingSupport(EditingDomain editingDomain, ColumnViewer viewer, EAttribute emfAttribute) { + super(editingDomain, viewer, emfAttribute); + this.editor = new ComboBoxCellEditor((Composite) viewer.getControl(), OVERRIDE_LITERALS); + } + + @Override + protected Object getValue(Object element) { + if (element instanceof ComposedPropertyInstance) { + Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); + return super.getValue(param.getDefaultValueBean().getTypeInstance()); + } + return super.getValue(element); + } + + @Override + protected void setValue(Object element, Object userInputValue) { + if (element instanceof ComposedPropertyInstance) { + Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); + super.setValue(param.getDefaultValueBean().getTypeInstance(), userInputValue); + } else { + super.setValue(element, userInputValue); + } + } + @Override + protected boolean canEdit(Object element) { + if (element instanceof ComposedPropertyInstance) { + Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); + if (param.getDefaultValueBean().getIsCalculated()) { + return false; + } + return super.canEdit(param.getDefaultValueBean().getTypeInstance()); + } + return false; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + +} diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java index 3c8d5b93..762c4e6e 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java @@ -18,7 +18,6 @@ import de.dlr.sc.virsat.model.dvlm.categories.CategoryAssignment; import de.dlr.sc.virsat.model.dvlm.categories.propertydefinitions.AProperty; -import de.dlr.sc.virsat.model.dvlm.categories.propertyinstances.ComposedPropertyInstance; import de.dlr.sc.virsat.model.dvlm.concepts.util.ActiveConceptHelper; import de.dlr.sc.virsat.model.dvlm.general.GeneralPackage; import de.dlr.sc.virsat.model.dvlm.inheritance.InheritancePackage; @@ -30,7 +29,6 @@ import de.dlr.sc.virsat.uiengine.ui.cellEditor.aproperties.MultiPropertyEditingSupport; import de.dlr.sc.virsat.uiengine.ui.cellEditor.aproperties.QudvUnitCellEditingSupport; import de.dlr.sc.virsat.uiengine.ui.cellEditor.aproperties.ValuePropertyCellEditingSupport; -import de.dlr.sc.virsat.uiengine.ui.cellEditor.emfattributes.EBooleanCellEditingSupport; import de.dlr.sc.virsat.uiengine.ui.cellEditor.emfattributes.EStringCellEditingSupport; import de.dlr.sc.virsat.uiengine.ui.editor.snippets.AUiSnippetGenericCategoryAssignmentTable; import de.dlr.sc.virsat.uiengine.ui.editor.snippets.AUiSnippetGenericTable; @@ -99,37 +97,7 @@ protected boolean canEdit(Object element) { colOverride = (TreeViewerColumn) createDefaultColumn("Override"); colOverride.getColumn().setToolTipText(DESCRIPTION_OVERRIDE); colOverride.getColumn().setWidth(0); - colOverride.setEditingSupport(new EBooleanCellEditingSupport(editingDomain, columnViewer, InheritancePackage.Literals.IOVERRIDABLE_INHERITANCE_LINK__OVERRIDE) { - @Override - protected Object getValue(Object element) { - if (element instanceof ComposedPropertyInstance) { - Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); - return super.getValue(param.getDefaultValueBean().getTypeInstance()); - } - return super.getValue(element); - } - - @Override - protected void setValue(Object element, Object userInputValue) { - if (element instanceof ComposedPropertyInstance) { - Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); - super.setValue(param.getDefaultValueBean().getTypeInstance(), userInputValue); - } else { - super.setValue(element, userInputValue); - } - } - @Override - protected boolean canEdit(Object element) { - if (element instanceof ComposedPropertyInstance) { - Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); - if (param.getDefaultValueBean().getIsCalculated()) { - return false; - } - return super.canEdit(param.getDefaultValueBean().getTypeInstance()); - } - return false; - } - }); + colOverride.setEditingSupport(new OverrideFlagCellEditingSupport(editingDomain, columnViewer, InheritancePackage.Literals.IOVERRIDABLE_INHERITANCE_LINK__OVERRIDE)); } @Override From 68db08ba6b58428ffc82c423e1d0d42e263dde55 Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Fri, 25 Aug 2023 12:54:04 +0200 Subject: [PATCH 08/11] Update use of icons --- .../resources/icons/FloatProperty.gif | Bin 0 -> 880 bytes .../itemprovider/VirSatCefTreeLabelProvider.java | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/FloatProperty.gif diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/FloatProperty.gif b/de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/FloatProperty.gif new file mode 100644 index 0000000000000000000000000000000000000000..a073c949421d75e57147caa960dab9f99d6d9962 GIT binary patch literal 880 zcmZ?wbhEHb6krfw_|5c?=a0|P#-5ie(iY{Hel4>y-hRSZ8GNw^39-Ee&oUG2iBIe{I h)l<_A{I%wIPF~zF+oJfH$coMCe(k2s|F}6AtO4}bCKUhx literal 0 HcmV?d00001 diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java index fb828f90..389989da 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java @@ -34,6 +34,7 @@ import de.dlr.sc.virsat.model.extension.cefx.model.SystemParameters; import de.dlr.sc.virsat.model.extension.cefx.model.Value; import de.dlr.sc.virsat.model.extension.cefx.ui.Activator; +import de.dlr.sc.virsat.model.extension.cefx.ui.snippet.tableimpl.OverrideFlagCellEditingSupport; import de.dlr.sc.virsat.model.extension.cefx.ui.snippet.tableimpl.UiSnippetCefTreeTableImpl; import de.dlr.sc.virsat.project.markers.VirSatProblemMarkerHelper; import de.dlr.sc.virsat.project.ui.labelProvider.VirSatTransactionalAdapterFactoryLabelProvider; @@ -55,11 +56,13 @@ public class VirSatCefTreeLabelProvider extends VirSatTransactionalAdapterFactor private static final String CALCULATED_STRING = "<>"; private static final String OVERRIDE_IMAGE_PATH = "resources/icons/Override.gif"; private static final String INHERIT_IMAGE_PATH = "resources/icons/Inherit.gif"; + private static final String FLOAT_PROP_IMAGE_PATH = "resources/icons/FloatProperty.gif"; private static final int OVERRIDE_COLUMN = 3; private ColumnViewer columnViewer; private Image imageCalculated; private Image imageOverride; private Image imageInherited; + private Image imageFloat; TreeViewerColumn colOne; TreeViewerColumn colTwo; @@ -87,6 +90,7 @@ public VirSatCefTreeLabelProvider(AdapterFactory adapterFactory, ColumnViewer co imageOverride = ExtendedImageRegistry.INSTANCE.getImage(Activator.getImageDescriptor(OVERRIDE_IMAGE_PATH)); imageInherited = ExtendedImageRegistry.INSTANCE.getImage(Activator.getImageDescriptor(INHERIT_IMAGE_PATH)); imageCalculated = DVLMEditorPlugin.getPlugin().getImageRegistry().get(DVLMEditorPlugin.IMAGE_CALCULATED); + imageFloat = ExtendedImageRegistry.INSTANCE.getImage(Activator.getImageDescriptor(FLOAT_PROP_IMAGE_PATH)); } @Override @@ -120,8 +124,12 @@ public String getColumnText(Object object, int columnIndex) { Boolean overwrite = parameterBean.getDefaultValueBean().getTypeInstance().isOverride(); if (parameterBean.getDefaultValueBean().getIsCalculated()) { return CALCULATED_STRING; + } + if (overwrite) { + return OverrideFlagCellEditingSupport.OVERRIDE_LITERALS[1]; + } else { + return OverrideFlagCellEditingSupport.OVERRIDE_LITERALS[0]; } - return overwrite.toString(); } } else if (ca.getType().getFullQualifiedName().equals(Value.FULL_QUALIFIED_CATEGORY_NAME)) { Value valueBean = new Value(ca); @@ -225,7 +233,9 @@ private Image getColumnImageForParameter(CategoryAssignment ca, int columnIndex) return problemImage; } else if (piHelper.isCalculated(ca)) { return imageCalculated; - } + } else { + return imageFloat; + } } else if (columnIndex == OVERRIDE_COLUMN) { if (ca.getType().getFullQualifiedName().equals(Parameter.FULL_QUALIFIED_CATEGORY_NAME)) { Parameter parameterBean = new Parameter(ca); From 4e9399460d958b7dc9941ce8f1df7680e923f1ed Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Fri, 25 Aug 2023 14:17:04 +0200 Subject: [PATCH 09/11] Use icons on system mode values --- .../VirSatCefTreeLabelProvider.java | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java index 389989da..c990a944 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java @@ -14,6 +14,7 @@ import org.eclipse.jface.viewers.ColumnViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewerColumn; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.TreeColumn; @@ -57,6 +58,7 @@ public class VirSatCefTreeLabelProvider extends VirSatTransactionalAdapterFactor private static final String OVERRIDE_IMAGE_PATH = "resources/icons/Override.gif"; private static final String INHERIT_IMAGE_PATH = "resources/icons/Inherit.gif"; private static final String FLOAT_PROP_IMAGE_PATH = "resources/icons/FloatProperty.gif"; + private static final Color COLOR_READ_ONLY = new Color(96, 96, 96); private static final int OVERRIDE_COLUMN = 3; private ColumnViewer columnViewer; private Image imageCalculated; @@ -146,6 +148,22 @@ public String getColumnText(Object object, int columnIndex) { } else if (column == colThree.getColumn()) { AUnit unit = valuePropertyBean.getTypeInstance().getUnit(); return super.getText(unit); + } else if (column == colOverrie.getColumn()) { + if (ca.getSuperTis().isEmpty()) { + column.setWidth(0); + } else { + column.setWidth(UiSnippetCefTreeTableImpl.OVERRIDE_COLUMN_SIZE); + } + Boolean overwrite = valueBean.getValueBean().getTypeInstance().isOverride() + || valueBean.getModeBean().getTypeInstance().isOverride(); + if (valueBean.getModeBean().getIsCalculated()) { + return CALCULATED_STRING; + } + if (overwrite) { + return OverrideFlagCellEditingSupport.OVERRIDE_LITERALS[1]; + } else { + return OverrideFlagCellEditingSupport.OVERRIDE_LITERALS[0]; + } } } else if (ca.getType().getFullQualifiedName().equals(SystemParameters.FULL_QUALIFIED_CATEGORY_NAME)) { UnitValuePropertyInstance uvi = (UnitValuePropertyInstance) object; @@ -244,7 +262,6 @@ private Image getColumnImageForParameter(CategoryAssignment ca, int columnIndex) return (override) ? imageOverride : imageInherited; } } - } return null; } @@ -281,8 +298,16 @@ private Image getColumnImageForModeValue(CategoryAssignment ca, int columnIndex) } else if (columnIndex == 1) { APropertyInstance propertyInstance = ca.getPropertyInstances().get(0); Image problemImage = mip.getProblemImageForEObject(propertyInstance); - return (problemImage != null) ? problemImage : null; - } + return (problemImage != null) ? problemImage : imageFloat; + } else if (columnIndex == OVERRIDE_COLUMN) { + Value valueBean = new Value(ca); + Boolean override = valueBean.getValueBean().getTypeInstance().isOverride() + || valueBean.getModeBean().getTypeInstance().isOverride(); + if (valueBean.getModeBean().getIsCalculated()) { + return imageCalculated; + } + return (override) ? imageOverride : imageInherited; + } return null; } @@ -303,5 +328,17 @@ private Image getColumnImageForEquipmentParameter(CategoryAssignment ca, int col } return null; } + + @Override + public Color getForeground(Object object) { + CategoryAssignment ca = getCategoryAssignment(object); + PropertyInstanceHelper piHelper = new PropertyInstanceHelper(); + redirectNotification(ca, object); + if (piHelper.isCalculated(ca)) { + return COLOR_READ_ONLY; + } + + return super.getForeground(object); + } } From 7bdc8c782f33880e0ea4febac48364f9d801c269 Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Mon, 28 Aug 2023 16:31:24 +0200 Subject: [PATCH 10/11] Perperly check if mode values can be edited and move to helper class --- .../cefx/util/CefModeHelperTest.java | 35 ++++++++++++++++++- .../VirSatCefTreeLabelProvider.java | 33 ++++++++++++----- .../tableimpl/UiSnippetCefTreeTableImpl.java | 15 +++++++- .../extension/cefx/util/CefModeHelper.java | 29 +++++++++++++++ 4 files changed, 101 insertions(+), 11 deletions(-) diff --git a/de.dlr.sc.virsat.model.extension.cefx.test/src/de/dlr/sc/virsat/model/extension/cefx/util/CefModeHelperTest.java b/de.dlr.sc.virsat.model.extension.cefx.test/src/de/dlr/sc/virsat/model/extension/cefx/util/CefModeHelperTest.java index d1fe8821..3dd708c3 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.test/src/de/dlr/sc/virsat/model/extension/cefx/util/CefModeHelperTest.java +++ b/de.dlr.sc.virsat.model.extension.cefx.test/src/de/dlr/sc/virsat/model/extension/cefx/util/CefModeHelperTest.java @@ -9,10 +9,11 @@ *******************************************************************************/ package de.dlr.sc.virsat.model.extension.cefx.util; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.hasItems; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -23,8 +24,12 @@ import org.junit.Test; import de.dlr.sc.virsat.concept.unittest.util.test.AConceptTestCase; +import de.dlr.sc.virsat.model.concept.types.property.BeanPropertyComposed; +import de.dlr.sc.virsat.model.dvlm.categories.CategoryAssignment; import de.dlr.sc.virsat.model.dvlm.concepts.Concept; import de.dlr.sc.virsat.model.dvlm.concepts.util.ActiveConceptHelper; +import de.dlr.sc.virsat.model.extension.cefx.model.EquipmentMassParameters; +import de.dlr.sc.virsat.model.extension.cefx.model.EquipmentParameters; import de.dlr.sc.virsat.model.extension.cefx.model.Parameter; import de.dlr.sc.virsat.model.extension.cefx.model.SystemMode; import de.dlr.sc.virsat.model.extension.cefx.model.Value; @@ -209,5 +214,33 @@ public void testGetModeValueOrDefault() { assertEquals("Found the correct mode value", value1.getValue(), modeValue1, EPS); assertEquals("Found the correct mode value", value2.getValue(), modeValue2, EPS); } + + @Test + public void testIsValueCalculated() { + CefModeHelper helper = new CefModeHelper(); + + ElementConfiguration subSystem = new ElementConfiguration(conceptPS); + EquipmentMassParameters paramsMass = new EquipmentMassParameters(conceptCEFX); + EquipmentParameters params = new EquipmentParameters(conceptCEFX); + subSystem.add(params); + subSystem.add(paramsMass); + BeanPropertyComposed beanNotComputed = paramsMass.getMassBean(); + BeanPropertyComposed beanComputed = paramsMass.getMassTotalBean(); + + Value valueNotComputed = new Value(conceptCEFX); + Value valueComputed = new Value(conceptCEFX); + + SystemMode systemMode1 = new SystemMode(conceptCEFX); + SystemMode systemMode2 = new SystemMode(conceptCEFX); + + valueNotComputed.setMode(systemMode1); + valueComputed.setMode(systemMode2); + + beanNotComputed.getValue().getModeValues().add(valueNotComputed); + beanComputed.getValue().getModeValues().add(valueComputed); + + assertTrue(helper.isValueCalculated((CategoryAssignment) valueComputed.getTypeInstance())); + assertFalse(helper.isValueCalculated((CategoryAssignment) valueNotComputed.getTypeInstance())); + } } diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java index c990a944..fddd503a 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/itemprovider/VirSatCefTreeLabelProvider.java @@ -37,6 +37,7 @@ import de.dlr.sc.virsat.model.extension.cefx.ui.Activator; import de.dlr.sc.virsat.model.extension.cefx.ui.snippet.tableimpl.OverrideFlagCellEditingSupport; import de.dlr.sc.virsat.model.extension.cefx.ui.snippet.tableimpl.UiSnippetCefTreeTableImpl; +import de.dlr.sc.virsat.model.extension.cefx.util.CefModeHelper; import de.dlr.sc.virsat.project.markers.VirSatProblemMarkerHelper; import de.dlr.sc.virsat.project.ui.labelProvider.VirSatTransactionalAdapterFactoryLabelProvider; import de.dlr.sc.virsat.uieingine.ui.DVLMEditorPlugin; @@ -100,13 +101,13 @@ public String getColumnText(Object object, int columnIndex) { TreeColumn column = ((TreeViewer) columnViewer).getTree().getColumn(columnIndex); CategoryAssignment ca = getCategoryAssignment(object); + CefModeHelper modeHelper = new CefModeHelper(); redirectNotification(ca, object); if (ca == null || ca.getType() == null) { return null; } - if (ca.getType().getFullQualifiedName().equals(Parameter.FULL_QUALIFIED_CATEGORY_NAME)) { Parameter parameterBean = new Parameter(ca); redirectNotification(parameterBean.getDefaultValueBean().getTypeInstance(), ca); @@ -156,7 +157,7 @@ public String getColumnText(Object object, int columnIndex) { } Boolean overwrite = valueBean.getValueBean().getTypeInstance().isOverride() || valueBean.getModeBean().getTypeInstance().isOverride(); - if (valueBean.getModeBean().getIsCalculated()) { + if (modeHelper.isValueCalculated(ca)) { return CALCULATED_STRING; } if (overwrite) { @@ -291,6 +292,7 @@ private Image getColumnImageForSystemParameter(CategoryAssignment ca, int column * @return image problem image or null image */ private Image getColumnImageForModeValue(CategoryAssignment ca, int columnIndex) { + CefModeHelper modeHelper = new CefModeHelper(); if (columnIndex == 0) { APropertyInstance propertyInstance = ca.getPropertyInstances().get(1); Image problemImage = mip.getProblemImageForEObject(propertyInstance); @@ -298,15 +300,20 @@ private Image getColumnImageForModeValue(CategoryAssignment ca, int columnIndex) } else if (columnIndex == 1) { APropertyInstance propertyInstance = ca.getPropertyInstances().get(0); Image problemImage = mip.getProblemImageForEObject(propertyInstance); - return (problemImage != null) ? problemImage : imageFloat; + if (problemImage != null) { + return problemImage; + } else if (modeHelper.isValueCalculated(ca)) { + return imageCalculated; + } else { + return imageFloat; + } } else if (columnIndex == OVERRIDE_COLUMN) { Value valueBean = new Value(ca); Boolean override = valueBean.getValueBean().getTypeInstance().isOverride() || valueBean.getModeBean().getTypeInstance().isOverride(); - if (valueBean.getModeBean().getIsCalculated()) { - return imageCalculated; - } - return (override) ? imageOverride : imageInherited; + if (!modeHelper.isValueCalculated(ca)) { + return (override) ? imageOverride : imageInherited; + } } return null; } @@ -331,14 +338,22 @@ private Image getColumnImageForEquipmentParameter(CategoryAssignment ca, int col @Override public Color getForeground(Object object) { + boolean isCalculated = false; CategoryAssignment ca = getCategoryAssignment(object); PropertyInstanceHelper piHelper = new PropertyInstanceHelper(); + CefModeHelper modeHelper = new CefModeHelper(); redirectNotification(ca, object); - if (piHelper.isCalculated(ca)) { + if (ca.getType().getFullQualifiedName().equals(Value.FULL_QUALIFIED_CATEGORY_NAME)) { + isCalculated = modeHelper.isValueCalculated(ca); + } else { + isCalculated = piHelper.isCalculated(ca); + } + + if (isCalculated) { return COLOR_READ_ONLY; } return super.getForeground(object); } - + } diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java index 762c4e6e..767338ca 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/UiSnippetCefTreeTableImpl.java @@ -26,6 +26,7 @@ import de.dlr.sc.virsat.model.extension.cefx.model.Value; import de.dlr.sc.virsat.model.extension.cefx.ui.itemprovider.VirSatCefTreeLabelProvider; import de.dlr.sc.virsat.model.extension.cefx.ui.util.CefUiHelper; +import de.dlr.sc.virsat.model.extension.cefx.util.CefModeHelper; import de.dlr.sc.virsat.uiengine.ui.cellEditor.aproperties.MultiPropertyEditingSupport; import de.dlr.sc.virsat.uiengine.ui.cellEditor.aproperties.QudvUnitCellEditingSupport; import de.dlr.sc.virsat.uiengine.ui.cellEditor.aproperties.ValuePropertyCellEditingSupport; @@ -79,7 +80,19 @@ protected boolean canEdit(Object element) { }); colValue = (TreeViewerColumn) createDefaultColumn("Value"); - MultiPropertyEditingSupport editingSupportValue = new MultiPropertyEditingSupport(columnViewer); + MultiPropertyEditingSupport editingSupportValue = new MultiPropertyEditingSupport(columnViewer) { + @Override + protected boolean canEdit(Object element) { + if (element instanceof CategoryAssignment + && ((CategoryAssignment) element).getType().getFullQualifiedName().equals(Value.FULL_QUALIFIED_CATEGORY_NAME)) { + if (new CefModeHelper().isValueCalculated((CategoryAssignment) element)) { + return false; + } + + } + return super.canEdit(element); + } + }; AProperty defaultValueProperty = acHelper.getProperty(Activator.PLUGIN_ID, Parameter.class.getSimpleName(), Parameter.PROPERTY_DEFAULTVALUE); //Parameter.class.getSimpleName() = non fully qualified name, e.g. "Parameter" editingSupportValue.registerEditingSupport(new ValuePropertyCellEditingSupport(editingDomain, columnViewer, defaultValueProperty)); diff --git a/de.dlr.sc.virsat.model.extension.cefx/src/de/dlr/sc/virsat/model/extension/cefx/util/CefModeHelper.java b/de.dlr.sc.virsat.model.extension.cefx/src/de/dlr/sc/virsat/model/extension/cefx/util/CefModeHelper.java index cf9216d4..5f09ba59 100644 --- a/de.dlr.sc.virsat.model.extension.cefx/src/de/dlr/sc/virsat/model/extension/cefx/util/CefModeHelper.java +++ b/de.dlr.sc.virsat.model.extension.cefx/src/de/dlr/sc/virsat/model/extension/cefx/util/CefModeHelper.java @@ -19,6 +19,11 @@ import de.dlr.sc.virsat.model.concept.types.structural.ABeanStructuralElementInstance; import de.dlr.sc.virsat.model.concept.types.structural.BeanStructuralElementInstance; import de.dlr.sc.virsat.model.concept.types.structural.IBeanStructuralElementInstance; +import de.dlr.sc.virsat.model.dvlm.categories.ATypeInstance; +import de.dlr.sc.virsat.model.dvlm.categories.CategoryAssignment; +import de.dlr.sc.virsat.model.dvlm.categories.propertyinstances.ComposedPropertyInstance; +import de.dlr.sc.virsat.model.dvlm.categories.propertyinstances.impl.ArrayInstanceImpl; +import de.dlr.sc.virsat.model.dvlm.categories.propertyinstances.util.PropertyInstanceHelper; import de.dlr.sc.virsat.model.dvlm.concepts.Concept; import de.dlr.sc.virsat.model.dvlm.qudv.AUnit; import de.dlr.sc.virsat.model.dvlm.structural.StructuralElementInstance; @@ -172,4 +177,28 @@ public SystemMode getModeByName(IBeanStructuralElementInstance beanSei, String m return null; } + + + /** + * Checking if a mode value is calculated by going up the tree and checking if the + * actual composed property is calculated + * @param caValue the CA of the value + * @return true if calculated + */ + public boolean isValueCalculated(CategoryAssignment caValue) { + PropertyInstanceHelper piHelper = new PropertyInstanceHelper(); + if (caValue.eContainer() != null && caValue.eContainer() instanceof ComposedPropertyInstance) { + ComposedPropertyInstance modeValuesCP = (ComposedPropertyInstance) caValue.eContainer(); + if (modeValuesCP.eContainer() != null + && modeValuesCP.eContainer() instanceof ArrayInstanceImpl) { + ArrayInstanceImpl modeValesAi = (ArrayInstanceImpl) modeValuesCP.eContainer(); + if (modeValesAi.eContainer() != null + && modeValesAi.eContainer() instanceof CategoryAssignment + && piHelper.isCalculated((ATypeInstance) modeValesAi.eContainer())) { + return true; + } + } + } + return false; + } } From cb36e509ae9d79d8cb936bb782287fc640549f5b Mon Sep 17 00:00:00 2001 From: "tobias.franz@dlr.de" Date: Mon, 28 Aug 2023 16:31:53 +0200 Subject: [PATCH 11/11] Fix editing support not working if column was handling mode value --- .../tableimpl/OverrideFlagCellEditingSupport.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/OverrideFlagCellEditingSupport.java b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/OverrideFlagCellEditingSupport.java index ae004e8d..6a1c0a8e 100644 --- a/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/OverrideFlagCellEditingSupport.java +++ b/de.dlr.sc.virsat.model.extension.cefx.ui/src/de/dlr/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/OverrideFlagCellEditingSupport.java @@ -16,8 +16,11 @@ import org.eclipse.jface.viewers.ComboBoxCellEditor; import org.eclipse.swt.widgets.Composite; +import de.dlr.sc.virsat.model.dvlm.categories.CategoryAssignment; import de.dlr.sc.virsat.model.dvlm.categories.propertyinstances.ComposedPropertyInstance; import de.dlr.sc.virsat.model.extension.cefx.model.Parameter; +import de.dlr.sc.virsat.model.extension.cefx.model.Value; +import de.dlr.sc.virsat.model.extension.cefx.util.CefModeHelper; import de.dlr.sc.virsat.uiengine.ui.cellEditor.emfattributes.EBooleanCellEditingSupport; public class OverrideFlagCellEditingSupport extends EBooleanCellEditingSupport { @@ -35,6 +38,9 @@ protected Object getValue(Object element) { if (element instanceof ComposedPropertyInstance) { Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); return super.getValue(param.getDefaultValueBean().getTypeInstance()); + } else if (element instanceof CategoryAssignment) { + Value value = new Value((CategoryAssignment) element); + return super.getValue(value.getValueBean().getTypeInstance()); } return super.getValue(element); } @@ -44,6 +50,9 @@ protected void setValue(Object element, Object userInputValue) { if (element instanceof ComposedPropertyInstance) { Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); super.setValue(param.getDefaultValueBean().getTypeInstance(), userInputValue); + } else if (element instanceof CategoryAssignment) { + Value value = new Value((CategoryAssignment) element); + super.setValue(value.getValueBean().getTypeInstance(), userInputValue); } else { super.setValue(element, userInputValue); } @@ -56,6 +65,12 @@ protected boolean canEdit(Object element) { return false; } return super.canEdit(param.getDefaultValueBean().getTypeInstance()); + } else if (element instanceof CategoryAssignment + && ((CategoryAssignment) element).getType().getFullQualifiedName().equals(Value.FULL_QUALIFIED_CATEGORY_NAME)) { + if (!(new CefModeHelper().isValueCalculated((CategoryAssignment) element))) { + return true; + } + } return false; }