Commit 8669c4e2 authored by Saad bin Abid's avatar Saad bin Abid
Browse files

added the checkbox for checking if the requirement is implemented correctly....

added the checkbox for checking if the requirement is implemented correctly. This is done for property sections of Enum, EnumerationMemberProperty, Structure, StructureMemberProperty.
parent 15528a2e
......@@ -17,6 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.expression.ui.properties;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY;
import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
......@@ -24,6 +26,8 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
......@@ -64,6 +68,11 @@ public class EnumPropertySection extends PropertySectionBase {
private Label detachLabel;
/** The detach button. */
private Button detachButton;
/** Stores state enumeration implement the requirement correctly flag button. */
private Button enumerationImplReqButton;
/** Label for the "state automaton implement requirement" text. */
private Label enumerationImplreqLabel;
ExternalRelationSpecification spec;
/** {@inheritDoc} */
@Override
......@@ -72,6 +81,9 @@ public class EnumPropertySection extends PropertySectionBase {
showTraces = createFormText("Traced to:");
showTraces.setEditable(false);
enumerationImplReqButton = getWidgetFactory().createButton(composite, "", SWT.CHECK);
enumerationImplreqLabel =
createFormEntryAndReturnLabel(enumerationImplReqButton, "Correctly Implement Req.:");
detachButton = getWidgetFactory().createButton(composite, "Detach from library", SWT.NONE);
detachLabel = createFormEntry(detachButton, "Name");
......@@ -118,13 +130,30 @@ public class EnumPropertySection extends PropertySectionBase {
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
if(traces.size() == 0) {
enumerationImplReqButton.setEnabled(false);
enumerationImplreqLabel.setEnabled(false);
} else {
enumerationImplReqButton.setEnabled(true);
enumerationImplreqLabel.setEnabled(true);
spec =
pickInstanceOf(ExternalRelationSpecification.class,
enumeration.getSpecifications()).get(0);
}
}
/** {@inheritDoc} */
@Override
public void refresh() {
super.refresh();
if(spec == null) {
return;
}
IObservableValue modelObservable1 =
observeValue(spec,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY);
dbc.bindValue(SWTObservables.observeSelection(enumerationImplReqButton), modelObservable1,
null, null);
if(enumeration instanceof EnumerationRef) {
detachLabel.setVisible(true);
detachButton.setVisible(true);
......
......@@ -17,13 +17,20 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.expression.ui.properties;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY;
import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.fortiss.af3.expression.model.definitions.EnumerationMember;
......@@ -50,6 +57,12 @@ public final class EnumerationMemberPropertySection extends PropertySectionBase
/** Text section showing the traces */
private Text showTraces;
/** Stores state enumeration member implement the requirement correctly flag button. */
private Button enumerationMemberImplReqButton;
/** Label for the "state automaton implement requirement" text. */
private Label enumerationMemberImplreqLabel;
ExternalRelationSpecification spec;
/** {@inheritDoc} */
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
......@@ -57,6 +70,10 @@ public final class EnumerationMemberPropertySection extends PropertySectionBase
showTraces = createFormText("Traced to:");
showTraces.setEditable(false);
enumerationMemberImplReqButton = getWidgetFactory().createButton(composite, "", SWT.CHECK);
enumerationMemberImplreqLabel =
createFormEntryAndReturnLabel(enumerationMemberImplReqButton,
"Correctly Implement Req.:");
}
/** {@inheritDoc} */
......@@ -69,11 +86,29 @@ public final class EnumerationMemberPropertySection extends PropertySectionBase
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
if(traces.size() == 0) {
enumerationMemberImplReqButton.setEnabled(false);
enumerationMemberImplreqLabel.setEnabled(false);
} else {
enumerationMemberImplReqButton.setEnabled(true);
enumerationMemberImplreqLabel.setEnabled(true);
spec =
pickInstanceOf(ExternalRelationSpecification.class, member.getSpecifications())
.get(0);
}
}
/** {@inheritDoc} */
@Override
public void refresh() {
super.refresh();
if(spec == null) {
return;
}
IObservableValue modelObservable1 =
observeValue(spec,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY);
dbc.bindValue(SWTObservables.observeSelection(enumerationMemberImplReqButton),
modelObservable1, null, null);
}
}
......@@ -17,6 +17,7 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.expression.ui.properties;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.performComplexTextBinding;
import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
......@@ -26,7 +27,11 @@ import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.fortiss.af3.expression.model.definitions.DefinitionsPackage;
......@@ -58,6 +63,11 @@ public final class StructureMemberPropertySection extends PropertySectionBase {
/** Member type widget. */
private Text memberTypeText;
/** Stores structure member implement the requirement correctly flag button. */
private Button structureMemberImplReqButton;
/** Label for the "structure member implement requirement" text. */
private Label structureMemberImplreqLabel;
ExternalRelationSpecification spec;
/** {@inheritDoc} */
@Override
......@@ -66,6 +76,10 @@ public final class StructureMemberPropertySection extends PropertySectionBase {
showTraces = createFormText("Traced to:");
showTraces.setEditable(false);
structureMemberImplReqButton = getWidgetFactory().createButton(composite, "", SWT.CHECK);
structureMemberImplreqLabel =
createFormEntryAndReturnLabel(structureMemberImplReqButton,
"Correctly Implement Req.:");
memberTypeText = createDecoratedText("Type");
}
......@@ -79,12 +93,30 @@ public final class StructureMemberPropertySection extends PropertySectionBase {
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
if(traces.size() == 0) {
structureMemberImplReqButton.setEnabled(false);
structureMemberImplreqLabel.setEnabled(false);
} else {
structureMemberImplReqButton.setEnabled(true);
structureMemberImplreqLabel.setEnabled(true);
spec =
pickInstanceOf(ExternalRelationSpecification.class, member.getSpecifications())
.get(0);
}
}
/** {@inheritDoc} */
@Override
public void refresh() {
super.refresh();
if(spec == null) {
return;
}
IObservableValue modelObservable1 =
observeValue(spec,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY);
dbc.bindValue(SWTObservables.observeSelection(structureMemberImplReqButton),
modelObservable1, null, null);
IObservableValue modelObservable =
observeValue(member, DefinitionsPackage.Literals.STRUCTURE_MEMBER__TYPE);
......
......@@ -17,6 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.expression.ui.properties;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY;
import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
......@@ -24,6 +26,8 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
......@@ -65,6 +69,12 @@ public class StructurePropertySection extends PropertySectionBase {
/** The detach button. */
private Button detachButton;
/** Stores structure member implement the requirement correctly flag button. */
private Button structureImplReqButton;
/** Label for the "structure member implement requirement" text. */
private Label structureImplreqLabel;
ExternalRelationSpecification spec;
/** {@inheritDoc} */
@Override
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
......@@ -72,6 +82,9 @@ public class StructurePropertySection extends PropertySectionBase {
showTraces = createFormText("Traced to:");
showTraces.setEditable(false);
structureImplReqButton = getWidgetFactory().createButton(composite, "", SWT.CHECK);
structureImplreqLabel =
createFormEntryAndReturnLabel(structureImplReqButton, "Correctly Implement Req.:");
detachButton = getWidgetFactory().createButton(composite, "Detach from library", SWT.NONE);
detachLabel = createFormEntry(detachButton, "Name");
......@@ -118,13 +131,30 @@ public class StructurePropertySection extends PropertySectionBase {
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
if(traces.size() == 0) {
structureImplReqButton.setEnabled(false);
structureImplreqLabel.setEnabled(false);
} else {
structureImplReqButton.setEnabled(true);
structureImplreqLabel.setEnabled(true);
spec =
pickInstanceOf(ExternalRelationSpecification.class,
structure.getSpecifications()).get(0);
}
}
/** {@inheritDoc} */
@Override
public void refresh() {
super.refresh();
if(spec == null) {
return;
}
IObservableValue modelObservable1 =
observeValue(spec,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY);
dbc.bindValue(SWTObservables.observeSelection(structureImplReqButton), modelObservable1,
null, null);
if(structure instanceof StructureRef) {
detachLabel.setVisible(true);
detachButton.setVisible(true);
......
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