diff --git a/community-resources/src/CommunityFileTypes.xml b/community-resources/src/CommunityFileTypes.xml deleted file mode 100644 index ea9e8ff5ede0..000000000000 --- a/community-resources/src/CommunityFileTypes.xml +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/AbstractFileType.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/AbstractFileType.java index bb22816266e3..c218d7e407e1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/AbstractFileType.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/AbstractFileType.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.fileTypes.impl; import com.intellij.ide.highlighter.FileTypeRegistrator; @@ -316,14 +302,14 @@ public class AbstractFileType extends UserFileType implements return !Comparing.equal(myDefaultSyntaxTable, getSyntaxTable()); } - @NonNls private static final String ELEMENT_MAPPING = "mapping"; - @NonNls private static final String ATTRIBUTE_EXT = "ext"; + @NonNls static final String ELEMENT_MAPPING = "mapping"; + @NonNls static final String ATTRIBUTE_EXT = "ext"; @NonNls private static final String ATTRIBUTE_PATTERN = "pattern"; /** Applied for removed mappings approved by user */ @NonNls private static final String ATTRIBUTE_APPROVED = "approved"; @NonNls private static final String ELEMENT_REMOVED_MAPPING = "removed_mapping"; - @NonNls private static final String ATTRIBUTE_TYPE = "type"; + @NonNls static final String ATTRIBUTE_TYPE = "type"; @NotNull public static List> readAssociations(@NotNull Element element) { diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java index 354c5197d596..1d1e815b11f4 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java @@ -67,6 +67,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; +import static com.intellij.openapi.fileTypes.impl.AbstractFileType.*; + @State(name = "FileTypeManager", storages = @Storage("filetypes.xml"), additionalExportFile = FileTypeManagerImpl.FILE_SPEC ) public class FileTypeManagerImpl extends FileTypeManagerEx implements PersistentStateComponent, Disposable, ApplicationComponent { private static final Logger LOG = Logger.getInstance(FileTypeManagerImpl.class); @@ -191,7 +193,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent fileType.writeExternal(root); - Element map = new Element(AbstractFileType.ELEMENT_EXTENSION_MAP); + Element map = new Element(ELEMENT_EXTENSION_MAP); writeExtensionsMap(map, fileType, false); if (!map.getChildren().isEmpty()) { root.addContent(map); @@ -311,16 +313,27 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent if (defaultFileTypesUrl != null) { Element defaultFileTypesElement = JdomKt.loadElement(URLUtil.openStream(defaultFileTypesUrl)); for (Element e : defaultFileTypesElement.getChildren()) { - //noinspection SpellCheckingInspection if ("filetypes".equals(e.getName())) { for (Element element : e.getChildren(ELEMENT_FILETYPE)) { loadFileType(element, true); } } - else if (AbstractFileType.ELEMENT_EXTENSION_MAP.equals(e.getName())) { + else if (ELEMENT_EXTENSION_MAP.equals(e.getName())) { readGlobalMappings(e); } } + + if (PlatformUtils.isIdeaCommunity()) { + Element extensionMap = new Element(ELEMENT_EXTENSION_MAP); + extensionMap.addContent(new Element(ELEMENT_MAPPING) + .setAttribute(ATTRIBUTE_EXT, "jspx") + .setAttribute(ATTRIBUTE_TYPE, "XML")); + //noinspection SpellCheckingInspection + extensionMap.addContent(new Element(ELEMENT_MAPPING) + .setAttribute(ATTRIBUTE_EXT, "tagx") + .setAttribute(ATTRIBUTE_TYPE, "XML")); + readGlobalMappings(extensionMap); + } } } catch (Exception e) { @@ -1087,7 +1100,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent if (element.getName().equals(ELEMENT_IGNORE_FILES)) { myIgnoredPatterns.setIgnoreMasks(element.getAttributeValue(ATTRIBUTE_LIST)); } - else if (AbstractFileType.ELEMENT_EXTENSION_MAP.equals(element.getName())) { + else if (ELEMENT_EXTENSION_MAP.equals(element.getName())) { readGlobalMappings(element); } } @@ -1244,7 +1257,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent state.addContent(new Element(ELEMENT_IGNORE_FILES).setAttribute(ATTRIBUTE_LIST, ignoreFiles)); } - Element map = new Element(AbstractFileType.ELEMENT_EXTENSION_MAP); + Element map = new Element(ELEMENT_EXTENSION_MAP); List notExternalizableFileTypes = new ArrayList<>(); for (FileType type : mySchemeManager.getAllSchemes()) { @@ -1414,7 +1427,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent } } else { - Element extensions = typeElement.getChild(AbstractFileType.ELEMENT_EXTENSION_MAP); + Element extensions = typeElement.getChild(ELEMENT_EXTENSION_MAP); if (extensions != null) { for (Pair association : AbstractFileType.readAssociations(extensions)) { associate(type, association.getFirst(), false);