Commit 6f25618e authored by Filip Reaboi's avatar Filip Reaboi
Browse files

Wrapping code with ICommandStackService.getInstance().runAsCommand(project, () -> { });

refs 2978
parent 09f148b5
......@@ -21,6 +21,7 @@ import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.component.utils.ComponentModelElementFactory;
import org.fortiss.af3.project.model.execution.ExecutionConfiguration;
import org.fortiss.tooling.kernel.service.ICommandStackService;
import test.org.fortiss.af3.expression.base.ExpressionTestModelBase;
......@@ -53,8 +54,10 @@ public class ComponentTestModelBase extends ExpressionTestModelBase {
@Override
public void setupModel() {
super.setupModel();
createComponentArchitecture();
createExecutionConfig();
ICommandStackService.getInstance().runAsCommand(project, () -> {
createComponentArchitecture();
createExecutionConfig();
});
}
/** Creates an empty component architecture. */
......
......@@ -33,6 +33,7 @@ import org.fortiss.af3.component.utils.BehaviorModelElementFactory;
import org.fortiss.af3.expression.language.evaluation.NoVal;
import org.fortiss.af3.expression.model.terms.imperative.StatementSequence;
import org.fortiss.af3.expression.model.terms.impl.IntConstStaticImpl;
import org.fortiss.tooling.kernel.service.ICommandStackService;
/**
* Programmatic setup of the code-specification-based Counter test model.
......@@ -69,7 +70,10 @@ public class CounterTestModel extends ComponentTestModelBase {
@Override
public void setupModel() {
super.setupModel();
createCounterComponent();
ICommandStackService.getInstance().runAsCommand(project, () -> {
createCounterComponent();
});
}
/** Creates the counter component. */
......
......@@ -23,6 +23,7 @@ import static org.fortiss.af3.project.utils.ProjectUtils.loadProjectFromPlugin;
import org.fortiss.af3.component.AF3ComponentActivator;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.utils.ProjectUtils;
import org.fortiss.tooling.kernel.service.ICommandStackService;
/**
* A test model loaded from an existing AF3 file.
......@@ -46,12 +47,20 @@ public class FileLoadedTestModel extends ComponentTestModelBase {
@Override
public void setupModel() {
super.setupModel();
ICommandStackService.getInstance()
.runAsCommand(
project,
() -> {
FileProject project =
loadProjectFromPlugin(AF3ComponentActivator.PLUGIN_ID, fileToLoad, true);
FileProject project =
loadProjectFromPlugin(AF3ComponentActivator.PLUGIN_ID,
fileToLoad, true);
componentArchitecture = findFirstComponentArchitecture(project);
rootComponent = componentArchitecture.getTopComponent();
executionConfiguration = ProjectUtils.findOrCreateExecutionConfigurationFor(rootComponent);
componentArchitecture = findFirstComponentArchitecture(project);
rootComponent = componentArchitecture.getTopComponent();
executionConfiguration =
ProjectUtils
.findOrCreateExecutionConfigurationFor(rootComponent);
});
}
}
......@@ -32,6 +32,7 @@ import org.fortiss.af3.component.simulator.ExecutableComponent;
import org.fortiss.af3.component.utils.BehaviorModelElementFactory;
import org.fortiss.af3.expression.language.evaluation.NoVal;
import org.fortiss.af3.expression.model.terms.imperative.StatementSequence;
import org.fortiss.tooling.kernel.service.ICommandStackService;
/**
* Programmatic setup of a one bit full adder that is realized as chaining of
......@@ -69,7 +70,9 @@ public class OneBitFullAdderTestModel extends ComponentTestModelBase {
@Override
public void setupModel() {
super.setupModel();
createOneBitFullAdderComponent();
ICommandStackService.getInstance().runAsCommand(project, () -> {
createOneBitFullAdderComponent();
});
}
/** Creates the component. */
......
......@@ -28,6 +28,7 @@ import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.component.model.behavior.code.CodeSpecification;
import org.fortiss.af3.expression.language.evaluation.NoVal;
import org.fortiss.tooling.kernel.service.ICommandStackService;
/**
* Programmatic setup of a one bit half adder.
......@@ -55,7 +56,9 @@ public class OneBitHalfAdderTestModel extends ComponentTestModelBase {
@Override
public void setupModel() {
super.setupModel();
createOneBitHalfAdder(rootComponent);
ICommandStackService.getInstance().runAsCommand(project, () -> {
createOneBitHalfAdder(rootComponent);
});
}
/** Creates a "one bit half adder" component. */
......
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