remove CommunityFileTypes.xml

This commit is contained in:
Vladimir Krivosheev
2017-10-18 11:25:24 +02:00
parent 1559630e54
commit 5dc7aa7e39
3 changed files with 23 additions and 274 deletions
File diff suppressed because one or more lines are too long
@@ -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<AbstractFileType> 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<Pair<FileNameMatcher, String>> readAssociations(@NotNull Element element) {
@@ -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<Element>, 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<FileType> 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<FileNameMatcher, String> association : AbstractFileType.readAssociations(extensions)) {
associate(type, association.getFirst(), false);