Search in sources :

Example 1 with IViewRegistry

use of org.eclipse.ui.views.IViewRegistry in project knime-core by knime.

the class KNIMEApplicationActionBarAdvisor method createViewAction.

private OpenKnimeViewAction createViewAction(final String viewId) {
    IViewRegistry viewReg = PlatformUI.getWorkbench().getViewRegistry();
    IViewDescriptor vDesc = viewReg.find(viewId);
    if (vDesc == null) {
        return null;
    }
    if (!vDesc.getAllowMultiple()) {
        // views that cannot be instantiated multiple times are ignored
        return null;
    }
    OpenKnimeViewAction result = new OpenKnimeViewAction(viewId);
    result.setText(vDesc.getLabel());
    result.setImageDescriptor(vDesc.getImageDescriptor());
    return result;
}
Also used : IViewDescriptor(org.eclipse.ui.views.IViewDescriptor) IViewRegistry(org.eclipse.ui.views.IViewRegistry)

Example 2 with IViewRegistry

use of org.eclipse.ui.views.IViewRegistry in project mdw-designer by CenturyLinkCloud.

the class ShowViewMenu method getItem.

@SuppressWarnings({ "unchecked", "rawtypes" })
private CommandContributionItemParameter getItem(String viewId) {
    IViewRegistry viewReg = Activator.getDefault().getWorkbench().getViewRegistry();
    IViewDescriptor viewDesc = viewReg.find(viewId);
    if (viewDesc == null)
        return null;
    String label = viewDesc.getLabel();
    CommandContributionItemParameter parms = new PluginCCIP(viewDesc, window, viewId, IWorkbenchCommandConstants.VIEWS_SHOW_VIEW, CommandContributionItem.STYLE_PUSH);
    parms.label = label;
    parms.icon = viewDesc.getImageDescriptor();
    parms.parameters = new HashMap();
    parms.parameters.put("org.eclipse.ui.views.showView.viewId", viewId);
    return parms;
}
Also used : IViewDescriptor(org.eclipse.ui.views.IViewDescriptor) HashMap(java.util.HashMap) CommandContributionItemParameter(org.eclipse.ui.menus.CommandContributionItemParameter) IViewRegistry(org.eclipse.ui.views.IViewRegistry)

Aggregations

IViewDescriptor (org.eclipse.ui.views.IViewDescriptor)2 IViewRegistry (org.eclipse.ui.views.IViewRegistry)2 HashMap (java.util.HashMap)1 CommandContributionItemParameter (org.eclipse.ui.menus.CommandContributionItemParameter)1