Search in sources :

Example 1 with OpenDisplayAction

use of org.csstudio.display.builder.rcp.OpenDisplayAction 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 2 with OpenDisplayAction

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

the class TopDisplaysMenu method getContributionItems.

@Override
protected IContributionItem[] getContributionItems() {
    final IMenuManager items = new MenuManager(Messages.TopDisplays, OpenDisplayAction.getIcon(), null);
    try {
        final String setting = Preferences.getTopDisplays();
        final List<DisplayInfo> displays = DisplayInfoXMLUtil.fromDisplaysXML(setting);
        for (DisplayInfo display : displays) items.add(new OpenDisplayAction(display));
    } catch (Exception ex) {
        logger.log(Level.WARNING, "Cannot create 'top displays'", ex);
    }
    return new IContributionItem[] { items };
}
Also used : DisplayInfo(org.csstudio.display.builder.rcp.DisplayInfo) IContributionItem(org.eclipse.jface.action.IContributionItem) OpenDisplayAction(org.csstudio.display.builder.rcp.OpenDisplayAction) IMenuManager(org.eclipse.jface.action.IMenuManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 3 with OpenDisplayAction

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

the class TopDisplaysToolbarItems method createContributionItems.

@Override
public void createContributionItems(final IServiceLocator serviceLocator, final IContributionRoot additions) {
    // for ExtensionContributionFactory example
    try {
        final String setting = Preferences.getTopDisplays();
        final List<DisplayInfo> displays = DisplayInfoXMLUtil.fromDisplaysXML(setting);
        for (DisplayInfo display : displays) {
            final IAction action = new OpenDisplayAction(display);
            final IContributionItem item = new ActionContributionItem(action);
            additions.addContributionItem(item, null);
        }
    } catch (Exception ex) {
        logger.log(Level.WARNING, "Cannot create 'top displays'", ex);
    }
}
Also used : ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) DisplayInfo(org.csstudio.display.builder.rcp.DisplayInfo) IAction(org.eclipse.jface.action.IAction) IContributionItem(org.eclipse.jface.action.IContributionItem) OpenDisplayAction(org.csstudio.display.builder.rcp.OpenDisplayAction)

Aggregations

DisplayInfo (org.csstudio.display.builder.rcp.DisplayInfo)3 OpenDisplayAction (org.csstudio.display.builder.rcp.OpenDisplayAction)3 IContributionItem (org.eclipse.jface.action.IContributionItem)2 URI (java.net.URI)1 Macros (org.csstudio.display.builder.model.macros.Macros)1 IFile (org.eclipse.core.resources.IFile)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 IAction (org.eclipse.jface.action.IAction)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1