Search in sources :

Example 11 with ProcessorInfo

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

the class SwitchProcessorCompoundContributionItem method updateSelection.

private void updateSelection() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    ICommandService commandService = (ICommandService) workbench.getService(ICommandService.class);
    Command command = commandService.getCommand(SWITCH_PROCESSOR_COMMAND);
    try {
        ProcessorInfo currentProcessor = ManagementCatalogue.getInstance().getCurrentProcessorInfo();
        HandlerUtil.updateRadioState(command, currentProcessor.getName());
    } catch (ExecutionException e) {
        log.log(Level.SEVERE, "Could not update radio state", e);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) Command(org.eclipse.core.commands.Command) ExecutionException(org.eclipse.core.commands.ExecutionException) ICommandService(org.eclipse.ui.commands.ICommandService)

Example 12 with ProcessorInfo

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

the class SwitchProcessorDialog method okPressed.

@Override
protected void okPressed() {
    IStructuredSelection sel = (IStructuredSelection) processorsTable.getSelection();
    if (!sel.isEmpty())
        processorInfo = (ProcessorInfo) sel.getFirstElement();
    super.okPressed();
}
Also used : ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 13 with ProcessorInfo

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

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

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

ProcessorInfo (org.yamcs.protobuf.YamcsManagement.ProcessorInfo)15 ManagementCatalogue (org.yamcs.studio.core.model.ManagementCatalogue)10 EditProcessorRequest (org.yamcs.protobuf.Rest.EditProcessorRequest)4 ClientInfo (org.yamcs.protobuf.YamcsManagement.ClientInfo)3 Shell (org.eclipse.swt.widgets.Shell)2 IWorkbench (org.eclipse.ui.IWorkbench)2 EditClientRequest (org.yamcs.protobuf.Rest.EditClientRequest)2 ConnectionInfo (org.yamcs.protobuf.Web.ConnectionInfo)2 Statistics (org.yamcs.protobuf.YamcsManagement.Statistics)2 YamcsInstance (org.yamcs.protobuf.YamcsManagement.YamcsInstance)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 ArrayList (java.util.ArrayList)1 Command (org.eclipse.core.commands.Command)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 Separator (org.eclipse.jface.action.Separator)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