Search in sources :

Example 1 with MessageDialog

use of org.rstudio.core.client.widget.MessageDialog in project rstudio by rstudio.

the class VersionControlPage method acceptNavigation.

@Override
protected boolean acceptNavigation() {
    SessionInfo sessionInfo = RStudioGinjector.INSTANCE.getSession().getSessionInfo();
    if (!sessionInfo.isVcsAvailable(getVcsId())) {
        NewProjectResources.Styles styles = NewProjectResources.INSTANCE.styles();
        VerticalPanel verticalPanel = new VerticalPanel();
        verticalPanel.addStyleName(styles.vcsNotInstalledWidget());
        if (Desktop.isDesktop()) {
            HTML msg = new HTML("<p>" + getTitle() + " was not detected " + "on the system path.</p>" + "<p>To create projects from " + getTitle() + " " + "repositories you should install " + getTitle() + " " + "and then restart RStudio.</p>" + "<p>Note that if " + getTitle() + " is installed " + "and not on the path, then you can specify its location using " + "the " + (BrowseCap.isMacintosh() ? "Preferences" : "Options") + " dialog.</p>");
            msg.setWidth("100%");
            verticalPanel.add(msg);
            HelpLink vcsHelpLink = new VcsHelpLink();
            vcsHelpLink.setCaption("Using " + getTitle() + " with RStudio");
            vcsHelpLink.addStyleName(styles.vcsHelpLink());
            verticalPanel.add(vcsHelpLink);
        } else {
            HTML msg = new HTML("<p>An installation of " + getTitle() + " was not detected " + "on this system.</p>" + "<p>To create projects from " + getTitle() + " " + "repositories you should request that your server " + "administrator install the " + getTitle() + " package.</p>");
            msg.setWidth("100%");
            verticalPanel.add(msg);
        }
        MessageDialog dlg = new MessageDialog(MessageDialog.INFO, getTitle() + " Not Found", verticalPanel);
        dlg.addButton("OK", (Operation) null, true, false);
        dlg.showModal();
        return false;
    } else {
        return true;
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) HelpLink(org.rstudio.studio.client.common.HelpLink) VcsHelpLink(org.rstudio.studio.client.common.vcs.VcsHelpLink) SessionInfo(org.rstudio.studio.client.workbench.model.SessionInfo) HTML(com.google.gwt.user.client.ui.HTML) MessageDialog(org.rstudio.core.client.widget.MessageDialog) VcsHelpLink(org.rstudio.studio.client.common.vcs.VcsHelpLink)

Example 2 with MessageDialog

use of org.rstudio.core.client.widget.MessageDialog in project rstudio by rstudio.

the class RStudioAPI method showDialog.

private void showDialog(String caption, String message, final String url) {
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.addStyleName(RES.styles().textInfoWidget());
    SafeHtml safeMsg = DialogHtmlSanitizer.sanitizeHtml(message);
    HTML msg = new HTML(safeMsg.asString());
    msg.setWidth("100%");
    verticalPanel.add(msg);
    if (!StringUtil.isNullOrEmpty(url)) {
        HyperlinkLabel link = new HyperlinkLabel(url, new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                RStudioGinjector.INSTANCE.getGlobalDisplay().openWindow(url);
            }
        });
        link.addStyleName(RES.styles().installLink());
        verticalPanel.add(link);
    }
    MessageDialog dlg = new MessageDialog(MessageDialog.INFO, caption, verticalPanel);
    dlg.addButton("OK", new Operation() {

        @Override
        public void execute() {
            server_.showDialogCompleted(null, false, new SimpleRequestCallback<Void>());
        }
    }, true, false);
    dlg.showModal();
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HTML(com.google.gwt.user.client.ui.HTML) MessageDialog(org.rstudio.core.client.widget.MessageDialog) Operation(org.rstudio.core.client.widget.Operation) HyperlinkLabel(org.rstudio.core.client.widget.HyperlinkLabel) SimpleRequestCallback(org.rstudio.studio.client.common.SimpleRequestCallback)

Aggregations

HTML (com.google.gwt.user.client.ui.HTML)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 MessageDialog (org.rstudio.core.client.widget.MessageDialog)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 HyperlinkLabel (org.rstudio.core.client.widget.HyperlinkLabel)1 Operation (org.rstudio.core.client.widget.Operation)1 HelpLink (org.rstudio.studio.client.common.HelpLink)1 SimpleRequestCallback (org.rstudio.studio.client.common.SimpleRequestCallback)1 VcsHelpLink (org.rstudio.studio.client.common.vcs.VcsHelpLink)1 SessionInfo (org.rstudio.studio.client.workbench.model.SessionInfo)1