use of org.csstudio.display.builder.runtime.RuntimeAction in project org.csstudio.display.builder by kasemir.
the class ContextMenuSupport method fillContextMenu.
private void fillContextMenu(final IMenuManager manager) {
final Widget context_menu_widget = view.getActiveWidget();
if (context_menu_widget == null) {
logger.log(Level.WARNING, "Missing context_menu_widget");
manager.add(new Action("No widget") {
});
} else {
// Widget info
manager.add(new WidgetInfoAction(context_menu_widget));
// Actions of the widget
for (ActionInfo info : context_menu_widget.propActions().getValue().getActions()) {
if (info.getType() == ActionType.OPEN_DISPLAY) {
// Add variant for all the available Target types: Replace, new Tab, ...
final OpenDisplayActionInfo open_info = (OpenDisplayActionInfo) info;
for (Target target : Target.values()) {
// STANDALONE can be achieved via StandaloneAction on new display
if (target == Target.STANDALONE)
continue;
final String desc = target == Target.REPLACE ? open_info.getDescription() : open_info.getDescription() + " (" + target + ")";
manager.add(new ActionInfoWrapper(context_menu_widget, new OpenDisplayActionInfo(desc, open_info.getFile(), open_info.getMacros(), target)));
}
} else
manager.add(new ActionInfoWrapper(context_menu_widget, info));
}
// Actions of the widget runtime
final WidgetRuntime<Widget> runtime = RuntimeUtil.getRuntime(context_menu_widget);
if (runtime == null)
throw new NullPointerException("Missing runtime for " + context_menu_widget);
for (RuntimeAction info : runtime.getRuntimeActions()) manager.add(new RuntimeActionWrapper(context_menu_widget, info));
}
// Placeholder for ProcessVariable object contributions
manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(new Separator());
if (context_menu_widget != null) {
final Node node = JFXBaseRepresentation.getJFXNode(context_menu_widget);
final Scene scene = node.getScene();
manager.add(new SaveSnapshotAction(shell, scene));
manager.add(new PrintAction(shell, scene));
manager.add(new SendEMailAction(shell, scene));
manager.add(new SendLogbookAction(shell, scene));
manager.add(new FullScreenAction(view.getSite().getPage()));
if (support_standalone)
manager.add(new StandaloneAction(view));
}
// Placeholder for the display editor.
// If editor.rcp plugin is included, it adds "Open in editor"
manager.add(new Separator("display_editor"));
manager.add(new ReloadDisplayAction());
}
Aggregations