Commit 678d66a2 authored by Chen Wenwen's avatar Chen Wenwen
Browse files

TestSuiteSpecification changing

parent 05b56780
......@@ -60,7 +60,7 @@ import org.fortiss.tooling.kernel.utils.EcoreUtils;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: EABC227D424BB61843E5B56F0B9EC603
* @ConQAT.Rating YELLOW Hash: 47A23B762A0E8605207A75C89210BA55
*/
public class TestSuiteSpecificationEditor extends FormsEditorBase<TestSuiteSpecification> {
......@@ -139,6 +139,8 @@ public class TestSuiteSpecificationEditor extends FormsEditorBase<TestSuiteSpeci
TestSuiteSpecificationPart.class, editedObject.getSpecificationsList())) {
addSpecificationPartSection(specPart);
}
form.reflow(true);
}
/** adds the section control for one specification part */
......@@ -162,7 +164,6 @@ public class TestSuiteSpecificationEditor extends FormsEditorBase<TestSuiteSpeci
TestingModelPackage.Literals.TEST_SUITE_SPECIFICATION_PART__ACTIVE));
final Composite sectionContent = toolkit.createComposite(section);
sectionContent.setLayoutData(GridDataFactory.fillDefaults().create());
viewValue.addValueChangeListener(new IValueChangeListener() {
......@@ -174,13 +175,14 @@ public class TestSuiteSpecificationEditor extends FormsEditorBase<TestSuiteSpeci
if(specPart.isActive()) {
deactivateAllOtherParts(specPart);
}
form.reflow(true);
}
});
partHandler.initSettingSection(sectionContent, toolkit, dbc, specPart);
((GridData)sectionContent.getLayoutData()).exclude = !specPart.isActive();
}
}
......
......@@ -22,10 +22,14 @@ import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.testing.model.TestSuite;
import org.fortiss.af3.testing.model.TestSuiteSpecification;
import org.fortiss.af3.testing.model.TestSuiteSpecificationPart;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.service.ICommandStackService;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.service.IPrototypeService;
/**
* {@link IElementCompositor} for {@link TestSuiteSpecification} and {@link TestSuite}
......@@ -33,7 +37,7 @@ import org.fortiss.tooling.kernel.extension.data.Prototype;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: BCB02CBEDE99A124A391584FA0BA5CF4
* @ConQAT.Rating YELLOW Hash: 14DBFF73993BCF4335B381D2635E65D8
*/
public class ComponentArchitectureCompositor implements IElementCompositor<ComponentArchitecture> {
......@@ -55,8 +59,33 @@ public class ComponentArchitectureCompositor implements IElementCompositor<Compo
@Override
public boolean compose(ComponentArchitecture container, EObject contained,
IElementCompositionContext context) {
return container.getTopComponent().getSpecificationsList()
.add((IModelElementSpecification)contained);
boolean rv =
container.getTopComponent().getSpecificationsList()
.add((IModelElementSpecification)contained);
if(contained instanceof TestSuiteSpecification) {
for(Prototype prototype : IPrototypeService.INSTANCE.getComposablePrototypes(contained
.getClass())) {
if(prototype.getPrototypeCopy() instanceof TestSuiteSpecificationPart) {
IElementCompositorService.INSTANCE.compose(contained,
prototype.getPrototypeCopy(), context);
}
}
for(final IModelElementSpecification spec : ((TestSuiteSpecification)contained)
.getSpecificationsList()) {
if(spec instanceof TestSuiteSpecificationPart &&
!spec.equals(((TestSuiteSpecification)contained).getSpecificationsList()
.get(0))) {
ICommandStackService.INSTANCE.runAsCommand(spec, new Runnable() {
@Override
public void run() {
((TestSuiteSpecificationPart)spec).setActive(false);
}
});
}
}
}
return rv;
}
/** {@inheritDoc} */
......
......@@ -22,10 +22,14 @@ import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.testing.model.TestSuite;
import org.fortiss.af3.testing.model.TestSuiteSpecification;
import org.fortiss.af3.testing.model.TestSuiteSpecificationPart;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.service.ICommandStackService;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.service.IPrototypeService;
/**
* {@link IElementCompositor} for {@link TestSuiteSpecification} and {@link TestSuite}
......@@ -34,7 +38,7 @@ import org.fortiss.tooling.kernel.extension.data.Prototype;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: CDA2C715F1AED6199828C0C28D868C9A
* @ConQAT.Rating YELLOW Hash: BC9D67F098E6FB19E5B7BE2C40B5F446
*/
public class ComponentCompositor implements IElementCompositor<Component> {
......@@ -56,7 +60,31 @@ public class ComponentCompositor implements IElementCompositor<Component> {
@Override
public boolean compose(Component container, EObject contained,
IElementCompositionContext context) {
return container.getSpecificationsList().add((IModelElementSpecification)contained);
boolean rv = container.getSpecificationsList().add((IModelElementSpecification)contained);
if(contained instanceof TestSuiteSpecification) {
for(Prototype prototype : IPrototypeService.INSTANCE.getComposablePrototypes(contained
.getClass())) {
if(prototype.getPrototypeCopy() instanceof TestSuiteSpecificationPart) {
IElementCompositorService.INSTANCE.compose(contained,
prototype.getPrototypeCopy(), context);
}
}
for(final IModelElementSpecification spec : ((TestSuiteSpecification)contained)
.getSpecificationsList()) {
if(spec instanceof TestSuiteSpecificationPart &&
!spec.equals(((TestSuiteSpecification)contained).getSpecificationsList()
.get(0))) {
ICommandStackService.INSTANCE.runAsCommand(spec, new Runnable() {
@Override
public void run() {
((TestSuiteSpecificationPart)spec).setActive(false);
}
});
}
}
}
return rv;
}
/** {@inheritDoc} */
......
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