Search in sources :

Example 11 with ManagementCatalogue

use of org.yamcs.studio.core.model.ManagementCatalogue 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 12 with ManagementCatalogue

use of org.yamcs.studio.core.model.ManagementCatalogue in project yamcs-studio by yamcs.

the class SwitchProcessorDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite area = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(area, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new GridLayout());
    Composite tableWrapper = new Composite(composite, SWT.NONE);
    TableColumnLayout tcl = new TableColumnLayout();
    tableWrapper.setLayoutData(new GridData(GridData.FILL_BOTH));
    tableWrapper.setLayout(tcl);
    processorsTable = new TableViewer(tableWrapper, SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
    processorsTable.getTable().setHeaderVisible(true);
    processorsTable.getTable().setLinesVisible(true);
    TableViewerColumn instanceColumn = new TableViewerColumn(processorsTable, SWT.NONE);
    instanceColumn.getColumn().setText("Instance");
    instanceColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            ProcessorInfo info = (ProcessorInfo) element;
            return info.getInstance();
        }
    });
    tcl.setColumnData(instanceColumn.getColumn(), new ColumnPixelData(100));
    TableViewerColumn nameColumn = new TableViewerColumn(processorsTable, SWT.NONE);
    nameColumn.getColumn().setText("Processor");
    nameColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            ProcessorInfo info = (ProcessorInfo) element;
            return info.getName();
        }
    });
    tcl.setColumnData(nameColumn.getColumn(), new ColumnWeightData(100));
    TableViewerColumn typeColumn = new TableViewerColumn(processorsTable, SWT.NONE);
    typeColumn.getColumn().setText("Type");
    typeColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            ProcessorInfo info = (ProcessorInfo) element;
            return info.getType();
        }
    });
    tcl.setColumnData(typeColumn.getColumn(), new ColumnPixelData(100));
    processorsTable.setContentProvider(ArrayContentProvider.getInstance());
    processorsTable.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
    processorsTable.setComparator(new ViewerComparator() {

        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            if (e1 == null || e2 == null)
                return 0;
            ProcessorInfo p1 = (ProcessorInfo) e1;
            ProcessorInfo p2 = (ProcessorInfo) e2;
            int c = p1.getInstance().compareTo(p2.getInstance());
            return (c != 0) ? c : p1.getName().compareTo(p2.getName());
        }
    });
    ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
    processorsTable.setInput(catalogue.getProcessors());
    return composite;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Composite(org.eclipse.swt.widgets.Composite) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) ColumnPixelData(org.eclipse.jface.viewers.ColumnPixelData) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) GridLayout(org.eclipse.swt.layout.GridLayout) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 13 with ManagementCatalogue

use of org.yamcs.studio.core.model.ManagementCatalogue 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 14 with ManagementCatalogue

use of org.yamcs.studio.core.model.ManagementCatalogue in project yamcs-studio by yamcs.

the class YamcsPlugin method start.

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    TimeEncoding.setUp();
    yamcsClient = new YamcsClient(getProductString(), true);
    yamcsClient.addConnectionListener(new UIConnectionListener());
    ManagementCatalogue managementCatalogue = new ManagementCatalogue();
    catalogues.put(ManagementCatalogue.class, managementCatalogue);
    addYamcsConnectionListener(managementCatalogue);
    registerCatalogue(new TimeCatalogue());
    registerCatalogue(new ParameterCatalogue());
    registerCatalogue(new CommandingCatalogue());
    registerCatalogue(new AlarmCatalogue());
    registerCatalogue(new EventCatalogue());
    registerCatalogue(new LinkCatalogue());
    registerCatalogue(new ArchiveCatalogue());
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) YamcsClient(org.yamcs.studio.core.client.YamcsClient) TimeCatalogue(org.yamcs.studio.core.model.TimeCatalogue) ParameterCatalogue(org.yamcs.studio.core.model.ParameterCatalogue) AlarmCatalogue(org.yamcs.studio.core.model.AlarmCatalogue) EventCatalogue(org.yamcs.studio.core.model.EventCatalogue) CommandingCatalogue(org.yamcs.studio.core.model.CommandingCatalogue) LinkCatalogue(org.yamcs.studio.core.model.LinkCatalogue) ArchiveCatalogue(org.yamcs.studio.core.model.ArchiveCatalogue)

Example 15 with ManagementCatalogue

use of org.yamcs.studio.core.model.ManagementCatalogue in project yamcs-studio by yamcs.

the class ArchivePanel method seekReplay.

public void seekReplay(long newPosition) {
    if (newPosition == TimeEncoding.INVALID_INSTANT)
        return;
    Display.getDefault().asyncExec(() -> {
        ProcessorInfo processor = ManagementCatalogue.getInstance().getCurrentProcessorInfo();
        if (processor == null || processor.getName().equals("realtime"))
            return;
        String seekTime = TimeEncoding.toString(newPosition);
        EditProcessorRequest req = EditProcessorRequest.newBuilder().setSeek(seekTime).build();
        ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
        catalogue.editProcessorRequest(processor.getInstance(), processor.getName(), req);
    });
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) EditProcessorRequest(org.yamcs.protobuf.Rest.EditProcessorRequest) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo)

Aggregations

ManagementCatalogue (org.yamcs.studio.core.model.ManagementCatalogue)16 ProcessorInfo (org.yamcs.protobuf.YamcsManagement.ProcessorInfo)10 EditProcessorRequest (org.yamcs.protobuf.Rest.EditProcessorRequest)4 ClientInfo (org.yamcs.protobuf.YamcsManagement.ClientInfo)4 Shell (org.eclipse.swt.widgets.Shell)3 EditClientRequest (org.yamcs.protobuf.Rest.EditClientRequest)3 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)1 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)1 ColumnPixelData (org.eclipse.jface.viewers.ColumnPixelData)1 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerComparator (org.eclipse.jface.viewers.ViewerComparator)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Display (org.eclipse.swt.widgets.Display)1 IWorkbench (org.eclipse.ui.IWorkbench)1