use of org.osate.ge.aadl2.internal.util.classifiers.ClassifierOperationExecutor in project osate2 by osate.
the class CreateClassifierPaletteCommand method getOperation.
@Override
public Optional<Operation> getOperation(final GetTargetedOperationContext ctx) {
return ctx.getTarget().getBusinessObject(EObject.class).map(targetBo -> {
if (!(targetBo instanceof AadlPackage || isValidBaseClassifier(targetBo))) {
return null;
}
final BusinessObjectContext pkgBoc = getPackageBoc(ctx.getTarget(), ctx.getQueryService());
if (pkgBoc == null) {
return null;
}
final AadlPackage pkg = (AadlPackage) pkgBoc.getBusinessObject();
final IProject project = ProjectUtil.getProjectForBoOrThrow(pkg);
final ResourceSet rs = targetBo.eResource().getResourceSet();
return Operation.createWithBuilder(builder -> {
builder.supply(() -> {
final ClassifierOperation args = buildCreateOperations(pkg, targetBo, project, rs);
if (args == null) {
return StepResult.abort();
}
return StepResult.forValue(args);
}).executeOperation(classifierOp -> Operation.createWithBuilder(innerBuilder -> {
final ClassifierOperationExecutor opExec = new ClassifierOperationExecutor(rs, project);
opExec.execute(innerBuilder, classifierOp, pkgBoc);
}));
});
});
}
Aggregations