Search in sources :

Example 6 with ClientInfo

use of org.yamcs.protobuf.YamcsManagement.ClientInfo 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 7 with ClientInfo

use of org.yamcs.protobuf.YamcsManagement.ClientInfo 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)

Example 8 with ClientInfo

use of org.yamcs.protobuf.YamcsManagement.ClientInfo 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)

Example 9 with ClientInfo

use of org.yamcs.protobuf.YamcsManagement.ClientInfo in project yamcs-studio by yamcs.

the class ManagementCatalogue method getCurrentYamcsInstance.

// Careful we must support the case where Yamcs itself changes the instance of our client
// TODO maybe remove this and instead just store an instance field in YamcsClient ?
public static String getCurrentYamcsInstance() {
    ManagementCatalogue catalogue = getInstance();
    if (catalogue == null) {
        return null;
    }
    ClientInfo ci = catalogue.getCurrentClientInfo();
    if (ci != null) {
        return ci.getInstance();
    } else {
        // Fallback (initial connection properties
        YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
        YamcsConnectionProperties props = yamcsClient.getYamcsConnectionProperties();
        return (props != null) ? props.getInstance() : null;
    }
}
Also used : YamcsClient(org.yamcs.studio.core.client.YamcsClient) YamcsConnectionProperties(org.yamcs.api.YamcsConnectionProperties) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo)

Aggregations

ClientInfo (org.yamcs.protobuf.YamcsManagement.ClientInfo)9 ManagementCatalogue (org.yamcs.studio.core.model.ManagementCatalogue)4 ProcessorInfo (org.yamcs.protobuf.YamcsManagement.ProcessorInfo)3 EditClientRequest (org.yamcs.protobuf.Rest.EditClientRequest)2 ConnectionInfo (org.yamcs.protobuf.Web.ConnectionInfo)2 Statistics (org.yamcs.protobuf.YamcsManagement.Statistics)2 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)1 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)1 ControlEvent (org.eclipse.swt.events.ControlEvent)1 ControlListener (org.eclipse.swt.events.ControlListener)1 Shell (org.eclipse.swt.widgets.Shell)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 IWorkbench (org.eclipse.ui.IWorkbench)1 YamcsConnectionProperties (org.yamcs.api.YamcsConnectionProperties)1 CreateProcessorRequest (org.yamcs.protobuf.Rest.CreateProcessorRequest)1 YamcsInstance (org.yamcs.protobuf.YamcsManagement.YamcsInstance)1 YamcsClient (org.yamcs.studio.core.client.YamcsClient)1 ManagementListener (org.yamcs.studio.core.model.ManagementListener)1