Search in sources :

Example 1 with EditClientRequest

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

the class ChooseProcessorDialogHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell shell = HandlerUtil.getActiveShellChecked(event);
    SwitchProcessorDialog dialog = new SwitchProcessorDialog(shell);
    if (dialog.open() == Window.OK) {
        ProcessorInfo info = dialog.getProcessorInfo();
        if (info != null) {
            ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
            int currentClientId = catalogue.getCurrentClientInfo().getId();
            EditClientRequest req = EditClientRequest.newBuilder().setInstance(info.getInstance()).setProcessor(info.getName()).build();
            // Internal state will be changed automatically within
            // the ManagementCatalogue.
            catalogue.editClientRequest(currentClientId, req);
        }
    }
    return null;
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) Shell(org.eclipse.swt.widgets.Shell) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) EditClientRequest(org.yamcs.protobuf.Rest.EditClientRequest)

Example 2 with EditClientRequest

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

the class LeaveReplayHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
    ClientInfo clientInfo = catalogue.getCurrentClientInfo();
    EditClientRequest req = EditClientRequest.newBuilder().setProcessor("realtime").build();
    catalogue.editClientRequest(clientInfo.getId(), req);
    return null;
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) EditClientRequest(org.yamcs.protobuf.Rest.EditClientRequest) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo)

Example 3 with EditClientRequest

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

the class SwitchProcessorHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    if (HandlerUtil.matchesRadioState(event))
        return null;
    String radioParameter = event.getParameter(RadioState.PARAMETER_ID);
    HandlerUtil.updateRadioState(event.getCommand(), radioParameter);
    ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
    ProcessorInfo processorInfo = catalogue.getProcessorInfo(radioParameter);
    if (processorInfo != null) {
        ClientInfo clientInfo = catalogue.getCurrentClientInfo();
        EditClientRequest req = EditClientRequest.newBuilder().setProcessor(processorInfo.getName()).build();
        catalogue.editClientRequest(clientInfo.getId(), req);
    } else {
        log.warning("Processor '" + radioParameter + "' not found in catalogue");
    }
    return null;
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) EditClientRequest(org.yamcs.protobuf.Rest.EditClientRequest) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo)

Aggregations

EditClientRequest (org.yamcs.protobuf.Rest.EditClientRequest)3 ManagementCatalogue (org.yamcs.studio.core.model.ManagementCatalogue)3 ClientInfo (org.yamcs.protobuf.YamcsManagement.ClientInfo)2 ProcessorInfo (org.yamcs.protobuf.YamcsManagement.ProcessorInfo)2 Shell (org.eclipse.swt.widgets.Shell)1