Search in sources :

Example 6 with NamedObjectId

use of org.yamcs.protobuf.Yamcs.NamedObjectId in project yamcs-studio by yamcs.

the class CommandInfoTreeViewerFilter method matching.

private boolean matching(CommandInfo cmd) {
    // check match in all namespaces
    boolean matching = false;
    for (NamedObjectId alias : cmd.getAliasList()) {
        matching |= alias.getName().matches(regex);
    }
    matching |= cmd.getQualifiedName().matches(regex);
    return matching;
}
Also used : NamedObjectId(org.yamcs.protobuf.Yamcs.NamedObjectId)

Example 7 with NamedObjectId

use of org.yamcs.protobuf.Yamcs.NamedObjectId in project yamcs-studio by yamcs.

the class CommandInfoViewerFilter method select.

@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
    CommandInfo cmd = (CommandInfo) element;
    // check match in all namespace
    boolean matching = false;
    for (NamedObjectId alias : cmd.getAliasList()) {
        matching |= alias.getName().matches(regex);
    }
    matching |= cmd.getQualifiedName().matches(regex);
    return matching;
}
Also used : CommandInfo(org.yamcs.protobuf.Mdb.CommandInfo) NamedObjectId(org.yamcs.protobuf.Yamcs.NamedObjectId)

Example 8 with NamedObjectId

use of org.yamcs.protobuf.Yamcs.NamedObjectId in project yamcs-studio by yamcs.

the class AddToStackWizardPage2 method updateControl.

private void updateControl() {
    // Check if we keep state if the user just flips between back and next without actually changing the command.
    if (previousCommand.equals(command.getMetaCommand().getQualifiedName())) {
        return;
    }
    previousCommand = command.getMetaCommand().getQualifiedName();
    // Clear previous state
    command.getAssignments().clear();
    // set header message
    setMessage(AddToStackWizardPage1.getMessage(command.getMetaCommand()));
    // populate namespace combo
    // (switching ops name and qualified name)
    aliases = new ArrayList<>();
    aliases.add(command.getMetaCommand().getQualifiedName());
    for (NamedObjectId noi : command.getMetaCommand().getAliasList()) {
        String alias = noi.getNamespace() + "/" + noi.getName();
        if (alias.equals(command.getMetaCommand().getQualifiedName()))
            continue;
        aliases.add(alias);
    }
    namespaceCombo.setItems(aliases.toArray(new String[aliases.size()]));
    namespaceCombo.select(0);
    command.setSelectedAliase(aliases.get(0));
    // Register new state
    atb.updateCommandArguments();
    atb.pack();
    controlComposite.layout();
}
Also used : NamedObjectId(org.yamcs.protobuf.Yamcs.NamedObjectId)

Example 9 with NamedObjectId

use of org.yamcs.protobuf.Yamcs.NamedObjectId in project yamcs-studio by yamcs.

the class EditStackedCommandDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new GridLayout());
    // command namespace selection
    // populate namespace combo
    // (switching ops name and qualified name)
    List<String> aliases = new ArrayList<String>();
    aliases.add(command.getMetaCommand().getQualifiedName());
    for (NamedObjectId noi : command.getMetaCommand().getAliasList()) {
        String alias = noi.getNamespace() + "/" + noi.getName();
        if (alias.equals(command.getMetaCommand().getQualifiedName()))
            continue;
        aliases.add(alias);
    }
    Composite namespaceComposite = new Composite(composite, SWT.NONE);
    namespaceComposite.setLayout(new GridLayout(2, false));
    Label chooseNamespace = new Label(namespaceComposite, SWT.NONE);
    chooseNamespace.setText("Choose Command Namespace: ");
    Combo namespaceCombo = new Combo(namespaceComposite, SWT.READ_ONLY);
    namespaceCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            command.setSelectedAliase(aliases.get(namespaceCombo.getSelectionIndex()));
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    namespaceCombo.setItems(aliases.toArray(new String[aliases.size()]));
    for (int i = 0; i < aliases.size(); i++) {
        if (aliases.get(i).equals(command.getSelectedAlias())) {
            namespaceCombo.select(i);
        }
    }
    ExpandableComposite ec = new ExpandableComposite(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
    ec.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ec.setLayout(new GridLayout(1, false));
    ec.setText("Command Options");
    Composite optionsComposite = new Composite(ec, SWT.NONE);
    optionsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    optionsComposite.setLayout(new GridLayout(2, false));
    Label l1 = new Label(optionsComposite, SWT.NONE);
    l1.setText("Comment");
    GridData gridData = new GridData(SWT.NONE, SWT.TOP, false, false);
    l1.setLayoutData(gridData);
    Text comment = new Text(optionsComposite, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
    comment.setText(command.getComment() != null ? command.getComment() : "");
    ec.setExpanded(!comment.getText().isEmpty());
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData.heightHint = 2 * comment.getLineHeight();
    comment.setLayoutData(gridData);
    ec.setClient(optionsComposite);
    ec.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            parent.layout(true);
            composite.layout();
            optionsComposite.layout();
        }
    });
    comment.addModifyListener(evt -> {
        if (comment.getText().trim().isEmpty()) {
            command.setComment(null);
        } else {
            command.setComment(comment.getText());
        }
    });
    atb = new ArgumentTableBuilder(command);
    atb.createArgumentTable(composite);
    atb.updateCommandArguments();
    atb.pack();
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ArrayList(java.util.ArrayList) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NamedObjectId(org.yamcs.protobuf.Yamcs.NamedObjectId) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 10 with NamedObjectId

use of org.yamcs.protobuf.Yamcs.NamedObjectId in project yamcs-studio by yamcs.

the class IndexBox method receiveArchiveRecords.

public void receiveArchiveRecords(List<ArchiveRecord> records) {
    String[] nameparts;
    synchronized (tmData) {
        for (ArchiveRecord r : records) {
            // debugLog(r.packet+"\t"+r.num+"\t"+new Date(r.first)+"\t"+new Date(r.last));
            NamedObjectId id = r.getId();
            String grpName = null;
            String shortName = null;
            // split the id into group->name
            if (!id.hasNamespace()) {
                int idx = id.getName().lastIndexOf("/");
                if (idx != -1) {
                    grpName = id.getName().substring(0, idx + 1);
                    shortName = id.getName().substring(idx + 1);
                }
            }
            if (grpName == null) {
                nameparts = id.getName().split("[_\\.]", 2);
                if (nameparts.length > 1) {
                    grpName = nameparts[0];
                    shortName = nameparts[1].replaceFirst("INST_", "").replaceFirst("Tlm_Pkt_", "");
                } else {
                    grpName = "";
                    shortName = id.getName();
                }
            }
            if (!tmData.containsKey(id.getName())) {
                tmData.put(id.getName(), new TreeSet<IndexChunkSpec>());
            }
            TreeSet<IndexChunkSpec> al = tmData.get(id.getName());
            String info = r.hasInfo() ? r.getInfo() : null;
            IndexChunkSpec tnew = new IndexChunkSpec(r.getFirst(), r.getLast(), r.getNum(), info);
            IndexChunkSpec told = al.floor(tnew);
            if ((told == null) || (mergeTime == -1) || (!told.merge(tnew, mergeTime))) {
                al.add(tnew);
            }
            if (!allPackets.containsKey(id.getName())) {
                IndexLineSpec pkt = new IndexLineSpec(id.getName(), grpName, shortName);
                allPackets.put(id.getName(), pkt);
                ArrayList<IndexLineSpec> plvec;
                if ((plvec = groups.get(grpName)) == null) {
                    plvec = new ArrayList<>();
                    groups.put(grpName, plvec);
                }
                plvec.add(pkt);
            }
        }
        titleLabel.setText(name);
    }
}
Also used : IndexChunkSpec(org.yamcs.studio.archive.ArchivePanel.IndexChunkSpec) ArchiveRecord(org.yamcs.protobuf.Yamcs.ArchiveRecord) NamedObjectId(org.yamcs.protobuf.Yamcs.NamedObjectId) GradientPaint(java.awt.GradientPaint)

Aggregations

NamedObjectId (org.yamcs.protobuf.Yamcs.NamedObjectId)12 ArrayList (java.util.ArrayList)4 CommandInfo (org.yamcs.protobuf.Mdb.CommandInfo)4 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)3 ColumnPixelData (org.eclipse.jface.viewers.ColumnPixelData)3 TreeViewerColumn (org.eclipse.jface.viewers.TreeViewerColumn)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 List (java.util.List)2 TreeColumnLayout (org.eclipse.jface.layout.TreeColumnLayout)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 Viewer (org.eclipse.jface.viewers.Viewer)2 ViewerComparator (org.eclipse.jface.viewers.ViewerComparator)2 Text (org.eclipse.swt.widgets.Text)2 ParameterInfo (org.yamcs.protobuf.Mdb.ParameterInfo)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 GradientPaint (java.awt.GradientPaint)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1