Commit 06a7b09d authored by Sabine Teufl's avatar Sabine Teufl
Browse files

ExternalRelations: small bugs and report gerneration

refs 645
parent e29feb50
......@@ -84,7 +84,7 @@ public final class ConnectExternalRelationToComponentAction extends
Component selected = null;
ExternalRelationSpecification spec = getTarget().getTargetSpecification();
ExternalRelationSpecification spec = getTarget().getExternalRelationSpecification();
if(spec != null && spec.getSpecificationOf() instanceof Component) {
selected = (Component)spec.getSpecificationOf();
}
......
......@@ -38,7 +38,6 @@ import java.util.Map;
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.emf.databinding.EMFDataBindingContext;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
......@@ -218,13 +217,13 @@ public class ExternalRelationSection {
createRelationColumn(relationTableViewer, ExternalRelationColumn.AUTHOR, "Author", 100,
true);
// column3 Target
// column3 Target Editor
createRelationColumn(relationTableViewer, ExternalRelationColumn.TEDITOR, "--->", 35, false);
// column4 Target
createRelationColumn(relationTableViewer, ExternalRelationColumn.TARGET, "Target", 150,
true);
// column4 Target Editor
createRelationColumn(relationTableViewer, ExternalRelationColumn.TEDITOR, "--->", 35, false);
// column5 Comment
createRelationColumn(relationTableViewer, ExternalRelationColumn.COMMENT, "Comment", 200,
true);
......@@ -280,7 +279,8 @@ public class ExternalRelationSection {
@Override
public void run() {
ExternalRelationSpecification spec =
getExternalRelationAt(itemIndex).getTargetSpecification();
getExternalRelationAt(itemIndex)
.getExternalRelationSpecification();
if(spec != null) {
ICommandStackService.INSTANCE.runAsCommand(
......@@ -382,12 +382,30 @@ public class ExternalRelationSection {
registeredSourceViewers.add(sourceViewerAuthor);
sourceViewerLookUpMap.put(sourceViewerAuthor.getTextWidget(), sourceViewerAuthor);
// column3 Target
// column3 Target Editor
TableEditor editorTEditor = new TableEditor(relationTable);
Button editorButton = toolkit.createButton(relationTable, "", SWT.NONE);
editorButton.setImage(imageDescriptorFromPlugin(PLUGIN_ID, "/icons/component.gif")
.createImage());
editorButton.setToolTipText("Assign target");
editorButton.addSelectionListener(new SelectionAdapter() {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
new ConnectExternalRelationToComponentAction(relation, relationComposite.getShell())
.run();
refreshTable();
}
});
editorTEditor.minimumWidth = editorButton.getSize().x;
specifyControl(editorTEditor, editorButton, ExternalRelationColumn.TEDITOR, item,
editorMap, controlMap);
// column4 Target
TableEditor editorTarget = new TableEditor(relationTable);
// target createRelatedRequirementsTable
IObservableList observeTargetList =
observeList(relation.getSourceRequirement(), IMODEL_ELEMENT__REFERENCED_BY);
final TableViewer targetTableViewer = new TableViewer(relationTable, SWT.BORDER);
fillControlFactory.applyTo(targetTableViewer.getTable());
toolkit.adapt(targetTableViewer.getTable());
......@@ -413,11 +431,8 @@ public class ExternalRelationSection {
return super.getImage(element);
}
});
targetTableViewer.setInput(observeTargetList);
// TableViewer targetTableViewer =
// createSpecificationTable(relationTable, MiraPackage.Literals.EXTERNAL_RELATION,
// relation);
targetTableViewer.setInput(observeList(relation.getSourceRequirement(),
IMODEL_ELEMENT__REFERENCED_BY));
targetTableViewer.addDoubleClickListener(new IDoubleClickListener() {
/** {@inheritDoc} */
......@@ -435,27 +450,6 @@ public class ExternalRelationSection {
specifyControl(editorTarget, targetTableViewer.getTable(), ExternalRelationColumn.TARGET,
item, editorMap, controlMap);
// column4 Target Editor
TableEditor editorSTEditor = new TableEditor(relationTable);
Button editorButton = toolkit.createButton(relationTable, "", SWT.NONE);
editorButton.setImage(imageDescriptorFromPlugin(PLUGIN_ID, "/icons/component.gif")
.createImage());
editorButton.setToolTipText("Assign target");
editorButton.addSelectionListener(new SelectionAdapter() {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
new ConnectExternalRelationToComponentAction(relation, relationComposite.getShell())
.run();
refreshTable();
}
});
editorSTEditor.minimumWidth = editorButton.getSize().x;
specifyControl(editorSTEditor, editorButton, ExternalRelationColumn.TEDITOR, item,
editorMap, controlMap);
// column5 Comment
TableEditor editorComment = new TableEditor(relationTable);
SourceViewer sourceViewerComment =
......@@ -635,10 +629,10 @@ public class ExternalRelationSection {
STATUS(1),
/** matching by the author column */
AUTHOR(2),
/** matching by the target requirements column */
TARGET(3),
/** matching by the target external specification editor column */
TEDITOR(4),
TEDITOR(3),
/** matching by the target requirements column */
TARGET(4),
/** matching by the comment column */
COMMENT(5);
......
......@@ -91,7 +91,7 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="incomingRequirementRelation"
upperBound="-1" eType="#//RequirementRelation" eOpposite="#//RequirementRelation/targetRequirement"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="externalRelation" upperBound="-1"
eType="#//ExternalRelation"/>
eType="#//ExternalRelation" eOpposite="#//ExternalRelation/sourceRequirement"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RequirementConnector" eSuperTypes="platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IConnector"/>
<eClassifiers xsi:type="ecore:EEnum" name="RequirementStatus">
......@@ -203,20 +203,19 @@
lowerBound="1" eType="#//relations/RequirementRelationStatus"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ExternalRelation" eSuperTypes="platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IConnection">
<eOperations name="getTargetSpecification" eType="#//ExternalRelationSpecification">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return ExternalRelationStaticImpl.getTargetSpecification(this);"/>
</eAnnotations>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EReference" name="analysis" lowerBound="1"
eType="#//Analysis" eOpposite="#//Analysis/externalRelation"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="author" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sourceRequirement" eType="#//Requirement"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="externalRelationStatus"
lowerBound="1" eType="#//relations/RequirementRelationStatus"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sourceRequirement" eType="#//Requirement"
eOpposite="#//Requirement/externalRelation"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="externalRelationSpecification"
eType="#//ExternalRelationSpecification" eOpposite="#//ExternalRelationSpecification/externalRelation"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ExternalRelationSpecification" eSuperTypes="#//RequirementSpecification">
<eStructuralFeatures xsi:type="ecore:EReference" name="externalRelation" eType="#//ExternalRelation"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="externalRelation" eType="#//ExternalRelation"
eOpposite="#//ExternalRelation/externalRelationSpecification"/>
</eClassifiers>
<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:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElementContainer">
......
......@@ -95,9 +95,9 @@
<genClasses ecoreClass="mira.ecore#//ExternalRelation">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//ExternalRelation/analysis"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//ExternalRelation/author"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//ExternalRelation/sourceRequirement"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//ExternalRelation/externalRelationStatus"/>
<genOperations ecoreOperation="mira.ecore#//ExternalRelation/getTargetSpecification"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//ExternalRelation/sourceRequirement"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//ExternalRelation/externalRelationSpecification"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//ExternalRelationSpecification">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//ExternalRelationSpecification/externalRelation"/>
......
......@@ -20,6 +20,7 @@ package org.fortiss.af3.mira.command;
import static org.eclipse.emf.ecore.util.EcoreUtil.delete;
import org.fortiss.af3.mira.model.ExternalRelation;
import org.fortiss.af3.mira.model.ExternalRelationSpecification;
import org.fortiss.af3.mira.model.RequirementSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.model.element.IModelElementReference;
......@@ -42,7 +43,7 @@ public class CreateExternalRelationRequirementSpecificationCommand implements Ru
private IModelElement target;
/** the specification prototype */
private RequirementSpecification spec;
private ExternalRelationSpecification externalRelationSpecification;
/**
* boolean indicating if other requirement specifications of the same type referencing the same
......@@ -55,10 +56,11 @@ public class CreateExternalRelationRequirementSpecificationCommand implements Ru
* element and the specification prototype
*/
public CreateExternalRelationRequirementSpecificationCommand(ExternalRelation externalRelation,
IModelElement target, RequirementSpecification spec, boolean deleteOtherOfSameType) {
IModelElement target, ExternalRelationSpecification externalRelationSpecification,
boolean deleteOtherOfSameType) {
this.externalRelation = externalRelation;
this.target = target;
this.spec = spec;
this.externalRelationSpecification = externalRelationSpecification;
this.deleteOtherOfSameType = deleteOtherOfSameType;
}
......@@ -70,15 +72,20 @@ public class CreateExternalRelationRequirementSpecificationCommand implements Ru
// the list must be copied to avoid ConcurrentModificationException
for(IModelElementReference ref : externalRelation.getReferencedByList().toArray(
new IModelElementReference[0])) {
if(ref.getClass().equals(spec.getClass())) {
if(ref.getClass().equals(externalRelationSpecification.getClass())) {
externalRelation.getReferencedByList().remove(ref);
delete(ref);
}
}
}
spec.setName("Ref: " + externalRelation.getSourceRequirement().getReqId() + " - " +
externalRelation.setExternalRelationSpecification(externalRelationSpecification);
externalRelationSpecification.setExternalRelation(externalRelation);
externalRelationSpecification.setName("Ref: " +
externalRelation.getSourceRequirement().getReqId() + " - " +
externalRelation.getSourceRequirement().getName());
target.getSpecificationsList().add(spec);
spec.setReference(externalRelation.getSourceRequirement());
target.getSpecificationsList().add(externalRelationSpecification);
externalRelationSpecification.setReference(externalRelation.getSourceRequirement());
}
}
......@@ -3,11 +3,8 @@
*/
package org.fortiss.af3.mira.model.impl;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.ExternalRelation;
import org.fortiss.af3.mira.model.ExternalRelationSpecification;
import org.fortiss.af3.mira.model.Requirement;
/**
......@@ -27,10 +24,10 @@ class ExternalRelationStaticImpl {
}
/** Return the {@link ExternalRelationSpecification} of the {@link ExternalRelation} */
public static ExternalRelationSpecification getTargetSpecification(
ExternalRelation externalRelation) {
return pickFirstInstanceOf(ExternalRelationSpecification.class,
externalRelation.getReferencedByList());
}
// public static ExternalRelationSpecification getTargetSpecification(
// ExternalRelation externalRelation) {
// return pickFirstInstanceOf(ExternalRelationSpecification.class,
// externalRelation.getReferencedByList());
// }
}
......@@ -40,6 +40,7 @@ import java.util.LinkedList;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.ExternalRelation;
import org.fortiss.af3.mira.model.ImageItem;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementRelation;
......@@ -77,6 +78,7 @@ import org.fortiss.af3.table.model.TableStringExpression;
import org.fortiss.af3.table.model.TableVariableExpression;
import org.fortiss.af3.table.model.TransitionRule;
import org.fortiss.af3.table.utils.TableUtils;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.kernel.model.IIdLabeled;
import org.fortiss.tooling.kernel.model.INamedElement;
import org.fortiss.tooling.kernel.utils.EcoreUtils;
......@@ -172,7 +174,6 @@ public class ContextFactory {
// evaluate relations of the requirement
ctx.defineContextList("relations");
ctx.set("has_relation", a.getRequirementRelationLength() > 0);
handleRequirmentRelations(ctx, a);
return ctx;
}
......@@ -235,16 +236,43 @@ public class ContextFactory {
}
// evaluate traces to architecture
ctx.set("has_externalRelation", r.getExternalRelationLength() > 0);
ctx.defineContextList("externalRelations");
handleExternalRelations(ctx, r);
// evaluate comments
ctx.set("comments", r.getComment());
return ctx;
}
/**
* Evaluate the {@link RequirementRelation} to the given {@link EvaluationContext}
*/
private static void handleExternalRelations(EvaluationContext ctx, Requirement r) {
for(ExternalRelation externalRelation : r.getExternalRelationList()) {
EvaluationContext relationCtx = new EvaluationContext();
relationCtx.set("externalRelationAuthor", externalRelation.getAuthor());
IModelElement targetSpecification =
externalRelation.getExternalRelationSpecification().getSpecificationOf();
relationCtx.set("externalRelationTarget",
((INamedElement)targetSpecification).getName());
relationCtx.set("externalRelationTargetType", targetSpecification.eClass().getName());
relationCtx.set("externalRelationComment", externalRelation.getComment());
ctx.addContext("externalRelations", relationCtx);
}
}
/**
* Evaluate the {@link RequirementRelation} to the given {@link EvaluationContext}
*/
private static void handleRequirmentRelations(EvaluationContext ctx, Analysis a) {
ctx.set("has_relation", a.getRequirementRelationLength() > 0);
for(RequirementRelation relation : a.getRequirementRelationList()) {
String relationType =
IRelationTypeService.INSTANCE.getHandler(relation.getRequirementRelationType())
......@@ -262,7 +290,7 @@ public class ContextFactory {
EvaluationContext relationCtx = new EvaluationContext();
relationCtx.set("relationType", relationType);
relationCtx.set("relationAuthoer", relation.getAuthor());
relationCtx.set("relationAuthor", relation.getAuthor());
relationCtx.set("relationComment", relationComment);
relationCtx.set("relationSource",
getRequirementNameString(relation.getSourceRequirementList(), "\n"));
......
......@@ -128,7 +128,8 @@ public class MiraUtils {
public static void removeEmptyExternalRelation(Analysis analysis) {
for(ExternalRelation externalRelation : analysis.getExternalRelationList()) {
if(externalRelation.getSourceRequirement() == null) {
ExternalRelationSpecification spec = externalRelation.getTargetSpecification();
ExternalRelationSpecification spec =
externalRelation.getExternalRelationSpecification();
if(spec != null) {
ICommandStackService.INSTANCE.runAsCommand(spec.getSpecificationOf(),
new DeleteRequirementSpecificationCommand(spec));
......
......@@ -390,6 +390,26 @@
</TMPL_LOOP subComponent>
</TMPL_LOOP subComponent>
</TMPL_LOOP formalspecs>
<h4> Traces to architecture</h3>
<TMPL_IF has_externalRelation>
<table stype = "border-style:solid; text-align:center">
<tr>
<td style="width: 250px; border-style:solid; text-align:center">Author</td>
<td style="width: 250px; border-style:solid; text-align:center">Target</td>
<td style="width: 250px; border-style:solid; text-align:center">Target type</td>
<td style="width: 250px; border-style:solid; text-align:center">Comment</td>
</tr>
<TMPL_LOOP externalRelations>
<tr>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR externalRelationAuthor></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR externalRelationTarget></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR externalRelationTargetType></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR externalRelationComment></td>
</tr>
</TMPL_LOOP externalRelations>
</table>
</TMPL_IF has_externalRelation>
<TMPL_ELSE has_externalRelation>none</TMPL_ELSE has_externalRelation>
</TMPL_LOOP requirements>
</TMPL_LOOP requirementsContainer>
......@@ -519,7 +539,6 @@
</td>
</tr>
</table>
<TMPL_IF is_usecase>
<TMPL_LOOP scenarios>
......@@ -620,9 +639,29 @@
</TMPL_LOOP subComponent>
</TMPL_LOOP subComponent>
</TMPL_LOOP formalspecs>
<h4> Traces to architecture</h3>
<TMPL_IF has_externalRelation>
<table stype = "border-style:solid; text-align:center">
<tr>
<td style="width: 250px; border-style:solid; text-align:center">Author</td>
<td style="width: 250px; border-style:solid; text-align:center">Target</td>
<td style="width: 250px; border-style:solid; text-align:center">Target type</td>
<td style="width: 250px; border-style:solid; text-align:center">Comment</td>
</tr>
<TMPL_LOOP externalRelations>
<tr>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR externalRelationAuthor></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR externalRelationTarget></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR externalRelationTargetType></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR externalRelationComment></td>
</tr>
</TMPL_LOOP externalRelations>
</table>
</TMPL_IF has_externalRelation>
<TMPL_ELSE has_externalRelation>none</TMPL_ELSE has_externalRelation>
</TMPL_LOOP requirements>
<h3> Requirement relations</h3>
<h3> Traces within requirements</h3>
<TMPL_IF has_relation>
<table stype = "border-style:solid; text-align:center">
<tr>
......@@ -635,7 +674,7 @@
<TMPL_LOOP relations>
<tr>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR relationType></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR relationAuthoer></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR relationAuthor></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR relationSource></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR relationTarget></td>
<td style="width: 250px; border-style:solid; text-align:center"><TMPL_VAR relationComment></td>
......@@ -644,5 +683,6 @@
</table>
</TMPL_IF has_relation>
<TMPL_ELSE has_relation>none</TMPL_ELSE has_relation>
</body>
</html>
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