use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo in project yamcs-studio by yamcs.
the class ProcessingInfoDialogHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = HandlerUtil.getActiveShellChecked(event);
ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
ProcessorInfo processor = catalogue.getCurrentProcessorInfo();
if (processor != null) {
catalogue.fetchInstanceInformationRequest(processor.getInstance()).whenComplete((data, exc) -> {
if (exc == null) {
Display display = Display.getDefault();
if (!display.isDisposed()) {
display.asyncExec(() -> {
try {
YamcsInstance instance = YamcsInstance.parseFrom(data);
new ProcessingInfoDialog(shell, instance, processor).open();
} catch (InvalidProtocolBufferException e) {
log.log(Level.SEVERE, "Failed to decode server message", e);
}
});
}
}
});
}
return null;
}
use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo in project yamcs-studio by yamcs.
the class ProcessorStatusLineContributionItem method clientUpdated.
@Override
public void clientUpdated(ClientInfo updatedInfo) {
Display.getDefault().asyncExec(() -> {
if (updatedInfo.getCurrentClient()) {
ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
ProcessorInfo processorInfo = catalogue.getProcessorInfo(updatedInfo.getInstance(), updatedInfo.getProcessorName());
updateText(processorInfo);
}
});
}
use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo in project yamcs-studio by yamcs.
the class YamcsUIPlugin method postWorkbenchStartup.
/**
* Hook called by application layer to bootstrap connection state
*/
public void postWorkbenchStartup(IWorkbench workbench) {
// Listen to processing-info updates
// Trigger initial state
doUpdateGlobalProcessingState(workbench, null);
ManagementCatalogue.getInstance().addManagementListener(new ManagementListener() {
@Override
public void processorUpdated(ProcessorInfo processorInfo) {
updateGlobalProcessingState(processorInfo);
}
@Override
public void processorClosed(ProcessorInfo processorInfo) {
updateGlobalProcessingState(processorInfo);
}
@Override
public void statisticsUpdated(Statistics stats) {
}
@Override
public void clientUpdated(ClientInfo clientInfo) {
updateGlobalProcessingState(clientInfo);
}
@Override
public void clientDisconnected(ClientInfo clientInfo) {
updateGlobalProcessingState(clientInfo);
}
@Override
public void instanceUpdated(ConnectionInfo connectionInfo) {
}
@Override
public void clearAllManagementData() {
}
});
// Request connection to Yamcs server
boolean singleConnectionMode = getPreferenceStore().getBoolean("singleConnectionMode");
if (!singleConnectionMode && ConnectionPreferences.isAutoConnect()) {
RCPUtils.runCommand("org.yamcs.studio.core.ui.autoconnect");
}
}
use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo 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;
}
use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo in project yamcs-studio by yamcs.
the class SwitchProcessorCompoundContributionItem method getContributionItems.
@Override
public IContributionItem[] getContributionItems() {
List<IContributionItem> items = new ArrayList<>();
ProcessorInfo currentProcessor = ManagementCatalogue.getInstance().getCurrentProcessorInfo();
items.add(createProcessorItem(currentProcessor));
items.add(new Separator());
String instance = ManagementCatalogue.getCurrentYamcsInstance();
List<ProcessorInfo> processors = ManagementCatalogue.getInstance().getProcessors(instance);
Collections.sort(processors, (p1, p2) -> p1.getName().compareTo(p2.getName()));
processors.forEach(processor -> {
if (!processor.getName().equals(currentProcessor.getName())) {
CommandContributionItem item = createProcessorItem(processor);
items.add(item);
}
});
updateSelection();
return items.toArray(new IContributionItem[0]);
}
Aggregations