Commit 264a57aa authored by Alexander Diewald's avatar Alexander Diewald
Browse files

DSE: Enable Correct Saving of Models With Custom Solver Settings

Issue-Ref: 4064
Issue-Url: https://af3-developer.fortiss.org/issues/4064

Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent fa020fc2
Z3Backend.java 709c00ee3e35bee97425af853592829b08ee304f GREEN
Z3Backend.java 4d949b6c127b61c7324df9be7034d17b0b301dbb YELLOW
......@@ -128,10 +128,4 @@ public class Z3Backend implements IDSEBackend {
public String getName() {
return "Z3 (SMT)";
}
/** {@inheritDoc} */
@Override
public String toString() {
return getName();
}
}
RuleSetUIProvider.java 9805f8c6d231992cc3471ea2cd9e6b3eb05e004d GREEN
SolverSettingsDialog.java 25b3541fc6eab090500321fa32a3f68992fff0a0 GREEN
SolverSettingsTreeTableViewer.java 279e92b20a6b48e8e99ea7a2039fef419ea42826 GREEN
SolverSettingsTreeTableViewer.java 0f0be7ff52d2c48fbff9d37c7e23bd7a99eb1948 YELLOW
SynthesisCategoryExplorationTargetContentProvider.java 410f00e07b5f4208b762b80baf563b2b73a93a71 GREEN
SynthesisCategoryRuleSetContentProvider.java 039913dba18b0248d10a77275258bc9acf9526cf GREEN
SynthesisFXContentController.java 3c7b3419813fc8794e7f3db35a94e3c4d3d3287c YELLOW
SynthesisFXContentController.java b5b981a42ae8bd551253ba347b48bbdca936ce96 YELLOW
SynthesisFXViewPart.java e40c2bd501d87b41c6324ab80fd34e64410db644 GREEN
......@@ -17,6 +17,7 @@ package org.fortiss.af3.exploration.ui.perspective.synthesis;
import static java.lang.Boolean.getBoolean;
import static org.apache.commons.lang3.math.NumberUtils.createNumber;
import static org.fortiss.af3.exploration.ui.perspective.service.internal.ExplorationCommandRunner.getRunner;
import java.util.ArrayList;
import java.util.Collection;
......@@ -73,11 +74,11 @@ public class SolverSettingsTreeTableViewer {
@SuppressWarnings("unchecked") BackendSetting<Object> setting =
(BackendSetting<Object>)element;
if(Number.class.isAssignableFrom(setting.getType())) {
setting.setValue(createNumber((String)value));
getRunner().run(() -> setting.setValue(createNumber((String)value)));
} else if(Boolean.class.isAssignableFrom(setting.getType())) {
setting.setValue(getBoolean((String)value));
getRunner().run(() -> setting.setValue(getBoolean((String)value)));
} else if(String.class.isAssignableFrom(setting.getType())) {
setting.setValue(value);
getRunner().run(() -> setting.setValue(value));
}
}
}
......
......@@ -94,6 +94,7 @@ import javafx.scene.control.Dialog;
import javafx.scene.control.Label;
import javafx.scene.control.TreeTableView;
import javafx.scene.layout.AnchorPane;
import javafx.util.StringConverter;
/**
* {@link ICompositeFXController} for the main pane of the synthesis view. It allows to group
......@@ -255,15 +256,33 @@ public class SynthesisFXContentController extends CompositeFXControllerBase<Anch
dbsService.getDSEBackends(selectedSynthesises, FEASIBILITY_CHECK);
feasibilitySolverCombo.setItems(observableArrayList(cBackends));
if(!cBackends.isEmpty()) {
feasibilitySolverCombo.setConverter(createExpTgtComboConverter(feasibilitySolverCombo));
feasibilitySolverCombo.getSelectionModel().select(0);
}
Set<IDSEBackend> oBackends = dbsService.getDSEBackends(selectedSynthesises, OPTIMIZATION);
optimalitySolverCombo.setItems(observableArrayList(oBackends));
if(!oBackends.isEmpty()) {
optimalitySolverCombo.setConverter(createExpTgtComboConverter(optimalitySolverCombo));
optimalitySolverCombo.getSelectionModel().select(0);
}
}
protected StringConverter<IDSEBackend> createExpTgtComboConverter(ComboBox<IDSEBackend> combo) {
return new StringConverter<IDSEBackend>() {
@Override
public String toString(IDSEBackend object) {
return object != null ? object.getName() : "";
}
@Override
public IDSEBackend fromString(String string) {
return combo.getItems().stream().filter(ap -> ap.getName().equals(string))
.findFirst().orElse(null);
}
};
}
/** Returns the {@link SolverSettings} of the currently selected feasibility checker. */
protected SolverSettings getSolverSettings(IDSEBackend selectedBackend) {
SolverSettings settings = solverSettings.get(selectedBackend);
......
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