Yesterday we saw how we can slim down our standard welcome screen by removing unwanted tabs (sections).
Alternatively, we can tell MPS to use a “flat”, tabless welcome screen instead of the default one. Here is what the standard tabless screen looks like:
To use this welcome screen we need to set the system property use.tabbed.welcome.screen
to false
. The easiest way to
do so is to add a corresponding line to the vm options section of the RCP startup script in MPS:
If you are not against some more XML patching, you can also replace the standard actions by custom ones. The actions on
this screen are taken from the WelcomeScreen.QuickStart
action group that is extended in two different places.
Specifically, we need to patch META-INF/VcsActions.xml
in lib/platform-impl.jar
to remove this bit:
<reference ref="Vcs.VcsClone">
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
</reference>
and we can do it with the following xml-patch excerpt:
<diff>
<remove sel="idea-plugin/actions/reference[@ref='Vcs.VcsClone'
and .//add-to-group[@group-id='WelcomeScreen.QuickStart']]" />
</diff>
This removes the “Get from Version Control” action.
To remove the other two actions, we need to patch idea/MPSActionManager.xml
contained in lib/mps-workbench.jar
. The
interesting fragment in this file is this:
<group id="WelcomeScreen.QuickStart.MPS">
<action id="WelcomeScreen.CreateNewProject"
class="jetbrains.mps.workbench.actions.NewMPSProjectAction"
text="New Project"
description="You can create a new project with this action"/>
<action id="WelcomeScreen.OpenProject"
class="jetbrains.mps.workbench.actions.OpenMPSProjectAction"
text="Open"
description="You can open existing project with this action"/>
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
</group>
And we can either remove the group completely or remove actions from it. I prefer the latter, to keep changes as minimal as possible:
<diff>
<remove msel="idea-plugin/actions/group[@id='WelcomeScreen.QuickStart.MPS']/action" />
</diff>
(The msel
above indicates that I expect more than one XML element to match the selection.)
Now the welcome screen is practically empty, apart from the two dropdown menus in the bottom-right corner.
The dropdowns (Configure and Get Help) are unfortunately hardcoded and impossible to remove without replacing the entire welcome screen with custom code, which is even more involved than XML patching, so we will not go there today.
Now we can start adding our own custom actions. Adding is much easier than removing, of course, and can be done with standard MPS means. I have previously described how you can create an action and add it to an existing group.
The IDEA group WelcomeScreen.QuickStart
does not exist in MPS, we first need to create a representation of this group
ourselves. This is done by creating a bootstrap group which is a special group whose identifier we can set manually:
Now we can add our custom action to this group via an intermediate group:
And this is what our resulting welcome screen looks like: