use of org.csstudio.opibuilder.runmode.RunModeService.DisplayMode in project yamcs-studio by yamcs.
the class OpenDisplayAction method openOPI.
private void openOPI(final IPath absolutePath, final boolean ctrlPressed, final boolean shiftPressed) {
DisplayMode mode = getDisplayMode();
if (ctrlPressed && !shiftPressed)
mode = DisplayMode.NEW_TAB;
else if (!ctrlPressed && shiftPressed)
mode = DisplayMode.NEW_WINDOW;
else if (ctrlPressed && shiftPressed)
mode = DisplayMode.NEW_SHELL;
final IOPIRuntime runtime = getWidgetModel().getRootDisplayModel().getOpiRuntime();
RunModeService.openDisplay(absolutePath, Optional.ofNullable(getMacrosInput()), mode, Optional.ofNullable(runtime));
}
use of org.csstudio.opibuilder.runmode.RunModeService.DisplayMode in project yamcs-studio by yamcs.
the class ScriptUtil method openOPI.
/**
* Open an OPI.
*
* @param widget
* the widget to which the script is attached.
* @param opiPath
* the path of the OPI. It can be either an absolute path or a relative path to the Display file of the
* widget.
* @param target
* target place of the new OPI. 0: new tab; 1: replace current one; 2: new window; 3: view on left; 4:
* view on right; 5: view on top; 6: view on bottom; 7: detached view; 8: new shell
* @param macrosInput
* the macrosInput. null if no macros needed.
*/
public static final void openOPI(AbstractBaseEditPart widget, String opiPath, int target, MacrosInput macrosInput) {
final OpenDisplayAction action = new OpenDisplayAction();
// Map target IDs of this API to DisplayMode
final DisplayMode mode;
switch(target) {
case 0:
mode = DisplayMode.NEW_TAB;
break;
case 2:
mode = DisplayMode.NEW_WINDOW;
break;
case 3:
mode = DisplayMode.NEW_TAB_LEFT;
break;
case 4:
mode = DisplayMode.NEW_TAB_RIGHT;
break;
case 5:
mode = DisplayMode.NEW_TAB_TOP;
break;
case 6:
mode = DisplayMode.NEW_TAB_BOTTOM;
break;
case 7:
mode = DisplayMode.NEW_TAB_DETACHED;
break;
case 8:
mode = DisplayMode.NEW_SHELL;
break;
default:
mode = DisplayMode.REPLACE;
}
action.setWidgetModel(widget.getWidgetModel());
action.setPropertyValue(OpenDisplayAction.PROP_PATH, opiPath);
action.setPropertyValue(OpenDisplayAction.PROP_MACROS, macrosInput);
action.setPropertyValue(OpenDisplayAction.PROP_MODE, mode.ordinal());
action.run();
}
Aggregations