use of org.rstudio.core.client.command.impl.DesktopMenuCallback in project rstudio by rstudio.
the class DesktopApplicationHeader method initialize.
@Inject
public void initialize(final Commands commands, EventBus events, final Session session, ApplicationServerOperations server, Provider<DesktopHooks> pDesktopHooks, Provider<CodeSearch> pCodeSearch, Provider<UIPrefs> pUIPrefs, ErrorManager errorManager, GlobalDisplay globalDisplay, ApplicationQuit appQuit) {
session_ = session;
eventBus_ = events;
pUIPrefs_ = pUIPrefs;
globalDisplay_ = globalDisplay;
ignoredUpdates_ = IgnoredUpdates.create();
server_ = server;
appQuit_ = appQuit;
binder_.bind(commands, this);
commands.mainMenu(new DesktopMenuCallback());
pDesktopHooks.get();
commands.uploadFile().remove();
commands.exportFiles().remove();
commands.updateCredentials().remove();
commands.checkForUpdates().setVisible(true);
commands.showLogFiles().setVisible(true);
commands.diagnosticsReport().setVisible(true);
commands.showFolder().setVisible(true);
events.addHandler(SessionInitEvent.TYPE, new SessionInitHandler() {
public void onSessionInit(SessionInitEvent sie) {
final SessionInfo sessionInfo = session.getSessionInfo();
toolbar_.completeInitialization(sessionInfo);
new JSObjectStateValue("updates", "ignoredUpdates", ClientState.PERSISTENT, session_.getSessionInfo().getClientState(), false) {
@Override
protected void onInit(JsObject value) {
if (value != null)
ignoredUpdates_ = value.cast();
}
@Override
protected JsObject getValue() {
ignoredUpdatesDirty_ = false;
return ignoredUpdates_.cast();
}
@Override
protected boolean hasChanged() {
return ignoredUpdatesDirty_;
}
};
Scheduler.get().scheduleFinally(new ScheduledCommand() {
public void execute() {
Desktop.getFrame().onWorkbenchInitialized(sessionInfo.getScratchDir());
if (sessionInfo.getDisableCheckForUpdates())
commands.checkForUpdates().remove();
if (!sessionInfo.getDisableCheckForUpdates() && pUIPrefs_.get().checkForUpdates().getValue()) {
checkForUpdates(false);
}
}
});
}
});
events.addHandler(ShowFolderEvent.TYPE, new ShowFolderHandler() {
public void onShowFolder(ShowFolderEvent event) {
Desktop.getFrame().showFolder(event.getPath().getPath());
}
});
toolbar_ = new GlobalToolbar(commands, events, pCodeSearch);
ThemeStyles styles = ThemeResources.INSTANCE.themeStyles();
toolbar_.addStyleName(styles.desktopGlobalToolbar());
}
Aggregations