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