Commit 15528a2e authored by Saad bin Abid's avatar Saad bin Abid
Browse files

added the checkbox option "Correctly Implement Req." in the property sections...

added the checkbox option "Correctly Implement Req." in the property sections of stateautomaton, state and transitionsegmentspecification.
parent 2bb12293
......@@ -17,13 +17,20 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.state.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.mira.model.ExternalRelationSpecification;
......@@ -48,6 +55,11 @@ public class StateAutomatonPropertySection extends PropertySectionBase {
/** Text section showing the traces */
private Text showTraces;
/** Stores state automaton implement the requirement correctly flag button. */
private Button stateautomatonImplReqButton;
/** Label for the "state automaton implement requirement" text. */
private Label stateautomatonImplreqLabel;
ExternalRelationSpecification spec;
/** {@inheritDoc} */
@Override
......@@ -56,6 +68,10 @@ public class StateAutomatonPropertySection extends PropertySectionBase {
showTraces = createFormText("Traced to:");
showTraces.setEditable(false);
stateautomatonImplReqButton = getWidgetFactory().createButton(composite, "", SWT.CHECK);
stateautomatonImplreqLabel =
createFormEntryAndReturnLabel(stateautomatonImplReqButton,
"Correctly Implement Req.:");
}
/** {@inheritDoc} */
......@@ -68,11 +84,29 @@ public class StateAutomatonPropertySection extends PropertySectionBase {
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
if(traces.size() == 0) {
stateautomatonImplReqButton.setEnabled(false);
stateautomatonImplreqLabel.setEnabled(false);
} else {
stateautomatonImplReqButton.setEnabled(true);
stateautomatonImplreqLabel.setEnabled(true);
spec =
pickInstanceOf(ExternalRelationSpecification.class,
stateAutomaton.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(stateautomatonImplReqButton),
modelObservable1, null, null);
}
}
......@@ -17,6 +17,7 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z ratiu $
+--------------------------------------------------------------------------*/
package org.fortiss.af3.state.ui.properties;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY;
import static org.fortiss.af3.state.model.AF3StatePackage.Literals.TRANSITION_SEGMENT_SPECIFICATION__ACTIONS;
import static org.fortiss.af3.state.ui.utils.StateCompletionProposalUtils.createIdleActionsProposals;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.performComplexTextBinding;
......@@ -28,11 +29,13 @@ 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.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
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.component.model.behavior.common.Action;
......@@ -87,6 +90,12 @@ public class StateSpecificationPropertySection extends PropertySectionBase {
/** User selection flag */
private boolean userSelection;
/** Stores component implement the requirement correctly flag button. */
private Button stateImplReqButton;
/** Label for the "state implement requirement" text. */
private Label stateImplreqLabel;
ExternalRelationSpecification spec;
/** {@inheritDoc} */
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
......@@ -94,6 +103,9 @@ public class StateSpecificationPropertySection extends PropertySectionBase {
showTraces = createFormText("Traced to:");
showTraces.setEditable(false);
stateImplReqButton = getWidgetFactory().createButton(composite, "", SWT.CHECK);
stateImplreqLabel =
createFormEntryAndReturnLabel(stateImplReqButton, "Correctly Implement Req.:");
idleActionsText =
createDecoratedText("Idle actions:", SWT.MULTI | SWT.BORDER | SWT.WRAP |
SWT.V_SCROLL);
......@@ -167,6 +179,16 @@ public class StateSpecificationPropertySection extends PropertySectionBase {
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
if(traces.size() == 0) {
stateImplReqButton.setEnabled(false);
stateImplreqLabel.setEnabled(false);
} else {
stateImplReqButton.setEnabled(true);
stateImplreqLabel.setEnabled(true);
spec =
pickInstanceOf(ExternalRelationSpecification.class, state.getSpecifications())
.get(0);
}
idleTransitionSpecification = state.getIdleTransitionSpecification();
if(idleTransitionSpecification == null) {
LoggingUtils.error(AF3StateUIActivator.getDefault(),
......@@ -179,7 +201,7 @@ public class StateSpecificationPropertySection extends PropertySectionBase {
public void refresh() {
super.refresh();
if(specification == null) {
if(specification == null || spec == null) {
return;
}
......@@ -189,5 +211,11 @@ public class StateSpecificationPropertySection extends PropertySectionBase {
performComplexTextBinding(dbc, idleActionsText, actionsObservable,
new ActionsToStringConverter(), new StringToActionsConverter(specification),
new StringToActionsValidator(specification), null);
IObservableValue modelObservable1 =
observeValue(spec,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY);
dbc.bindValue(SWTObservables.observeSelection(stateImplReqButton), modelObservable1, null,
null);
}
}
......@@ -21,6 +21,7 @@ import static org.eclipse.jface.dialogs.MessageDialog.openError;
import static org.eclipse.jface.dialogs.MessageDialog.openInformation;
import static org.fortiss.af3.expression.utils.ExpressionUtils.isNoValChecked;
import static org.fortiss.af3.expression.utils.ExpressionUtils.isUsed;
import static org.fortiss.af3.mira.model.MiraPackage.Literals.EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY;
import static org.fortiss.af3.state.model.AF3StatePackage.Literals.TRANSITION_SEGMENT_SPECIFICATION__ACTIONS;
import static org.fortiss.af3.state.model.AF3StatePackage.Literals.TRANSITION_SEGMENT_SPECIFICATION__GUARD;
import static org.fortiss.af3.state.ui.utils.StateCompletionProposalUtils.createActionsProposals;
......@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
......@@ -45,6 +47,7 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
......@@ -100,6 +103,12 @@ public class TransitionSegmentSpecificationPropertySection extends
/** {@link Action}s widget. */
private Text actionsText;
/** Stores component implement the requirement correctly flag button. */
private Button transitionSegmentImplReqButton;
/** Label for the "state implement requirement" text. */
private Label transitionSegmentImplreqLabel;
ExternalRelationSpecification spec;
/** {@inheritDoc} */
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
......@@ -107,6 +116,10 @@ public class TransitionSegmentSpecificationPropertySection extends
showTraces = createFormText("Traced to:");
showTraces.setEditable(false);
transitionSegmentImplReqButton = getWidgetFactory().createButton(composite, "", SWT.CHECK);
transitionSegmentImplreqLabel =
createFormEntryAndReturnLabel(transitionSegmentImplReqButton,
"Correctly Implement Req.:");
guardText = createDecoratedText("Guard", SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
Button check = createDecoratedButton("Check NoVal", guardText);
check.addSelectionListener(new SelectionAdapter() {
......@@ -161,13 +174,25 @@ public class TransitionSegmentSpecificationPropertySection extends
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
if(traces.size() == 0) {
transitionSegmentImplReqButton.setEnabled(false);
transitionSegmentImplreqLabel.setEnabled(false);
} else {
transitionSegmentImplReqButton.setEnabled(true);
transitionSegmentImplreqLabel.setEnabled(true);
spec =
pickInstanceOf(ExternalRelationSpecification.class,
((TransitionSegment)input).getSpecifications()).get(0);
}
}
/** {@inheritDoc} */
@Override
public void refresh() {
super.refresh();
if(spec == null) {
return;
}
// create guard data binding
IObservableValue guardObservable =
observeValue(specification, TRANSITION_SEGMENT_SPECIFICATION__GUARD);
......@@ -181,6 +206,12 @@ public class TransitionSegmentSpecificationPropertySection extends
performComplexTextBinding(dbc, actionsText, actionsObservable,
new ActionsToStringConverter(), new StringToActionsConverter(specification),
new StringToActionsValidator(specification), null);
IObservableValue modelObservable1 =
observeValue(spec,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY);
dbc.bindValue(SWTObservables.observeSelection(transitionSegmentImplReqButton),
modelObservable1, null, null);
}
/** {@inheritDoc} */
......
Supports Markdown
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