Commit e013daef authored by Dongyue Mou's avatar Dongyue Mou
Browse files

added functional specification for requirement

parent ae7c7842
......@@ -56,6 +56,12 @@
modelElementClass="org.fortiss.af3.mira.model.glossary.GlossaryEntry">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.FunctionalSpecificationHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.functional.FunctionalSpecification">
</modelElementClass>
</modelElementHandler>
</extension>
<extension
point="org.fortiss.tooling.kernel.ui.modelEditorBinding">
......
......@@ -110,9 +110,15 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
"Success guarantees ", SWT.READ_ONLY);
singleLineLabelFactory.applyTo(successguaranteeLabel);
if (editedObject.getSuccessGuarantee() == null)
editedObject.setSuccessGuarantee(UsecaseFactory.eINSTANCE
.createConditionBase());
if (editedObject.getSuccessGuarantee() == null) {
executeCommand(new Runnable() {
@Override
public void run() {
editedObject.setSuccessGuarantee(UsecaseFactory.eINSTANCE
.createConditionBase());
}
});
}
SourceViewer successguaranteeInput = createSourceViewer(
detailComposite, SWT.BORDER, editedObject.getAnalysis());
singleLineInputFactory.applyTo(successguaranteeInput.getControl());
......@@ -166,9 +172,15 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
"Minimal guarantees ", SWT.READ_ONLY);
singleLineLabelFactory.applyTo(minguaranteeLabel);
if (editedObject.getMinimalGuarantee() == null)
editedObject.setMinimalGuarantee(UsecaseFactory.eINSTANCE
.createConditionBase());
if (editedObject.getMinimalGuarantee() == null) {
executeCommand(new Runnable() {
@Override
public void run() {
editedObject.setMinimalGuarantee(UsecaseFactory.eINSTANCE
.createConditionBase());
}
});
}
SourceViewer minguaranteeInput = createSourceViewer(detailComposite,
SWT.BORDER, editedObject.getAnalysis());
singleLineInputFactory.applyTo(minguaranteeInput.getControl());
......@@ -223,8 +235,13 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
singleLineLabelFactory.applyTo(precondLabel);
if (editedObject.getPrecondition() == null) {
editedObject.setPrecondition(UsecaseFactory.eINSTANCE
.createConditionBase());
executeCommand(new Runnable() {
@Override
public void run() {
editedObject.setPrecondition(UsecaseFactory.eINSTANCE
.createConditionBase());
}
});
}
SourceViewer precondInput = createSourceViewer(detailComposite,
SWT.BORDER, editedObject.getAnalysis());
......@@ -280,7 +297,13 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
singleLineLabelFactory.applyTo(triggerLabel);
if (editedObject.getTrigger() == null) {
editedObject.setTrigger(UsecaseFactory.eINSTANCE.createTrigger());
executeCommand(new Runnable() {
@Override
public void run() {
editedObject.setTrigger(UsecaseFactory.eINSTANCE
.createTrigger());
}
});
}
SourceViewer triggerInput = createSourceViewer(detailComposite,
SWT.BORDER, editedObject.getAnalysis());
......@@ -378,7 +401,13 @@ public class UseCaseEditor extends RequirementEditor<UseCase> {
singleLineLabelFactory.applyTo(scopeLabel);
if (editedObject.getScope() == null) {
editedObject.setScope(UsecaseFactory.eINSTANCE.createScope());
executeCommand(new Runnable() {
@Override
public void run() {
editedObject.setScope(UsecaseFactory.eINSTANCE
.createScope());
}
});
}
SourceViewer scopeInput = createSourceViewer(detailComposite,
......
/*--------------------------------------------------------------------------+
$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.handler;
import static org.conqat.lib.commons.string.StringUtils.isEmpty;
import static org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin;
import static org.fortiss.af3.mira.ui.AF3MiraUIActivator.PLUGIN_ID;
import java.util.ArrayList;
import java.util.List;
import org.conqat.lib.commons.string.StringUtils;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.tooling.base.model.element.IHiddenSpecification;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.extension.base.NamedCommentedModelElementHandlerBase;
/**
* {@link IModelElementHandler} for {@link Requirement}
*
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 534869BF50874DFB15EE6D1A585D4CA5
*/
public class FunctionalSpecificationHandler extends
NamedCommentedModelElementHandlerBase<FunctionalSpecification> {
/** {@inheritDoc} */
@Override
public String getName(FunctionalSpecification element) {
String name = element.getName();
if (isEmpty(name)) {
name = "Functional Specification";
}
return name;
}
/** {@inheritDoc} */
@Override
public String getDescription(FunctionalSpecification element) {
String comment = element.getComment();
if (StringUtils.isEmpty(comment)) {
comment = "Functional Specification (No comment)";
}
return comment.replaceAll("(\\r|\\n)", "");
}
/** {@inheritDoc} */
@Override
public List<EObject> getSubnodes(FunctionalSpecification element) {
return new ArrayList<EObject>(element.getContainedElementsList());
}
/** {@inheritDoc} */
@Override
public ImageDescriptor getIconImageDescriptor() {
return imageDescriptorFromPlugin(PLUGIN_ID,
"icons/Icon_FunctionalSpecification.png");
}
/** {@inheritDoc} */
@Override
public List<EObject> getConnectors(FunctionalSpecification element) {
return new ArrayList<EObject>(element.getConnectorsList());
}
/** {@inheritDoc} */
@Override
public List<EObject> getSpecifications(FunctionalSpecification element) {
return getFilteredSpecifications(element);
}
/**
* Returns the list of specifications without {@link IHiddenSpecification}s.
*/
/* package */static List<EObject> getFilteredSpecifications(
Component element) {
List<EObject> result = new ArrayList<EObject>();
for (IModelElementSpecification spec : element.getSpecificationsList()) {
if (!(spec instanceof IHiddenSpecification)) {
result.add(spec);
}
}
return result;
}
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ Export-Package: org.fortiss.af3.mira,
org.fortiss.af3.mira.command.glossary,
org.fortiss.af3.mira.compose,
org.fortiss.af3.mira.model,
org.fortiss.af3.mira.model.functional,
org.fortiss.af3.mira.model.glossary,
org.fortiss.af3.mira.model.impl,
org.fortiss.af3.mira.model.relations,
......
......@@ -251,4 +251,8 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="text" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</eSubpackages>
<eSubpackages name="functional" nsURI="http://www.fortiss.org/af3/mira/functional"
nsPrefix="org-fortiss-af3-mira-functional">
<eClassifiers xsi:type="ecore:EClass" name="FunctionalSpecification" eSuperTypes="platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecification platform:/plugin/org.fortiss.af3.component/model/component.ecore#//Component"/>
</eSubpackages>
</ecore:EPackage>
......@@ -5,7 +5,7 @@
modelDirectory="/org.fortiss.af3.mira/generated-src" modelPluginID="org.fortiss.af3.mira"
modelName="Mira" editorPluginClass="org.fortiss.af3.mira.model.presentation.ModelEditorPlugin"
importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" arrayAccessors="true"
complianceLevel="6.0" copyrightFields="false" usedGenPackages="platform:/plugin/org.fortiss.tooling.base/model/base.genmodel#//model platform:/plugin/org.fortiss.tooling.kernel/model/kernel.genmodel#//model">
complianceLevel="6.0" copyrightFields="false" usedGenPackages="platform:/plugin/org.fortiss.tooling.base/model/base.genmodel#//model platform:/plugin/org.fortiss.tooling.kernel/model/kernel.genmodel#//model platform:/plugin/org.fortiss.af3.component/model/component.genmodel#//model platform:/plugin/org.fortiss.af3.project/model/project.genmodel#//model platform:/plugin/org.fortiss.af3.expression/model/expression.genmodel#//model">
<foreignModel>mira.ecore</foreignModel>
<genPackages prefix="Mira" basePackage="org.fortiss.af3.mira" disposableProviderFactory="true"
ecorePackage="mira.ecore#/">
......@@ -149,5 +149,9 @@
<genOperations ecoreOperation="mira.ecore#//glossary/WordElement/toString"/>
</genClasses>
</nestedGenPackages>
<nestedGenPackages prefix="Functional" basePackage="org.fortiss.af3.mira.model"
disposableProviderFactory="true" ecorePackage="mira.ecore#//functional">
<genClasses ecoreClass="mira.ecore#//functional/FunctionalSpecification"/>
</nestedGenPackages>
</genPackages>
</genmodel:GenModel>
......@@ -44,15 +44,13 @@
<extension
point="org.fortiss.tooling.kernel.modelElementCompositor">
<modelElementCompositor
compositor="org.fortiss.af3.mira.compose.AnalysisCompositor"
modelElementClass="org.fortiss.af3.mira.model.Analysis">
compositor="org.fortiss.af3.mira.compose.AnalysisCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.Analysis">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.mira.compose.UseCaseCompositor"
modelElementClass="org.fortiss.af3.mira.model.usecase.UseCase">
compositor="org.fortiss.af3.mira.compose.UseCaseCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.usecase.UseCase">
</modelElementClass>
......@@ -63,6 +61,12 @@
modelElementClass="org.fortiss.af3.mira.model.glossary.Glossary">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.mira.compose.RequirementCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.Requirement">
</modelElementClass>
</modelElementCompositor>
</extension>
<extension
point="org.fortiss.tooling.kernel.modelElementConstraintChecker">
......
/*--------------------------------------------------------------------------+
$Id: CreateRequirementSpecificationCommand.java 1955 2011-11-22 14:00:29Z mou $
| |
| 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.compose;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.mira.model.usecase.Scenario;
import org.fortiss.af3.mira.model.usecase.ScenarioStep;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/**
* {@link IElementCompositor} implementation for the {@link Scenario}s.
*
* @author mou
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating GREEN Hash: 5774D580C4492DDF23B5C09251BEB8E2
*/
public class ScenarioCompositor implements IElementCompositor<Scenario> {
/** {@inheritDoc} */
@Override
public boolean canCompose(Scenario container, EObject contained,
IElementCompositionContext context) {
return contained instanceof ScenarioStep;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return prototype.getPrototype() instanceof ScenarioStep;
}
/** {@inheritDoc} */
@Override
public boolean compose(Scenario container, EObject contained,
IElementCompositionContext context) {
if (!canCompose(container, contained, context)) {
return false;
}
return container.getContainedElementsList().add(
(IHierarchicElement) contained);
}
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
return contained instanceof Scenario;
}
/** {@inheritDoc} */
@Override
public boolean decompose(EObject contained) {
return contained.eContainer().eContents().remove(contained);
}
}
/*--------------------------------------------------------------------------+
$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.compose;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.af3.mira.model.usecase.UseCase;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/**
* {@link IElementCompositor} implementation for the {@link UseCase}s.
*
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 8D7806C197298F0A7EF904343E2134A0
*/
public class RequirementCompositor implements IElementCompositor<Requirement> {
/** {@inheritDoc} */
@Override
public boolean canCompose(Requirement container, EObject contained,
IElementCompositionContext context) {
return contained instanceof FunctionalSpecification;
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return prototype.getPrototype() instanceof FunctionalSpecification;
}
/** {@inheritDoc} */
@Override
public boolean compose(Requirement container, EObject contained,
IElementCompositionContext context) {
return container.getContainedElementsList().add((IHierarchicElement)contained);
}
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
return contained instanceof FunctionalSpecification;
}
/** {@inheritDoc} */
@Override
public boolean decompose(EObject contained) {
Requirement requirement = (Requirement)contained.eContainer();
return requirement.getContainedElementsList().remove(contained);
}
}
......@@ -18,13 +18,18 @@ $Id: CreateRequirementSpecificationCommand.java 1955 2011-11-22 14:00:29Z mou $
package org.fortiss.af3.mira.prototype;
import static org.fortiss.af3.mira.utils.MiraUtils.loadChecklist;
import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createNodeElementLayout;
import java.util.ArrayList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.fortiss.af3.component.model.AF3ComponentFactory;
import org.fortiss.af3.component.model.CausalityComponentSpecification;
import org.fortiss.af3.mira.model.MiraFactory;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementPriority;
import org.fortiss.af3.mira.model.functional.FunctionalFactory;
import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.af3.mira.model.glossary.Glossary;
import org.fortiss.af3.mira.model.glossary.GlossaryFactory;
import org.fortiss.af3.mira.model.usecase.UseCase;
......@@ -45,8 +50,7 @@ public class PrototypeProvider extends PrototypeProviderBase {
/** {@inheritDoc} */
@Override
protected void registerPrototypes() {
registerPrimaryPrototype("Requirements Analysis",
MiraFactory.eINSTANCE.createAnalysis());
registerPrimaryPrototype("Requirements Analysis", MiraFactory.eINSTANCE.createAnalysis());
// create check list prototype
ArrayList<CheckList> checklists_requirement = new ArrayList<CheckList>();
......@@ -54,12 +58,11 @@ public class PrototypeProvider extends PrototypeProviderBase {
// create requirement
Requirement req = MiraFactory.eINSTANCE.createRequirement();
req.getConnectorsList().add(
MiraFactory.eINSTANCE.createRequirementConnector());
req.getConnectorsList().add(MiraFactory.eINSTANCE.createRequirementConnector());
req.setPriority(RequirementPriority.NORMAL);
for (CheckList checklist : checklists_requirement)
for(CheckList checklist : checklists_requirement)
req.getSpecificationsList().add(EcoreUtil.copy(checklist));
registerPrimaryPrototype("New Requirement", req);
registerPrimaryPrototype("Requirement", req);
// create check list prototype
ArrayList<CheckList> checklists_usecase = new ArrayList<CheckList>();
......@@ -67,25 +70,34 @@ public class PrototypeProvider extends PrototypeProviderBase {
// create use case
UseCase uc = UsecaseFactory.eINSTANCE.createUseCase();
uc.getConnectorsList().add(
MiraFactory.eINSTANCE.createRequirementConnector());
uc.getConnectorsList().add(MiraFactory.eINSTANCE.createRequirementConnector());
uc.setPriority(RequirementPriority.NORMAL);
for (CheckList checklist : checklists_usecase) {
for(CheckList checklist : checklists_usecase) {
uc.getSpecificationsList().add(EcoreUtil.copy(checklist));
}
registerPrimaryPrototype("New Use Case", uc);
registerPrimaryPrototype("Use Case", uc);
// create scenario
registerPrimaryPrototype("New Scenario",
UsecaseFactory.eINSTANCE.createScenario());
registerPrimaryPrototype("Scenario", UsecaseFactory.eINSTANCE.createScenario());
// register glossary
Glossary glossary = GlossaryFactory.eINSTANCE.createGlossary();
glossary.setName("Glossary");
registerPrimaryPrototype("New Glossary", glossary);
registerPrimaryPrototype("Glossary", glossary);
// register glossary entry
registerPrimaryPrototype("New Entry",
GlossaryFactory.eINSTANCE.createGlossaryEntry());
registerPrimaryPrototype("Entry", GlossaryFactory.eINSTANCE.createGlossaryEntry());
// register functional requirement
FunctionalSpecification funcreq =
FunctionalFactory.eINSTANCE.createFunctionalSpecification();
CausalityComponentSpecification spec =
AF3ComponentFactory.eINSTANCE.createCausalityComponentSpecification();
spec.setStronglyCausal(false);
funcreq.getSpecificationsList().add(spec);
createNodeElementLayout(funcreq);
funcreq.setName("Functional Specification");
registerPrimaryPrototype("Functional Specification", funcreq);
}
}
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