Commit d85743e3 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

done

refs 2881
parent 2bebdc85
......@@ -115,6 +115,12 @@
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.functional.FormalSpecification">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.AspectHandlers$DerivedRequirementHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.DerivedRequirementSpecification">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.AspectHandlers$ParameterDefinitionHandler">
......@@ -382,6 +388,12 @@
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.Requirement">
</modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.mira.ui.editorbinding.AspectBindings$DerivedRequirementBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.Requirement">
</modelElementClass>
</modelEditorBinding>
</extension>
<extension
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.editor;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.fortiss.af3.mira.model.ParameterDefinition;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.service.IPersistencyService;
/**
* Editor for the parameter definition aspect of a {@link Requirement}.
*
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 49FDBAB1C793DB7F7BD7EAC3BC114D35
*/
public class DerivedRequirementEditor<T extends Requirement> extends RequirementEditorBase<T> {
/** {@inheritDoc} */
@Override
protected void createSections() {
super.createSections();
toolkit.createLabel(form.getForm().getBody(),
"This requirement is a design choice (in DO178: \"derived requirement\")");
Button deleteButton =
toolkit.createButton(form.getForm().getBody(), "Remove aspect", SWT.None);
deleteButton.addSelectionListener(new SelectionAdapter() {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
ITopLevelElement modelContext =
IPersistencyService.getInstance().getTopLevelElementFor(editedObject);
modelContext.runAsCommand(() -> {
for(ParameterDefinition pd : pickInstanceOf(ParameterDefinition.class,
editedObject.getSpecifications())) {
IElementCompositorService.getInstance().decompose(pd);
}
});
}
});
}
}
......@@ -21,6 +21,7 @@ import static org.fortiss.af3.mira.utils.MiraUtils.SECONDEDITORPRIORITY;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.mira.model.DerivedRequirementSpecification;
import org.fortiss.af3.mira.model.ModeSpecification;
import org.fortiss.af3.mira.model.ParameterDefinition;
import org.fortiss.af3.mira.model.Requirement;
......@@ -29,6 +30,7 @@ import org.fortiss.af3.mira.model.functional.FormalSpecification;
import org.fortiss.af3.mira.model.functional.SignalContainerSpecification;
import org.fortiss.af3.mira.model.interfacebehaviour.InterfaceBehaviourSpecification;
import org.fortiss.af3.mira.model.usecase.UseCaseSpecification;
import org.fortiss.af3.mira.ui.editor.DerivedRequirementEditor;
import org.fortiss.af3.mira.ui.editor.InterfaceBehaviourAspectEditor;
import org.fortiss.af3.mira.ui.editor.InterfaceEditor;
import org.fortiss.af3.mira.ui.editor.ModeDefinitionEditor;
......@@ -44,7 +46,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: FB009827E55199EF560B7CB680F9DDEC
* @ConQAT.Rating YELLOW Hash: 26BD8505935AA09CB0B0D1B47F31F655
*/
public class AspectBindings {
......@@ -223,4 +225,29 @@ public class AspectBindings {
return SECONDEDITORPRIORITY;
}
}
/** Binding for mode definition aspect. */
public static class DerivedRequirementBinding extends ModelEditorBindingBase<Requirement> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass(Requirement obj) {
if(pickFirstInstanceOf(DerivedRequirementSpecification.class, obj.getSpecifications()) == null) {
return null;
}
return DerivedRequirementEditor.class;
}
/** {@inheritDoc} */
@Override
public String getLabel() {
return "Design choice";
}
/** {@inheritDoc} */
@Override
public int getPriority() {
return SECONDEDITORPRIORITY;
}
}
}
......@@ -25,6 +25,7 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.mira.model.DerivedRequirementSpecification;
import org.fortiss.af3.mira.model.ModeSpecification;
import org.fortiss.af3.mira.model.ParameterDefinition;
import org.fortiss.af3.mira.model.Requirement;
......@@ -43,7 +44,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 0899C4803983269593D20B8A2FEEE101
* @ConQAT.Rating YELLOW Hash: 5520252CEFD18654E79771287481E6E1
*/
public class AspectHandlers {
/** Handler for {@link InterfaceBehaviourSpecification}'s. */
......@@ -123,6 +124,17 @@ public class AspectHandlers {
}
}
/** Handler for {@link ParameterDefinition}'s. */
public static class DerivedRequirementHandler extends
SpecificationHandlerBase<DerivedRequirementSpecification> {
/** {@inheritDoc} */
@Override
public String getName(DerivedRequirementSpecification element) {
return "Design choice aspect";
}
}
/** Handler for the interface (formerly called "formal specification") aspect. */
public static class FormalSpecificationHandler extends
SpecificationHandlerBase<FormalSpecification> {
......
......@@ -301,6 +301,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="modes" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DerivedRequirementSpecification" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecification"/>
<eSubpackages name="usecase" nsURI="http://www.fortiss.org/af3/mira/usecase" nsPrefix="org-fortiss-af3-mira-usecase">
<eClassifiers xsi:type="ecore:EClass" name="UseCase" eSuperTypes="#//Requirement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElementContainer #//usecase/UseCaseSpecification">
<eOperations name="getScopeSpecification" eType="#//usecase/ScopeSpecification">
......
......@@ -151,6 +151,7 @@
<genClasses ecoreClass="mira.ecore#//ModeSpecification">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//ModeSpecification/modes"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//DerivedRequirementSpecification"/>
<nestedGenPackages prefix="Usecase" basePackage="org.fortiss.af3.mira.model" disposableProviderFactory="true"
ecorePackage="mira.ecore#//usecase">
<genEnums typeSafeEnumCompatible="false" ecoreEnum="mira.ecore#//usecase/ScenarioStepActionType">
......
......@@ -22,6 +22,7 @@ import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.mira.model.DerivedRequirementSpecification;
import org.fortiss.af3.mira.model.ModeSpecification;
import org.fortiss.af3.mira.model.ParameterDefinition;
import org.fortiss.af3.mira.model.Requirement;
......@@ -45,7 +46,7 @@ import org.fortiss.tooling.kernel.extension.data.Prototype;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: EBAA65CAC02D87327B71686144A5F266
* @ConQAT.Rating YELLOW Hash: A72005189F87481418C5BA8ADDD17080
*/
public class RequirementCompositor extends HierarchicElementCompositorBase<Requirement> {
/** {@inheritDoc} */
......@@ -62,6 +63,11 @@ public class RequirementCompositor extends HierarchicElementCompositorBase<Requi
if(ifbs == null && contained instanceof InterfaceBehaviourSpecification) {
return true;
}
DerivedRequirementSpecification drs =
pickFirstInstanceOf(DerivedRequirementSpecification.class, specs);
if(drs == null && contained instanceof DerivedRequirementSpecification) {
return true;
}
SignalContainerSpecification scs =
pickFirstInstanceOf(SignalContainerSpecification.class, specs);
if(scs == null && contained instanceof SignalContainerSpecification) {
......@@ -96,6 +102,7 @@ public class RequirementCompositor extends HierarchicElementCompositorBase<Requi
EObject elt = prototype.getPrototype();
return elt instanceof FormalSpecification || elt instanceof ModeSpecification ||
elt instanceof InterfaceBehaviourSpecification ||
elt instanceof DerivedRequirementSpecification ||
elt instanceof SignalContainerSpecification || elt instanceof ParameterDefinition ||
elt instanceof SafetyLevelRequirementSpecification ||
elt instanceof UseCaseSpecification || elt instanceof Scenario ||
......@@ -125,6 +132,7 @@ public class RequirementCompositor extends HierarchicElementCompositorBase<Requi
contained instanceof InterfaceBehaviourSpecification ||
contained instanceof SignalContainerSpecification ||
contained instanceof ParameterDefinition ||
contained instanceof DerivedRequirementSpecification ||
contained instanceof SafetyLevelRequirementSpecification ||
contained instanceof UseCaseSpecification || contained instanceof Scenario ||
contained instanceof MSCSpecification || contained instanceof FormalSpecification;
......
......@@ -18,6 +18,7 @@ $Id: CreateRequirementSpecificationCommand.java 1955 2011-11-22 14:00:29Z mou $
package org.fortiss.af3.mira.prototype;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createAnalysis;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createDerivedRequirementSpecification;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createExternalSystem;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createFunctionalSpecification;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createGlossary;
......@@ -36,6 +37,7 @@ import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createSignalReq
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createStakeholder;
import static org.fortiss.af3.mira.utils.MiraModelElementFactory.createUseCaseSpecification;
import org.fortiss.af3.mira.model.DerivedRequirementSpecification;
import org.fortiss.af3.mira.model.ModeSpecification;
import org.fortiss.af3.mira.model.ParameterDefinition;
import org.fortiss.af3.mira.model.Requirement;
......@@ -56,7 +58,7 @@ import org.fortiss.tooling.kernel.extension.base.PrototypeProviderBase;
*
* @author mou
* @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash: 41117A28F8ECF84C0C6D0ED083AB9680
* @ConQAT.Rating YELLOW Hash: 1CAF1E6BFD0C92C84AE492DBE8616D83
*/
public class PrototypeProvider extends PrototypeProviderBase {
......@@ -107,5 +109,8 @@ public class PrototypeProvider extends PrototypeProviderBase {
ModeSpecification ms = createModeSpecification();
registerPrimaryPrototype("Mode aspect", ms, CATEGORY_NAME);
DerivedRequirementSpecification drs = createDerivedRequirementSpecification();
registerPrimaryPrototype("Design choice aspect", drs, CATEGORY_NAME);
}
}
......@@ -25,6 +25,7 @@ import java.util.ArrayList;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.utils.ComponentModelElementFactory;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.DerivedRequirementSpecification;
import org.fortiss.af3.mira.model.DocumentReference;
import org.fortiss.af3.mira.model.ExternalRelation;
import org.fortiss.af3.mira.model.ExternalRelationSpecification;
......@@ -93,7 +94,7 @@ import org.fortiss.af3.mira.model.verification.CheckList;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: D1255DFAA376ABD128F295E35FE1A3F5
* @ConQAT.Rating YELLOW Hash: 0E64151700AB453302BF6E68682A6A2C
*/
public final class MiraModelElementFactory {
......@@ -181,6 +182,11 @@ public final class MiraModelElementFactory {
return MiraFactory.eINSTANCE.createModeSpecification();
}
/** Creates a {@link DerivedRequirementSpecification}. */
public static DerivedRequirementSpecification createDerivedRequirementSpecification() {
return MiraFactory.eINSTANCE.createDerivedRequirementSpecification();
}
/** Initializes the given use case specification. */
private static void initUseCaseSpecification(UseCaseSpecification uc) {
uc.setInputs(UsecaseFactory.eINSTANCE.createInputs());
......
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