How to add menu Items to toolbar in Eclipse E4

老子叫甜甜 提交于 2019-12-13 04:41:17

问题


I have an Eclipse RCP application and have added a tollbar via TrimBar->Window Trim->Toolbar->Tool Control. I have tried to add menu/ menu items using SWT Menu but it is not visible in the toolbar. Other components like buttons,labels,combo boxes are added without any problem. Is it possible to add Menu Items to toolbar?

File Edit View Tools Window Help Here-The-Combobox-To-Be-Added

File/Edit/View/Tools/Window/Help are the menu items in the toolbar. And after that a combobox is to be added.

Thanks


回答1:


One solution might be to add a combo box to the trimbar.

I have tried out a progress indicator in the trim bar: Use a ToolControl element in the UI specification WindowTrim->Toolbar->ToolControl. The class given with the tool control is a POJO. Here is the beginning of my progress bindicator:

public class ProgressIndicator implements IProgressMonitor {

    private ProgressBar progressBar;

    @PostConstruct
    public void createControls(final Composite parent) {
        final Group g = new Group(parent, SWT.SHADOW_ETCHED_IN | SWT.FILL);
        g.setLayout(new FillLayout());
        g.setToolTipText(Nls.INSTANCE.getString("Progressbar.tooltip"));
        this.progressBar = new ProgressBar(g, SWT.NONE );
        this.progressBar.setVisible(false);
    }
...
}


来源:https://stackoverflow.com/questions/23804839/how-to-add-menu-items-to-toolbar-in-eclipse-e4

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!