Commit 7ba7d840 authored by Vivek Nigam's avatar Vivek Nigam
Browse files

<mira> Safety Aspects



* Extended Hazards and MooNSolutions with Name
* started a editor
* corrected bugs

Issue-Ref: 3418
Signed-off-by: Vivek Nigam's avatarVivek Nigam <nigam@fortiss.org>
parent 05890036
......@@ -10,7 +10,7 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.fortiss.af3.expression.AF3ExpressionActivator
Require-Bundle: org.fortiss.af3.generator.common;visibility:=reexport;bundle-version="2.13.0",
Require-Bundle: org.fortiss.af3.generator.common;bundle-version="2.13.0";visibility:=reexport,
org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.fortiss.af3.project;visibility:=reexport,
......@@ -25,7 +25,7 @@ Export-Package: org.antlr.stringtemplate,
org.fortiss.af3.expression.generator.c,
org.fortiss.af3.expression.generator.java,
org.fortiss.af3.expression.generator.nusmv.utils,
org.fortiss.af3.expression.language,
org.fortiss.af3.expression.language,
org.fortiss.af3.expression.language.constraint,
org.fortiss.af3.expression.language.evaluation,
org.fortiss.af3.expression.model,
......
......@@ -16,48 +16,42 @@
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/types"
class="org.fortiss.af3.expression.model.types.TypesPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.types.TypesPackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/terms"
class="org.fortiss.af3.expression.model.terms.TermsPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.terms.TermsPackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/terms/imperative"
class="org.fortiss.af3.expression.model.terms.imperative.ImperativePackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.terms.imperative.ImperativePackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/terms/collection"
class="org.fortiss.af3.expression.model.terms.collection.CollectionPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.terms.collection.CollectionPackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/definitions"
class="org.fortiss.af3.expression.model.definitions.DefinitionsPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.definitions.DefinitionsPackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/definitions/library"
class="org.fortiss.af3.expression.model.definitions.library.LibraryPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.definitions.library.LibraryPackage"/>
</extension>
<extension
......
AnalysisEditor.java ab1f7a5ecbd1bea48d9bc14009f2f10123c17c43 GREEN
AspectEditorBase.java 52b5f77252d8a273c423801aeb2984163a9c5d6e GREEN
AssetsEditor.java 1b0b6f83be0430569a9ff4ab458e606ad5a1058b GREEN
AssetsEditor.java 165885aba6ff43f5b59e690bb11f2c33805af90b YELLOW
CounterMeasuresEditor.java 94b90214d707dcb4739f308b981e608492a8690e GREEN
DateToStringConverter.java c969b068ea1dfd77b7153dd8937dca2e4b5630b7 GREEN
DerivedRequirementEditor.java b63b7200096998268b777f6060076073cb018a89 GREEN
......
......@@ -15,9 +15,23 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.editor;
import static org.fortiss.af3.mira.ui.utils.HighlightUtils.createSourceViewer;
import static org.fortiss.af3.mira.ui.utils.MiraLayoutUtils.singleLineInputFactory;
import static org.fortiss.af3.mira.ui.utils.MiraLayoutUtils.singleLineLabelFactory;
import static org.fortiss.tooling.kernel.model.FortissToolingKernelPackage.Literals.INAMED_ELEMENT__NAME;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.bind;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.safety.HazardRequirementSpecification;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
/**
......@@ -30,15 +44,36 @@ public class HazardRequirementEditor<T extends Requirement> extends AspectEditor
/** {@inheritDoc} */
@Override
protected void createAspectSection() {
// TODO Auto-generated method stub
for(IModelElementSpecification spec : editedObject.getSpecifications()) {
if(spec instanceof HazardRequirementSpecification) {
addHazardDefinitionSection((HazardRequirementSpecification)spec);
}
}
}
/**
* Definition of the Hazard section
*/
private void addHazardDefinitionSection(HazardRequirementSpecification spec) {
Composite hazardSection =
createNewSection("Hazard definition", "This requirement defines Hazard parameters:");
hazardSection.setLayout(new GridLayout(2, false));
Label nameLabel = toolkit.createLabel(hazardSection, "Hazard Name ", SWT.READ_ONLY);
singleLineLabelFactory.applyTo(nameLabel);
SourceViewer inputName = createSourceViewer(form, hazardSection, SWT.BORDER, analysis);
registeredSourceViewers.add(inputName);
singleLineInputFactory.applyTo(inputName.getControl());
bind(dbc, inputName.getTextWidget(), spec, INAMED_ELEMENT__NAME);
}
/** {@inheritDoc} */
@Override
protected List<IModelElementSpecification> getElementsToDelete() {
// TODO Auto-generated method stub
return null;
ArrayList<IModelElementSpecification> res = new ArrayList<IModelElementSpecification>();
res.addAll(pickInstanceOf(HazardRequirementSpecification.class,
editedObject.getSpecifications()));
return res;
}
}
AnalysisEditorBinding.java ca735cd4b22e526d164b8fb2c3c80ac37435c6ef GREEN
AspectBindings.java f16af7b995441c9622038db49da0387758d58e41 YELLOW
AspectBindings.java b53a3a3a9f4ccc79cd3b1e27aa400e4ef0e7fc0d YELLOW
ExternalSystemEditorbindings.java 40c012d99f576964ef603d32103a266aba25c8f3 GREEN
GlossaryEditorBinding.java 4dd69c6ef1605a123db5a4d2ca93e5f600c0b360 GREEN
GlossaryEntryEditorBindings.java bd793cb120fca29f9ccaee59eeebbb1652cfe180 GREEN
......
......@@ -27,6 +27,8 @@ import org.fortiss.af3.mira.model.functional.FormalSpecification;
import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.af3.mira.model.functional.SignalContainerSpecification;
import org.fortiss.af3.mira.model.interfacebehaviour.InterfaceBehaviourSpecification;
import org.fortiss.af3.mira.model.safety.HazardRequirementSpecification;
import org.fortiss.af3.mira.model.safety.MooNSolutionRequirementSpecification;
import org.fortiss.af3.mira.model.security.Assets;
import org.fortiss.af3.mira.model.security.CounterMeasuresRequirementSpecification;
import org.fortiss.af3.mira.model.security.ThreatsRequirementSpecification;
......@@ -165,7 +167,7 @@ public class AspectBindings {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass(Requirement obj) {
if(pickFirstInstanceOf(Assets.class, obj.getSpecifications()) == null) {
if(pickFirstInstanceOf(HazardRequirementSpecification.class, obj.getSpecifications()) == null) {
return null;
}
return HazardRequirementEditor.class;
......@@ -190,7 +192,8 @@ public class AspectBindings {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass(Requirement obj) {
if(pickFirstInstanceOf(Assets.class, obj.getSpecifications()) == null) {
if(pickFirstInstanceOf(MooNSolutionRequirementSpecification.class,
obj.getSpecifications()) == null) {
return null;
}
return MooNSolutionRequirementEditor.class;
......
......@@ -891,11 +891,11 @@
<eClassifiers xsi:type="ecore:EClass" name="ThreatsRequirementSpecification" eSuperTypes="#//security/SecurityRequirementSpecification platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementReference"/>
</eSubpackages>
<eSubpackages name="safety" nsURI="http://www.fortiss.org/af3/mira/safety" nsPrefix="org-fortiss-af3-mira-safety">
<eClassifiers xsi:type="ecore:EClass" name="HazardRequirementSpecification" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecification #//INonFunctionalRequirement">
<eClassifiers xsi:type="ecore:EClass" name="HazardRequirementSpecification" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecification #//INonFunctionalRequirement platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="hazardImpact" eType="#//safety/HazardImpact"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MooNSolutionRequirementSpecification"
eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecification #//INonFunctionalRequirement">
eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecification #//INonFunctionalRequirement platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="sameChannel" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="voterThreshold" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="inputSignals" upperBound="-1"
......
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