From bd0a3d90721a85c9b8f3ea1006518f5d9a713357 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Mon, 24 Aug 2026 14:24:24 +0200 Subject: [PATCH 1/8] ValidationView: replace EMF Forms ModelView with native Eclipse UI and SWT widgets --- .../META-INF/MANIFEST.MF | 8 +- .../OSGI-INF/l10n/bundle.properties | 36 +++- .../set/feature/validation/Messages.java | 96 +++++++++ .../validation/parts/ModelInfoSection.java | 189 ++++++++++++++++++ .../validation/parts/ValidationPart.java | 46 ++--- .../validation/parts/ValidationTablePart.java | 8 +- .../report/RefreshActionReferences.java | 39 ---- .../viewmodel/ValidationReport.view | 120 ----------- 8 files changed, 334 insertions(+), 208 deletions(-) create mode 100644 java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java delete mode 100644 java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/RefreshActionReferences.java delete mode 100644 java/bundles/org.eclipse.set.feature.validation/viewmodel/ValidationReport.view diff --git a/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF index e87d653363..590e9c0b37 100644 --- a/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF @@ -32,11 +32,8 @@ Import-Package: com.google.common.base;version="15.0.0", org.eclipse.emf.ecore.resource, org.eclipse.emf.ecore.util, org.eclipse.emf.ecore.xmi, - org.eclipse.emf.ecp.ui.view;version="1.17.1", - org.eclipse.emf.ecp.ui.view.swt;version="1.17.1", - org.eclipse.emf.ecp.view.spi.custom.model;version="1.17.1", - org.eclipse.emf.ecp.view.spi.model;version="1.17.1", org.eclipse.emf.edit.domain, + org.eclipse.emf.edit.provider, org.eclipse.jface.dialogs, org.eclipse.jface.layout, org.eclipse.jface.operation, @@ -82,6 +79,8 @@ Import-Package: com.google.common.base;version="15.0.0", org.eclipse.set.utils.widgets, org.eclipse.set.utils.xml, org.eclipse.swt.widgets, + org.eclipse.ui.forms, + org.eclipse.ui.forms.widgets, org.osgi.service.component.annotations;version="1.3.0", org.osgi.service.event;version="1.4.0", org.slf4j;version="1.7.2" @@ -90,7 +89,6 @@ Require-Bundle: com.google.guava, org.eclipse.xtend.lib, org.eclipse.xtend.lib.macro, org.eclipse.set.rcp.compatibility;bundle-version="0.1.0";resolution:=optional, - org.eclipse.emf.edit, org.eclipse.set.core.services, org.apache.commons.lang3;bundle-version="3.1.0", org.eclipse.nebula.widgets.nattable.core, diff --git a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties index bae49ee701..7e2fb0909b 100644 --- a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties +++ b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties @@ -21,15 +21,33 @@ ExportValidationTitleMsg=Export als CSV ProgressMsg=Öffne Validierungssicht ShowValidationTableMsg=Zeige Meldungen in neuer Sicht SourceMsg=Quelltext -ValidationReport.Supported.Version=Unterstütztes XML-Schema -ValidationReport.Used.Version=Verwendetes XML-Schema (in Datei) -ValidationReport.ModelInfo=Modellinformationen -ValidationReport.FunctionalModelInfo=Fachliche Modellinformationen -ValidationReport.Validity=Gültigkeit -ValidationReport.Messages=Validierungsmeldungen -ValidationReport.Subworks=Untergewerke -ValidationReport.GeladeneDatei=Geladene Datei -ValidationReport.ContainerContents = PlanPro-Container + +ValidationReport_ModelInfo=Modellinformationen +ValidationReport_FunctionalModelInfo=Fachliche Modellinformationen + +ValidationReport_Supported_Version=Unterstütztes XML-Schema +ValidationReport_Used_Version=Verwendetes XML-Schema (in Datei) +ValidationReport_Version_PlanPro=PlanPro +ValidationReport_Version_Signalbegriffe=Signalbegriffe + + +ValidationReport_Validity=Gültigkeit +ValidationReport_Validity_XSD_VALID=XSD-Gültigkeit +ValidationReport_Validity_EMF_VALID=EMF-Gültigkeit +ValidationReport_Validity_ModelLoaded=Verarbeitbar + +ValidationReport_Messages=Validierungsmeldungen +ValidationReport_Subworks=Untergewerke +ValidationReport_Subwork_Model_Content=Enthalten + +ValidationReport_GeladeneDatei=Geladene Datei +ValidationReport_GeladeneDatei_DateiName=Dateiname +ValidationReport_GeladeneDatei_TimeStamp=Zeitstempel +ValidationReport_GeladeneDatei_MD5=MD5 +ValidationReport_GeladeneDatei_GUID=GUID + + +ValidationReport_ContainerContents =PlanPro-Container ModelLoaderImpl_loadMsg=PlanPro-Datei wird geladen ModelSession_ChangeIndicator=(geändert) NilTestProblem_Message=Die nach Datenmodell erforderliche Angabe ist nicht vorhanden. diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java index bde18c0a62..46aea6aedb 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java @@ -255,4 +255,100 @@ public class Messages { * Speichern PlanPro Daten */ public String SaveToolboxFile; + + /** + * Modellinformationen + */ + public String ValidationReport_ModelInfo; + + /** + * Fachliche Modellinformationen + */ + public String ValidationReport_FunctionalModelInfo; + + /** + * Gültigkeit + */ + public String ValidationReport_Validity; + + /** + * XSD-Gültigkeit + */ + public String ValidationReport_Validity_XSD_VALID; + + /** + * EMF-Gültigkeit + */ + public String ValidationReport_Validity_EMF_VALID; + + /** + * Verarbeitbar + */ + public String ValidationReport_Validity_ModelLoaded; + + /** + * Validierungsmeldungen + */ + public String ValidationReport_Messages; + + /** + * Untergewerke + */ + public String ValidationReport_Subworks; + + /** + * Enthalten + */ + public String ValidationReport_Subwork_Model_Content; + + /** + * Geladene Datei + */ + public String ValidationReport_GeladeneDatei; + + /** + * Dateiname + */ + public String ValidationReport_GeladeneDatei_DateiName; + + /** + * Zeitstempel + */ + public String ValidationReport_GeladeneDatei_TimeStamp; + + /** + * MD5 + */ + public String ValidationReport_GeladeneDatei_MD5; + + /** + * GUID + */ + public String ValidationReport_GeladeneDatei_GUID; + + /** + * PlanPro-Container + */ + public String ValidationReport_ContainerContents; + + /** + * PlanPro + */ + public String ValidationReport_Version_PlanPro; + + /** + * Signalbegriffe + */ + public String ValidationReport_Version_Signalbegriffe; + + /** + * Verwendetes XML-Schema (in Datei) + */ + public String ValidationReport_Used_Version; + + /** + * Unterstütztes XML-Schema + */ + public String ValidationReport_Supported_Version; + } diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java new file mode 100644 index 0000000000..25821ceab7 --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java @@ -0,0 +1,189 @@ +/** + * Copyright (c) 2026 DB InfraGO AG and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + */ +package org.eclipse.set.feature.validation.parts; + +import java.util.Collection; +import java.util.function.Function; +import java.util.stream.Collectors; + +import org.eclipse.set.feature.validation.Messages; +import org.eclipse.set.model.validationreport.ValidationReport; +import org.eclipse.set.model.validationreport.VersionInfo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.forms.widgets.ExpandableComposite; +import org.eclipse.ui.forms.widgets.FormToolkit; +import org.eclipse.xtext.xbase.lib.Pair; + +/** + * The section control for loaded file information + * + * @author truong + */ +public class ModelInfoSection { + + protected class GroupSectionControl { + Composite viewSection; + Group group; + + public GroupSectionControl(final Composite viewSection, + final String groupName) { + this.viewSection = viewSection; + createGroup(groupName); + } + + private void createGroup(final String groupName) { + group = new Group(viewSection, SWT.NONE); + group.setText(groupName); + group.setLayout(new GridLayout(2, false)); + group.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); + } + + public GroupSectionControl addTextControl(final String labelText, + final String text) { + final TextFieldWithLabelControl textFieldWithLabelControl = new TextFieldWithLabelControl( + group, labelText, text); + textFieldWithLabelControl.createControl(); + return this; + } + } + + protected record TextFieldWithLabelControl(Composite parent, + String labelText, String text) { + public void createControl() { + final Label label = new Label(parent, SWT.NONE); + label.setText(labelText); + + final Text textField = new Text(parent, SWT.BORDER); + textField.setLayoutData( + new GridData(SWT.FILL, SWT.CENTER, true, false)); + textField.setEnabled(false); + textField.setText(text); + } + } + + Messages messages; + Composite parent; + + /** + * @param parent + * the parent composite + * @param messages + * the {@link Messages} + */ + public ModelInfoSection(final Composite parent, final Messages messages) { + this.messages = messages; + this.parent = parent; + } + + protected void createModelInformationGroup( + final ValidationReport validationReport) { + final Composite section = createExpandedSecion( + messages.ValidationReport_ModelInfo); + + final GroupSectionControl loadedFileGroup = new GroupSectionControl( + section, messages.ValidationReport_GeladeneDatei); + loadedFileGroup // + .addTextControl( + messages.ValidationReport_GeladeneDatei_DateiName, + validationReport.getFileInfo().getFileName()) + .addTextControl( + messages.ValidationReport_GeladeneDatei_TimeStamp, + validationReport.getFileInfo().getTimeStamp()) + .addTextControl(messages.ValidationReport_GeladeneDatei_MD5, + validationReport.getFileInfo().getChecksum()) + .addTextControl(messages.ValidationReport_GeladeneDatei_GUID, + validationReport.getFileInfo().getGuid()); + + final GroupSectionControl validityGroup = new GroupSectionControl( + section, messages.ValidationReport_Validity); + validityGroup // + .addTextControl(messages.ValidationReport_Validity_XSD_VALID, + validationReport.getXsdValid()) + .addTextControl(messages.ValidationReport_Validity_EMF_VALID, + validationReport.getEmfValid()) + .addTextControl(messages.ValidationReport_Validity_ModelLoaded, + validationReport.getModelLoaded()); + + final Pair usedVersion = transformVersionInfo( + validationReport.getFileInfo().getUsedVersion()); + final GroupSectionControl loadedVersionGroup = new GroupSectionControl( + section, messages.ValidationReport_Used_Version); + loadedVersionGroup // + .addTextControl(messages.ValidationReport_Version_PlanPro, + usedVersion.getKey()) + .addTextControl( + messages.ValidationReport_Version_Signalbegriffe, + usedVersion.getValue()); + + final Pair supportedVersions = transformVersionInfo( + validationReport.getSupportedVersion()); + final GroupSectionControl supportVersionGroup = new GroupSectionControl( + section, messages.ValidationReport_Supported_Version); + supportVersionGroup // + .addTextControl(messages.ValidationReport_Version_PlanPro, + supportedVersions.getKey()) + .addTextControl( + messages.ValidationReport_Version_Signalbegriffe, + supportedVersions.getValue()); + } + + protected void createFunctionalInformationenGroup( + final ValidationReport validationReport) { + final Composite expandedSecion = createExpandedSecion( + messages.ValidationReport_FunctionalModelInfo); + final GroupSectionControl subworkGroup = new GroupSectionControl( + expandedSecion, messages.ValidationReport_Subworks); + subworkGroup.addTextControl( + messages.ValidationReport_Subwork_Model_Content, + validationReport.getSubworkTypes()); + + final GroupSectionControl containerContentsGroup = new GroupSectionControl( + expandedSecion, messages.ValidationReport_ContainerContents); + containerContentsGroup.addTextControl( + messages.ValidationReport_Subwork_Model_Content, + validationReport.getFileInfo().getContainerContents()); + } + + private Composite createExpandedSecion(final String sectionTitle) { + final Composite container = new Composite(parent, SWT.NONE); + container.setLayout(new FillLayout()); + container.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); + final FormToolkit formToolkit = new FormToolkit(parent.getDisplay()); + final ExpandableComposite ec = formToolkit + .createExpandableComposite(container, + ExpandableComposite.TWISTIE + | ExpandableComposite.TITLE_BAR + | ExpandableComposite.EXPANDED); + ec.setBackground(parent.getBackground()); + ec.setText(sectionTitle); + final Composite section = new Composite(ec, SWT.NONE); + section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + section.setLayout(new GridLayout(2, true)); + ec.setClient(section); + return section; + } + + private static Pair transformVersionInfo( + final VersionInfo versionInfo) { + final Function, String> toString = versions -> versions + .stream() + .collect(Collectors.joining(", ")); //$NON-NLS-1$ + return new Pair<>(toString.apply(versionInfo.getPlanProVersions()), + toString.apply(versionInfo.getSignalbegriffeVersions())); + } +} diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java index cbadcdc6ad..396914d2b4 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java @@ -10,7 +10,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.function.Function; import org.eclipse.e4.core.services.nls.Translation; import org.eclipse.e4.ui.di.UISynchronize; @@ -37,18 +36,16 @@ import org.eclipse.set.model.planpro.PlanPro.Container_AttributeGroup; import org.eclipse.set.model.validationreport.ValidationReport; import org.eclipse.set.model.validationreport.ValidationSeverity; +import org.eclipse.set.utils.BasePart; import org.eclipse.set.utils.SaveAndRefreshAction; import org.eclipse.set.utils.SelectableAction; -import org.eclipse.set.utils.emfforms.AbstractEmfFormsPart; import org.eclipse.set.utils.events.ContainerDataChanged; import org.eclipse.set.utils.events.ProjectDataChanged; import org.eclipse.set.utils.table.menu.TableMenuService; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -65,14 +62,12 @@ * * @author Bleidiessel / Schaefer */ -public class ValidationPart extends AbstractEmfFormsPart { +public class ValidationPart extends BasePart { private static final int BUTTON_WIDTH_EXPORT_VALIDATION = 30; private static final String VIEW_VALIDATION_REPORT = "validationReport"; //$NON-NLS-1$ - private static final String INJECT_VIEW_VALIDATION_NATTABLE = "validationTableNattable"; //$NON-NLS-1$ - private Exception createException; @Inject @@ -113,9 +108,9 @@ public class ValidationPart extends AbstractEmfFormsPart { @PostConstruct void postConstruct() { - getBroker().subscribe(Events.CLOSE_SESSION, event -> { - modelService.put(INJECT_VIEW_VALIDATION_NATTABLE, null); - }); + // getBroker().subscribe(Events.CLOSE_SESSION, event -> { + // modelService.put(INJECT_VIEW_VALIDATION_NATTABLE, null); + // }); } /** @@ -126,8 +121,9 @@ public ValidationPart() { super(); } + // @Override - protected void createFormsView(final Composite parent) { + protected void createView(final Composite parent) { final Shell shell = getToolboxShell(); final MPart part = getToolboxPart(); final DialogService dialogService = getDialogService(); @@ -143,7 +139,7 @@ protected void createFormsView(final Composite parent) { } } - private void create(final Composite parent) { + protected void create(final Composite parent) { try { // create validation report transformation = new SessionToValidationReportTransformation( @@ -155,30 +151,23 @@ private void create(final Composite parent) { // Register nattable injector tableView = new ValidationTableView(this, messages, tableMenuService); - final Function func = this::createInjectedTable; - modelService.put(INJECT_VIEW_VALIDATION_NATTABLE, func); - // create form content - final ScrolledComposite viewComposite = new ScrolledComposite( - parent, SWT.V_SCROLL); - viewComposite.setLayout(new GridLayout()); - GridDataFactory.fillDefaults() - .grab(true, true) - .applyTo(viewComposite); + final ModelInfoSection validationView = new ModelInfoSection(parent, + messages); - createEmfFormsPart(viewComposite, validationReport, - VIEW_VALIDATION_REPORT); - viewComposite.setContent(getView().getSWTControl()); + validationView.createModelInformationGroup(validationReport); + validationView.createFunctionalInformationenGroup(validationReport); + createInjectedTable(parent); // initial update of button states updateButtonStates(); - // Resize the EMF Forms view according to the outside area to update + // Resize the EMF Forms view according to the outside area to + // update // the scroll view size when the window is resized resizeListenerObject = parent; resizeListener = event -> { - final Point size = getView().getSWTControl() - .computeSize(SWT.DEFAULT, SWT.DEFAULT); + final Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT); final Rectangle bounds = parent.getBounds(); // No offset from parent bounds.x = 0; @@ -189,7 +178,6 @@ private void create(final Composite parent) { bounds.height = (int) Math.max(bounds.height - 25.0, size.y * 0.9); - getView().getSWTControl().setBounds(bounds); }; parent.addListener(SWT.Resize, resizeListener); @@ -201,7 +189,6 @@ private void create(final Composite parent) { protected Control createInjectedTable(final Composite innerParent) { final Composite composite = new Composite(innerParent, SWT.NONE); - GridLayoutFactory.swtDefaults().numColumns(3).applyTo(composite); GridDataFactory.swtDefaults() .align(SWT.FILL, SWT.FILL) @@ -342,6 +329,5 @@ protected void preDestroy() { && !resizeListenerObject.isDisposed()) { resizeListenerObject.removeListener(SWT.RESIZE, resizeListener); } - this.dispose(); } } diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java index eab242a707..fc5c71f7d7 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java @@ -9,7 +9,6 @@ package org.eclipse.set.feature.validation.parts; import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.emf.ecp.ui.view.ECPRendererException; import org.eclipse.set.core.services.configurationservice.UserConfigurationService; import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; import org.eclipse.set.core.services.version.PlanProVersionService; @@ -17,8 +16,8 @@ import org.eclipse.set.feature.validation.report.SessionToValidationReportTransformation; import org.eclipse.set.feature.validation.table.ValidationTableView; import org.eclipse.set.model.validationreport.ValidationReport; +import org.eclipse.set.utils.BasePart; import org.eclipse.set.utils.SelectableAction; -import org.eclipse.set.utils.emfforms.AbstractEmfFormsPart; import org.eclipse.set.utils.table.menu.TableMenuService; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Composite; @@ -30,7 +29,7 @@ * * @author Schaefer */ -public class ValidationTablePart extends AbstractEmfFormsPart { +public class ValidationTablePart extends BasePart { @Inject @Translation @@ -57,8 +56,7 @@ public ValidationTablePart() { } @Override - protected void createFormsView(final Composite parent) - throws ECPRendererException { + protected void createView(final Composite parent) { // create validation report final SessionToValidationReportTransformation transformation = new SessionToValidationReportTransformation( messages, versionService, enumTranslationService); diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/RefreshActionReferences.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/RefreshActionReferences.java deleted file mode 100644 index e84cf59250..0000000000 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/RefreshActionReferences.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2018 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.feature.validation.report; - -import java.util.LinkedHashSet; -import java.util.Set; - -import org.eclipse.emf.ecp.view.spi.custom.model.ECPHardcodedReferences; -import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference; -import org.eclipse.emf.ecp.view.spi.model.VFeaturePathDomainModelReference; -import org.eclipse.emf.ecp.view.spi.model.VViewFactory; - -import org.eclipse.set.model.validationreport.ValidationreportPackage; - -/** - * Custom domain model references for refresh control. - * - * @author Schaefer - */ -public class RefreshActionReferences implements ECPHardcodedReferences { - - @Override - public Set getNeededDomainModelReferences() { - final Set references = new LinkedHashSet<>(); - final VFeaturePathDomainModelReference reference = VViewFactory.eINSTANCE - .createFeaturePathDomainModelReference(); - reference.setDomainModelEFeature(ValidationreportPackage.eINSTANCE - .getValidationReport_Problems()); - references.add(reference); - return references; - } - -} diff --git a/java/bundles/org.eclipse.set.feature.validation/viewmodel/ValidationReport.view b/java/bundles/org.eclipse.set.feature.validation/viewmodel/ValidationReport.view deleted file mode 100644 index 9e98629434..0000000000 --- a/java/bundles/org.eclipse.set.feature.validation/viewmodel/ValidationReport.view +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /org.eclipse.set.model.validationreport/model/validationreport.ecore - From 565cb3449101ad58994f084154eb14b4de888d42 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Mon, 24 Aug 2026 14:42:49 +0200 Subject: [PATCH 2/8] fix compile --- java/bundles/org.eclipse.set.feature.validation/build.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/java/bundles/org.eclipse.set.feature.validation/build.properties b/java/bundles/org.eclipse.set.feature.validation/build.properties index 8dba431192..f31304946e 100644 --- a/java/bundles/org.eclipse.set.feature.validation/build.properties +++ b/java/bundles/org.eclipse.set.feature.validation/build.properties @@ -4,5 +4,4 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ OSGI-INF/,\ - viewmodel/,\ plugin.xml \ No newline at end of file From f489679fbe9886fef893ee7a6d194cd248d7c303 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Mon, 24 Aug 2026 15:28:50 +0200 Subject: [PATCH 3/8] fix missing label --- .../OSGI-INF/l10n/bundle.properties | 3 ++- .../src/org/eclipse/set/feature/validation/Messages.java | 5 +++++ .../set/feature/validation/parts/ValidationPart.java | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties index 7e2fb0909b..af832071fa 100644 --- a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties +++ b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties @@ -15,13 +15,14 @@ ValidMsg=gültig ValidationNotSupportedMsg=Überprfung nicht untersttzt YesMsg=Ja NoSubworks=Kein Untergewerk vorhanden. -ExportFileName=Validierungsmeldungen + ExportValidationMsg=Export als CSV ExportValidationTitleMsg=Export als CSV ProgressMsg=Öffne Validierungssicht ShowValidationTableMsg=Zeige Meldungen in neuer Sicht SourceMsg=Quelltext +ValidationReport_Report_Title=Validierungsmeldungen ValidationReport_ModelInfo=Modellinformationen ValidationReport_FunctionalModelInfo=Fachliche Modellinformationen diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java index 46aea6aedb..66f77fde25 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java @@ -351,4 +351,9 @@ public class Messages { */ public String ValidationReport_Supported_Version; + /** + * Validierungsmeldungen + */ + public String ValidationReport_Report_Title; + } diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java index 396914d2b4..437677c621 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java @@ -37,18 +37,21 @@ import org.eclipse.set.model.validationreport.ValidationReport; import org.eclipse.set.model.validationreport.ValidationSeverity; import org.eclipse.set.utils.BasePart; +import org.eclipse.set.utils.Fonts; import org.eclipse.set.utils.SaveAndRefreshAction; import org.eclipse.set.utils.SelectableAction; import org.eclipse.set.utils.events.ContainerDataChanged; import org.eclipse.set.utils.events.ProjectDataChanged; import org.eclipse.set.utils.table.menu.TableMenuService; import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; @@ -188,6 +191,11 @@ protected void create(final Composite parent) { } protected Control createInjectedTable(final Composite innerParent) { + final Label validationReportLabel = new Label(innerParent, SWT.LEFT); + final Font font = localResourceManager.create(Fonts.TABLE_HEADING); + validationReportLabel.setFont(font); + validationReportLabel.setText(messages.ValidationReport_Report_Title); + final Composite composite = new Composite(innerParent, SWT.NONE); GridLayoutFactory.swtDefaults().numColumns(3).applyTo(composite); GridDataFactory.swtDefaults() From 72285f530d314ce8d7dacfc9e3c3367bfe1655d1 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Tue, 25 Aug 2026 09:33:26 +0200 Subject: [PATCH 4/8] Validation Report Overview --- .../OSGI-INF/l10n/bundle.properties | 4 +- .../set/feature/validation/Messages.java | 10 ++ .../validation/parts/ModelInfoSection.java | 6 +- .../validation/parts/ValidationPart.java | 10 +- .../parts/ValidationReportOverview.java | 95 +++++++++++++++++++ 5 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java diff --git a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties index af832071fa..f6caf0c5f9 100644 --- a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties +++ b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties @@ -19,10 +19,12 @@ NoSubworks=Kein Untergewerk vorhanden. ExportValidationMsg=Export als CSV ExportValidationTitleMsg=Export als CSV ProgressMsg=Öffne Validierungssicht -ShowValidationTableMsg=Zeige Meldungen in neuer Sicht +ShowValidationTableMsg=Zeige Meldungen SourceMsg=Quelltext ValidationReport_Report_Title=Validierungsmeldungen +ValidationReport_Report_PlaningRegion=Meldungen in Planungsbereich +ValidationReport_Report_ViewRegion=Meldungen in Betrachstungsbereich ValidationReport_ModelInfo=Modellinformationen ValidationReport_FunctionalModelInfo=Fachliche Modellinformationen diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java index 66f77fde25..b2c95a1392 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java @@ -356,4 +356,14 @@ public class Messages { */ public String ValidationReport_Report_Title; + /** + * Meldungen in Planungsbereich + */ + public String ValidationReport_Report_PlaningRegion; + + /** + * Meldungen in Betrachstungsbereich + */ + public String ValidationReport_Report_ViewRegion; + } diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java index 25821ceab7..63354f5b52 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java @@ -76,8 +76,8 @@ public void createControl() { } } - Messages messages; - Composite parent; + protected Messages messages; + protected Composite parent; /** * @param parent @@ -159,7 +159,7 @@ protected void createFunctionalInformationenGroup( validationReport.getFileInfo().getContainerContents()); } - private Composite createExpandedSecion(final String sectionTitle) { + protected Composite createExpandedSecion(final String sectionTitle) { final Composite container = new Composite(parent, SWT.NONE); container.setLayout(new FillLayout()); container.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java index 437677c621..c55bc7f26a 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java @@ -161,9 +161,13 @@ protected void create(final Composite parent) { validationView.createModelInformationGroup(validationReport); validationView.createFunctionalInformationenGroup(validationReport); - createInjectedTable(parent); - // initial update of button states - updateButtonStates(); + final ValidationReportOverview validationReportOverview = new ValidationReportOverview( + parent, validationReport, toolboxPartService, messages); + // createInjectedTable(parent); + // // initial update of button states + // updateButtonStates(); + validationReportOverview + .createValidationReportOverviewGroup(validationReport); // Resize the EMF Forms view according to the outside area to // update diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java new file mode 100644 index 0000000000..8351b44e4d --- /dev/null +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) 2026 DB InfraGO AG and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + */ +package org.eclipse.set.feature.validation.parts; + +import java.util.List; +import java.util.function.ToLongFunction; + +import org.eclipse.set.basis.constants.ToolboxConstants; +import org.eclipse.set.core.services.part.ToolboxPartService; +import org.eclipse.set.feature.validation.Messages; +import org.eclipse.set.model.validationreport.ObjectScope; +import org.eclipse.set.model.validationreport.ValidationProblem; +import org.eclipse.set.model.validationreport.ValidationReport; +import org.eclipse.set.model.validationreport.ValidationSeverity; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; + +/** + * + */ +public class ValidationReportOverview extends ModelInfoSection { + private final ValidationReport validationReport; + private final ToolboxPartService toolboxPartservice; + + public ValidationReportOverview(final Composite parent, + final ValidationReport validationReport, + final ToolboxPartService toolboxPartservice, + final Messages messages) { + super(parent, messages); + this.validationReport = validationReport; + this.toolboxPartservice = toolboxPartservice; + } + + protected void createValidationReportOverviewGroup( + final ValidationReport validationReport) { + final Composite expandedSecion = createExpandedSecion( + messages.ValidationReport_Report_Title); + createReportInfoGroup(expandedSecion, + messages.ValidationReport_Report_PlaningRegion, + ObjectScope.PLAN); + + createReportInfoGroup(expandedSecion, + messages.ValidationReport_Report_ViewRegion, + ObjectScope.BETRACHTUNG); + + final Button showTableButton = new Button(expandedSecion, SWT.PUSH); + showTableButton.setText(messages.ShowValidationTableMsg); + showTableButton.addListener(SWT.Selection, event -> toolboxPartservice + .showPart(ToolboxConstants.VALIDATION_TABLE_PART_ID)); + showTableButton + .setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true)); + + } + + protected void createReportInfoGroup(final Composite expandedSection, + final String groupTitle, final ObjectScope scope) { + final List reportInRegion = validationReport + .getProblems() + .stream() + .filter(report -> report.getObjectScope().equals(scope)) + .toList(); + final ToLongFunction getSeverityCount = severity -> reportInRegion + .stream() + .filter(report -> report.getSeverity().equals(severity)) + .count(); + + final GroupSectionControl regionGroup = new GroupSectionControl( + expandedSection, groupTitle); + + final long errorCount = getSeverityCount + .applyAsLong(ValidationSeverity.ERROR); + regionGroup.addTextControl(messages.ErrorMsg, + String.valueOf(errorCount)); + + final long warningCount = getSeverityCount + .applyAsLong(ValidationSeverity.WARNING); + regionGroup.addTextControl(messages.WarningMsg, + String.valueOf(warningCount)); + + final long successCount = getSeverityCount + .applyAsLong(ValidationSeverity.SUCCESS); + regionGroup.addTextControl(messages.SuccessMsg, + String.valueOf(successCount)); + } +} From 9a3943960b9c4e6000fc5705966c292e5eebc5ee Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Wed, 26 Aug 2026 09:48:43 +0200 Subject: [PATCH 5/8] ValidationView: metadata --- .../OSGI-INF/l10n/bundle.properties | 7 +- .../validation/LayoutInfoRequired.java | 4 +- .../set/feature/validation/Messages.java | 29 ++++ .../validation/parts/ModelInfoSection.java | 41 ++++++ .../validation/parts/ValidationPart.java | 124 ++---------------- .../parts/ValidationReportOverview.java | 13 +- .../validation/parts/ValidationTablePart.java | 19 ++- ...sionToValidationReportTransformation.xtend | 2 +- 8 files changed, 116 insertions(+), 123 deletions(-) diff --git a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties index f6caf0c5f9..cedc10f62c 100644 --- a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties +++ b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties @@ -48,7 +48,12 @@ ValidationReport_GeladeneDatei_DateiName=Dateiname ValidationReport_GeladeneDatei_TimeStamp=Zeitstempel ValidationReport_GeladeneDatei_MD5=MD5 ValidationReport_GeladeneDatei_GUID=GUID - +ValidationReport_Metadata=Wesentliche Planungsmetadaten +ValidationReport_Metadata_Location=führende Örtlichkeit +ValidationReport_Metadata_Route=führende Strecke +ValidationReport_Metadata_BuildDesignation=Bauzustand Kurzbezeichnung +ValidationReport_Metadata_Index=Index +ValidationReport_Metadata_LfdNr=Laufende Nummer ValidationReport_ContainerContents =PlanPro-Container ModelLoaderImpl_loadMsg=PlanPro-Datei wird geladen diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/LayoutInfoRequired.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/LayoutInfoRequired.java index d54978ad07..5b193be290 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/LayoutInfoRequired.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/LayoutInfoRequired.java @@ -23,7 +23,7 @@ */ @Component(immediate = true, service = CustomValidator.class) public class LayoutInfoRequired extends AbstractCustomValidator { - public static final String LAYOUT_VALIDATION_TYPE = "Metainformationen"; //$NON-NLS-1$ + public static final String METADATA_VALIDATION_TYPE = "Metainformationen"; //$NON-NLS-1$ @Override public void validate(final ToolboxFile toolboxFile, @@ -55,7 +55,7 @@ private CustomValidationProblemImpl layoutMissing() { @Override public String validationType() { - return LAYOUT_VALIDATION_TYPE; + return METADATA_VALIDATION_TYPE; } } diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java index b2c95a1392..f75b31e940 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java @@ -366,4 +366,33 @@ public class Messages { */ public String ValidationReport_Report_ViewRegion; + /** + * führende Örtlichkeit + */ + public String ValidationReport_Metadata_Location; + + /** + * führende Strecke + */ + public String ValidationReport_Metadata_Route; + + /** + * Bauzustand Kurzbezeichnung + */ + public String ValidationReport_Metadata_BuildDesignation; + + /** + * Index + */ + public String ValidationReport_Metadata_Index; + + /** + * Laufende Nummer + */ + public String ValidationReport_Metadata_LfdNr; + + /** + * Wesentliche Planungsmetadaten + */ + public String ValidationReport_Metadata; } diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java index 63354f5b52..ffe4620364 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java @@ -10,11 +10,18 @@ */ package org.eclipse.set.feature.validation.parts; +import static org.eclipse.set.ppmodel.extensions.PlanProSchnittstelleExtensions.*; + import java.util.Collection; +import java.util.Optional; import java.util.function.Function; import java.util.stream.Collectors; +import javax.xml.datatype.XMLGregorianCalendar; + +import org.eclipse.set.basis.IModelSession; import org.eclipse.set.feature.validation.Messages; +import org.eclipse.set.model.planpro.PlanPro.PlanPro_Schnittstelle; import org.eclipse.set.model.validationreport.ValidationReport; import org.eclipse.set.model.validationreport.VersionInfo; import org.eclipse.swt.SWT; @@ -159,6 +166,40 @@ protected void createFunctionalInformationenGroup( validationReport.getFileInfo().getContainerContents()); } + @SuppressWarnings("nls") + protected void createMetadataInformationenGroup( + final IModelSession modelSession) { + final Composite expandedSecion = createExpandedSecion( + messages.ValidationReport_Metadata); + final PlanPro_Schnittstelle planProSchnittstelle = modelSession + .getPlanProSchnittstelle(); + final GroupSectionControl groupSectionControl = new GroupSectionControl( + expandedSecion, ""); + final Optional datumAbschlussGruppe = getDatumAbschlussGruppe( + planProSchnittstelle); + final String dateString = datumAbschlussGruppe.isPresent() // + ? datumAbschlussGruppe.get().toString() // + : ""; + groupSectionControl + .addTextControl(messages.ValidationReport_Metadata_Location, + getFuehrendeOertlichkeit(planProSchnittstelle) + .orElse("")) + .addTextControl(messages.ValidationReport_Metadata_Route, + getStreckeAbschnitt(planProSchnittstelle).orElse("")) + .addTextControl( + messages.ValidationReport_Metadata_BuildDesignation, + getBauzustandKurzbezeichnung(planProSchnittstelle) + .orElse("")) + .addTextControl(messages.ValidationReport_Metadata_Index, + getIndexAusgabe(planProSchnittstelle).orElse("")) + .addTextControl(messages.ValidationReport_Metadata_LfdNr, + getLaufendeNummerAusgabe(planProSchnittstelle) + .orElse("")) + .addTextControl( + messages.ValidationReport_GeladeneDatei_TimeStamp, + dateString); + } + protected Composite createExpandedSecion(final String sectionTitle) { final Composite container = new Composite(parent, SWT.NONE); container.setLayout(new FillLayout()); diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java index c55bc7f26a..61433f683e 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java @@ -12,11 +12,8 @@ import java.util.List; import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.e4.ui.di.UISynchronize; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.emf.common.notify.Notification; -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.set.basis.ProblemMessage; import org.eclipse.set.basis.cache.Cache; import org.eclipse.set.basis.constants.Events; @@ -25,10 +22,10 @@ import org.eclipse.set.basis.extensions.MApplicationElementExtensions; import org.eclipse.set.basis.files.ToolboxFileRole; import org.eclipse.set.core.services.cache.CacheService; -import org.eclipse.set.core.services.configurationservice.UserConfigurationService; import org.eclipse.set.core.services.dialog.DialogService; import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; import org.eclipse.set.core.services.part.ToolboxPartService; +import org.eclipse.set.core.services.planningaccess.PlanningAccessService; import org.eclipse.set.core.services.version.PlanProVersionService; import org.eclipse.set.feature.validation.Messages; import org.eclipse.set.feature.validation.report.SessionToValidationReportTransformation; @@ -37,25 +34,18 @@ import org.eclipse.set.model.validationreport.ValidationReport; import org.eclipse.set.model.validationreport.ValidationSeverity; import org.eclipse.set.utils.BasePart; -import org.eclipse.set.utils.Fonts; import org.eclipse.set.utils.SaveAndRefreshAction; import org.eclipse.set.utils.SelectableAction; import org.eclipse.set.utils.events.ContainerDataChanged; import org.eclipse.set.utils.events.ProjectDataChanged; -import org.eclipse.set.utils.table.menu.TableMenuService; import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; -import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; import jakarta.inject.Inject; @@ -67,29 +57,25 @@ */ public class ValidationPart extends BasePart { - private static final int BUTTON_WIDTH_EXPORT_VALIDATION = 30; - - private static final String VIEW_VALIDATION_REPORT = "validationReport"; //$NON-NLS-1$ + protected static final String VIEW_VALIDATION_REPORT = "validationReport"; //$NON-NLS-1$ private Exception createException; @Inject private ToolboxPartService toolboxPartService; - @Inject - private TableMenuService tableMenuService; - private SessionToValidationReportTransformation transformation; private ValidationReport validationReport; private ValidationTableView tableView; - private Button exportValidationButton; - @Inject private PlanProVersionService versionService; + @Inject + private PlanningAccessService planingAccessService; + @Inject EnumTranslationService enumTranslationService; @@ -97,25 +83,12 @@ public class ValidationPart extends BasePart { @Translation Messages messages; - @Inject - UISynchronize sync; - @Inject CacheService cacheService; - @Inject - UserConfigurationService userConfigService; - private Listener resizeListener; private Composite resizeListenerObject; - @PostConstruct - void postConstruct() { - // getBroker().subscribe(Events.CLOSE_SESSION, event -> { - // modelService.put(INJECT_VIEW_VALIDATION_NATTABLE, null); - // }); - } - /** * Create the part. */ @@ -144,6 +117,9 @@ protected void createView(final Composite parent) { protected void create(final Composite parent) { try { + final ScrolledComposite scrolledComposite = new ScrolledComposite(parent, + SWT.V_SCROLL); + // create validation report transformation = new SessionToValidationReportTransformation( messages, versionService, enumTranslationService); @@ -151,23 +127,16 @@ protected void create(final Composite parent) { storageReport(); - // Register nattable injector - tableView = new ValidationTableView(this, messages, - tableMenuService); - final ModelInfoSection validationView = new ModelInfoSection(parent, messages); validationView.createModelInformationGroup(validationReport); validationView.createFunctionalInformationenGroup(validationReport); + validationView.createMetadataInformationenGroup(getModelSession()); final ValidationReportOverview validationReportOverview = new ValidationReportOverview( parent, validationReport, toolboxPartService, messages); - // createInjectedTable(parent); - // // initial update of button states - // updateButtonStates(); - validationReportOverview - .createValidationReportOverviewGroup(validationReport); + validationReportOverview.createValidationReportOverviewGroup(); // Resize the EMF Forms view according to the outside area to // update @@ -194,65 +163,6 @@ protected void create(final Composite parent) { } } - protected Control createInjectedTable(final Composite innerParent) { - final Label validationReportLabel = new Label(innerParent, SWT.LEFT); - final Font font = localResourceManager.create(Fonts.TABLE_HEADING); - validationReportLabel.setFont(font); - validationReportLabel.setText(messages.ValidationReport_Report_Title); - - final Composite composite = new Composite(innerParent, SWT.NONE); - GridLayoutFactory.swtDefaults().numColumns(3).applyTo(composite); - GridDataFactory.swtDefaults() - .align(SWT.FILL, SWT.FILL) - .grab(true, false) - .applyTo(composite); - - final Control natTable = tableView.create(innerParent, - validationReport); - // create the open view button - final Button showTableButton = new Button(composite, SWT.PUSH); - GridDataFactory.swtDefaults() - .align(SWT.LEFT, SWT.FILL) - .grab(false, false) - .applyTo(showTableButton); - - showTableButton.setText(messages.ShowValidationTableMsg); - showTableButton.addListener(SWT.Selection, - event -> showValidationTable()); - showTableButton.setSize(BUTTON_WIDTH_EXPORT_VALIDATION, 0); - - // create the toggle collapsed button - final Button collapseAllButton = tableView - .createExpandCollapseAllButton(composite, - messages.ValidationTable_ExpandAllGroup, - messages.ValidationTable_CollapseAllGroup); - - exportValidationButton = new Button(composite, SWT.PUSH); - GridDataFactory.swtDefaults() - .align(SWT.RIGHT, SWT.FILL) - .grab(true, false) - .applyTo(exportValidationButton); - exportValidationButton.setText(messages.ExportValidationMsg); - exportValidationButton.addListener(SWT.Selection, - event -> tableView.exportCsv()); - exportValidationButton.setSize(BUTTON_WIDTH_EXPORT_VALIDATION, 0); - - // Setup layout - showTableButton - .setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, true)); - collapseAllButton - .setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, true)); - exportValidationButton - .setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, true)); - - GridDataFactory.swtDefaults() - .align(SWT.FILL, SWT.FILL) - .grab(true, true) - .hint(SWT.DEFAULT, 600) - .applyTo(natTable); - return natTable; - } - private void storageReport() { final Cache cache = cacheService.getCache(ToolboxFileRole.SESSION, ToolboxConstants.CacheId.PROBLEM_MESSAGE); @@ -278,10 +188,6 @@ private void storageReport() { getBroker().post(Events.PROBLEMS_CHANGED, null); } - void showValidationTable() { - toolboxPartService.showPart(ToolboxConstants.VALIDATION_TABLE_PART_ID); - } - @Override protected void updateViewContainerDataChanged( final List container) { @@ -305,19 +211,11 @@ private void updateValidationView() { // reset outdated mark setOutdated(false); - // update buttons - updateButtonStates(); - // update table tableView.updateView(validationReport); } } - private void updateButtonStates() { - exportValidationButton - .setEnabled(!validationReport.getProblems().isEmpty()); - } - @Override protected SelectableAction getOutdatedAction() { return new SaveAndRefreshAction(this); diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java index 8351b44e4d..6a57aecc56 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java @@ -32,6 +32,16 @@ public class ValidationReportOverview extends ModelInfoSection { private final ValidationReport validationReport; private final ToolboxPartService toolboxPartservice; + /** + * @param parent + * the parent composite + * @param validationReport + * the {@link ValidationReport} + * @param toolboxPartservice + * the {@link ToolboxPartService} + * @param messages + * the {@link Messages} + */ public ValidationReportOverview(final Composite parent, final ValidationReport validationReport, final ToolboxPartService toolboxPartservice, @@ -41,8 +51,7 @@ public ValidationReportOverview(final Composite parent, this.toolboxPartservice = toolboxPartservice; } - protected void createValidationReportOverviewGroup( - final ValidationReport validationReport) { + protected void createValidationReportOverviewGroup() { final Composite expandedSecion = createExpandedSecion( messages.ValidationReport_Report_Title); createReportInfoGroup(expandedSecion, diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java index fc5c71f7d7..6d475d7764 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java @@ -9,6 +9,10 @@ package org.eclipse.set.feature.validation.parts; import org.eclipse.e4.core.services.nls.Translation; +import org.eclipse.set.basis.cache.Cache; +import org.eclipse.set.basis.constants.ToolboxConstants; +import org.eclipse.set.basis.files.ToolboxFileRole; +import org.eclipse.set.core.services.cache.CacheService; import org.eclipse.set.core.services.configurationservice.UserConfigurationService; import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; import org.eclipse.set.core.services.version.PlanProVersionService; @@ -45,6 +49,9 @@ public class ValidationTablePart extends BasePart { @Inject UserConfigurationService userConfigService; + @Inject + CacheService cacheService; + private ValidationTableView tableView; /** @@ -58,10 +65,14 @@ public ValidationTablePart() { @Override protected void createView(final Composite parent) { // create validation report - final SessionToValidationReportTransformation transformation = new SessionToValidationReportTransformation( - messages, versionService, enumTranslationService); - final ValidationReport validationReport = transformation - .transform(getModelSession()); + final Cache cache = cacheService.getCache(ToolboxFileRole.SESSION, + ToolboxConstants.CacheId.PROBLEM_MESSAGE); + final ValidationReport validationReport = cache + .get(ValidationPart.VIEW_VALIDATION_REPORT, () -> { + final SessionToValidationReportTransformation transformation = new SessionToValidationReportTransformation( + messages, versionService, enumTranslationService); + return transformation.transform(getModelSession()); + }); // export action getBanderole().setExportAction(new SelectableAction() { diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/SessionToValidationReportTransformation.xtend b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/SessionToValidationReportTransformation.xtend index 669bd6f196..fce3e12151 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/SessionToValidationReportTransformation.xtend +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/SessionToValidationReportTransformation.xtend @@ -332,7 +332,7 @@ class SessionToValidationReportTransformation { if (objectScope === null || objectScope === ObjectScope.UNKNOWN) { if (validationSourceClass == PlanPro_Layoutinfo || - type === LayoutInfoRequired.LAYOUT_VALIDATION_TYPE) { + type === LayoutInfoRequired.METADATA_VALIDATION_TYPE) { objectScope = ObjectScope.LAYOUT } else { objectScope = ObjectScope.CONTENT From c5935bc2eb68033775d315c7478e2836e3277880 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Wed, 26 Aug 2026 15:09:05 +0200 Subject: [PATCH 6/8] add scrollview --- .../validation/parts/ValidationPart.java | 36 ++---- .../parts/ValidationReportOverview.java | 104 ---------------- ...tion.java => ValidationViewModelInfo.java} | 111 +++++++++++++++--- 3 files changed, 110 insertions(+), 141 deletions(-) delete mode 100644 java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java rename java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/{ModelInfoSection.java => ValidationViewModelInfo.java} (67%) diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java index 61433f683e..c4021a692b 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java @@ -14,6 +14,7 @@ import org.eclipse.e4.core.services.nls.Translation; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.emf.common.notify.Notification; +import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.set.basis.ProblemMessage; import org.eclipse.set.basis.cache.Cache; import org.eclipse.set.basis.constants.Events; @@ -25,7 +26,6 @@ import org.eclipse.set.core.services.dialog.DialogService; import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; import org.eclipse.set.core.services.part.ToolboxPartService; -import org.eclipse.set.core.services.planningaccess.PlanningAccessService; import org.eclipse.set.core.services.version.PlanProVersionService; import org.eclipse.set.feature.validation.Messages; import org.eclipse.set.feature.validation.report.SessionToValidationReportTransformation; @@ -42,6 +42,7 @@ import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; @@ -73,9 +74,6 @@ public class ValidationPart extends BasePart { @Inject private PlanProVersionService versionService; - @Inject - private PlanningAccessService planingAccessService; - @Inject EnumTranslationService enumTranslationService; @@ -117,33 +115,25 @@ protected void createView(final Composite parent) { protected void create(final Composite parent) { try { - final ScrolledComposite scrolledComposite = new ScrolledComposite(parent, - SWT.V_SCROLL); - // create validation report transformation = new SessionToValidationReportTransformation( messages, versionService, enumTranslationService); validationReport = transformation.transform(getModelSession()); - storageReport(); + final ScrolledComposite sc1 = new ScrolledComposite(parent, + SWT.V_SCROLL); + sc1.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().grab(true, true).applyTo(sc1); - final ModelInfoSection validationView = new ModelInfoSection(parent, - messages); - - validationView.createModelInformationGroup(validationReport); - validationView.createFunctionalInformationenGroup(validationReport); - validationView.createMetadataInformationenGroup(getModelSession()); - - final ValidationReportOverview validationReportOverview = new ValidationReportOverview( - parent, validationReport, toolboxPartService, messages); - validationReportOverview.createValidationReportOverviewGroup(); + final ValidationViewModelInfo validationView = new ValidationViewModelInfo( + sc1, messages, validationReport); - // Resize the EMF Forms view according to the outside area to - // update - // the scroll view size when the window is resized + validationView.createView(getModelSession(), toolboxPartService); + sc1.setContent(validationView); resizeListenerObject = parent; resizeListener = event -> { - final Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT); + final Point size = validationView.computeSize(SWT.DEFAULT, + SWT.DEFAULT); final Rectangle bounds = parent.getBounds(); // No offset from parent bounds.x = 0; @@ -153,7 +143,7 @@ protected void create(final Composite parent) { // Use internal height or the parent height bounds.height = (int) Math.max(bounds.height - 25.0, size.y * 0.9); - + validationView.setBounds(bounds); }; parent.addListener(SWT.Resize, resizeListener); diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java deleted file mode 100644 index 6a57aecc56..0000000000 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationReportOverview.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (c) 2026 DB InfraGO AG and others - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v2.0 which is available at - * https://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - * - */ -package org.eclipse.set.feature.validation.parts; - -import java.util.List; -import java.util.function.ToLongFunction; - -import org.eclipse.set.basis.constants.ToolboxConstants; -import org.eclipse.set.core.services.part.ToolboxPartService; -import org.eclipse.set.feature.validation.Messages; -import org.eclipse.set.model.validationreport.ObjectScope; -import org.eclipse.set.model.validationreport.ValidationProblem; -import org.eclipse.set.model.validationreport.ValidationReport; -import org.eclipse.set.model.validationreport.ValidationSeverity; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * - */ -public class ValidationReportOverview extends ModelInfoSection { - private final ValidationReport validationReport; - private final ToolboxPartService toolboxPartservice; - - /** - * @param parent - * the parent composite - * @param validationReport - * the {@link ValidationReport} - * @param toolboxPartservice - * the {@link ToolboxPartService} - * @param messages - * the {@link Messages} - */ - public ValidationReportOverview(final Composite parent, - final ValidationReport validationReport, - final ToolboxPartService toolboxPartservice, - final Messages messages) { - super(parent, messages); - this.validationReport = validationReport; - this.toolboxPartservice = toolboxPartservice; - } - - protected void createValidationReportOverviewGroup() { - final Composite expandedSecion = createExpandedSecion( - messages.ValidationReport_Report_Title); - createReportInfoGroup(expandedSecion, - messages.ValidationReport_Report_PlaningRegion, - ObjectScope.PLAN); - - createReportInfoGroup(expandedSecion, - messages.ValidationReport_Report_ViewRegion, - ObjectScope.BETRACHTUNG); - - final Button showTableButton = new Button(expandedSecion, SWT.PUSH); - showTableButton.setText(messages.ShowValidationTableMsg); - showTableButton.addListener(SWT.Selection, event -> toolboxPartservice - .showPart(ToolboxConstants.VALIDATION_TABLE_PART_ID)); - showTableButton - .setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true)); - - } - - protected void createReportInfoGroup(final Composite expandedSection, - final String groupTitle, final ObjectScope scope) { - final List reportInRegion = validationReport - .getProblems() - .stream() - .filter(report -> report.getObjectScope().equals(scope)) - .toList(); - final ToLongFunction getSeverityCount = severity -> reportInRegion - .stream() - .filter(report -> report.getSeverity().equals(severity)) - .count(); - - final GroupSectionControl regionGroup = new GroupSectionControl( - expandedSection, groupTitle); - - final long errorCount = getSeverityCount - .applyAsLong(ValidationSeverity.ERROR); - regionGroup.addTextControl(messages.ErrorMsg, - String.valueOf(errorCount)); - - final long warningCount = getSeverityCount - .applyAsLong(ValidationSeverity.WARNING); - regionGroup.addTextControl(messages.WarningMsg, - String.valueOf(warningCount)); - - final long successCount = getSeverityCount - .applyAsLong(ValidationSeverity.SUCCESS); - regionGroup.addTextControl(messages.SuccessMsg, - String.valueOf(successCount)); - } -} diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationViewModelInfo.java similarity index 67% rename from java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java rename to java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationViewModelInfo.java index ffe4620364..6f8e027847 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ModelInfoSection.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationViewModelInfo.java @@ -13,21 +13,29 @@ import static org.eclipse.set.ppmodel.extensions.PlanProSchnittstelleExtensions.*; import java.util.Collection; +import java.util.List; import java.util.Optional; import java.util.function.Function; +import java.util.function.ToLongFunction; import java.util.stream.Collectors; import javax.xml.datatype.XMLGregorianCalendar; import org.eclipse.set.basis.IModelSession; +import org.eclipse.set.basis.constants.ToolboxConstants; +import org.eclipse.set.core.services.part.ToolboxPartService; import org.eclipse.set.feature.validation.Messages; import org.eclipse.set.model.planpro.PlanPro.PlanPro_Schnittstelle; +import org.eclipse.set.model.validationreport.ObjectScope; +import org.eclipse.set.model.validationreport.ValidationProblem; import org.eclipse.set.model.validationreport.ValidationReport; +import org.eclipse.set.model.validationreport.ValidationSeverity; import org.eclipse.set.model.validationreport.VersionInfo; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; @@ -41,7 +49,7 @@ * * @author truong */ -public class ModelInfoSection { +public class ValidationViewModelInfo extends Composite { protected class GroupSectionControl { Composite viewSection; @@ -84,21 +92,42 @@ public void createControl() { } protected Messages messages; - protected Composite parent; + protected ValidationReport validationReport; + FormToolkit formToolkit; /** * @param parent * the parent composite * @param messages * the {@link Messages} + * @param validationReport + * the {@link ValidationReport} */ - public ModelInfoSection(final Composite parent, final Messages messages) { + public ValidationViewModelInfo(final Composite parent, + final Messages messages, final ValidationReport validationReport) { + super(parent, SWT.NONE); + setLayout(new GridLayout()); + setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + formToolkit = new FormToolkit(getDisplay()); this.messages = messages; - this.parent = parent; + this.validationReport = validationReport; } - protected void createModelInformationGroup( - final ValidationReport validationReport) { + /** + * @param modelSession + * the {@link IModelSession} + * @param toolboxPartService + * the {@link ToolboxPartService} + */ + public void createView(final IModelSession modelSession, + final ToolboxPartService toolboxPartService) { + createModelInformationGroup(); + createFunctionalInformationenGroup(); + createMetadataInformationenGroup(modelSession); + createValidationReportOverviewGroup(toolboxPartService); + } + + private void createModelInformationGroup() { final Composite section = createExpandedSecion( messages.ValidationReport_ModelInfo); @@ -149,8 +178,7 @@ protected void createModelInformationGroup( supportedVersions.getValue()); } - protected void createFunctionalInformationenGroup( - final ValidationReport validationReport) { + private void createFunctionalInformationenGroup() { final Composite expandedSecion = createExpandedSecion( messages.ValidationReport_FunctionalModelInfo); final GroupSectionControl subworkGroup = new GroupSectionControl( @@ -167,7 +195,7 @@ protected void createFunctionalInformationenGroup( } @SuppressWarnings("nls") - protected void createMetadataInformationenGroup( + private void createMetadataInformationenGroup( final IModelSession modelSession) { final Composite expandedSecion = createExpandedSecion( messages.ValidationReport_Metadata); @@ -189,7 +217,11 @@ protected void createMetadataInformationenGroup( .addTextControl( messages.ValidationReport_Metadata_BuildDesignation, getBauzustandKurzbezeichnung(planProSchnittstelle) - .orElse("")) + .orElse("")); + + final GroupSectionControl secondGroup = new GroupSectionControl( + expandedSecion, ""); + secondGroup .addTextControl(messages.ValidationReport_Metadata_Index, getIndexAusgabe(planProSchnittstelle).orElse("")) .addTextControl(messages.ValidationReport_Metadata_LfdNr, @@ -200,17 +232,68 @@ protected void createMetadataInformationenGroup( dateString); } - protected Composite createExpandedSecion(final String sectionTitle) { - final Composite container = new Composite(parent, SWT.NONE); + private void createValidationReportOverviewGroup( + final ToolboxPartService toolboxPartService) { + final Composite expandedSecion = createExpandedSecion( + messages.ValidationReport_Report_Title); + createReportInfoGroup(expandedSecion, + messages.ValidationReport_Report_PlaningRegion, + ObjectScope.PLAN); + + createReportInfoGroup(expandedSecion, + messages.ValidationReport_Report_ViewRegion, + ObjectScope.BETRACHTUNG); + + final Button showTableButton = new Button(expandedSecion, SWT.PUSH); + showTableButton.setText(messages.ShowValidationTableMsg); + showTableButton.addListener(SWT.Selection, event -> toolboxPartService + .showPart(ToolboxConstants.VALIDATION_TABLE_PART_ID)); + showTableButton + .setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true)); + + } + + private void createReportInfoGroup(final Composite expandedSection, + final String groupTitle, final ObjectScope scope) { + final List reportInRegion = validationReport + .getProblems() + .stream() + .filter(report -> report.getObjectScope().equals(scope)) + .toList(); + final ToLongFunction getSeverityCount = severity -> reportInRegion + .stream() + .filter(report -> report.getSeverity().equals(severity)) + .count(); + + final GroupSectionControl regionGroup = new GroupSectionControl( + expandedSection, groupTitle); + + final long errorCount = getSeverityCount + .applyAsLong(ValidationSeverity.ERROR); + regionGroup.addTextControl(messages.ErrorMsg, + String.valueOf(errorCount)); + + final long warningCount = getSeverityCount + .applyAsLong(ValidationSeverity.WARNING); + regionGroup.addTextControl(messages.WarningMsg, + String.valueOf(warningCount)); + + final long successCount = getSeverityCount + .applyAsLong(ValidationSeverity.SUCCESS); + regionGroup.addTextControl(messages.SuccessMsg, + String.valueOf(successCount)); + } + + private Composite createExpandedSecion(final String sectionTitle) { + final Composite container = new Composite(this, SWT.NONE); container.setLayout(new FillLayout()); container.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); - final FormToolkit formToolkit = new FormToolkit(parent.getDisplay()); final ExpandableComposite ec = formToolkit .createExpandableComposite(container, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED); - ec.setBackground(parent.getBackground()); + ec.setBackground(getBackground()); ec.setText(sectionTitle); final Composite section = new Composite(ec, SWT.NONE); section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); From f87dab2088e47346a771b7b2356335bf460aef70 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Wed, 26 Aug 2026 16:43:03 +0200 Subject: [PATCH 7/8] update SWTBot & use observable value for metadata --- .../META-INF/MANIFEST.MF | 2 + .../observable/SupplierObservableValue.java | 51 +++++++++++++ .../META-INF/MANIFEST.MF | 4 ++ .../validation/parts/ValidationPart.java | 20 +++++- .../validation/parts/ValidationTablePart.java | 19 ++--- .../parts/ValidationViewModelInfo.java | 71 ++++++++++++++----- .../set/swtbot/ValidationViewTest.java | 16 ++++- 7 files changed, 147 insertions(+), 36 deletions(-) create mode 100644 java/bundles/org.eclipse.set.basis/src/org/eclipse/set/basis/observable/SupplierObservableValue.java diff --git a/java/bundles/org.eclipse.set.basis/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.basis/META-INF/MANIFEST.MF index c9947b4f55..bfe4bb17b1 100644 --- a/java/bundles/org.eclipse.set.basis/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.basis/META-INF/MANIFEST.MF @@ -35,6 +35,8 @@ Export-Package: org.eclipse.set.basis, org.eclipse.set.basis.viewgroups Import-Package: com.google.common.collect, org.apache.commons.lang3, + org.eclipse.core.databinding.observable, + org.eclipse.core.databinding.observable.value;version="[1.0.0,2.0.0)", org.eclipse.core.runtime, org.eclipse.e4.core.contexts, org.eclipse.e4.core.di, diff --git a/java/bundles/org.eclipse.set.basis/src/org/eclipse/set/basis/observable/SupplierObservableValue.java b/java/bundles/org.eclipse.set.basis/src/org/eclipse/set/basis/observable/SupplierObservableValue.java new file mode 100644 index 0000000000..4fb5f4b75e --- /dev/null +++ b/java/bundles/org.eclipse.set.basis/src/org/eclipse/set/basis/observable/SupplierObservableValue.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2026 DB InfraGO AG and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + */ +package org.eclipse.set.basis.observable; + +import java.util.function.Supplier; + +import org.eclipse.core.databinding.observable.value.WritableValue; + +/** + * Observable with Supplier to get value + * + * @author truong + * @param + * the value type + */ +public class SupplierObservableValue extends WritableValue { + + private final Supplier supplier; + + /** + * @param supplier + * the {@link Supplier} to get value + * @param valueType + * the value type + */ + public SupplierObservableValue(final Supplier supplier, + final Object valueType) { + super(supplier.get(), valueType); + this.supplier = supplier; + } + + /** + * Set value through supplier + */ + public void calculate() { + if (getRealm().isCurrent()) { + setValue(supplier.get()); + } else { + getRealm().asyncExec(() -> setValue(supplier.get())); + } + } + +} diff --git a/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF index 590e9c0b37..04fac2154a 100644 --- a/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF @@ -14,6 +14,9 @@ Import-Package: com.google.common.base;version="15.0.0", org.apache.commons.io.filefilter;version="2.15.0", org.apache.commons.text, org.apache.poi;version="5.0.0", + org.eclipse.core.databinding, + org.eclipse.core.databinding.observable.value, + org.eclipse.core.databinding.property.value, org.eclipse.core.runtime;version="3.5.0", org.eclipse.e4.core.contexts;version="1.7.0", org.eclipse.e4.core.di;version="1.7.0", @@ -49,6 +52,7 @@ Import-Package: com.google.common.base;version="15.0.0", org.eclipse.set.basis.extensions, org.eclipse.set.basis.files, org.eclipse.set.basis.guid, + org.eclipse.set.basis.observable, org.eclipse.set.basis.part, org.eclipse.set.basis.viewgroups, org.eclipse.set.core.services.cache, diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java index c4021a692b..dfb46d0987 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationPart.java @@ -46,7 +46,9 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; +import org.osgi.service.event.EventHandler; +import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; import jakarta.inject.Inject; @@ -86,6 +88,20 @@ public class ValidationPart extends BasePart { private Listener resizeListener; private Composite resizeListenerObject; + private EventHandler subworkChangeHandler; + + private ValidationViewModelInfo validationView; + + @PostConstruct + void postConstrct() { + subworkChangeHandler = event -> { + if (!event.getTopic().equalsIgnoreCase(Events.SUBWORK_CHANGED)) { + return; + } + validationView.update(); + }; + getBroker().subscribe(Events.SUBWORK_CHANGED, subworkChangeHandler); + } /** * Create the part. @@ -125,8 +141,8 @@ protected void create(final Composite parent) { sc1.setLayout(new GridLayout()); GridDataFactory.fillDefaults().grab(true, true).applyTo(sc1); - final ValidationViewModelInfo validationView = new ValidationViewModelInfo( - sc1, messages, validationReport); + validationView = new ValidationViewModelInfo(sc1, messages, + validationReport); validationView.createView(getModelSession(), toolboxPartService); sc1.setContent(validationView); diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java index 6d475d7764..fc5c71f7d7 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationTablePart.java @@ -9,10 +9,6 @@ package org.eclipse.set.feature.validation.parts; import org.eclipse.e4.core.services.nls.Translation; -import org.eclipse.set.basis.cache.Cache; -import org.eclipse.set.basis.constants.ToolboxConstants; -import org.eclipse.set.basis.files.ToolboxFileRole; -import org.eclipse.set.core.services.cache.CacheService; import org.eclipse.set.core.services.configurationservice.UserConfigurationService; import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; import org.eclipse.set.core.services.version.PlanProVersionService; @@ -49,9 +45,6 @@ public class ValidationTablePart extends BasePart { @Inject UserConfigurationService userConfigService; - @Inject - CacheService cacheService; - private ValidationTableView tableView; /** @@ -65,14 +58,10 @@ public ValidationTablePart() { @Override protected void createView(final Composite parent) { // create validation report - final Cache cache = cacheService.getCache(ToolboxFileRole.SESSION, - ToolboxConstants.CacheId.PROBLEM_MESSAGE); - final ValidationReport validationReport = cache - .get(ValidationPart.VIEW_VALIDATION_REPORT, () -> { - final SessionToValidationReportTransformation transformation = new SessionToValidationReportTransformation( - messages, versionService, enumTranslationService); - return transformation.transform(getModelSession()); - }); + final SessionToValidationReportTransformation transformation = new SessionToValidationReportTransformation( + messages, versionService, enumTranslationService); + final ValidationReport validationReport = transformation + .transform(getModelSession()); // export action getBanderole().setExportAction(new SelectableAction() { diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationViewModelInfo.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationViewModelInfo.java index 6f8e027847..63e61cc1bc 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationViewModelInfo.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/parts/ValidationViewModelInfo.java @@ -12,17 +12,22 @@ import static org.eclipse.set.ppmodel.extensions.PlanProSchnittstelleExtensions.*; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Optional; import java.util.function.Function; +import java.util.function.Supplier; import java.util.function.ToLongFunction; import java.util.stream.Collectors; import javax.xml.datatype.XMLGregorianCalendar; +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.jface.databinding.swt.typed.WidgetProperties; import org.eclipse.set.basis.IModelSession; import org.eclipse.set.basis.constants.ToolboxConstants; +import org.eclipse.set.basis.observable.SupplierObservableValue; import org.eclipse.set.core.services.part.ToolboxPartService; import org.eclipse.set.feature.validation.Messages; import org.eclipse.set.model.planpro.PlanPro.PlanPro_Schnittstelle; @@ -75,6 +80,23 @@ public GroupSectionControl addTextControl(final String labelText, textFieldWithLabelControl.createControl(); return this; } + + public GroupSectionControl addObservableTextControl( + final String labelText, final Supplier getTextFunc) { + final Label label = new Label(group, SWT.NONE); + label.setText(labelText); + + final Text textField = new Text(group, SWT.BORDER); + textField.setLayoutData( + new GridData(SWT.FILL, SWT.CENTER, true, false)); + textField.setEnabled(false); + final SupplierObservableValue text = new SupplierObservableValue<>( + getTextFunc, String.class); + observableValues.add(text); + final DataBindingContext ctx = new DataBindingContext(); + ctx.bindValue(WidgetProperties.text().observe(textField), text); + return this; + } } protected record TextFieldWithLabelControl(Composite parent, @@ -94,6 +116,7 @@ public void createControl() { protected Messages messages; protected ValidationReport validationReport; FormToolkit formToolkit; + private final List> observableValues; /** * @param parent @@ -111,6 +134,7 @@ public ValidationViewModelInfo(final Composite parent, formToolkit = new FormToolkit(getDisplay()); this.messages = messages; this.validationReport = validationReport; + this.observableValues = new ArrayList<>(); } /** @@ -203,33 +227,40 @@ private void createMetadataInformationenGroup( .getPlanProSchnittstelle(); final GroupSectionControl groupSectionControl = new GroupSectionControl( expandedSecion, ""); - final Optional datumAbschlussGruppe = getDatumAbschlussGruppe( - planProSchnittstelle); - final String dateString = datumAbschlussGruppe.isPresent() // - ? datumAbschlussGruppe.get().toString() // - : ""; + groupSectionControl - .addTextControl(messages.ValidationReport_Metadata_Location, - getFuehrendeOertlichkeit(planProSchnittstelle) + .addObservableTextControl( + messages.ValidationReport_Metadata_Location, + () -> getFuehrendeOertlichkeit(planProSchnittstelle) .orElse("")) - .addTextControl(messages.ValidationReport_Metadata_Route, - getStreckeAbschnitt(planProSchnittstelle).orElse("")) - .addTextControl( + .addObservableTextControl( + messages.ValidationReport_Metadata_Route, + () -> getStreckeAbschnitt(planProSchnittstelle) + .orElse("")) + .addObservableTextControl( messages.ValidationReport_Metadata_BuildDesignation, - getBauzustandKurzbezeichnung(planProSchnittstelle) + () -> getBauzustandKurzbezeichnung(planProSchnittstelle) .orElse("")); final GroupSectionControl secondGroup = new GroupSectionControl( expandedSecion, ""); secondGroup - .addTextControl(messages.ValidationReport_Metadata_Index, - getIndexAusgabe(planProSchnittstelle).orElse("")) - .addTextControl(messages.ValidationReport_Metadata_LfdNr, - getLaufendeNummerAusgabe(planProSchnittstelle) + .addObservableTextControl( + messages.ValidationReport_Metadata_Index, + () -> getIndexAusgabe(planProSchnittstelle).orElse("")) + .addObservableTextControl( + messages.ValidationReport_Metadata_LfdNr, + () -> getLaufendeNummerAusgabe(planProSchnittstelle) .orElse("")) - .addTextControl( + .addObservableTextControl( messages.ValidationReport_GeladeneDatei_TimeStamp, - dateString); + () -> { + final Optional datumAbschlussGruppe = getDatumAbschlussGruppe( + planProSchnittstelle); + return datumAbschlussGruppe.isPresent() // + ? datumAbschlussGruppe.get().toString() // + : ""; + }); } private void createValidationReportOverviewGroup( @@ -310,4 +341,10 @@ private static Pair transformVersionInfo( return new Pair<>(toString.apply(versionInfo.getPlanProVersions()), toString.apply(versionInfo.getSignalbegriffeVersions())); } + + @Override + public void update() { + super.update(); + observableValues.forEach(SupplierObservableValue::calculate); + } } diff --git a/java/bundles/org.eclipse.set.swtbot/src/org/eclipse/set/swtbot/ValidationViewTest.java b/java/bundles/org.eclipse.set.swtbot/src/org/eclipse/set/swtbot/ValidationViewTest.java index 1af114a281..9672fd4a17 100644 --- a/java/bundles/org.eclipse.set.swtbot/src/org/eclipse/set/swtbot/ValidationViewTest.java +++ b/java/bundles/org.eclipse.set.swtbot/src/org/eclipse/set/swtbot/ValidationViewTest.java @@ -29,6 +29,8 @@ import org.eclipse.set.swtbot.utils.AbstractSWTBotTest; import org.eclipse.set.swtbot.utils.SWTBotUtils; import org.eclipse.set.utils.table.export.ExportToCSV; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCTabItem; import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; @@ -209,6 +211,13 @@ protected void thenExpectModelInformationEquals() { } protected void whenOpeningValidateView() { + final SWTBotCTabItem cTabItem = bot.cTabItem("Validierung"); + cTabItem.activate(); + } + + protected void whenOpenReportTable() { + whenOpeningValidateView(); + bot.button("Zeige Meldungen").click(); nattableBot = SWTBotUtils.waitForNattable(bot, 30000); layers = SWTBotUtils.getNattableLayers(nattableBot); } @@ -223,8 +232,11 @@ void beforeAll() throws Exception { @ExtendWith(TestFailHandle.class) void testValidateReport() throws Exception { givenReferenceCSV(); - whenOpeningValidateView(); - bot.button("Alle ausklappen").click(); + whenOpenReportTable(); + final SWTBotButton ausKlappenButton = bot.button("Alle ausklappen"); + if (ausKlappenButton != null) { + ausKlappenButton.click(); + } thenRowAndColumnCountEqualReferenceCSV(); thenExpectTableDataEqualReferenceCSV(); } From b544b49b5e3a511caad6772401ae4795bc1b8daf Mon Sep 17 00:00:00 2001 From: TruongQuangSB <131350493+TruongQuangSB@users.noreply.github.com> Date: Thu, 27 Aug 2026 09:33:54 +0200 Subject: [PATCH 8/8] Fix missing dependency --- .../org.eclipse.set.feature.validation/META-INF/MANIFEST.MF | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF index 04fac2154a..1e904bcedc 100644 --- a/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.feature.validation/META-INF/MANIFEST.MF @@ -37,6 +37,8 @@ Import-Package: com.google.common.base;version="15.0.0", org.eclipse.emf.ecore.xmi, org.eclipse.emf.edit.domain, org.eclipse.emf.edit.provider, + org.eclipse.jface.databinding.swt, + org.eclipse.jface.databinding.swt.typed, org.eclipse.jface.dialogs, org.eclipse.jface.layout, org.eclipse.jface.operation,