Commit d8dbc962 authored by Alexander Diewald's avatar Alexander Diewald

DSE-UI: Improve the handling of no safety standard being set

Issue-Ref: 4022
Issue-Url: https://af3-developer.fortiss.org/issues/4022Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent 05e54172
DashboardWizard.java 327a5ae84e8c8c0e48bfa9694e4827fc14f000a0 GREEN DashboardWizard.java 3971e02827062ba9ecd114598b2681e45a97fcaf YELLOW
DashboardWizardRootElementSelectionBase.java 1fe550598f11da4cdcf1ecc02173dfc2b992b669 GREEN DashboardWizardRootElementSelectionBase.java e7218b31a2e5cae269b118dfac6c90db906c1f63 YELLOW
DashboardWizardSelectAllocation.java 1a9a0db43c3d8e2247804be2de6eccbd0a9aa48c GREEN DashboardWizardSelectAllocation.java 1a9a0db43c3d8e2247804be2de6eccbd0a9aa48c GREEN
DashboardWizardSelectComponentArchitecture.java 26ee0bd9412f05dfad0903d86bda159b0629b722 GREEN DashboardWizardSelectComponentArchitecture.java 26ee0bd9412f05dfad0903d86bda159b0629b722 GREEN
DashboardWizardSelectDataDictionary.java 8322cfbd0c0b0019b67de766303137f2fab77a2d GREEN DashboardWizardSelectDataDictionary.java 8322cfbd0c0b0019b67de766303137f2fab77a2d GREEN
DashboardWizardSelectPlatformArchitecture.java be7a3b016564cf2cd16f14efbe75c58aca3dbc79 GREEN DashboardWizardSelectPlatformArchitecture.java 2b3b06b82f7b8837efc358b585da7beb529ea51f YELLOW
DashboardWizardSelectProjectSource.java 9463d2a5fc69c015ae487606fa529b888b4f9e7c GREEN DashboardWizardSelectProjectSource.java 9463d2a5fc69c015ae487606fa529b888b4f9e7c GREEN
DashboardWizardSelectTaskArchitecture.java 8e52e852435047dba0f68d8dc454a8eb3159e461 GREEN DashboardWizardSelectTaskArchitecture.java 8e52e852435047dba0f68d8dc454a8eb3159e461 GREEN
DashboardWizardSelectTimingSpecification.java 26bceb07a6e7aaa0f82e1162886b0d9091ad3398 GREEN DashboardWizardSelectTimingSpecification.java 26bceb07a6e7aaa0f82e1162886b0d9091ad3398 GREEN
......
...@@ -158,6 +158,7 @@ public class DashboardWizard extends Wizard { ...@@ -158,6 +158,7 @@ public class DashboardWizard extends Wizard {
if(impPage.getSelectedElement() != null) { if(impPage.getSelectedElement() != null) {
isTrue(impPage.getRootElementType() isTrue(impPage.getRootElementType()
.isAssignableFrom(impPage.getSelectedElement().getClass())); .isAssignableFrom(impPage.getSelectedElement().getClass()));
selectedElements.put(impPage.getRootElementType(), impPage.getSelectedElement()); selectedElements.put(impPage.getRootElementType(), impPage.getSelectedElement());
} }
} }
......
...@@ -15,9 +15,12 @@ ...@@ -15,9 +15,12 @@
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.ui.perspective.dashboard.projectwizard; package org.fortiss.af3.exploration.ui.perspective.dashboard.projectwizard;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNoneEmpty;
import static org.eclipse.jface.viewers.AbstractTreeViewer.ALL_LEVELS; import static org.eclipse.jface.viewers.AbstractTreeViewer.ALL_LEVELS;
import static org.fortiss.tooling.kernel.ui.util.SelectionUtils.checkAndPickFirst; import static org.fortiss.tooling.kernel.ui.util.SelectionUtils.checkAndPickFirst;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement; import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.showWarning;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionChangedListener;
...@@ -34,6 +37,7 @@ import org.eclipse.swt.layout.GridLayout; ...@@ -34,6 +37,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.Tree;
import org.eclipse.wb.swt.SWTResourceManager; import org.eclipse.wb.swt.SWTResourceManager;
import org.fortiss.af3.exploration.model.project.DSE;
import org.fortiss.af3.exploration.ui.perspective.generic.HierarchicElementContentProvider; import org.fortiss.af3.exploration.ui.perspective.generic.HierarchicElementContentProvider;
import org.fortiss.tooling.kernel.model.IProjectRootElement; import org.fortiss.tooling.kernel.model.IProjectRootElement;
import org.fortiss.tooling.kernel.ui.presentation.ModelElementLabelProvider; import org.fortiss.tooling.kernel.ui.presentation.ModelElementLabelProvider;
...@@ -80,6 +84,22 @@ public abstract class DashboardWizardRootElementSelectionBase<T extends IProject ...@@ -80,6 +84,22 @@ public abstract class DashboardWizardRootElementSelectionBase<T extends IProject
/** Predicate if the given {@link IProjectRootElement} and may be selected. */ /** Predicate if the given {@link IProjectRootElement} and may be selected. */
protected abstract boolean isRelevantRootElement(T rootElement); protected abstract boolean isRelevantRootElement(T rootElement);
/**
* Optional method to notice the user about reduced functionality when importing the given
* {@link IProjectRootElement}. Thus, he or she can decide whether to adjust the model
* beforehand.
*
* @param rootElement
* element to examin whether its selection implies reduced functionality of the
* {@link DSE}.
*
* @return a string to notify the user about reduced functionality for the selected element.
*/
protected String noticeReducedFunctionality(T rootElement) {
// Optional implementation by children.
return null;
}
/** Returns the content provider to be used for the {@link TreeViewer} shown in this page. */ /** Returns the content provider to be used for the {@link TreeViewer} shown in this page. */
protected ITreeContentProvider createContentProvider() { protected ITreeContentProvider createContentProvider() {
return new HierarchicElementContentProvider(); return new HierarchicElementContentProvider();
...@@ -116,6 +136,9 @@ public abstract class DashboardWizardRootElementSelectionBase<T extends IProject ...@@ -116,6 +136,9 @@ public abstract class DashboardWizardRootElementSelectionBase<T extends IProject
}); });
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
/** Predicate to avoid blocking the UI for double clicks. */
private boolean userNoticeShown = false;
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void selectionChanged(SelectionChangedEvent event) { public void selectionChanged(SelectionChangedEvent event) {
...@@ -140,6 +163,16 @@ public abstract class DashboardWizardRootElementSelectionBase<T extends IProject ...@@ -140,6 +163,16 @@ public abstract class DashboardWizardRootElementSelectionBase<T extends IProject
setErrorMessage(errorMessage); setErrorMessage(errorMessage);
selectedRootElement = rootElement; selectedRootElement = rootElement;
// Shows a user notice about reduced functionality if needed and if no severe error
// was detected in the model.
if(isEmpty(errorMessage)) {
String noticeMessage = noticeReducedFunctionality(rootElement);
if(isNoneEmpty(noticeMessage) && !userNoticeShown) {
showWarning(noticeMessage);
userNoticeShown = true;
}
}
treeViewer.refresh(true); treeViewer.refresh(true);
setPageComplete(rootElement != null || !isRequired()); setPageComplete(rootElement != null || !isRequired());
} }
......
...@@ -19,6 +19,7 @@ import static org.fortiss.af3.exploration.util.ModelSnapshotExtractUtils.createP ...@@ -19,6 +19,7 @@ import static org.fortiss.af3.exploration.util.ModelSnapshotExtractUtils.createP
import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.findAllGatewayUnits; import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.findAllGatewayUnits;
import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.findAtomicTransmissionUnits; import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.findAtomicTransmissionUnits;
import static org.fortiss.af3.task.util.TaskArchitectureUtils.findTargetExecutionUnits; import static org.fortiss.af3.task.util.TaskArchitectureUtils.findTargetExecutionUnits;
import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotation;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf; import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement; import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
...@@ -28,6 +29,8 @@ import java.util.function.Function; ...@@ -28,6 +29,8 @@ import java.util.function.Function;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.exploration.model.project.ModelSnapshot; import org.fortiss.af3.exploration.model.project.ModelSnapshot;
import org.fortiss.af3.platform.model.PlatformArchitecture; import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.safety.model.SafetyStandard;
import org.fortiss.af3.safety.model.annotation.SafetyIntegrityLevel;
import org.fortiss.tooling.kernel.model.IProjectRootElement; import org.fortiss.tooling.kernel.model.IProjectRootElement;
/** /**
...@@ -61,6 +64,18 @@ public class DashboardWizardSelectPlatformArchitecture ...@@ -61,6 +64,18 @@ public class DashboardWizardSelectPlatformArchitecture
return !findTargetExecutionUnits(platformArchitecture).isEmpty(); return !findTargetExecutionUnits(platformArchitecture).isEmpty();
} }
/** {@inheritDoc} */
@Override
protected String noticeReducedFunctionality(PlatformArchitecture rootElement) {
SafetyIntegrityLevel sil = getAnnotation(rootElement, SafetyIntegrityLevel.class);
if(sil.getSafetyStandard() == SafetyStandard.UNDEFINED) {
return "The safety standard of the platform architecture is not defined.\n" +
"To use the safety level constraints, please define the safety standard" +
" and the level in the modelling perspective.";
}
return null;
}
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public Function<PlatformArchitecture, ModelSnapshot> getModelToSnapShotConverter() { public Function<PlatformArchitecture, ModelSnapshot> getModelToSnapShotConverter() {
......
AllocationPatternFXController.java 840bc404f6aefb8bc0e6f9b25f156d9db647178b GREEN AllocationPatternFXController.java 840bc404f6aefb8bc0e6f9b25f156d9db647178b GREEN
CouplingPatternFXController.java 937034aa2dd680abfcd815c32deb5f322663dc37 GREEN CouplingPatternFXController.java 937034aa2dd680abfcd815c32deb5f322663dc37 GREEN
MemoryPatternFXController.java b45b1eb1418d75cc4f4b2983b996b8ef4abab58d GREEN MemoryPatternFXController.java b45b1eb1418d75cc4f4b2983b996b8ef4abab58d GREEN
SafetyPatternFXController.java 340e5725052639da11f04154d4d19f3f7f677ca6 YELLOW SafetyPatternFXController.java d64b5f02e6c21a88956fb5ca542e7f9b3532a156 YELLOW
...@@ -23,10 +23,14 @@ import static org.fortiss.af3.exploration.util.ExplorationModelElementFactory.cr ...@@ -23,10 +23,14 @@ import static org.fortiss.af3.exploration.util.ExplorationModelElementFactory.cr
import static org.fortiss.af3.exploration.util.ExplorationModelElementFactory.createResourceDimension; import static org.fortiss.af3.exploration.util.ExplorationModelElementFactory.createResourceDimension;
import static org.fortiss.af3.exploration.util.PatternFactoryUtils.calcPatternName; import static org.fortiss.af3.exploration.util.PatternFactoryUtils.calcPatternName;
import static org.fortiss.af3.exploration.util.PatternFactoryUtils.createSafetyPatternExpression; import static org.fortiss.af3.exploration.util.PatternFactoryUtils.createSafetyPatternExpression;
import static org.fortiss.af3.safety.utils.SafetyUtils.getSafetyStandardOf;
import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotation;
import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotationValue; import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotationValue;
import static org.fortiss.tooling.common.util.LambdaUtils.getFirst;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Optional;
import org.eclipse.emf.common.util.Enumerator; import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
...@@ -40,6 +44,7 @@ import org.fortiss.af3.exploration.ui.perspective.service.EventBroker; ...@@ -40,6 +44,7 @@ import org.fortiss.af3.exploration.ui.perspective.service.EventBroker;
import org.fortiss.af3.exploration.ui.perspective.service.IDSEPerspectiveManager; import org.fortiss.af3.exploration.ui.perspective.service.IDSEPerspectiveManager;
import org.fortiss.af3.exploration.ui.perspective.targetdef.PatternFXControllerBase; import org.fortiss.af3.exploration.ui.perspective.targetdef.PatternFXControllerBase;
import org.fortiss.af3.platform.model.ExecutionUnit; import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.safety.model.SafetyStandard;
import org.fortiss.af3.safety.model.annotation.SafetyIntegrityLevel; import org.fortiss.af3.safety.model.annotation.SafetyIntegrityLevel;
import org.fortiss.af3.task.model.allocation.ComponentToTaskAllocationEntry; import org.fortiss.af3.task.model.allocation.ComponentToTaskAllocationEntry;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase; import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase;
...@@ -162,6 +167,15 @@ public class SafetyPatternFXController extends PatternFXControllerBase { ...@@ -162,6 +167,15 @@ public class SafetyPatternFXController extends PatternFXControllerBase {
SuperSet<ExecutionUnit> executionUnits = SuperSet<ExecutionUnit> executionUnits =
dse.getCurrentStep().getSuperSetMap().get(ExecutionUnit.class); dse.getCurrentStep().getSuperSetMap().get(ExecutionUnit.class);
// Exit early if no safety standard is defined --> undefined behavior.
Optional<ExecutionUnit> execUnit = getFirst(executionUnits.getEntries());
if(execUnit.isPresent()) {
SafetyIntegrityLevel sil = getAnnotation(execUnit.get(), SafetyIntegrityLevel.class);
if(getSafetyStandardOf(sil) == SafetyStandard.UNDEFINED) {
return;
}
}
@SuppressWarnings("unchecked") DynamicTreeTableUIProviderBase<EObject> uiProvider = @SuppressWarnings("unchecked") DynamicTreeTableUIProviderBase<EObject> uiProvider =
(DynamicTreeTableUIProviderBase<EObject>)(DynamicTreeTableUIProviderBase<?>)new DynamicTreeTableUIProviderBase<INamedElement>() { (DynamicTreeTableUIProviderBase<EObject>)(DynamicTreeTableUIProviderBase<?>)new DynamicTreeTableUIProviderBase<INamedElement>() {
/** {@inheritDoc} */ /** {@inheritDoc} */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment