private void updateRightPanel() {
    setOKActionEnabled(myCurrentTemplateItem != null);

    String description =
        myCurrentTemplateItem != null ? myCurrentTemplateItem.getDescription() : null;
    if (StringUtil.isNotEmpty(description)) {
      StringBuilder sb = new StringBuilder("<html><body><font face=\"Verdana\" ");
      sb.append(SystemInfo.isMac ? "" : "size=\"-1\"").append('>');
      sb.append(description).append("</font></body></html>");
      description = sb.toString();
    }
    myDescriptionPane.setText(description);
    myDescriptionPanel.setVisible(description != null);

    JComponent component =
        myCurrentTemplateItem != null ? myCurrentTemplateItem.getSettings() : null;
    myTemplateSettings.removeAll();
    if (component != null) {
      myTemplateSettings.add(
          component,
          new GridConstraints(
              0,
              0,
              1,
              1,
              GridConstraints.ANCHOR_NORTHWEST,
              GridConstraints.FILL_BOTH,
              GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
              GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
              null,
              null,
              null));
      myTemplateSettings.add(
          myProjectFormatPanel.getPanel(),
          new GridConstraints(
              1,
              0,
              1,
              1,
              GridConstraints.ANCHOR_NORTHWEST,
              GridConstraints.FILL_HORIZONTAL,
              GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
              GridConstraints.SIZEPOLICY_FIXED,
              null,
              null,
              null,
              1));
    }
    if (myCurrentTemplateItem != null)
      myCurrentTemplateItem.setNewProjectPath(myProjectPath.getPath());
    myTemplateSettingsHolder.setVisible(component != null);
  }
  @Override
  protected void doOKAction() {
    super.doOKAction();

    if (myCurrentProject != null) {
      int exitCode =
          Messages.showDialog(
              IdeBundle.message("prompt.open.project.in.new.frame"),
              IdeBundle.message("title.open.project"),
              new String[] {
                IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe")
              },
              1,
              Messages.getQuestionIcon());
      if (exitCode == 1) {
        ProjectUtil.closeAndDispose(myCurrentProject);
      }
    }

    final ProjectOptions myOptions = new ProjectOptions();
    myOptions.setProjectName(myProjectName.getText());
    myOptions.setProjectPath(myProjectPath.getPath());
    myOptions.setCreateNewLanguage(false);
    myOptions.setCreateNewSolution(false);
    myOptions.setStorageScheme(myProjectFormatPanel.isDefault());

    // invoke later is for plugins to be ready
    ApplicationManager.getApplication()
        .invokeLater(
            new Runnable() {
              @Override
              public void run() {
                try {
                  ProjectFactory factory = new ProjectFactory(myCurrentProject, myOptions);
                  Project project = factory.createProject();
                  myCurrentTemplateItem
                      .getTemplateFiller()
                      .fillProjectWithModules(project.getComponent(MPSProject.class));
                  factory.activate();
                } catch (ProjectNotCreatedException e) {
                  Messages.showErrorDialog(getContentPane(), e.getMessage());
                }
              }
            });
  }