use of org.yamcs.studio.core.model.ManagementCatalogue 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.studio.core.model.ManagementCatalogue 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.studio.core.model.ManagementCatalogue in project yamcs-studio by yamcs.
the class ProcessorStatusLineContributionItem method dispose.
@Override
public void dispose() {
ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
if (catalogue != null) {
catalogue.removeManagementListener(this);
}
YamcsPlugin.getDefault().removeYamcsConnectionListener(this);
}
use of org.yamcs.studio.core.model.ManagementCatalogue in project yamcs-studio by yamcs.
the class RestartInstanceHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
ClientInfo clientInfo = catalogue.getCurrentClientInfo();
Shell shell = HandlerUtil.getActiveShell(event);
String instance = clientInfo.getInstance();
catalogue.restartInstance(clientInfo.getInstance()).whenComplete((ret, ex) -> {
log.log(Level.SEVERE, "Failed to restart instance '" + instance + "'", ex);
Display.getDefault().asyncExec(() -> {
MessageDialog.openError(shell, "Failed to restart instance '" + instance + "'", ex.getMessage());
});
});
return null;
}
use of org.yamcs.studio.core.model.ManagementCatalogue 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;
}
Aggregations