Search in sources :

Example 6 with ManagementCatalogue

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;
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) Shell(org.eclipse.swt.widgets.Shell) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) YamcsInstance(org.yamcs.protobuf.YamcsManagement.YamcsInstance) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) Display(org.eclipse.swt.widgets.Display)

Example 7 with ManagementCatalogue

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);
        }
    });
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo)

Example 8 with ManagementCatalogue

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);
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue)

Example 9 with ManagementCatalogue

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;
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) Shell(org.eclipse.swt.widgets.Shell) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo)

Example 10 with ManagementCatalogue

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;
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) Shell(org.eclipse.swt.widgets.Shell) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) EditClientRequest(org.yamcs.protobuf.Rest.EditClientRequest)

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