Commit a5fd5d9c authored by Hernan Ponce de Leon's avatar Hernan Ponce de Leon
Browse files

Properties tabs related to component

refs 3060
parent e1ae99b3
......@@ -26,3 +26,5 @@ Export-Package: org.fortiss.af3.component.ui,
org.fortiss.af3.component.ui.simulator.menu,
org.fortiss.af3.component.ui.simulator.views,
org.fortiss.af3.component.ui.utils
Import-Package: org.fortiss.af3.mira.model,
org.fortiss.af3.mira.model.impl
......@@ -19,8 +19,13 @@ package org.fortiss.af3.component.ui.properties;
import static org.fortiss.af3.component.model.AF3ComponentPackage.Literals.CAUSALITY_COMPONENT_SPECIFICATION__STRONGLY_CAUSAL;
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.LoggingUtils.error;
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.jface.viewers.ArrayContentProvider;
......@@ -34,6 +39,7 @@ 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.component.model.CausalityComponentSpecification;
import org.fortiss.af3.component.model.Component;
......@@ -41,6 +47,7 @@ import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.component.model.VerifBehaviourComponentSpecification;
import org.fortiss.af3.component.model.VerificationBehaviour;
import org.fortiss.af3.component.ui.AF3ComponentUIActivator;
import org.fortiss.af3.mira.model.ExternalRelationSpecification;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase;
......@@ -58,6 +65,12 @@ public final class ComponentSpecificationPropertySection extends PropertySection
/** Stores the current input. */
private Component component;
/** Store the traces. */
private Set<String> traces;
/** Text section showing the traces */
private Text showTraces;
/** The selected {@link CausalityComponentSpecification}. */
private CausalityComponentSpecification specification;
......@@ -85,6 +98,9 @@ public final class ComponentSpecificationPropertySection extends PropertySection
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
showTraces = createFormText("Traced to:");
showTraces.setEditable(false);
stronglyCausalButton = getWidgetFactory().createButton(composite, "", SWT.CHECK);
stronglyCausalLabel =
createFormEntryAndReturnLabel(stronglyCausalButton, "Strongly Causal");
......@@ -121,7 +137,8 @@ public final class ComponentSpecificationPropertySection extends PropertySection
/** Store the value of verification behavior when it changes. */
private void verifBehaviourChangeHandler(final VerificationBehaviour value) {
ITopLevelElement topLevel = IPersistencyService.getInstance().getTopLevelElementFor(component);
ITopLevelElement topLevel =
IPersistencyService.getInstance().getTopLevelElementFor(component);
topLevel.runAsCommand(new Runnable() {
@Override
public void run() {
......@@ -138,6 +155,12 @@ public final class ComponentSpecificationPropertySection extends PropertySection
} else {
component = (Component)input;
}
traces =
pickInstanceOf(ExternalRelationSpecification.class, component.getSpecifications())
.stream()
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
enableStronglyCausal(component.getContainedElements().isEmpty());
specification = component.getCausalitySpecification();
verifBehaviourSpec = component.getVerifBehaviour();
......
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