@Override
  protected void buildDialog(
      Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {
    builder
        .setTitle(NEW_HASKELL_FILE)
        .addKind("Empty module", HaskellIcons.FILE, "Haskell Module")
        .setValidator(
            new InputValidatorEx() {
              @Nullable
              @Override
              public String getErrorText(String inputString) {
                final String error = " is not a valid Haskell module name.";
                if (inputString.isEmpty()) {
                  return null;
                }
                if (VALID_MODULE_NAME_REGEX.matcher(inputString).matches()) {
                  return null;
                }
                return '\'' + inputString + '\'' + error;
              }

              @Override
              public boolean checkInput(String inputString) {
                return true;
              }

              @Override
              public boolean canClose(String inputString) {
                return getErrorText(inputString) == null;
              }
            });
  }
  //    @Override
  protected void buildDialog(
      Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {

    PsiFile childs[] = directory.getFiles();

    Set<String> packages = new HashSet<String>();

    for (PsiFile child : childs) {
      if (child instanceof GoFile) {
        GoFile goFile = (GoFile) child;

        if (!goFile.getPackage().isMainPackage()) {
          packages.add(goFile.getPackage().getPackageName());
        }
      }
    }

    builder.addKind("New file", GoIcons.GO_ICON_16x16, "single");

    for (String packageName : packages) {
      builder.addKind(
          "New file in library: " + packageName, GoIcons.GO_ICON_16x16, "lib." + packageName);
    }
  }