Search in sources :

Example 1 with DisplayInfo

use of org.csstudio.display.builder.rcp.DisplayInfo in project org.csstudio.display.builder by kasemir.

the class NavigationAction method addAction.

/**
 * Add action to navigate to a specific display to the 'menu'.
 *
 *  <p><code>menu</code> must be valid
 *
 *  @param display Target display
 *  @param steps Position of that display in navigation stack
 */
private void addAction(final DisplayInfo display, final int steps) {
    final Action action = new Action(display.getName()) {

        @Override
        public void run() {
            final DisplayInfo display = navigate(steps);
            part.loadDisplayFile(display);
        }
    };
    action.setImageDescriptor(icon);
    final ActionContributionItem item = new ActionContributionItem(action);
    item.fill(menu, -1);
}
Also used : Action(org.eclipse.jface.action.Action) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) DisplayInfo(org.csstudio.display.builder.rcp.DisplayInfo)

Example 2 with DisplayInfo

use of org.csstudio.display.builder.rcp.DisplayInfo in project org.csstudio.display.builder by kasemir.

the class NavigationAction method getMenu.

// IMenuCreator
@Override
public Menu getMenu(final Control parent) {
    // Entries can change, so re-create on each call
    if (menu != null)
        menu.dispose();
    menu = new Menu(parent);
    final List<DisplayInfo> displays = getDisplays();
    final int N = displays.size();
    for (int i = 0; i < N; ++i) addAction(displays.get(N - i - 1), i + 1);
    return menu;
}
Also used : DisplayInfo(org.csstudio.display.builder.rcp.DisplayInfo) Menu(org.eclipse.swt.widgets.Menu)

Example 3 with DisplayInfo

use of org.csstudio.display.builder.rcp.DisplayInfo in project org.csstudio.display.builder by kasemir.

the class RuntimeLauncher method open.

@Override
public void open(final IPath location) {
    String path = location.toOSString();
    // If possible, convert to workspace resource
    final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    URI uri = URIUtil.toURI(location);
    final IFile[] files = root.findFilesForLocationURI(uri);
    if (files != null && files.length > 0)
        path = files[0].getFullPath().toOSString();
    final DisplayInfo info = new DisplayInfo(path, "Navigator File", new Macros());
    new OpenDisplayAction(info).run();
}
Also used : IFile(org.eclipse.core.resources.IFile) DisplayInfo(org.csstudio.display.builder.rcp.DisplayInfo) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) OpenDisplayAction(org.csstudio.display.builder.rcp.OpenDisplayAction) URI(java.net.URI) Macros(org.csstudio.display.builder.model.macros.Macros)

Example 4 with DisplayInfo

use of org.csstudio.display.builder.rcp.DisplayInfo in project org.csstudio.display.builder by kasemir.

the class StandaloneAction method run.

@Override
public void run() {
    final DisplayModel parent_model = view.getDisplayModel();
    final DisplayInfo info = view.getDisplayInfo();
    ActionUtil.handleAction(parent_model, new OpenDisplayActionInfo(Messages.OpenStandalone, info.getPath(), info.getMacros(), OpenDisplayActionInfo.Target.STANDALONE));
}
Also used : DisplayInfo(org.csstudio.display.builder.rcp.DisplayInfo) DisplayModel(org.csstudio.display.builder.model.DisplayModel) OpenDisplayActionInfo(org.csstudio.display.builder.model.properties.OpenDisplayActionInfo)

Example 5 with DisplayInfo

use of org.csstudio.display.builder.rcp.DisplayInfo in project org.csstudio.display.builder by kasemir.

the class RCP_JFXRepresentation method openDisplayOnPage.

private ToolkitRepresentation<Parent, Node> openDisplayOnPage(final IWorkbenchPage page, final DisplayModel model, final Consumer<DisplayModel> close_handler) throws Exception {
    final DisplayInfo info = DisplayInfo.forModel(model);
    final RuntimeViewPart part = RuntimeViewPart.open(page, close_handler, info);
    final RCP_JFXRepresentation new_representation = part.getRepresentation();
    new_representation.representModel(part.getRoot(), model);
    return new_representation;
}
Also used : RuntimeViewPart(org.csstudio.display.builder.rcp.RuntimeViewPart) DisplayInfo(org.csstudio.display.builder.rcp.DisplayInfo)

Aggregations

DisplayInfo (org.csstudio.display.builder.rcp.DisplayInfo)8 OpenDisplayAction (org.csstudio.display.builder.rcp.OpenDisplayAction)3 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)2 IContributionItem (org.eclipse.jface.action.IContributionItem)2 URI (java.net.URI)1 DisplayModel (org.csstudio.display.builder.model.DisplayModel)1 Macros (org.csstudio.display.builder.model.macros.Macros)1 OpenDisplayActionInfo (org.csstudio.display.builder.model.properties.OpenDisplayActionInfo)1 RuntimeViewPart (org.csstudio.display.builder.rcp.RuntimeViewPart)1 IFile (org.eclipse.core.resources.IFile)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Menu (org.eclipse.swt.widgets.Menu)1