Search in sources :

Example 6 with CommandInfo

use of org.yamcs.protobuf.Mdb.CommandInfo in project yamcs-studio by yamcs.

the class AddToStackWizardPage1 method addAliasColumn.

// Add dynamically columns for each alias of a command
private void addAliasColumn(String namespace) {
    TreeViewerColumn aliasColumn = new TreeViewerColumn(commandsTreeTable, SWT.NONE);
    aliasColumn.getColumn().setText(namespace);
    aliasColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            CommandInfo cmd = (CommandInfo) element;
            if (cmd.getAbstract()) {
                // show a blank line if the command is abstract
                return "";
            }
            List<NamedObjectId> aliases = cmd.getAliasList();
            for (NamedObjectId aliase : aliases) {
                if (aliase.getNamespace().equals(namespace))
                    return aliase.getName();
            }
            return "";
        }
    });
    tcl.setColumnData(aliasColumn.getColumn(), new ColumnPixelData(COLUMN_WIDTH));
}
Also used : ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) CommandInfo(org.yamcs.protobuf.Mdb.CommandInfo) ColumnPixelData(org.eclipse.jface.viewers.ColumnPixelData) ArrayList(java.util.ArrayList) List(java.util.List) NamedObjectId(org.yamcs.protobuf.Yamcs.NamedObjectId) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn)

Example 7 with CommandInfo

use of org.yamcs.protobuf.Mdb.CommandInfo 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)

Aggregations

CommandInfo (org.yamcs.protobuf.Mdb.CommandInfo)7 NamedObjectId (org.yamcs.protobuf.Yamcs.NamedObjectId)4 ArrayList (java.util.ArrayList)3 ArgumentInfo (org.yamcs.protobuf.Mdb.ArgumentInfo)3 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)2 ColumnPixelData (org.eclipse.jface.viewers.ColumnPixelData)2 StyledString (org.eclipse.jface.viewers.StyledString)2 TreeViewerColumn (org.eclipse.jface.viewers.TreeViewerColumn)2 FileReader (java.io.FileReader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 JAXBContext (javax.xml.bind.JAXBContext)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 TreeColumnLayout (org.eclipse.jface.layout.TreeColumnLayout)1 LocalResourceManager (org.eclipse.jface.resource.LocalResourceManager)1 ResourceManager (org.eclipse.jface.resource.ResourceManager)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1