Customize welcome screen options in MPS

Hi,

   When we open MPS, we will be getting the initial welcome screen like .I want to customize the available options like removing a menu item (for ex) Open Sample Proj) from here. or adding new action to the existing list.
How can i customize the menus shown here? 

1
5 comments

Hello,

Open Sample Project action can be removed by removing MPS/plugins/samples.jar from distribution (or excluding it from build script for standalone MPS).
Removing other actions is harder, because Create New Project and Open Project actions are registered in MPS/lib/mps-workbench.jar!/idea/MPSActionManager.xml (or in sources mps/workbench/mps-workbench/source/idea/MPSActionManager.xml).
And Check out from Version Control is platform action.

But you can easily add your actions here:
There is mps/workbench/resources/source/idea/PlatformActions.xml  (or in distribution at MPS/lib/mps-resources.jar!/idea/PlatfromActions.xml) where there are three action groups you can be intrested in:

  • WelcomeScreen.QuickStart - to this group you can add actions, which will be shown on welcome screen actions list. Actions Create New ProjectOpen Project  and Open Sample Project are added to this group.
  • WelcomeScreen.Documentation - to this group you can add some documentation actions, which will be shown in dropdown list under Get Help menu.
  • WelcomeScreen.Configure - to this group you can add some settings related actions, which will be shown in dropdown list under Configure menu.

To add action to one of this groups, you need to create your own group in plugin.xml and add this group to one of groups above by id.
Here is example from samples action

<group id="MPSWelcomeSamplesMenu">
<action id="OpenSampleLanguageProject"
class="jetbrains.mps.workbench.actions.welcomeScreen.OpenSampleProjectAction"
text="Open Sample Project"
description="Choose one of the MPS sample project files"/>
<add-to-group group-id="WelcomeScreen.Documentation" anchor="last"/>
<add-to-group group-id="MPSWelcomeGettingStartedMenu" anchor="last"/> <!-- group added to WelcomeScreen.QuickStart -->

</group>

If icon is specified for action, it will be shown, or you can set it by icon parameter for action tag. Same is right for text and description.
Group can be added to several other groups with anchor for general place inside group or relative to other action in combination with relative-to-action parameter (by group id).

2
Avatar
Permanently deleted user

Thank you @Victor :) 

0
Avatar
Permanently deleted user

I am trying to customize the welcome screen in a standalone IDE MPS. These instructions work if I use the existing actions (e.g., jetbrains.mps.workbench.actions.NewMPSProjectAction), but if I tried my custom action it does not work. It says that it cannot find the class: "class with name [..]  not found".

Any idea of how to fix this?

1

Hello Gabriele,

How is your action registered? If you use MPS plugin, than it is probably registered via code, not xml file, and is instantiated only when some project is opened, so action class has not been loaded yet on welcome screen.

Can you try to create plugin.xml with action registration and try if it works?
Look at MPS/plugins/samples.jar/META-INF/plugin.xml for reference.

1
Avatar
Permanently deleted user

Hello Victor,

thanks for your help.

To load the action I have edited the build script for the plugin, in order to generate a plugin.xml that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<idea-plugin version="2">
  [..]
  <actions>
    <group id="MPSWelcomeSamplesMenu">
<action id="CreateNewExampleProjectAction"
              class="MyIDE.plugin.CreateExampleAction"
              text="Create New Example Project"
description="You can create a new project with this action"/>
  <add-to-group group-id="WelcomeScreen.QuickStart" anchor="last"/> <!-- group added to WelcomeScreen.QuickStart -->
</group>
  </actions>
  [..]
</idea-plugin>

However, it gives the error mentioned in my previous comment: it does not find the class.

1

Please sign in to leave a comment.