use of org.rstudio.core.client.command.VisibleChangedHandler in project rstudio by rstudio.
the class RSConnectPublishButton method initialize.
@Inject
public void initialize(RSConnectServerOperations server, RMarkdownServerOperations rmdServer, EventBus events, Commands commands, GlobalDisplay display, Provider<UIPrefs> pUiPrefs, Session session, PlotPublishMRUList plotMru) {
server_ = server;
rmdServer_ = rmdServer;
events_ = events;
commands_ = commands;
display_ = display;
session_ = session;
pUiPrefs_ = pUiPrefs;
plotMru_ = plotMru;
// initialize visibility if requested
if (boundCommand_ != null) {
boundCommand_.addVisibleChangedHandler(new VisibleChangedHandler() {
@Override
public void onVisibleChanged(AppCommand command) {
applyVisiblity();
}
});
boundCommand_.addEnabledChangedHandler(new EnabledChangedHandler() {
@Override
public void onEnabledChanged(AppCommand command) {
applyVisiblity();
}
});
}
events_.addHandler(RSConnectDeploymentCompletedEvent.TYPE, this);
events_.addHandler(RPubsUploadStatusEvent.TYPE, this);
events_.addHandler(RmdRenderCompletedEvent.TYPE, this);
events_.addHandler(HTMLPreviewCompletedEvent.TYPE, this);
}
use of org.rstudio.core.client.command.VisibleChangedHandler in project rstudio by rstudio.
the class ConnectionsPane method createMainToolbar.
@Override
protected Toolbar createMainToolbar() {
toolbar_ = new Toolbar();
searchWidget_ = new SearchWidget(new SuggestOracle() {
@Override
public void requestSuggestions(Request request, Callback callback) {
// no suggestions
callback.onSuggestionsReady(request, new Response(new ArrayList<Suggestion>()));
}
});
backToConnectionsButton_ = new ToolbarButton(commands_.helpBack().getImageResource(), (ClickHandler) null);
backToConnectionsButton_.setTitle("View all connections");
// connect meuu
ToolbarPopupMenu connectMenu = new ToolbarPopupMenu();
connectMenu.addItem(connectMenuItem(commands_.historySendToConsole().getImageResource(), "R Console", ConnectionOptions.CONNECT_R_CONSOLE));
connectMenu.addSeparator();
connectMenu.addItem(connectMenuItem(commands_.newSourceDoc().getImageResource(), "New R Script", ConnectionOptions.CONNECT_NEW_R_SCRIPT));
connectMenu.addItem(connectMenuItem(commands_.newRNotebook().getImageResource(), "New R Notebook", ConnectionOptions.CONNECT_NEW_R_NOTEBOOK));
if (BrowseCap.INSTANCE.canCopyToClipboard()) {
connectMenu.addSeparator();
connectMenu.addItem(connectMenuItem(commands_.copyPlotToClipboard().getImageResource(), "Copy to Clipboard", ConnectionOptions.CONNECT_COPY_TO_CLIPBOARD));
}
connectMenuButton_ = new ToolbarButton("Connect", commands_.newConnection().getImageResource(), connectMenu);
// manage connect menu visibility
connectMenuButton_.setVisible(!commands_.disconnectConnection().isVisible());
commands_.disconnectConnection().addVisibleChangedHandler(new VisibleChangedHandler() {
@Override
public void onVisibleChanged(AppCommand command) {
connectMenuButton_.setVisible(!commands_.disconnectConnection().isVisible());
}
});
installConnectionsToolbar();
return toolbar_;
}
Aggregations