Commit be2ece6e authored by Romain Bioteau's avatar Romain Bioteau
Browse files

fix(contract) fix contract preview


closes BS-16238
parent 6a624f36
...@@ -172,12 +172,14 @@ public class GeneratedScriptPreviewPage extends WizardPage { ...@@ -172,12 +172,14 @@ public class GeneratedScriptPreviewPage extends WizardPage {
@Override @Override
public void setVisible(final boolean visible) { public void setVisible(final boolean visible) {
super.setVisible(visible); super.setVisible(visible);
final BusinessObjectData data = (BusinessObjectData) selectedDataObservable.getValue();
if (data != null) {
try { try {
getContainer().run(true, false, new IRunnableWithProgress() { getContainer().run(false, false, new IRunnableWithProgress() {
@Override @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
generateExpressionScript(monitor); generateExpressionScript(data, monitor);
} }
}); });
document.set(generatedExpression.getContent()); document.set(generatedExpression.getContent());
...@@ -190,13 +192,14 @@ public class GeneratedScriptPreviewPage extends WizardPage { ...@@ -190,13 +192,14 @@ public class GeneratedScriptPreviewPage extends WizardPage {
.open(); .open();
} }
} }
}
protected void generateExpressionScript(IProgressMonitor monitor) throws InvocationTargetException { protected void generateExpressionScript(BusinessObjectData data, IProgressMonitor monitor)
if (selectedDataObservable.getValue() != null) { throws InvocationTargetException {
rootContractInputGenerator = createRootContractInputGenerator(); rootContractInputGenerator = createRootContractInputGenerator();
if (!fieldToContractInputMappingsObservable.isEmpty()) { if (!fieldToContractInputMappingsObservable.isEmpty()) {
try { try {
rootContractInputGenerator.buildForInstanciation((BusinessObjectData) selectedDataObservable.getValue(), rootContractInputGenerator.buildForInstanciation(data,
monitor); monitor);
generatedExpression = rootContractInputGenerator.getInitialValueExpression(); generatedExpression = rootContractInputGenerator.getInitialValueExpression();
} catch (final OperationCreationException e) { } catch (final OperationCreationException e) {
...@@ -204,7 +207,6 @@ public class GeneratedScriptPreviewPage extends WizardPage { ...@@ -204,7 +207,6 @@ public class GeneratedScriptPreviewPage extends WizardPage {
} }
} }
} }
}
protected RootContractInputGenerator createRootContractInputGenerator() { protected RootContractInputGenerator createRootContractInputGenerator() {
final List<FieldToContractInputMapping> mappings = new ArrayList<>(); final List<FieldToContractInputMapping> mappings = new ArrayList<>();
......
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