Format pom.xml on create new module.
authorSergey Evdokimov <sergey.evdokimov@jetbrains.com>
Tue, 8 Oct 2013 15:08:37 +0000 (19:08 +0400)
committerSergey Evdokimov <sergey.evdokimov@jetbrains.com>
Tue, 8 Oct 2013 15:09:16 +0000 (19:09 +0400)
plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.java

index 1aa0de6dea835f5514f98154e911a56e933be26e..fba889c8be83a14f253ec1ee3c7fe8316054d4ff 100644 (file)
@@ -15,6 +15,7 @@
  */
 package org.jetbrains.idea.maven.utils;
 
+import com.intellij.codeInsight.actions.ReformatCodeProcessor;
 import com.intellij.codeInsight.lookup.LookupElement;
 import com.intellij.codeInsight.lookup.LookupElementBuilder;
 import com.intellij.codeInsight.template.TemplateManager;
@@ -51,6 +52,8 @@ import com.intellij.openapi.vfs.JarFileSystem;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VfsUtil;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiManager;
 import com.intellij.util.DisposeAwareRunnable;
 import com.intellij.util.Function;
 import com.intellij.util.SystemProperties;
@@ -358,6 +361,11 @@ public class MavenUtil {
     }
     else {
       VfsUtil.saveText(file, template.getTemplateText());
+
+      PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
+      if (psiFile != null) {
+        new ReformatCodeProcessor(project, psiFile, null, false).run();
+      }
     }
   }