eventBus.addHandler(OpenProjectFileEvent.TYPE, this);
eventBus.addHandler(SessionInitEvent.TYPE, new SessionInitHandler() {
public void onSessionInit(SessionInitEvent sie)
{
SessionInfo sessionInfo = session.getSessionInfo();
// ensure mru is initialized
ProjectMRUList mruList = pMRUList_.get();
// enable/disable commands
String activeProjectFile = sessionInfo.getActiveProjectFile();
boolean hasProject = activeProjectFile != null;
commands.closeProject().setEnabled(hasProject);
commands.projectOptions().setEnabled(hasProject);
// remove version control commands if necessary
if (!sessionInfo.isVcsEnabled())
{
commands.activateVcs().remove();
commands.vcsCommit().remove();
commands.vcsShowHistory().remove();
commands.vcsPull().remove();
commands.vcsPush().remove();
commands.vcsCleanup().remove();
}
else
{
commands.activateVcs().setMenuLabel(
"Show _" + sessionInfo.getVcsName());
// customize for svn if necessary
if (sessionInfo.getVcsName().equals(VCSConstants.SVN_ID))
{
commands.vcsPush().remove();
commands.vcsPull().setButtonLabel("Update");
commands.vcsPull().setMenuLabel("_Update");
}
// customize for git if necessary
if (sessionInfo.getVcsName().equals(VCSConstants.GIT_ID))
{
commands.vcsCleanup().remove();
}
}