Commit e2c7143f authored by Romain Bioteau's avatar Romain Bioteau Committed by GitHub
Browse files

fix(callActivity) fix selection provider for call activity (#748)

Closes BS-17299
parent aa6a1008
......@@ -38,7 +38,6 @@ import org.bonitasoft.studio.model.process.InputMappingAssignationType;
import org.bonitasoft.studio.model.process.Pool;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.e4.core.di.annotations.Creatable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.operation.IRunnableWithProgress;
import com.google.common.base.Predicate;
......@@ -47,14 +46,14 @@ import com.google.common.base.Strings;
@Creatable
public class FetchContractOperation implements IRunnableWithProgress {
@Inject
private CallActivitySelectionProvider selectionProvider;
@Inject
private RepositoryAccessor repositoryAccessor;
private final List<ContractInput> result = new ArrayList<>();
private CallActivity callActivity;
/*
* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
......@@ -62,7 +61,6 @@ public class FetchContractOperation implements IRunnableWithProgress {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
result.clear();
final CallActivity callActivity = (CallActivity) selectionProvider.getAdapter(EObject.class);
try {
result.addAll(getAccessibleContractInput(callActivity));
} catch (ProcessNotFoundException | NoProcessToCallDefined | NoContractDefinedException e) {
......@@ -140,4 +138,8 @@ public class FetchContractOperation implements IRunnableWithProgress {
return result;
}
public void setCallActivity(CallActivity callActivity) {
this.callActivity = callActivity;
}
}
......@@ -142,13 +142,14 @@ public class InputParametersMappingSection extends AbstractBonitaDescriptionSect
@Override
public void widgetSelected(final SelectionEvent e) {
try {
fetchContractOperation.setCallActivity((CallActivity) getEObject());
progressService.run(true, false, fetchContractOperation);
for (final ContractInput input : fetchContractOperation.getResult()) {
createInputMapping(null, InputMappingAssignationType.CONTRACT_INPUT, input.getName());
}
} catch (final InvocationTargetException ex) {
MessageDialogWithLink.openWarning(mainComposite.getShell(), Messages.fetchContract,
ex.getCause().getMessage());
ex.getTargetException().getMessage());
} catch (final InterruptedException e1) {
BonitaStudioLog.error(e1);
}
......
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