diff --git a/java/java-tests/testSrc/com/intellij/lang/java/parser/JavaParsingTestCase.java b/java/java-tests/testSrc/com/intellij/lang/java/parser/JavaParsingTestCase.java index 25a7d34c317b..6020148e610e 100644 --- a/java/java-tests/testSrc/com/intellij/lang/java/parser/JavaParsingTestCase.java +++ b/java/java-tests/testSrc/com/intellij/lang/java/parser/JavaParsingTestCase.java @@ -72,6 +72,13 @@ 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()); + try { + registerApplicationService((Class)Class.forName("com.intellij.psi.jsp.JspSpiUtil"), + Class.forName("com.intellij.jsp.impl.JspSpiUtilImpl").newInstance()); + } + catch (Exception ex) { + // jsp not available + } } @Override diff --git a/java/testFramework/src/com/intellij/testFramework/fixtures/InjectedLanguageFixtureTestCase.java b/java/testFramework/src/com/intellij/testFramework/fixtures/InjectedLanguageFixtureTestCase.java deleted file mode 100644 index 37029fb55703..000000000000 --- a/java/testFramework/src/com/intellij/testFramework/fixtures/InjectedLanguageFixtureTestCase.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2000-2009 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.testFramework.fixtures; - -import com.intellij.codeInsight.lookup.Lookup; -import com.intellij.codeInsight.lookup.LookupElement; -import com.intellij.codeInsight.lookup.LookupManager; -import com.intellij.codeInsight.lookup.impl.LookupImpl; -import com.intellij.openapi.application.Result; -import com.intellij.openapi.command.WriteCommandAction; -import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileTypes.FileType; -import com.intellij.psi.PsiFile; -import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; - -import java.util.Arrays; - -/** - * @author peter - */ -public abstract class InjectedLanguageFixtureTestCase extends LightCodeInsightFixtureTestCase { - protected void checkCompletionVariants(final FileType fileType, final String text, final String... strings) throws Throwable { - myFixture.configureByText(fileType, text.replaceAll("\\|", "")); - tuneCompletionFile(myFixture.getFile()); - final LookupElement[] elements = myFixture.completeBasic(); - assertNotNull(elements); - myFixture.checkResult(text.replaceAll("\\|", "")); - - assertSameElements(ContainerUtil.map(elements, new Function() { - @Override - public String fun(final LookupElement lookupItem) { - return lookupItem.getLookupString(); - } - }), strings); - } - - protected void assertNoVariants(final FileType fileType, final String text) throws Throwable { - checkCompleted(fileType, text, text); - } - - protected void checkCompleted(final FileType fileType, final String text, final String resultText) throws Throwable { - myFixture.configureByText(fileType, text.replaceAll("\\|", "")); - tuneCompletionFile(myFixture.getFile()); - final LookupElement[] elements = myFixture.completeBasic(); - if (elements != null && elements.length == 1) { - new WriteCommandAction(getProject()) { - @Override - protected void run(Result result) throws Throwable { - ((LookupImpl)LookupManager.getInstance(getProject()).getActiveLookup()).finishLookup(Lookup.NORMAL_SELECT_CHAR); - } - }.execute(); - } - else if (elements != null && elements.length > 0) { - fail(Arrays.toString(elements)); - } - myFixture.checkResult(resultText.replaceAll("\\|", "")); - FileDocumentManager.getInstance().saveDocument(myFixture.getDocument(myFixture.getFile())); - } - - protected void tuneCompletionFile(PsiFile file) { - } - -} diff --git a/platform/platform-impl/src/com/intellij/notification/EventLogConsole.java b/platform/platform-impl/src/com/intellij/notification/EventLogConsole.java index 06e2deb0b0b4..b1e08cfac799 100644 --- a/platform/platform-impl/src/com/intellij/notification/EventLogConsole.java +++ b/platform/platform-impl/src/com/intellij/notification/EventLogConsole.java @@ -113,7 +113,7 @@ class EventLogConsole { Document document = myLogEditor.getDocument(); boolean scroll = document.getTextLength() == myLogEditor.getCaretModel().getOffset(); - append(document, DateFormat.getTimeInstance(DateFormat.MEDIUM).format(notification.getCreationTime()) + " "); + append(document, DateFormat.getTimeInstance(DateFormat.MEDIUM).format(notification.getCreationTime()) + ". "); EventLog.LogEntry pair = EventLog.formatForLog(notification); diff --git a/platform/testFramework/src/com/intellij/mock/MockFileTypeManager.java b/platform/testFramework/src/com/intellij/mock/MockFileTypeManager.java index 98759dcec56a..45082cdc451d 100644 --- a/platform/testFramework/src/com/intellij/mock/MockFileTypeManager.java +++ b/platform/testFramework/src/com/intellij/mock/MockFileTypeManager.java @@ -1,6 +1,5 @@ package com.intellij.mock; -import com.intellij.lang.Language; import com.intellij.openapi.fileTypes.*; import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; import com.intellij.openapi.fileTypes.impl.AbstractFileType; @@ -138,25 +137,21 @@ public class MockFileTypeManager extends FileTypeManagerEx { public FileType getStdFileType(@NotNull @NonNls final String fileTypeName) { if ("ARCHIVE".equals(fileTypeName) || "CLASS".equals(fileTypeName)) return UnknownFileType.INSTANCE; if ("PLAIN_TEXT".equals(fileTypeName)) return PlainTextFileType.INSTANCE; - Language language = Language.findLanguageByID(fileTypeName); - if (language == null) { - // 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()); + if ("JAVA".equals(fileTypeName)) return loadFileTypeSafe("com.intellij.ide.highlighter.JavaFileType"); + if ("XML".equals(fileTypeName)) return loadFileTypeSafe("com.intellij.ide.highlighter.XmlFileType"); + if ("DTD".equals(fileTypeName)) return loadFileTypeSafe("com.intellij.ide.highlighter.DTDFileType"); + if ("JSP".equals(fileTypeName)) return loadFileTypeSafe("com.intellij.ide.highlighter.NewJspFileType"); + if ("JSPX".equals(fileTypeName)) return loadFileTypeSafe("com.intellij.ide.highlighter.JspxFileType"); + if ("HTML".equals(fileTypeName)) return loadFileTypeSafe("com.intellij.ide.highlighter.HtmlFileType"); + if ("XHTML".equals(fileTypeName)) return loadFileTypeSafe("com.intellij.ide.highlighter.XHtmlFileType"); + if ("JavaScript".equals(fileTypeName)) return loadFileTypeSafe("com.intellij.lang.javascript.JavaScriptFileType"); + if ("Properties".equals(fileTypeName)) return loadFileTypeSafe("com.intellij.lang.properties.PropertiesFileType"); + return new MockLanguageFileType(PlainTextLanguage.INSTANCE, fileTypeName.toLowerCase()); } - private static Language loadLanguageSafe(final String className) { + private static FileType loadFileTypeSafe(final String className) { try { - return (Language)Class.forName(className).getField("INSTANCE").get(null); + return (FileType)Class.forName(className).getField("INSTANCE").get(null); } catch (Exception e) { return null; diff --git a/platform/testFramework/src/com/intellij/mock/MockLanguageFileType.java b/platform/testFramework/src/com/intellij/mock/MockLanguageFileType.java index d789e952643c..89644063f5d7 100644 --- a/platform/testFramework/src/com/intellij/mock/MockLanguageFileType.java +++ b/platform/testFramework/src/com/intellij/mock/MockLanguageFileType.java @@ -43,7 +43,7 @@ public class MockLanguageFileType extends LanguageFileType{ @Override public boolean equals(Object obj) { - if (!(obj instanceof MockLanguageFileType)) return false; - return getLanguage().equals(((MockLanguageFileType)obj).getLanguage()); + if (!(obj instanceof LanguageFileType)) return false; + return getLanguage().equals(((LanguageFileType)obj).getLanguage()); } } diff --git a/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java b/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java index 4b575ab0da1f..65834dfaab54 100644 --- a/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java @@ -51,7 +51,7 @@ import java.io.IOException; public abstract class ParsingTestCase extends PlatformLiteFixture { protected String myFilePrefix = ""; protected String myFileExt; - @NonNls private final String myFullDataPath; + @NonNls protected final String myFullDataPath; protected PsiFile myFile; private MockPsiManager myPsiManager; private PsiFileFactoryImpl myFileFactory; diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java index 862159f90816..264898616be4 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java @@ -313,8 +313,6 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture { Document getDocument(PsiFile file); - void setFileContext(@Nullable PsiElement context); - @NotNull Collection findAllGutters(String filePath); diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index e45af68a650b..df0fdb55d753 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -94,7 +94,6 @@ import com.intellij.psi.impl.PsiManagerImpl; import com.intellij.psi.impl.cache.impl.todo.TodoIndex; import com.intellij.psi.impl.source.PostprocessReformattingAspect; import com.intellij.psi.impl.source.PsiFileImpl; -import com.intellij.psi.impl.source.resolve.FileContextUtil; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.search.UsageSearchContext; @@ -151,7 +150,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig private final TempDirTestFixture myTempDirFixture; protected final IdeaProjectTestFixture myProjectFixture; @NonNls private static final String XXX = "XXX"; - private PsiElement myFileContext; private final FileTreeAccessFilter myJavaFilesFilter = new FileTreeAccessFilter(); private boolean myAllowDirt; private boolean toInitializeDaemon; @@ -901,19 +899,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig @Override public void run() { final CodeCompletionHandlerBase handler = new CodeCompletionHandlerBase(type) { - @Override - protected PsiFile createFileCopy(final PsiFile file) { - final PsiFile copy = super.createFileCopy(file); - if (myFileContext != null) { - final PsiElement contextCopy = myFileContext.copy(); - final PsiFile containingFile = contextCopy.getContainingFile(); - if (containingFile instanceof PsiFileImpl) { - ((PsiFileImpl)containingFile).setOriginalFile(myFileContext.getContainingFile()); - } - setContext(copy, contextCopy); - } - return copy; - } @Override protected void completionFinished(int offset1, @@ -1064,7 +1049,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig myInspections = null; myAvailableLocalTools.clear(); myAvailableTools.clear(); - myFileContext = null; myProjectFixture.tearDown(); myTempDirFixture.tearDown(); @@ -1221,12 +1205,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig return PsiDocumentManager.getInstance(getProject()).getDocument(file); } - @Override - public void setFileContext(@Nullable final PsiElement context) { - myFileContext = context; - setContext(myFile, context); - } - /** * @param filePath * @throws IOException @@ -1266,7 +1244,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig throw new RuntimeException(e); } myFile = myPsiManager.findFile(copy); - setContext(myFile, myFileContext); myEditor = createEditor(copy); assert myEditor != null : "Editor couldn't be created for file: " + copy.getPath() + @@ -1292,12 +1269,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig return myFile; } - private static void setContext(final PsiFile file, final PsiElement context) { - if (file != null && context != null) { - file.putUserData(FileContextUtil.INJECTED_IN_ELEMENT, new IdentitySmartPointer(context)); - } - } - @Override public VirtualFile findFileInTempDir(final String filePath) { if (myTempDirFixture instanceof LightTempDirTestFixtureImpl) { diff --git a/plugins/groovy/jetgroovy.iml b/plugins/groovy/jetgroovy.iml index 2aa6f1509ccc..883b5316b0df 100644 --- a/plugins/groovy/jetgroovy.iml +++ b/plugins/groovy/jetgroovy.iml @@ -20,7 +20,7 @@ - + diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/InjectedGroovyTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/InjectedGroovyTest.groovy index be081f16927d..f9e07e63b86c 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/InjectedGroovyTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/InjectedGroovyTest.groovy @@ -15,6 +15,9 @@ */ package org.jetbrains.plugins.groovy.completion +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiFile +import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil import com.intellij.psi.util.PsiTreeUtil import com.intellij.psi.xml.XmlText import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase @@ -43,4 +46,14 @@ s.codePointAt(0) """) } + public void testIntelliLangInjections() throws Exception { + myFixture.addClass("package groovy.lang; public class GroovyShell { public void evaluate(String s) { }}"); + final PsiFile psiFile = myFixture.configureByText("script.groovy", 'new groovy.lang.GroovyShell().evaluate("s = new String()")'); + assertNotNull(psiFile); + def offset = psiFile.getText().indexOf('"') + 1 + final PsiElement elementAt = psiFile.findElementAt(offset); + assertNotNull(elementAt); + assert InjectedLanguageUtil.findInjectedPsiNoCommit(psiFile, offset) + } + } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyInjectionTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyInjectionTest.java deleted file mode 100644 index 3b4719d06946..000000000000 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyInjectionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2000-2010 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 org.jetbrains.plugins.groovy.lang; - -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.TextRange; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; -import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; -import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; -import org.intellij.plugins.intelliLang.inject.InjectorUtils; - -import java.util.List; - -/** - * @author Gregory.Shrago - */ -public class GroovyInjectionTest extends LightCodeInsightFixtureTestCase { - public void testIntelliLangInjections() throws Exception { - myFixture.addClass("package groovy.lang; public class GroovyShell { void evaluate(String s) { }}"); - final PsiFile psiFile = myFixture.configureByText("script.groovy", "void f() { new groovy.lang.GroovyShell().evaluate(\"s = new String()\") }"); - assertNotNull(psiFile); - final PsiElement elementAt = psiFile.findElementAt(psiFile.getText().indexOf('\"') + 1); - assertNotNull(elementAt); - InjectedLanguageUtil.forceInjectionOnElement(elementAt); - final List> files = InjectedLanguageUtil.getInjectedPsiFiles(elementAt); - } -} diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesFileType.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesFileType.java index 7c675340c93d..6bcbc49e3553 100644 --- a/plugins/properties/src/com/intellij/lang/properties/PropertiesFileType.java +++ b/plugins/properties/src/com/intellij/lang/properties/PropertiesFileType.java @@ -20,8 +20,8 @@ import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.encoding.EncodingManager; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.nio.charset.Charset; @@ -31,7 +31,7 @@ import java.nio.charset.Charset; */ public class PropertiesFileType extends LanguageFileType { public static final Icon FILE_ICON = IconLoader.getIcon("/fileTypes/properties.png"); - public static final LanguageFileType FILE_TYPE = new PropertiesFileType(); + public static final LanguageFileType INSTANCE = new PropertiesFileType(); @NonNls public static final String DEFAULT_EXTENSION = "properties"; @NonNls public static final String DOT_DEFAULT_EXTENSION = "."+DEFAULT_EXTENSION; diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesFileTypeFactory.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesFileTypeFactory.java index f0555f3ccd7a..110b483fbfed 100644 --- a/plugins/properties/src/com/intellij/lang/properties/PropertiesFileTypeFactory.java +++ b/plugins/properties/src/com/intellij/lang/properties/PropertiesFileTypeFactory.java @@ -24,6 +24,6 @@ import org.jetbrains.annotations.NotNull; */ public class PropertiesFileTypeFactory extends FileTypeFactory { public void createFileTypes(@NotNull FileTypeConsumer consumer) { - consumer.consume(PropertiesFileType.FILE_TYPE, PropertiesFileType.DEFAULT_EXTENSION); + consumer.consume(PropertiesFileType.INSTANCE, PropertiesFileType.DEFAULT_EXTENSION); } } diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesFilesManager.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesFilesManager.java index 98bd5e80ba78..e85246196a78 100644 --- a/plugins/properties/src/com/intellij/lang/properties/PropertiesFilesManager.java +++ b/plugins/properties/src/com/intellij/lang/properties/PropertiesFilesManager.java @@ -82,11 +82,11 @@ public class PropertiesFilesManager extends AbstractProjectComponent { } public Collection getAllPropertiesFiles() { - return FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, PropertiesFileType.FILE_TYPE, GlobalSearchScope.allScope(myProject)); + return FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, PropertiesFileType.INSTANCE, GlobalSearchScope.allScope(myProject)); } public boolean processAllPropertiesFiles(final Processor processor) { - return FileBasedIndex.getInstance().processValues(FileTypeIndex.NAME, PropertiesFileType.FILE_TYPE, null, new FileBasedIndex.ValueProcessor() { + return FileBasedIndex.getInstance().processValues(FileTypeIndex.NAME, PropertiesFileType.INSTANCE, null, new FileBasedIndex.ValueProcessor() { public boolean process(VirtualFile file, Void value) { return processor.process(file); } diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesReferenceManager.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesReferenceManager.java index 9c189df68e39..beca0556c8ba 100644 --- a/plugins/properties/src/com/intellij/lang/properties/PropertiesReferenceManager.java +++ b/plugins/properties/src/com/intellij/lang/properties/PropertiesReferenceManager.java @@ -115,7 +115,7 @@ public class PropertiesReferenceManager { @NotNull final PropertiesFileProcessor processor, @NotNull final BundleNameEvaluator evaluator) { - return FileBasedIndex.getInstance().processValues(FileTypeIndex.NAME, PropertiesFileType.FILE_TYPE, null, new FileBasedIndex.ValueProcessor() { + return FileBasedIndex.getInstance().processValues(FileTypeIndex.NAME, PropertiesFileType.INSTANCE, null, new FileBasedIndex.ValueProcessor() { public boolean process(VirtualFile file, Void value) { final PsiFile psiFile = myPsiManager.findFile(file); diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java index 628e784019ab..e236c84c4122 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java @@ -236,21 +236,21 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileAdapter() { @Override public void fileCreated(VirtualFileEvent event) { - if (event.getFile().getFileType() == PropertiesFileType.FILE_TYPE) { + if (event.getFile().getFileType() == PropertiesFileType.INSTANCE) { recreateEditorsPanel(); } } @Override public void fileDeleted(VirtualFileEvent event) { - if (event.getFile().getFileType() == PropertiesFileType.FILE_TYPE) { + if (event.getFile().getFileType() == PropertiesFileType.INSTANCE) { recreateEditorsPanel(); } } @Override public void propertyChanged(VirtualFilePropertyEvent event) { - if (event.getFile().getFileType() == PropertiesFileType.FILE_TYPE) { + if (event.getFile().getFileType() == PropertiesFileType.INSTANCE) { if (VirtualFile.PROP_NAME.equals(event.getPropertyName())) { recreateEditorsPanel(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java b/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java index 15da8e7bf450..f37eb6482170 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java @@ -129,9 +129,6 @@ public class EvaluatedXmlNameImpl implements EvaluatedXmlName { } public final boolean isNamespaceAllowed(String namespace, final XmlFile file, boolean qualified) { - if (myEqualToParent && qualified) { - System.out.println(); - } return myNamespaceKey == null || myEqualToParent && !qualified || isNamespaceAllowed(namespace, getNamespaceList(file)); } diff --git a/xml/impl/src/com/intellij/ide/highlighter/DTDFileType.java b/xml/impl/src/com/intellij/ide/highlighter/DTDFileType.java index eddb785259c0..63b566166903 100644 --- a/xml/impl/src/com/intellij/ide/highlighter/DTDFileType.java +++ b/xml/impl/src/com/intellij/ide/highlighter/DTDFileType.java @@ -25,6 +25,7 @@ import javax.swing.*; public class DTDFileType extends LanguageFileType { private static final Icon ICON = IconLoader.getIcon("/fileTypes/dtd.png"); + public static final DTDFileType INSTANCE = new DTDFileType(); public DTDFileType() { super(DTDLanguage.INSTANCE); diff --git a/xml/impl/src/com/intellij/ide/highlighter/XmlFileType.java b/xml/impl/src/com/intellij/ide/highlighter/XmlFileType.java index 1a720d69eb9d..d7d2c1cd39a7 100644 --- a/xml/impl/src/com/intellij/ide/highlighter/XmlFileType.java +++ b/xml/impl/src/com/intellij/ide/highlighter/XmlFileType.java @@ -15,7 +15,6 @@ */ package com.intellij.ide.highlighter; -import com.intellij.codeInsight.editorActions.TypedHandler; import com.intellij.ide.IdeBundle; import com.intellij.lang.xml.XMLLanguage; import com.intellij.openapi.util.IconLoader; @@ -32,7 +31,6 @@ public class XmlFileType extends XmlLikeFileType implements DomSupportEnabled { private XmlFileType() { super(XMLLanguage.INSTANCE); - TypedHandler.registerBaseLanguageQuoteHandler(XMLLanguage.class, TypedHandler.getQuoteHandlerForType(this)); } @NotNull diff --git a/xml/impl/src/com/intellij/xml/XmlFileTypeFactory.java b/xml/impl/src/com/intellij/xml/XmlFileTypeFactory.java index dd9156458b61..e08c7aa8401f 100644 --- a/xml/impl/src/com/intellij/xml/XmlFileTypeFactory.java +++ b/xml/impl/src/com/intellij/xml/XmlFileTypeFactory.java @@ -15,10 +15,12 @@ */ package com.intellij.xml; +import com.intellij.codeInsight.editorActions.TypedHandler; import com.intellij.ide.highlighter.DTDFileType; import com.intellij.ide.highlighter.HtmlFileType; import com.intellij.ide.highlighter.XHtmlFileType; import com.intellij.ide.highlighter.XmlFileType; +import com.intellij.lang.xml.XMLLanguage; import com.intellij.openapi.fileTypes.FileTypeConsumer; import com.intellij.openapi.fileTypes.FileTypeFactory; import org.jetbrains.annotations.NotNull; @@ -30,8 +32,9 @@ public class XmlFileTypeFactory extends FileTypeFactory { public void createFileTypes(@NotNull final FileTypeConsumer consumer) { consumer.consume(HtmlFileType.INSTANCE, "html;htm;sht;shtm;shtml"); consumer.consume(XHtmlFileType.INSTANCE, "xhtml"); - consumer.consume(new DTDFileType(), "dtd;ent;mod"); + consumer.consume(DTDFileType.INSTANCE, "dtd;ent;mod"); consumer.consume(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;hs;jhm;ant;xul;xslt"); + TypedHandler.registerBaseLanguageQuoteHandler(XMLLanguage.class, TypedHandler.getQuoteHandlerForType(XmlFileType.INSTANCE)); } }