...
 
Commits (56)
......@@ -17,6 +17,8 @@ Export-Package: org.fortiss.af3.component.ui,
org.fortiss.af3.component.ui.editor,
org.fortiss.af3.component.ui.editor.code,
org.fortiss.af3.component.ui.editor.datastate,
org.fortiss.af3.component.ui.editor.fx,
org.fortiss.af3.component.ui.editor.fx.visual,
org.fortiss.af3.component.ui.editpart,
org.fortiss.af3.component.ui.editpart.figure,
org.fortiss.af3.component.ui.examples,
......
ComponentControllerFactory.java 8de3dc95e8a981f93dc179ef510062cc7a112901 YELLOW
ComponentModelFactory.java 9141373b9498b8e947ef1ca8921128bdf66ec308 YELLOW
ComponentStructureFXEditor.java 2d7c0f40fffb4cfb918b60da5de3d5fc0c067916 YELLOW
ComponentStructureFXEditorBinding.java 82516f6e6855be6336116f0ea5563f461d163fc5 YELLOW
ComponentVisualFactory.java 5422167d12bb5553ed816363d41e0288fe481056 YELLOW
ComponentControllerFactory.java 57c48af3d6c2d51a9040a8b754a8b19b73525777 GREEN
ComponentModelFactory.java 9141373b9498b8e947ef1ca8921128bdf66ec308 GREEN
ComponentStructureFXEditor.java 2d7c0f40fffb4cfb918b60da5de3d5fc0c067916 GREEN
ComponentStructureFXEditorBinding.java 82516f6e6855be6336116f0ea5563f461d163fc5 GREEN
ComponentVisualFactory.java 5422167d12bb5553ed816363d41e0288fe481056 GREEN
......@@ -28,7 +28,7 @@ import org.fortiss.af3.component.model.Port;
import org.fortiss.tooling.base.ui.editor.fx.controller.EObjectDiagramController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedContentAnchorageController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedDiagramAnchorageController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedLineLinkBendPointController;
import org.fortiss.tooling.base.ui.editor.fx.controller.LayoutedRectangularResizableContentController;
/**
......@@ -59,7 +59,7 @@ public final class ComponentControllerFactory implements IControllerFactory {
/** {@inheritDoc} */
@Override
public IController createLinkController(ILinkMVCBundle modelBundle) {
return new LayoutedLinkBendPointController<>(modelBundle, Channel.class);
return new LayoutedLineLinkBendPointController<>(modelBundle, Channel.class);
}
/** {@inheritDoc} */
......
ContentComponentPortVisual.java 6e398120650316a0649173efd70c508efd3b5d09 YELLOW
ContentComponentVisual.java 1343052af19542e4860043c0bcfb2b3e997d0422 YELLOW
DiagramComponentPortVisual.java 918915c5801064ebfb2bb6028f4e588256b1aefe YELLOW
ContentComponentPortVisual.java 6e398120650316a0649173efd70c508efd3b5d09 GREEN
ContentComponentVisual.java 1343052af19542e4860043c0bcfb2b3e997d0422 GREEN
DiagramComponentPortVisual.java 918915c5801064ebfb2bb6028f4e588256b1aefe GREEN
......@@ -27,6 +27,15 @@
</modelElementClass>
</modelEditorBinding>
</extension>
<extension
point="org.fortiss.tooling.kernel.ui.modelEditorBinding">
<modelEditorBinding
binding="org.fortiss.af3.cosimulation.ui.editor.fx.ExternalSpecificationFXEditorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.component.model.IReadOnlyBehaviorSpecification">
</modelElementClass>
</modelEditorBinding>
</extension>
<extension
point="org.fortiss.tooling.kernel.ui.contextMenuContribution">
<contextMenuContribution
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.text.Font?>
<AnchorPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TitledPane text="External Behavior Specification" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<HBox prefHeight="122.0" prefWidth="488.0">
<children>
<Label prefHeight="24.0" prefWidth="34.0" text="Path:">
<font>
<Font size="14.0" />
</font>
</Label>
<TextField fx:id="browseTextField" editable="false" HBox.hgrow="ALWAYS">
<font>
<Font size="14.0" />
</font>
<HBox.margin>
<Insets left="10.0" right="10.0" />
</HBox.margin>
</TextField>
<Button fx:id="browseButton" mnemonicParsing="false" onMouseClicked="#browseFiles" text="Browse">
<font>
<Font size="14.0" />
</font>
</Button>
</children>
</HBox>
</content>
<font>
<Font size="14.0" />
</font>
</TitledPane>
</children>
</AnchorPane>
ExternalSpecificationFXController.java 93296c80f8331d5ef5db210c113d6a29f0e2b5e6 GREEN
ExternalSpecificationFXEditor.java f96392509542fa312b9d535dd441644c4c591e2b GREEN
ExternalSpecificationFXEditorBinding.java 642a213c82baee68913c37ccdc0edeef2d3fddf5 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2011 fortiss GmbH |
| Copyright 2020 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
......@@ -13,43 +13,27 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.relation;
package org.fortiss.af3.cosimulation.ui.editor.fx;
import java.util.List;
import org.fortiss.af3.component.model.IReadOnlyBehaviorSpecification;
import org.fortiss.af3.cosimulation.model.IExternalBehaviorSpecification;
import org.fortiss.tooling.kernel.ui.extension.base.FXEditorBase;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.mira.model.relations.RequirementRelationType;
import javafx.scene.Parent;
/**
* AF3 service managing access to registered requirements relations. The
* extension point of the service is {@link org.fortiss.af3.mira.relation}
* Implementation of the {@link IExternalBehaviorSpecification} editor.
*
* @author mou
* @author munaro
*/
public interface IRelationTypeService {
/**
* Singleton instance of the service.
*
* @deprecated use {@link #getInstance()}
*/
@Deprecated
public static final IRelationTypeService INSTANCE = new RelationTypeService();
/** Returns the singleton instance of the service. */
public static IRelationTypeService getInstance() {
return INSTANCE;
public class ExternalSpecificationFXEditor extends FXEditorBase<IReadOnlyBehaviorSpecification> {
/** {@inheritDoc} */
@Override
protected Parent createSceneRoot() {
ExternalSpecificationFXController controller =
new ExternalSpecificationFXController(getEditedObject());
controller.loadLayout();
return controller.getLayout();
}
/** Finds type system handler for the model element's project configuration. */
IRelationTypeHandler<RequirementRelationType> getHandler(EObject element);
/**
* Return a list of all registered handlers. The list can be modified by the
* caller.
*/
List<IRelationTypeHandler<RequirementRelationType>> getHandlers();
/** Return the number of registered handlers. */
int getHandlerCount();
}
/*-------------------------------------------------------------------------+
| Copyright 2013 fortiss GmbH |
| Copyright 2020 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
......@@ -13,33 +13,36 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.ui.handler;
package org.fortiss.af3.cosimulation.ui.editor.fx;
import static org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin;
import static org.fortiss.af3.mira.ui.AF3MiraUIActivator.PLUGIN_ID;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.mira.model.relations.RequirementRelationStatus;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.cosimulation.model.IExternalBehaviorSpecification;
import org.fortiss.af3.expression.model.DataDictionary;
import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
/**
* {@link IModelElementHandler} for {@link RequirementRelationStatus}
* Extension of {@link ModelEditorBindingBase} implementation for the
* {@link IExternalBehaviorSpecification} editor.
*
* @author wenwenchen
* @author munaro
*/
public class RequirementRelationStatusHandler
extends ModelElementHandlerBase<RequirementRelationStatus> {
public class ExternalSpecificationFXEditorBinding extends ModelEditorBindingBase<DataDictionary> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass() {
return ExternalSpecificationFXEditor.class;
}
/** {@inheritDoc} */
@Override
public String getName(RequirementRelationStatus element) {
return element.getName();
public String getLabel() {
return "External Specification Editor (FX)";
}
/** {@inheritDoc} */
@Override
public ImageDescriptor getIconImageDescriptor() {
return imageDescriptorFromPlugin(PLUGIN_ID, "icons/Icon_RequirementRelationStatus.png");
public int getPriority() {
return -100;
}
}
CosimulationPrototypeProvider.java 15a72a81f2e7aaac5352f488bae00fc8d2a3149e GREEN
CosimulationPrototypeProvider.java 6716ca728f39c44a54e3308ef07849e1ab6c62bd GREEN
FMUSpecificationComponentCompositor.java 8ed5aa2c2e567c28b826181cb9696b06e21333de GREEN
SimulinkSpecificationComponentCompositor.java bcc6615de6055cb68f5590694d41d0373b14abde GREEN
......@@ -37,6 +37,7 @@ public class CosimulationPrototypeProvider extends GloballyCategorizedPrototypeP
registerPrimaryPrototype("FMU Specification", fmuSpec, CATEGORY_NAME_BEHAVIOR_SPEC);
SimulinkSpecification simSpec = createSimulinkSpecification();
registerPrimaryPrototype("Simulink Specification", simSpec, CATEGORY_NAME_BEHAVIOR_SPEC);
registerPrimaryPrototype("Simulink Specification (Beta)", simSpec,
CATEGORY_NAME_BEHAVIOR_SPEC);
}
}
......@@ -102,6 +102,11 @@
<modelElementClass
modelElementClass="org.fortiss.af3.expression.model.DataDictionary"></modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.expression.ui.editor.fx.DataDictionaryFXEvaluatorBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.expression.model.DataDictionary"></modelElementClass>
</modelEditorBinding>
</extension>
<extension
......
......@@ -2,3 +2,5 @@ DataDictionaryFXEditor.java 00ed9250166d4c2faacd1c6f72ec9a7acfaceab2 GREEN
DataDictionaryFXEditorBinding.java 8c2d41b5ec9ea8564cad6a1d7c25a2839e1d071e GREEN
DataDictionaryFXEditorContentProvider.java 855cde53505172d1bf5743b9b4f53aaa50548962 GREEN
DataDictionaryFXEditorUIProvider.java 1667f58cb7e6daf360a58e33e15a6d23b6dae071 GREEN
DataDictionaryFXEvaluator.java cf2f12de4f7e01b41de62e8e5841786ed9891cb5 GREEN
DataDictionaryFXEvaluatorBinding.java a15f93c5fb7cd292460aa5bea0a57a9fea42d315 GREEN
/*-------------------------------------------------------------------------+
| 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.expression.ui.editor.fx;
import static org.fortiss.af3.expression.ui.AF3ExpressionUIActivator.getFXImageURI;
import static org.fortiss.tooling.common.ui.javafx.util.GraphicUtils.getFXImageFromURI;
import java.util.LinkedList;
import org.fortiss.af3.expression.language.ParseException;
import org.fortiss.af3.expression.language.TypeChecker;
import org.fortiss.af3.expression.language.TypeSystemHandler;
import org.fortiss.af3.expression.model.DataDictionary;
import org.fortiss.af3.expression.model.definitions.TypeDefinition;
import org.fortiss.af3.expression.model.terms.IExpressionTerm;
import org.fortiss.af3.expression.model.types.impl.TBoolStaticImpl;
import org.fortiss.af3.expression.model.types.impl.TDoubleStaticImpl;
import org.fortiss.af3.expression.model.types.impl.TIntStaticImpl;
import org.fortiss.af3.project.model.typesystem.ITerm;
import org.fortiss.af3.project.model.typesystem.IType;
import org.fortiss.af3.project.services.ITypeSystemService;
import org.fortiss.af3.project.typesystem.IEvaluationContext;
import org.fortiss.af3.project.typesystem.ITermEvaluator;
import org.fortiss.af3.project.typesystem.ITypeSystemCompiler;
import org.fortiss.af3.project.typesystem.evaluation.Term;
import org.fortiss.tooling.kernel.ui.extension.base.FXEditorBase;
import javafx.scene.Parent;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
/**
* Editor implementation for the data dictionary evaluator (= data dictionary
* simulator).
*
* @author hoelzl
*/
public final class DataDictionaryFXEvaluator extends FXEditorBase<DataDictionary> {
/** The initial message displayed to the evaluator user. */
private static final String WELCOME = "Enter expression below and hit return." +
"\nUse up and down arrow keys to cycle through previous inputs.";
/** Stores the evaluator output text area. */
private TextArea evaluatorOutput = new TextArea();
/** Stores the evaluator help output label. */
private Label evaluatorHelp = new Label(WELCOME, INFO);
/** Stores the evaluator input text field. */
private TextField evaluatorInput = new TextField();
/** Stores the stack of successfully executed evaluator queries. */
private final LinkedList<String> evaluatorStack = new LinkedList<>();
/** Stores the current index in the query stack. */
private int stackPointer = 0;
/** Stores the error image. */
private static ImageView ERROR =
new ImageView(getFXImageFromURI(getFXImageURI("icons/error.gif")));
/** Stores the info image. */
private static ImageView INFO =
new ImageView(getFXImageFromURI(getFXImageURI("icons/info.gif")));
/** The flag if return is activated, i.e., parsing and type check succeed for current input. */
private boolean canExecute = false;
/** The default types. */
private static final IType[] DEFAULT_TYPES = new IType[] {TBoolStaticImpl.INSTANCE,
TIntStaticImpl.INSTANCE, TDoubleStaticImpl.INSTANCE};
/** {@inheritDoc} */
@Override
protected Parent createSceneRoot() {
BorderPane bpane = new BorderPane();
bpane.setCenter(evaluatorOutput);
VBox vbox = new VBox(evaluatorHelp, evaluatorInput);
bpane.setBottom(vbox);
registerListeners();
return bpane;
}
/** Registers the listeners. */
private void registerListeners() {
evaluatorInput.setOnKeyReleased(evt -> {
KeyCode kc = evt.getCode();
if(kc == KeyCode.ENTER && canExecute) {
setHelpAndCanExecuteFlag("", null);
evaluate();
return;
}
if(kc == KeyCode.DOWN) {
if(stackPointer < evaluatorStack.size() - 1) {
stackPointer++;
evaluatorInput.setText(evaluatorStack.get(stackPointer));
} else if(stackPointer == evaluatorStack.size() - 1) {
stackPointer++;
evaluatorInput.setText("");
}
} else if(kc == KeyCode.UP) {
if(stackPointer > 0) {
stackPointer--;
evaluatorInput.setText(evaluatorStack.get(stackPointer));
}
}
setHelpAndCanExecuteFlag("", null);
String input = evaluatorInput.getText().trim();
ITypeSystemCompiler compiler = TypeSystemHandler.INSTANCE.getTypeSystemCompiler();
ITerm term = null;
try {
term = compiler.compileTerm(input, editedObject);
} catch(ParseException pe) {
setHelpAndCanExecuteFlag(pe.getMessage(), ERROR);
}
// expression check and type checking
if(term instanceof IExpressionTerm) {
typecheckTerm((IExpressionTerm)term);
} else {
setHelpAndCanExecuteFlag("Input is not an expression.", ERROR);
}
});
}
/** Sets the help content. */
private void setHelpAndCanExecuteFlag(String text, ImageView image) {
evaluatorHelp.setText(text);
evaluatorHelp.setGraphic(image);
canExecute = image != ERROR;
}
/** Evaluates the user input. */
private void evaluate() {
ITerm inputTerm = compileInput(evaluatorInput.getText());
Term<? extends ITerm> resultTerm = evaluateTerm(inputTerm);
evaluatorOutput.appendText(" > " + inputTerm.toString() + "\n");
evaluatorOutput.appendText(" = " + resultTerm.toString() + "\n\n");
evaluatorStack.add(inputTerm.toString());
stackPointer = evaluatorStack.size();
evaluatorInput.setText("");
setHelpAndCanExecuteFlag("", null);
}
/** Evaluates the given term. */
private Term<? extends ITerm> evaluateTerm(ITerm term) {
ITermEvaluator evaluator =
ITypeSystemService.INSTANCE.getHandler(editedObject).getTermEvaluator();
IEvaluationContext context =
ITypeSystemService.INSTANCE.createEvaluationContext(editedObject);
return evaluator.evaluate(term, context);
}
/** Performs type checking on the given term. */
private void typecheckTerm(IExpressionTerm term) {
TypeChecker tc = new TypeChecker();
for(IType t : DEFAULT_TYPES) {
if(tc.typecheck(term, t, editedObject).isOK()) {
setDerivedTypeHelp(t);
return;
}
}
for(TypeDefinition td : editedObject.getTypeDefinitions()) {
IType t = td.createIType();
if(tc.typecheck(term, t, editedObject).isOK()) {
setDerivedTypeHelp(t);
return;
}
}
setHelpAndCanExecuteFlag("No type could be derived for entered expression", ERROR);
}
/** Sets the derived type info message. */
private void setDerivedTypeHelp(IType t) {
setHelpAndCanExecuteFlag("Derived type is: '" + t.toString() + "'", INFO);
}
/** Compiles the given input string. */
private ITerm compileInput(String input) {
input = input.trim();
return TypeSystemHandler.INSTANCE.getTypeSystemCompiler().compileTerm(input, editedObject);
}
/** {@inheritDoc} */
@Override
public void setFocus() {
evaluatorInput.requestFocus();
}
/** {@inheritDoc} */
@Override
public boolean enableLibraryView() {
return false;
}
}
......@@ -13,33 +13,34 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.mira.relation;
package org.fortiss.af3.expression.ui.editor.fx;
import org.fortiss.af3.mira.model.relations.RequirementRelationType;
import org.fortiss.tooling.kernel.service.base.IEObjectAware;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.expression.model.DataDictionary;
import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase;
/**
* Handler interface for registered requirements relations.
* Extension of {@link ModelEditorBindingBase} for the {@link DataDictionary} evaluator.
*
* @author hoelzlf
* @author hoelzl
*/
public interface IRelationTypeHandler<T extends RequirementRelationType> extends IEObjectAware<T> {
/** Returns the source display name. */
String getDisplayNameForSource();
/** Returns the target display name. */
String getDisplayNameForTarget();
/** Returns the relation name. */
String getTypeName();
/** Create a clean instance */
T createInstance();
/** Return the supported class */
Class<T> getRelationTypeClass();
/** Return the ranking numbering */
int getRanking();
public final class DataDictionaryFXEvaluatorBinding extends ModelEditorBindingBase<DataDictionary> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass() {
return DataDictionaryFXEvaluator.class;
}
/** {@inheritDoc} */
@Override
public String getLabel() {
return "Evaluator (FX)";
}
/** {@inheritDoc} */
@Override
public int getPriority() {
return -200;
}
}
......@@ -11,12 +11,6 @@
modelElementClass="org.fortiss.af3.mira.model.Analysis">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.RequirementRelationStatusHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.relations.RequirementRelationStatus">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.RequirementsContainerHandler">
<modelElementClass
......@@ -35,12 +29,6 @@
modelElementClass="org.fortiss.af3.mira.model.Requirement">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.RequirementSpecificationHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.RequirementSpecification">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.GlossaryHandler">
<modelElementClass
......
/*-------------------------------------------------------------------------+
| Copyright 2012 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.action;
import static org.conqat.ide.commons.ui.dialog.MessageUtils.confirm;
import static org.eclipse.emf.ecore.util.EcoreUtil.delete;
import java.util.List;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementSpecification;
import org.fortiss.tooling.kernel.service.ICommandStackService;
import org.fortiss.tooling.kernel.ui.extension.base.EObjectActionBase;
/**
* Action to delete a list of {@link RequirementSpecification}s
*
* @author mou
*/
public class DeleteRequirementSpecificationAction extends EObjectActionBase<Requirement> {
/** A list of {@link RequirementSpecification} to be deleted. */
private List<RequirementSpecification> reqSpecs;
/** Constructor. */
public DeleteRequirementSpecificationAction(Requirement editedObject,
List<RequirementSpecification> specs) {
super("DeleteRequirementSpecificationActionBase");
setTarget(editedObject);
this.reqSpecs = specs;
}
/** {@inheritDoc} */
@Override
public void run() {
if(reqSpecs == null || reqSpecs.size() == 0) {
return;
}
if(!confirm("Delete Reference of Requirement", "Do you want to delete the reference?")) {
return;
}
ICommandStackService.getInstance().runAsCommand(getTarget(), new Runnable() {
@Override
public void run() {
for(RequirementSpecification reqspec : reqSpecs) {
getTarget().getReferencedBy().remove(reqspec);
delete(reqspec);
}
}
});
}
}
......@@ -7,4 +7,4 @@ ConnectionHoverInformationControl.java 4b742ce99b43c31c9864420ed4d6a711cb3d3631
ConnectionTextHover.java 65c999c4d1020d9d20c4a5e62eb633f26be9bac9 GREEN
ListToWordRuleUpdateStrategy.java 08e21f1b7e0979afcbc5ecd2dae612786966a656 GREEN
MiraWordRule.java f8a6910146270ae4b85f162845a0cc7c86b4ff05 GREEN
ScannerManager.java a1480c24630bec3ef782a0df84de64517820ba91 GREEN
ScannerManager.java bfb0275e1691ea62f025a99ac3a71b266c417dc7 GREEN
......@@ -29,7 +29,6 @@ import org.eclipse.jface.text.rules.Token;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.ContextElement;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementSpecification;
import org.fortiss.af3.mira.model.WordElement;
import org.fortiss.af3.mira.model.glossary.Glossary;
import org.fortiss.af3.mira.model.glossary.GlossaryEntry;
......@@ -44,13 +43,13 @@ import org.fortiss.tooling.kernel.model.INamedElement;
*/
public class ScannerManager {
/** The token used for {@link ContextElement}'s. */
/** The token used for {@link ContextElement}s. */
public static final IToken elementToken = new Token(new TextAttribute(ELEMENT_COLOR));
/** The token used for {@link RequirementSpecification}'s. */
/** The token used for {@link Requirement}s. */
public static final IToken reqToken = new Token(new TextAttribute(REQ_COLOR));
/** The token used for synonyms of {@link ContextElement}'s. */
/** The token used for synonyms of {@link ContextElement}s. */
public static final IToken synonymToken = new Token(new TextAttribute(SYNONYM_COLOR));
/** The word detector used by all scanners. */
......
ContextUtils.java 273aa06af2c15073bbbdd6f1a8112190732eaa9b GREEN
HighlightUtils.java 9797de10e9c1fd6475bd1eda4d9a55746c17a219 GREEN
ImageUtils.java b87b930301c11cce514b9fb38e148bd00fe60d68 GREEN
ListenerUtils.java a33da975a9e64175712c1a3f1bcb67a6f4b4c8e9 GREEN
ListenerUtils.java f05728d39167b85752ee577a73e265d2764693f8 GREEN
MiraLayoutUtils.java 0ed0d5731be847edb8454acc27de691ac3ee28e9 GREEN
......@@ -20,7 +20,6 @@ import static org.conqat.ide.commons.ui.selection.SelectionUtils.checkAndPickFir
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.fortiss.af3.mira.model.RequirementSpecification;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
/**
......@@ -47,24 +46,4 @@ public class ListenerUtils {
}
};
}
/** The {@link IDoubleClickListener} to open a requirement from a requirement specification */
public static <T extends RequirementSpecification> IDoubleClickListener
openReqEditorFromReqSpecListener(final Class<T> clazz) {
return new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
RequirementSpecification reqSpec = checkAndPickFirst(event.getSelection(), clazz);
if(reqSpec == null)
return;
// the requirement of the requirement specification is found in
// eContainer().eContainer()
IModelEditorBindingService.getInstance()
.openInEditor(reqSpec.getSpecificationOf().eContainer().eContainer());
}
};
}
}
......@@ -19,15 +19,8 @@ Export-Package: org.fortiss.af3.mira,
org.fortiss.af3.mira.model.glossary.impl,
org.fortiss.af3.mira.model.glossary.util,
org.fortiss.af3.mira.model.impl,
org.fortiss.af3.mira.model.relations,
org.fortiss.af3.mira.model.relations.impl,
org.fortiss.af3.mira.model.relations.util,
org.fortiss.af3.mira.model.util,
org.fortiss.af3.mira.prototype,
org.fortiss.af3.mira.relation,
org.fortiss.af3.mira.relation.handler,
org.fortiss.af3.mira.report,
org.fortiss.af3.mira.report.template,
org.fortiss.af3.mira.utils,
org.fortiss.af3.mira.verification,
test.org.fortiss.af3.mira
......
mira.ecore 5efdc0d70d2f4f9be410bbb17077533eb4ce036f RED
mira.ecore 6f65a501f30154def7b0805517153fb4f5516b9c RED
......@@ -31,15 +31,6 @@
<details key="body" value="return AnalysisStaticImpl.computeReqID(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="initializeRequirementRelationStatus">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="AnalysisStaticImpl.initializeRequirementRelationStatus(this);"/>
</eAnnotations>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EReference" name="requirementRelation" upperBound="-1"
eType="#//RequirementRelation" containment="true" eOpposite="#//RequirementRelation/analysis"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="requirementRelationStatus"
upperBound="-1" eType="#//relations/RequirementRelationStatus" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Requirement" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement #//IImageContainer platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//constraints/IConstrained">
<eOperations name="getAnalysis" eType="#//Analysis">
......@@ -88,10 +79,6 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="todo" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="reqId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EReference" name="outgoingRequirementRelation"
upperBound="-1" eType="#//RequirementRelation" eOpposite="#//RequirementRelation/sourceRequirement"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="incomingRequirementRelation"
upperBound="-1" eType="#//RequirementRelation" eOpposite="#//RequirementRelation/targetRequirement"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="safetyRequirementType"
eType="#//SafetyRequirementType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="safetyRequirement" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
......@@ -112,13 +99,6 @@
<eLiterals name="Normal" value="2" literal="Normal - Satisfier"/>
<eLiterals name="Low" value="3" literal="Low - Delighter"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RequirementSpecification" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementReference platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHiddenSpecification">
<eOperations name="getRequirement" eType="#//Requirement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RequirementSpecificationStaticImpl.getRequirement(this);"/>
</eAnnotations>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ImageItem" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//IExternalDocumentReference">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
......@@ -193,52 +173,12 @@
</eGenericType>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RequirementRelation" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IConnection">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="author" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="analysis" lowerBound="1"
eType="#//Analysis" eOpposite="#//Analysis/requirementRelation"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="requirementRelationType"
lowerBound="1" eType="#//relations/RequirementRelationType" containment="true"
eOpposite="#//relations/RequirementRelationType/requirementRelation"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sourceRequirement" upperBound="-1"
eType="#//Requirement" eOpposite="#//Requirement/outgoingRequirementRelation"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="targetRequirement" upperBound="-1"
eType="#//Requirement" eOpposite="#//Requirement/incomingRequirementRelation"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="requirementRelationStatus"
lowerBound="1" eType="#//relations/RequirementRelationStatus"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="SafetyRequirementType">
<eLiterals name="notassigned" literal="N/A"/>
<eLiterals name="Software" value="1" literal="Software"/>
<eLiterals name="Functional" value="2"/>
<eLiterals name="Hardware" value="3" literal="Hardware"/>
</eClassifiers>
<eSubpackages name="relations" nsURI="http://www.fortiss.org/af3/mira/relations"
nsPrefix="org-fortiss-af3-mira-relations">
<eClassifiers xsi:type="ecore:EClass" name="ConflictedRequirementRelationType"
eSuperTypes="#//relations/UndirectedRequirementRelationType"/>
<eClassifiers xsi:type="ecore:EClass" name="ContradictingRequirementRelationType"
eSuperTypes="#//relations/UndirectedRequirementRelationType"/>
<eClassifiers xsi:type="ecore:EClass" name="RefinementRequirementRelationType"
eSuperTypes="#//relations/DirectedRequirementRelationType"/>
<eClassifiers xsi:type="ecore:EClass" name="OverridingRequirementRelationType"
eSuperTypes="#//relations/DirectedRequirementRelationType"/>
<eClassifiers xsi:type="ecore:EClass" name="DirectedRequirementRelationType" abstract="true"
eSuperTypes="#//relations/RequirementRelationType"/>
<eClassifiers xsi:type="ecore:EClass" name="UndirectedRequirementRelationType"
abstract="true" eSuperTypes="#//relations/RequirementRelationType"/>
<eClassifiers xsi:type="ecore:EClass" name="DefinedDirectedRequirementRelationType"
eSuperTypes="#//relations/DirectedRequirementRelationType #//relations/DefinedRequirementRelationType"/>
<eClassifiers xsi:type="ecore:EClass" name="DefinedUndirectedRequirementRelationType"
eSuperTypes="#//relations/UndirectedRequirementRelationType #//relations/DefinedRequirementRelationType"/>
<eClassifiers xsi:type="ecore:EClass" name="DefinedRequirementRelationType" abstract="true"
eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement #//relations/RequirementRelationType"/>
<eClassifiers xsi:type="ecore:EClass" name="RequirementRelationType" abstract="true">
<eStructuralFeatures xsi:type="ecore:EReference" name="requirementRelation"
lowerBound="1" eType="#//RequirementRelation" eOpposite="#//RequirementRelation/requirementRelationType"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RequirementRelationStatus" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementReference"/>
</eSubpackages>
<eSubpackages name="glossary" nsURI="http://www.fortiss.org/af3/mira/glossary" nsPrefix="org-fortiss-af3-mira-glossary">
<eClassifiers xsi:type="ecore:EClass" name="Glossary" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement">
<eOperations name="getAnalysis" eType="#//Analysis">
......
......@@ -36,15 +36,11 @@
<genEnumLiterals ecoreEnumLiteral="mira.ecore#//SafetyRequirementType/Hardware"/>
</genEnums>
<genClasses ecoreClass="mira.ecore#//Analysis">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference mira.ecore#//Analysis/requirementRelation"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference mira.ecore#//Analysis/requirementRelationStatus"/>
<genOperations ecoreOperation="mira.ecore#//Analysis/getRequirementsList" body="return AnalysisStaticImpl.getRequirementsList(this);"/>
<genOperations ecoreOperation="mira.ecore#//Analysis/getGlossariesList" body="return AnalysisStaticImpl.getGlossariesList(this);"/>
<genOperations ecoreOperation="mira.ecore#//Analysis/getRequirementsContainersList"
body="return AnalysisStaticImpl.getRequirementsContainersList(this);"/>
<genOperations ecoreOperation="mira.ecore#//Analysis/computeReqID" body="return AnalysisStaticImpl.computeReqID(this);"/>
<genOperations ecoreOperation="mira.ecore#//Analysis/initializeRequirementRelationStatus"
body="AnalysisStaticImpl.initializeRequirementRelationStatus(this);"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//Requirement">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//Requirement/description"/>
......@@ -55,8 +51,6 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//Requirement/priority"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//Requirement/todo"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//Requirement/reqId"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//Requirement/outgoingRequirementRelation"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//Requirement/incomingRequirementRelation"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//Requirement/safetyRequirementType"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//Requirement/safetyRequirement"/>
<genOperations ecoreOperation="mira.ecore#//Requirement/getAnalysis" body="return RequirementStaticImpl.getAnalysis(this);"/>
......@@ -74,10 +68,6 @@
body="return RequirementStaticImpl.hasSafetyInformation(this);"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//RequirementConnector"/>
<genClasses ecoreClass="mira.ecore#//RequirementSpecification">
<genOperations ecoreOperation="mira.ecore#//RequirementSpecification/getRequirement"
body="return RequirementSpecificationStaticImpl.getRequirement(this);"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//ImageItem">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//ImageItem/path"/>
</genClasses>
......@@ -110,30 +100,6 @@
<genOperations ecoreOperation="mira.ecore#//RequirementsContainer/getRequirementsList"
body="return RequirementsContainerStaticImpl.getRequirementsList(this);"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//RequirementRelation">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//RequirementRelation/author"/>
<genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference mira.ecore#//RequirementRelation/analysis"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference mira.ecore#//RequirementRelation/requirementRelationType"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//RequirementRelation/sourceRequirement"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//RequirementRelation/targetRequirement"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference mira.ecore#//RequirementRelation/requirementRelationStatus"/>
</genClasses>
<nestedGenPackages prefix="Relations" basePackage="org.fortiss.af3.mira.model"
disposableProviderFactory="true" ecorePackage="mira.ecore#//relations">
<genClasses ecoreClass="mira.ecore#//relations/ConflictedRequirementRelationType"/>
<genClasses ecoreClass="mira.ecore#//relations/ContradictingRequirementRelationType"/>
<genClasses ecoreClass="mira.ecore#//relations/RefinementRequirementRelationType"/>
<genClasses ecoreClass="mira.ecore#//relations/OverridingRequirementRelationType"/>
<genClasses image="false" ecoreClass="mira.ecore#//relations/DirectedRequirementRelationType"/>
<genClasses image="false" ecoreClass="mira.ecore#//relations/UndirectedRequirementRelationType"/>
<genClasses ecoreClass="mira.ecore#//relations/DefinedDirectedRequirementRelationType"/>
<genClasses ecoreClass="mira.ecore#//relations/DefinedUndirectedRequirementRelationType"/>
<genClasses image="false" ecoreClass="mira.ecore#//relations/DefinedRequirementRelationType"/>
<genClasses image="false" ecoreClass="mira.ecore#//relations/RequirementRelationType">
<genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference mira.ecore#//relations/RequirementRelationType/requirementRelation"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//relations/RequirementRelationStatus"/>
</nestedGenPackages>
<nestedGenPackages prefix="Glossary" basePackage="org.fortiss.af3.mira.model"
disposableProviderFactory="true" ecorePackage="mira.ecore#//glossary">
<genClasses ecoreClass="mira.ecore#//glossary/Glossary">
......
......@@ -13,14 +13,6 @@
genModel="model/mira.genmodel"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated mira -->
<package
uri="http://www.fortiss.org/af3/mira/relations"
class="org.fortiss.af3.mira.model.relations.RelationsPackage"
genModel="model/mira.genmodel"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated mira -->
<package
......@@ -49,20 +41,11 @@
</extension>
<extension point="org.fortiss.tooling.kernel.modelElementConstraintChecker">
<modelElementConstraintChecker checker="org.fortiss.af3.mira.verification.RequirementConflictChecker">
<modelElementClass modelElementClass="org.fortiss.af3.mira.model.Requirement"/>
</modelElementConstraintChecker>
<modelElementConstraintChecker checker="org.fortiss.af3.mira.verification.RequirementDeclinedSourceChecker">
<modelElementClass modelElementClass="org.fortiss.af3.mira.model.Requirement"/>
</modelElementConstraintChecker>
<modelElementConstraintChecker checker="org.fortiss.af3.mira.verification.AnalysisRedundantRequirementChecker">
<modelElementClass modelElementClass="org.fortiss.af3.mira.model.Analysis"/>
</modelElementConstraintChecker>
<!-- Add new markers here -->
<modelElementConstraintChecker checker="org.fortiss.af3.mira.verification.RequirementRedundantTraceChecker">
<modelElementClass modelElementClass="org.fortiss.af3.mira.model.Analysis"/>
</modelElementConstraintChecker>
</extension>
<extension id="problemmarker" point="org.eclipse.core.resources.markers">
......
AF3MiraActivator.java ff793b78064c02fd4eadf86476968d6bee149707 GREEN
AF3MiraActivator.java 2ca46a1ba1b218bc92ffa103133cbe26bacd62a1 GREEN
......@@ -16,8 +16,6 @@
package org.fortiss.af3.mira;
import org.eclipse.core.runtime.Plugin;
import org.fortiss.af3.mira.relation.IRelationTypeService;
import org.fortiss.af3.mira.relation.RelationTypeService;
import org.osgi.framework.BundleContext;
/**
......@@ -41,9 +39,6 @@ public class AF3MiraActivator extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
RelationTypeService rts = (RelationTypeService)IRelationTypeService.getInstance();
rts.initializeService();
rts.startService();
}
/** {@inheritDoc} */
......
/*-------------------------------------------------------------------------+
| Copyright 2014 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.command;
import static org.eclipse.emf.ecore.util.EcoreUtil.delete;
import java.util.List;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementRelation;
import org.fortiss.af3.mira.model.relations.DirectedRequirementRelationType;
import org.fortiss.af3.mira.model.relations.UndirectedRequirementRelationType;
/**
* Command to change source and target requirements of a {@link RequirementRelation}
*
* @author teufl
*/
public class ChangeRequirementRelationCommand implements Runnable {
/** The relation. */
private RequirementRelation relation;
/** The new source requirements. */
List<Requirement> newSourceRequirementList;
/** The new target requirements. */
List<Requirement> newTargetRequirementList;
/** Constructor. */
public ChangeRequirementRelationCommand(RequirementRelation relation,
List<Requirement> newSourceRequirementList,
List<Requirement> newTargetRequirementList) {
this.relation = relation;
this.newSourceRequirementList = newSourceRequirementList;
this.newTargetRequirementList = newTargetRequirementList;
}
/** {@inheritDoc} */
@Override
public void run() {
if((relation.getRequirementRelationType() instanceof UndirectedRequirementRelationType ||
newSourceRequirementList.size() < 1) && newTargetRequirementList.size() < 1) {
delete(relation, true);
} else {
if(relation.getRequirementRelationType() instanceof DirectedRequirementRelationType) {
relation.getSourceRequirement().clear();
for(Requirement r : newSourceRequirementList) {
relation.getSourceRequirement().add(r);
}
}
relation.getTargetRequirement().clear();
for(Requirement r : newTargetRequirementList) {
relation.getTargetRequirement().add(r);
}
}
}
}
/*-------------------------------------------------------------------------+
| Copyright 2014 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.command;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementRelation;
import org.fortiss.af3.mira.relation.IRelationTypeService;
/**
* Command to create a {@link RequirementRelation}.
*
* @author teufl
*/
public class CreateRequirementRelationCommand implements Runnable {
/** New relation. */
private RequirementRelation newRelation;
/** The requirement. */
private Requirement requirement;
/** Constructor. */
public CreateRequirementRelationCommand(RequirementRelation newRelation,
Requirement requirement) {
this.newRelation = newRelation;
this.requirement = requirement;
}
/** {@inheritDoc} */
@Override
public void run() {
Analysis analysis = requirement.getAnalysis();
newRelation.getTargetRequirement().add(requirement);
// set to first relation type
newRelation.setRequirementRelationType(
IRelationTypeService.getInstance().getHandlers().get(0).createInstance());
// Initialize default requirement relation status
if(analysis.getRequirementRelationStatus().size() < 3) {
analysis.initializeRequirementRelationStatus();
}
// set relation status to first status
newRelation.setRequirementRelationStatus(analysis.getRequirementRelationStatus().get(0));
analysis.getRequirementRelation().add(newRelation);
}
}
/*-------------------------------------------------------------------------+
| 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.command;
import static org.fortiss.af3.mira.utils.MiraUtils.deleteOtherOfSameType;
import org.fortiss.af3.mira.model.Requirement;
import org.fortiss.af3.mira.model.RequirementSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
/**
* Command to link a {@link Requirement} to an {@link IModelElement} by
* attaching a {@link RequirementSpecification} on it
*
* @author mou
*/
public class CreateRequirementSpecificationCommand implements Runnable {
/** the source requirement */
private Requirement req;
/** the target model element */
private IModelElement target;
/** the specification prototype */
private RequirementSpecification spec;
/**
* boolean indicating if other requirement specifications of the same type referencing the same
* source requirement should be deleted
*/
private final boolean deleteOtherOfSameType;
/**
* Create the command with the given source requirement, target model
* element and the specification prototype
*/
public CreateRequirementSpecificationCommand(Requirement req, IModelElement target,
RequirementSpecification spec, boolean deleteOtherOfSameType) {
this.req = req;
this.target = target;