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

YELLOW

parent 9b14c7b1
......@@ -27,6 +27,8 @@ 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.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
......@@ -48,7 +50,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase;
* @author eder
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 22F6D9FB69FC23AEA81D9C64A61A7CD8
* @ConQAT.Rating YELLOW Hash: C68EBE0AE9BD875A54E3A9617C321DEA
*/
public final class StructureMemberPropertySection extends PropertySectionBase {
......@@ -64,9 +66,9 @@ public final class StructureMemberPropertySection extends PropertySectionBase {
/** Member type widget. */
private Text memberTypeText;
// TODO (SK,4) Please rephrase
/** Stores structure member implement the requirement correctly flag button. */
/** Check-box button for "Correctly implement requirement". */
private Button structureMemberImplReqButton;
/** Label for the "structure member implement requirement" text. */
private Label structureMemberImplreqLabel;
......@@ -91,13 +93,10 @@ public final class StructureMemberPropertySection extends PropertySectionBase {
@Override
protected void setSectionInput(Object input) {
member = (StructureMember)input;
// TODO (SK,19) following expression should be refactored.
// TODO (SK,20) pickInstanceOf(ExternalRelationSpecification.class,
// member.getSpecifications()) is used 3 times. Please make a local variable for it.
EList<ExternalRelationSpecification> specs =
pickInstanceOf(ExternalRelationSpecification.class, member.getSpecifications());
traces =
pickInstanceOf(ExternalRelationSpecification.class, member.getSpecifications())
.stream()
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
specs.stream().map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
if(traces.size() == 0) {
......@@ -107,12 +106,9 @@ public final class StructureMemberPropertySection extends PropertySectionBase {
structureMemberImplReqButton.setEnabled(true);
structureMemberImplreqLabel.setEnabled(true);
// check if the first instance of externalRelationSpecification is not null using get(0)
if(pickInstanceOf(ExternalRelationSpecification.class, member.getSpecifications()).get(
0) != null) {
if(specs.get(0) != null) {
// get(0) is to get the first instance of the externalRelationSpecification
spec =
pickInstanceOf(ExternalRelationSpecification.class,
member.getSpecifications()).get(0);
spec = specs.get(0);
}
}
}
......@@ -122,11 +118,12 @@ public final class StructureMemberPropertySection extends PropertySectionBase {
public void refresh() {
super.refresh();
if(spec != null) {
IObservableValue modelObservable1 =
IObservableValue modelObservable =
observeValue(spec,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY);
dbc.bindValue(SWTObservables.observeSelection(structureMemberImplReqButton),
modelObservable1, null, null);
ISWTObservableValue swtObservable =
SWTObservables.observeSelection(structureMemberImplReqButton);
dbc.bindValue(swtObservable, modelObservable, null, null);
}
IObservableValue modelObservable =
observeValue(member, DefinitionsPackage.Literals.STRUCTURE_MEMBER__TYPE);
......
......@@ -27,6 +27,8 @@ 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.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
......@@ -54,7 +56,7 @@ import org.fortiss.tooling.kernel.utils.EcoreUtils;
* @author eder
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: D403003AE043A7714919564F6CA4CD33
* @ConQAT.Rating YELLOW Hash: D42E8A8F7B27FE78206E4D9705CCC80C
*/
public class StructurePropertySection extends PropertySectionBase {
......@@ -69,7 +71,7 @@ public class StructurePropertySection extends PropertySectionBase {
/** The detach button. */
private Button detachButton;
/** Stores structure implement the requirement correctly flag button. */
/** Check-box button for "Correctly implement requirement". */
private Button structureImplReqButton;
/** Label for the "structure implement requirement" text. */
private Label structureImplreqLabel;
......@@ -126,13 +128,10 @@ public class StructurePropertySection extends PropertySectionBase {
@Override
protected void setSectionInput(Object input) {
structure = (Structure)input;
// TODO (SK,20) pickInstanceOf(ExternalRelationSpecification.class,
// member.getSpecifications()) is used 3 times. Please make a local variable for it.
// TODO (SK,19) following expression should be refactored.
EList<ExternalRelationSpecification> specs =
pickInstanceOf(ExternalRelationSpecification.class, structure.getSpecifications());
traces =
pickInstanceOf(ExternalRelationSpecification.class, structure.getSpecifications())
.stream()
.map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
specs.stream().map(e -> e.getExternalRelation().getSourceRequirement().getReqId())
.collect(Collectors.toSet());
showTraces.setText(StringUtils.join(traces, ", "));
if(traces.size() == 0) {
......@@ -142,12 +141,9 @@ public class StructurePropertySection extends PropertySectionBase {
structureImplReqButton.setEnabled(true);
structureImplreqLabel.setEnabled(true);
// check if the first instance of externalRelationSpecification is not null using get(0)
if(pickInstanceOf(ExternalRelationSpecification.class, structure.getSpecifications())
.get(0) != null) {
if(specs.get(0) != null) {
// get(0) is to get the first instance of the externalRelationSpecification
spec =
pickInstanceOf(ExternalRelationSpecification.class,
structure.getSpecifications()).get(0);
spec = specs.get(0);
}
}
}
......@@ -157,14 +153,12 @@ public class StructurePropertySection extends PropertySectionBase {
public void refresh() {
super.refresh();
if(spec != null) {
// TODO (SK,?) Why is 1 appended? This also exists in StructureMemberPropertySection,
// and EnumPropertySectio. Please fix there also. Please have a look at the change I
// have made in EnumerationMemberPropertySection for this issue.
IObservableValue modelObservable1 =
IObservableValue modelObservable =
observeValue(spec,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY);
dbc.bindValue(SWTObservables.observeSelection(structureImplReqButton),
modelObservable1, null, null);
ISWTObservableValue swtObservable =
SWTObservables.observeSelection(structureImplReqButton);
dbc.bindValue(swtObservable, modelObservable, null, null);
}
if(structure instanceof StructureRef) {
detachLabel.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