Search in sources :

Example 1 with ProcessVariable

use of org.csstudio.csdata.ProcessVariable in project yamcs-studio by yamcs.

the class OpenOPIProbeHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getActiveMenuSelection(event);
    ProcessVariable[] pvs = AdapterUtil.convert(selection, ProcessVariable.class);
    IPath probeOPIPath = ResourceUtil.getPathFromString("platform:/plugin/org.csstudio.opibuilder/opi/probe.opi");
    LinkedHashMap<String, String> macros = new LinkedHashMap<>();
    if (pvs.length > 0) {
        macros.put(MACRO_NAME, pvs[0].getName());
    }
    int i = 0;
    for (ProcessVariable pv : pvs) {
        // $NON-NLS-1$
        macros.put(MACRO_NAME + "_" + Integer.toString(i), pv.getName());
        i++;
    }
    MacrosInput macrosInput = new MacrosInput(macros, true);
    // Errors in here will show in dialog and error log
    RunModeService.openDisplay(probeOPIPath, Optional.of(macrosInput), DisplayMode.NEW_TAB_DETACHED, Optional.empty());
    return null;
}
Also used : MacrosInput(org.csstudio.opibuilder.util.MacrosInput) IPath(org.eclipse.core.runtime.IPath) ProcessVariable(org.csstudio.csdata.ProcessVariable) ISelection(org.eclipse.jface.viewers.ISelection) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with ProcessVariable

use of org.csstudio.csdata.ProcessVariable in project yamcs-studio by yamcs.

the class ProcessVariableNameTransferDropPVTargetListener method getPVNamesFromTransfer.

@Override
protected String[] getPVNamesFromTransfer() {
    if (getCurrentEvent().data == null)
        return null;
    ProcessVariable[] pvArray = (ProcessVariable[]) getCurrentEvent().data;
    List<String> pvList = new ArrayList<String>();
    for (ProcessVariable pv : pvArray) {
        pvList.add(pv.getName());
    }
    return pvList.toArray(new String[pvList.size()]);
}
Also used : ProcessVariable(org.csstudio.csdata.ProcessVariable) ArrayList(java.util.ArrayList)

Aggregations

ProcessVariable (org.csstudio.csdata.ProcessVariable)2 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 MacrosInput (org.csstudio.opibuilder.util.MacrosInput)1 IPath (org.eclipse.core.runtime.IPath)1 ISelection (org.eclipse.jface.viewers.ISelection)1