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);
}
}
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();
}
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;
}
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;
}
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);
});
}
Aggregations