IDEA-19372: Refactoring: Extract .tag file for static piece of JSP pycharm/96.742
authorDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Thu, 22 Jul 2010 14:39:11 +0000 (18:39 +0400)
committerDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Thu, 22 Jul 2010 14:39:11 +0000 (18:39 +0400)
java/jsp-base-openapi/src/com/intellij/psi/jsp/BaseJspFile.java
platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java
platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightFixtureTestCase.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
xml/impl/src/com/intellij/xml/util/XmlUtil.java

index 2327d9b7ad54272dc3afe4b24ded6ee85d0ee863..08e182bfc84269cfe5e3fad682fd0f2a554d51fc 100644 (file)
@@ -32,7 +32,7 @@ public interface BaseJspFile extends XmlFile {
   boolean isTagPage();
 
   XmlTag[] getDirectiveTags(JspDirectiveKind directiveKind, final boolean searchInIncludes);
-  XmlTag createDirective(XmlTag context, JspDirectiveKind page);
+  XmlTag createDirective(XmlTag context, JspDirectiveKind directiveKind);
 
   PsiFile getBaseLanguageRoot();
   /**
@@ -43,4 +43,4 @@ public interface BaseJspFile extends XmlFile {
 
   @NotNull
   JspxFileViewProvider getViewProvider();
-}
\ No newline at end of file
+}
index 8ed063a63bbf2349a1aac08a57f029f79b4c3a3c..a76d0a3738a516a355d5feaa85f7eb73247c6903 100644 (file)
@@ -658,8 +658,8 @@ public class VfsUtil {
   }
 
   @Nullable
-  public static VirtualFile createDirectoryIfMissing(@NotNull String dir) throws IOException {
-    return doCreateDirectoriesIfMissing(FileUtil.toSystemIndependentName(dir));
+  public static VirtualFile createDirectoryIfMissing(@NotNull String directoryPath) throws IOException {
+    return doCreateDirectoriesIfMissing(FileUtil.toSystemIndependentName(directoryPath));
   }
 
   private static VirtualFile doCreateDirectoriesIfMissing(String dir) throws IOException {
index d08ecca169efbd75ef27249ea7145f4e54c2c9f7..4f737128668537a09716f7fa66ed848bf938825a 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiFile;
 import com.intellij.testFramework.UsefulTestCase;
 import com.intellij.testFramework.builders.EmptyModuleFixtureBuilder;
 import org.jetbrains.annotations.NonNls;
@@ -83,4 +84,8 @@ public abstract class CodeInsightFixtureTestCase extends UsefulTestCase {
   protected Editor getEditor() {
     return myFixture.getEditor();
   }
+
+  protected PsiFile getFile() {
+    return myFixture.getFile();
+  }
 }
index 07b303e3a8b9aac6f7e6000171e135205a1bcf7c..51826773cf314bac88fd1749567e38c95597e482 100644 (file)
@@ -185,7 +185,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
           FileUtil.copy(fromFile, destFile);
         }
         catch (IOException e) {
-          throw new RuntimeException(e);
+          throw new RuntimeException("Cannot copy " + fromFile + " to " + destFile, e);
         }
       }
     }
index 3e803752e185e17b816dc2f7f40c0cdea7e28fa7..5d7e3834e6c39fba558151364cc9c4619d344325 100644 (file)
@@ -190,12 +190,17 @@ public class XmlUtil {
     return null;
   }
 
-  @Nullable
-  public static String findNamespacePrefixByURI(XmlFile file, @NonNls String uri) {
+  @SuppressWarnings({"ConstantConditions"})
+  public static XmlTag getRootTag(XmlFile file) {
     if (file == null) return null;
     final XmlDocument document = file.getDocument();
     if (document == null) return null;
-    final XmlTag tag = document.getRootTag();
+    return document.getRootTag();
+  }
+
+  @Nullable
+  public static String findNamespacePrefixByURI(XmlFile file, @NonNls String uri) {
+    final XmlTag tag = getRootTag(file);
     if (tag == null) return null;
 
     for (XmlAttribute attribute : tag.getAttributes()) {