Search in sources :

Example 6 with ProcessorInfo

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;
}
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 ProcessorInfo

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

Example 8 with 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");
    }
}
Also used : ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) ManagementListener(org.yamcs.studio.core.model.ManagementListener) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo) ConnectionInfo(org.yamcs.protobuf.Web.ConnectionInfo) Statistics(org.yamcs.protobuf.YamcsManagement.Statistics)

Example 9 with ProcessorInfo

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

Example 10 with ProcessorInfo

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]);
}
Also used : ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) IContributionItem(org.eclipse.jface.action.IContributionItem) ArrayList(java.util.ArrayList) CommandContributionItem(org.eclipse.ui.menus.CommandContributionItem) Separator(org.eclipse.jface.action.Separator)

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