IDEA-19372: Refactoring: Extract .tag file for static piece of JSP

This commit is contained in:
Dmitry Avdeev
2010-07-22 18:39:11 +04:00
parent 70683e16ce
commit f8dfd6beb4
5 changed files with 18 additions and 8 deletions
@@ -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();
}
}
@@ -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 {
@@ -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();
}
}
@@ -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);
}
}
}
@@ -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()) {