Search in sources :

Example 1 with CreateProcessorRequest

use of org.yamcs.protobuf.Rest.CreateProcessorRequest in project yamcs-studio by yamcs.

the class CreateReplayDialog method toCreateProcessorRequest.

public CreateProcessorRequest toCreateProcessorRequest(ClientInfo ci) {
    JsonObject spec = new JsonObject();
    spec.addProperty("start", TimeEncoding.fromCalendar(RCPUtils.toCalendar(startDate, startTime)));
    String specJson = new Gson().toJson(spec);
    CreateProcessorRequest.Builder resultb = CreateProcessorRequest.newBuilder().setName(name.getText()).setType("Archive").setConfig(specJson).addClientId(ci.getId());
    return resultb.build();
}
Also used : CreateProcessorRequest(org.yamcs.protobuf.Rest.CreateProcessorRequest) JsonObject(com.google.gson.JsonObject) Gson(com.google.gson.Gson)

Example 2 with CreateProcessorRequest

use of org.yamcs.protobuf.Rest.CreateProcessorRequest in project yamcs-studio by yamcs.

the class CreateReplayDialog method okPressed.

@Override
protected void okPressed() {
    getButton(IDialogConstants.OK_ID).setEnabled(false);
    ClientInfo ci = ManagementCatalogue.getInstance().getCurrentClientInfo();
    CreateProcessorRequest req = toCreateProcessorRequest(ci);
    ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
    catalogue.createProcessorRequest(ci.getInstance(), req).whenComplete((data, exc) -> {
        if (exc == null) {
            Display.getDefault().asyncExec(() -> {
                CreateReplayDialog.super.okPressed();
            });
        } else {
            log.log(Level.SEVERE, "Could not start replay", exc);
            Display.getDefault().asyncExec(() -> {
                MessageDialog.openError(Display.getCurrent().getActiveShell(), "Could not start replay", exc.getMessage());
                getButton(IDialogConstants.OK_ID).setEnabled(true);
            });
        }
    });
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) CreateProcessorRequest(org.yamcs.protobuf.Rest.CreateProcessorRequest) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo)

Aggregations

CreateProcessorRequest (org.yamcs.protobuf.Rest.CreateProcessorRequest)2 Gson (com.google.gson.Gson)1 JsonObject (com.google.gson.JsonObject)1 ClientInfo (org.yamcs.protobuf.YamcsManagement.ClientInfo)1 ManagementCatalogue (org.yamcs.studio.core.model.ManagementCatalogue)1