mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
fix tests & community compilation
This commit is contained in:
@@ -25,8 +25,6 @@
|
||||
<orderEntry type="module" module-name="testng" scope="TEST" />
|
||||
<orderEntry type="module" module-name="ui-designer" scope="TEST" />
|
||||
<orderEntry type="module" module-name="eclipse" scope="TEST" />
|
||||
<orderEntry type="module" module-name="jsp-spi" scope="TEST" />
|
||||
<orderEntry type="module" module-name="jsp-impl" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -15,15 +15,12 @@
|
||||
*/
|
||||
package com.intellij.lang.java.parser;
|
||||
|
||||
import com.intellij.jsp.impl.JspSpiUtilImpl;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.LanguageASTFactory;
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.lang.java.JavaParserDefinition;
|
||||
import com.intellij.lang.jsp.JavaInJspProvider;
|
||||
import com.intellij.mock.MockModule;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
@@ -36,8 +33,6 @@ import com.intellij.psi.SingleRootFileViewProvider;
|
||||
import com.intellij.psi.impl.source.PsiJavaFileImpl;
|
||||
import com.intellij.psi.impl.source.tree.FileElement;
|
||||
import com.intellij.psi.impl.source.tree.JavaASTFactory;
|
||||
import com.intellij.psi.jsp.JspSpiUtil;
|
||||
import com.intellij.psi.jsp.MockJavaInJspHandler;
|
||||
import com.intellij.psi.tree.IFileElementType;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.testFramework.IdeaTestCase;
|
||||
@@ -77,10 +72,6 @@ public abstract class JavaParsingTestCase extends ParsingTestCase {
|
||||
myLanguageLevel = LanguageLevel.JDK_1_6;
|
||||
getProject().registerService(LanguageLevelProjectExtension.class, new LanguageLevelProjectExtensionImpl(getProject()));
|
||||
addExplicitExtension(LanguageASTFactory.INSTANCE, JavaLanguage.INSTANCE, new JavaASTFactory());
|
||||
final ExtensionPointName<JavaInJspProvider> javaInJspEP = ExtensionPointName.create("com.intellij.jsp.javaInJspProvider");
|
||||
registerExtensionPoint(javaInJspEP, JavaInJspProvider.class);
|
||||
registerExtension(javaInJspEP, new MockJavaInJspHandler());
|
||||
registerApplicationService(JspSpiUtil.class, new JspSpiUtilImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.psi.jsp;
|
||||
|
||||
import com.intellij.jsp.impl.JavaInJspHandler;
|
||||
import com.intellij.lang.jsp.JspFileViewProviderImpl;
|
||||
import com.intellij.lang.jsp.JspxFileViewProvider;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author gregsh
|
||||
*/
|
||||
public class MockJavaInJspHandler extends JavaInJspHandler {
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiFile createJavaFile(@NotNull JspxFileViewProvider provider) {
|
||||
final PsiFile file = super.createJavaFile(provider);
|
||||
file.putUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY, LanguageLevel.JDK_1_6);
|
||||
return file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillContextPrefixes(JspFileViewProviderImpl viewProvider,
|
||||
JspFileViewProviderImpl.PrefixesWithLanguage prefixes,
|
||||
boolean includesOnly) {
|
||||
viewProvider.fillLocalPrefixes(prefixes);
|
||||
}
|
||||
}
|
||||
@@ -140,25 +140,29 @@ public class MockFileTypeManager extends FileTypeManagerEx {
|
||||
if ("PLAIN_TEXT".equals(fileTypeName)) return PlainTextFileType.INSTANCE;
|
||||
Language language = Language.findLanguageByID(fileTypeName);
|
||||
if (language == null) {
|
||||
try {
|
||||
// StdFileTypes initialization..
|
||||
if ("JAVA".equals(fileTypeName)) language = (Language)Class.forName("com.intellij.lang.java.JavaLanguage").getField("INSTANCE").get(null);
|
||||
if ("XML".equals(fileTypeName)) language = (Language)Class.forName("com.intellij.lang.xml.XMLLanguage").getField("INSTANCE").get(null);
|
||||
if ("DTD".equals(fileTypeName)) language = (Language)Class.forName("com.intellij.lang.dtd.DTDLanguage").getField("INSTANCE").get(null);
|
||||
if ("JSP".equals(fileTypeName)) language = (Language)Class.forName("com.intellij.lang.jsp.NewJspLanguage").getField("INSTANCE").get(null);
|
||||
if ("JSPX".equals(fileTypeName)) language = (Language)Class.forName("com.intellij.lang.jspx.JSPXLanguage").getField("INSTANCE").get(null);
|
||||
if ("HTML".equals(fileTypeName)) language = (Language)Class.forName("com.intellij.lang.html.HTMLLanguage").getField("INSTANCE").get(null);
|
||||
if ("XHTML".equals(fileTypeName)) language = (Language)Class.forName("com.intellij.lang.xhtml.XHTMLLanguage").getField("INSTANCE").get(null);
|
||||
if ("JavaScript".equals(fileTypeName)) language = (Language)Class.forName("com.intellij.lang.javascript.JavascriptLanguage").getField("INSTANCE").get(null);
|
||||
if ("Properties".equals(fileTypeName)) language = (Language)Class.forName("com.intellij.lang.properties.PropertiesLanguage").getField("INSTANCE").get(null);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// StdFileTypes initialization..
|
||||
if ("JAVA".equals(fileTypeName)) language = loadLanguageSafe("com.intellij.lang.java.JavaLanguage");
|
||||
if ("XML".equals(fileTypeName)) language = loadLanguageSafe("com.intellij.lang.xml.XMLLanguage");
|
||||
if ("DTD".equals(fileTypeName)) language = loadLanguageSafe("com.intellij.lang.dtd.DTDLanguage");
|
||||
if ("JSP".equals(fileTypeName)) language = loadLanguageSafe("com.intellij.lang.jsp.NewJspLanguage");
|
||||
if ("JSPX".equals(fileTypeName)) language = loadLanguageSafe("com.intellij.lang.jspx.JSPXLanguage");
|
||||
if ("HTML".equals(fileTypeName)) language = loadLanguageSafe("com.intellij.lang.html.HTMLLanguage");
|
||||
if ("XHTML".equals(fileTypeName)) language = loadLanguageSafe("com.intellij.lang.xhtml.XHTMLLanguage");
|
||||
if ("JavaScript".equals(fileTypeName)) language = loadLanguageSafe("com.intellij.lang.javascript.JavascriptLanguage");
|
||||
if ("Properties".equals(fileTypeName)) language = loadLanguageSafe("com.intellij.lang.properties.PropertiesLanguage");
|
||||
}
|
||||
return new MockLanguageFileType(language == null? PlainTextLanguage.INSTANCE : language, fileTypeName.toLowerCase());
|
||||
}
|
||||
|
||||
private static Language loadLanguageSafe(final String className) {
|
||||
try {
|
||||
return (Language)Class.forName(className).getField("INSTANCE").get(null);
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchemesManager<FileType, AbstractFileType> getSchemesManager() {
|
||||
return SchemesManager.EMPTY;
|
||||
|
||||
@@ -58,17 +58,6 @@ public abstract class ParsingTestCase extends PlatformLiteFixture {
|
||||
protected Language myLanguage;
|
||||
private ParserDefinition[] myDefinitions = new ParserDefinition[0];
|
||||
|
||||
public ParsingTestCase(@NonNls String dataPath, String fileExt) {
|
||||
myFullDataPath = getTestDataPath() + "/psi/" + dataPath;
|
||||
myFileExt = fileExt;
|
||||
}
|
||||
|
||||
public ParsingTestCase(@NonNls String dataPath, String fileExt, Language language) {
|
||||
myLanguage = language;
|
||||
myFullDataPath = getTestDataPath() + dataPath;
|
||||
myFileExt = fileExt;
|
||||
}
|
||||
|
||||
public ParsingTestCase(@NonNls String dataPath, String fileExt, ParserDefinition... definitions) {
|
||||
myDefinitions = definitions;
|
||||
myFullDataPath = getTestDataPath() + "/" + dataPath;
|
||||
|
||||
Reference in New Issue
Block a user