public void completeInitialization(SessionInfo sessionInfo) { StandardIcons icons = StandardIcons.INSTANCE; if (sessionInfo.isVcsEnabled()) { addLeftSeparator(); ToolbarPopupMenu vcsMenu = new ToolbarPopupMenu(); vcsMenu.addItem(commands_.vcsFileDiff().createMenuItem(false)); vcsMenu.addItem(commands_.vcsFileLog().createMenuItem(false)); vcsMenu.addItem(commands_.vcsFileRevert().createMenuItem(false)); vcsMenu.addSeparator(); vcsMenu.addItem(commands_.vcsViewOnGitHub().createMenuItem(false)); vcsMenu.addItem(commands_.vcsBlameOnGitHub().createMenuItem(false)); vcsMenu.addSeparator(); vcsMenu.addItem(commands_.vcsCommit().createMenuItem(false)); vcsMenu.addSeparator(); vcsMenu.addItem(commands_.vcsPull().createMenuItem(false)); vcsMenu.addItem(commands_.vcsCleanup().createMenuItem(false)); vcsMenu.addItem(commands_.vcsPush().createMenuItem(false)); vcsMenu.addSeparator(); vcsMenu.addItem(commands_.vcsShowHistory().createMenuItem(false)); vcsMenu.addSeparator(); vcsMenu.addItem(commands_.versionControlProjectSetup().createMenuItem(false)); ImageResource vcsIcon = null; if (sessionInfo.getVcsName().equals(VCSConstants.GIT_ID)) vcsIcon = icons.git(); else if (sessionInfo.getVcsName().equals(VCSConstants.SVN_ID)) vcsIcon = icons.svn(); ToolbarButton vcsButton = new ToolbarButton(null, vcsIcon, vcsMenu); vcsButton.setTitle("Version control"); addLeftWidget(vcsButton); } if (sessionInfo.getShinyappsInstalled()) { addLeftSeparator(); ToolbarButton deployButton = commands_.shinyAppsDeploy().createToolbarButton(); deployButton.setText("Deploy"); addLeftWidget(deployButton); } // project popup menu ProjectPopupMenu projectMenu = new ProjectPopupMenu(sessionInfo, commands_); addRightWidget(projectMenu.getToolbarButton()); }
private ToolbarButton( String text, ImageResource leftImage, ImageResource rightImage, ClickHandler clickHandler) { super(); setElement(binder.createAndBindUi(this)); this.setStylePrimaryName(styles_.toolbarButton()); setText(text); if (leftImage != null) leftImageWidget_ = new Image(leftImage); else leftImageWidget_ = new Image(); leftImageWidget_.setStylePrimaryName(styles_.toolbarButtonLeftImage()); leftImageCell_.appendChild(leftImageWidget_.getElement()); if (rightImage != null) { rightImageWidget_ = new Image(rightImage); rightImageWidget_.setStylePrimaryName(styles_.toolbarButtonRightImage()); rightImageCell_.appendChild(rightImageWidget_.getElement()); } if (clickHandler != null) addClickHandler(clickHandler); }