ThemeResources res = ThemeResources.INSTANCE;
addStyleName(res.themeStyles().globalToolbar());
// add new source doc commands
newMenu_ = new ToolbarPopupMenu();
newMenu_.addItem(commands.newSourceDoc().createMenuItem(false));
newMenu_.addSeparator();
newMenu_.addItem(commands.newRMarkdownDoc().createMenuItem(false));
newMenu_.addSeparator();
newMenu_.addItem(commands.newTextDoc().createMenuItem(false));
newMenu_.addItem(commands.newCppDoc().createMenuItem(false));
newMenu_.addSeparator();
newMenu_.addItem(commands.newSweaveDoc().createMenuItem(false));
newMenu_.addItem(commands.newRHTMLDoc().createMenuItem(false));
newMenu_.addItem(commands.newRPresentationDoc().createMenuItem(false));
newMenu_.addItem(commands.newRDocumentationDoc().createMenuItem(false));
// create and add new menu
StandardIcons icons = StandardIcons.INSTANCE;
ToolbarButton newButton = new ToolbarButton("",
icons.stock_new(),
newMenu_);
addLeftWidget(newButton);
addLeftSeparator();
// open button + mru
addLeftWidget(commands.openSourceDoc().createToolbarButton());
ToolbarPopupMenu mruMenu = new ToolbarPopupMenu();
mruMenu.addItem(commands.mru0().createMenuItem(false));
mruMenu.addItem(commands.mru1().createMenuItem(false));
mruMenu.addItem(commands.mru2().createMenuItem(false));
mruMenu.addItem(commands.mru3().createMenuItem(false));
mruMenu.addItem(commands.mru4().createMenuItem(false));
mruMenu.addItem(commands.mru5().createMenuItem(false));
mruMenu.addItem(commands.mru6().createMenuItem(false));
mruMenu.addItem(commands.mru7().createMenuItem(false));
mruMenu.addItem(commands.mru8().createMenuItem(false));
mruMenu.addItem(commands.mru9().createMenuItem(false));
mruMenu.addSeparator();
mruMenu.addItem(commands.clearRecentFiles().createMenuItem(false));
ToolbarButton mruButton = new ToolbarButton(mruMenu, false);
mruButton.setTitle("Open recent files");
addLeftWidget(mruButton);
addLeftSeparator();