Search in sources :

Example 1 with LinkCatalogue

use of org.yamcs.studio.core.model.LinkCatalogue in project yamcs-studio by yamcs.

the class YamcsPlugin method start.

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    TimeEncoding.setUp();
    yamcsClient = new YamcsClient(getProductString(), true);
    yamcsClient.addConnectionListener(new UIConnectionListener());
    ManagementCatalogue managementCatalogue = new ManagementCatalogue();
    catalogues.put(ManagementCatalogue.class, managementCatalogue);
    addYamcsConnectionListener(managementCatalogue);
    registerCatalogue(new TimeCatalogue());
    registerCatalogue(new ParameterCatalogue());
    registerCatalogue(new CommandingCatalogue());
    registerCatalogue(new AlarmCatalogue());
    registerCatalogue(new EventCatalogue());
    registerCatalogue(new LinkCatalogue());
    registerCatalogue(new ArchiveCatalogue());
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) YamcsClient(org.yamcs.studio.core.client.YamcsClient) TimeCatalogue(org.yamcs.studio.core.model.TimeCatalogue) ParameterCatalogue(org.yamcs.studio.core.model.ParameterCatalogue) AlarmCatalogue(org.yamcs.studio.core.model.AlarmCatalogue) EventCatalogue(org.yamcs.studio.core.model.EventCatalogue) CommandingCatalogue(org.yamcs.studio.core.model.CommandingCatalogue) LinkCatalogue(org.yamcs.studio.core.model.LinkCatalogue) ArchiveCatalogue(org.yamcs.studio.core.model.ArchiveCatalogue)

Example 2 with LinkCatalogue

use of org.yamcs.studio.core.model.LinkCatalogue in project yamcs-studio by yamcs.

the class DataLinkTableViewer method addPopupMenu.

private void addPopupMenu() {
    Menu contextMenu = new Menu(getTable());
    getTable().setMenu(contextMenu);
    MenuItem mItem1 = new MenuItem(contextMenu, SWT.None);
    mItem1.setText("Enable Link");
    mItem1.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent arg0) {
            widgetSelected(arg0);
        }

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            DataLinkRecord rec = (DataLinkRecord) (getTable().getSelection()[0].getData());
            if (rec == null)
                return;
            LinkCatalogue catalogue = LinkCatalogue.getInstance();
            catalogue.enableLink(rec.getLinkInfo().getInstance(), rec.getLinkInfo().getName()).whenComplete((data, exc) -> {
                if (exc != null) {
                    getTable().getDisplay().asyncExec(() -> {
                        showMessage(getTable().getShell(), exc.getMessage());
                    });
                }
            });
        }
    });
    MenuItem mItem2 = new MenuItem(contextMenu, SWT.None);
    mItem2.setText("Disable Link");
    mItem2.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent arg0) {
            widgetSelected(arg0);
        }

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            DataLinkRecord rec = (DataLinkRecord) (getTable().getSelection()[0].getData());
            if (rec == null)
                return;
            LinkCatalogue catalogue = LinkCatalogue.getInstance();
            catalogue.disableLink(rec.getLinkInfo().getInstance(), rec.getLinkInfo().getName()).whenComplete((data, exc) -> {
                if (exc != null) {
                    getTable().getDisplay().asyncExec(() -> {
                        showMessage(getTable().getShell(), exc.getMessage());
                    });
                }
            });
        }
    });
}
Also used : Shell(org.eclipse.swt.widgets.Shell) TableViewer(org.eclipse.jface.viewers.TableViewer) ControlListener(org.eclipse.swt.events.ControlListener) Table(org.eclipse.swt.widgets.Table) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) LinkInfo(org.yamcs.protobuf.YamcsManagement.LinkInfo) LinkCatalogue(org.yamcs.studio.core.model.LinkCatalogue) ArrayList(java.util.ArrayList) ControlEvent(org.eclipse.swt.events.ControlEvent) List(java.util.List) MenuItem(org.eclipse.swt.widgets.MenuItem) Composite(org.eclipse.swt.widgets.Composite) SWT(org.eclipse.swt.SWT) MessageBox(org.eclipse.swt.widgets.MessageBox) ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) SelectionListener(org.eclipse.swt.events.SelectionListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) LinkCatalogue(org.yamcs.studio.core.model.LinkCatalogue) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

LinkCatalogue (org.yamcs.studio.core.model.LinkCatalogue)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)1 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)1 SWT (org.eclipse.swt.SWT)1 ControlEvent (org.eclipse.swt.events.ControlEvent)1 ControlListener (org.eclipse.swt.events.ControlListener)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Composite (org.eclipse.swt.widgets.Composite)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1 MessageBox (org.eclipse.swt.widgets.MessageBox)1 Shell (org.eclipse.swt.widgets.Shell)1 Table (org.eclipse.swt.widgets.Table)1 LinkInfo (org.yamcs.protobuf.YamcsManagement.LinkInfo)1 YamcsClient (org.yamcs.studio.core.client.YamcsClient)1