prefer to use ArchiveFileType.INSTANCE directly to avoid possible earlier initialization due to FileTypeManager.getInstance call

This commit is contained in:
Vladimir Krivosheev
2018-11-19 10:45:48 +01:00
parent 7e6cefdb06
commit 5a5780076e
19 changed files with 49 additions and 184 deletions
@@ -1,22 +1,9 @@
/*
* 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.
*/
// Copyright 2000-2018 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.compiler.ant;
import com.intellij.compiler.ant.taskdefs.Include;
import com.intellij.compiler.ant.taskdefs.PatternSet;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.fileTypes.*;
import com.intellij.openapi.project.Project;
@@ -25,7 +12,7 @@ import java.io.PrintWriter;
import java.util.List;
/**
* Library pattern generation (based on {@link FileTypes#ARCHIVE} file type).
* Library pattern generation (based on {@link ArchiveFileType#INSTANCE} file type).
*/
public class LibraryPatterns extends Generator {
/**
@@ -41,7 +28,7 @@ public class LibraryPatterns extends Generator {
*/
public LibraryPatterns(Project project, GenerationOptions genOptions) {
myPatternSet = new PatternSet(BuildProperties.PROPERTY_LIBRARIES_PATTERNS);
final FileType type = FileTypes.ARCHIVE;
final FileType type = ArchiveFileType.INSTANCE;
final List<FileNameMatcher> matchers = FileTypeManager.getInstance().getAssociations(type);
for (FileNameMatcher m : matchers) {
if (m instanceof ExactFileNameMatcher) {
@@ -1,25 +1,11 @@
/*
* 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.
*/
// Copyright 2000-2018 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.compiler.impl.javaCompiler.eclipse;
import com.intellij.compiler.impl.javaCompiler.CompilerModuleOptionsComponent;
import com.intellij.compiler.options.ComparingUtils;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
@@ -52,7 +38,7 @@ public class EclipseCompilerConfigurable implements Configurable {
myAdditionalOptionsField.setDescriptor(null, false);
myPathToEcjField.addBrowseFolderListener(
"Path to ecj compiler tool", null, project,
new FileChooserDescriptor(true, false, true, true, false, false).withFileFilter(file -> file.getFileType() == StdFileTypes.ARCHIVE)
new FileChooserDescriptor(true, false, true, true, false, false).withFileFilter(file -> file.getFileType() == ArchiveFileType.INSTANCE)
);
}
@@ -7,6 +7,7 @@ import com.intellij.debugger.engine.JVMNameUtil;
import com.intellij.debugger.jdi.DecompiledLocalVariable;
import com.intellij.debugger.ui.JavaDebuggerSupport;
import com.intellij.icons.AllIcons;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
@@ -16,7 +17,6 @@ import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileChooserFactory;
import com.intellij.openapi.fileChooser.FileSaverDescriptor;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
@@ -206,7 +206,7 @@ public class CaptureConfigurable implements SearchableConfigurable {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, showHiddenFiles) &&
(file.isDirectory() || "xml".equals(file.getExtension()) || file.getFileType() == FileTypes.ARCHIVE);
(file.isDirectory() || "xml".equals(file.getExtension()) || file.getFileType() == ArchiveFileType.INSTANCE);
}
@Override
@@ -1,20 +1,7 @@
/*
* Copyright 2000-2017 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-2018 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.roots.ui.configuration.projectRoot
import com.intellij.ide.highlighter.ArchiveFileType
import com.intellij.jarRepository.JarRepositoryManager
import com.intellij.jarRepository.RepositoryAttachDialog
import com.intellij.jarRepository.RepositoryLibraryType
@@ -256,7 +243,7 @@ private class ComparingJarFilesTask(project: Project, private val downloadedFile
if (file.isDirectory) {
file.children.forEach { collectNestedJars(it, result) }
}
else if (file.fileType == StdFileTypes.ARCHIVE) {
else if (file.fileType == ArchiveFileType.INSTANCE) {
val jarRootUrl = VfsUtil.getUrlForLibraryRoot(VfsUtil.virtualToIoFile(file))
VirtualFileManager.getInstance().refreshAndFindFileByUrl(jarRootUrl)?.let { result.add(it) }
}
@@ -1,20 +1,7 @@
/*
* Copyright 2000-2017 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-2018 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.roots.ui.configuration.libraryEditor
import com.intellij.ide.highlighter.ArchiveFileType
import com.intellij.openapi.fileTypes.StdFileTypes
import com.intellij.openapi.progress.EmptyProgressIndicator
import com.intellij.openapi.roots.NativeLibraryOrderRootType
@@ -94,7 +81,7 @@ class JavaLibraryRootsDetectionTest : LightPlatformTestCase() {
val dir = directoryContent(content).generateInVirtualTempDir()
val detector = LibraryRootsDetectorImpl(DefaultLibraryRootsComponentDescriptor().rootDetectors)
val root = assertOneElement(dir.children.flatMap { file ->
val rootFile = if (file.fileType == StdFileTypes.ARCHIVE) JarFileSystem.getInstance().getJarRootForLocalFile(file)!! else file
val rootFile = if (file.fileType == ArchiveFileType.INSTANCE) JarFileSystem.getInstance().getJarRootForLocalFile(file)!! else file
detector.detectRoots(rootFile, EmptyProgressIndicator())
})
val type = assertOneElement(root.types)
@@ -2,12 +2,12 @@
package com.intellij.openapi.projectRoots.impl;
import com.intellij.icons.AllIcons;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.actionSystem.DataKey;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.*;
import com.intellij.openapi.roots.AnnotationOrderRootType;
@@ -74,7 +74,7 @@ public class JavaSdkImpl extends JavaSdk {
}
private void updateCache(VirtualFileEvent event) {
if (FileTypes.ARCHIVE.equals(fileTypeManager.getFileTypeByFileName(event.getFileName()))) {
if (ArchiveFileType.INSTANCE.equals(fileTypeManager.getFileTypeByFileName(event.getFileName()))) {
String filePath = event.getFile().getPath();
if (myCachedSdkHomeToVersionString.keySet().removeIf(sdkHome -> FileUtil.isAncestor(sdkHome, filePath, false))) {
myCachedVersionStringToJdkVersion.clear();
@@ -2,6 +2,7 @@
package com.intellij.openapi.externalSystem.util;
import com.intellij.execution.rmi.RemoteUtil;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.application.*;
import com.intellij.openapi.externalSystem.ExternalSystemAutoImportAware;
import com.intellij.openapi.externalSystem.ExternalSystemManager;
@@ -17,7 +18,6 @@ import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemLocalS
import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings;
import com.intellij.openapi.externalSystem.settings.ExternalProjectSettings;
import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListener;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
@@ -162,7 +162,7 @@ public class ExternalSystemApiUtil {
@NotNull
public static String getLocalFileSystemPath(@NotNull VirtualFile file) {
if (file.getFileType() == FileTypes.ARCHIVE) {
if (file.getFileType() == ArchiveFileType.INSTANCE) {
final VirtualFile jar = JarFileSystem.getInstance().getVirtualFileForJar(file);
if (jar != null) {
return jar.getPath();
@@ -3,13 +3,13 @@ package com.intellij.openapi.projectRoots.ui;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.LocalFileSystem;
@@ -315,7 +315,7 @@ public class PathEditor {
tempFile = LocalFileSystem.getInstance().findFileByPath(path);
}
if (tempFile != null && !tempFile.isDirectory()) {
return Boolean.valueOf(tempFile.getFileType().equals(FileTypes.ARCHIVE));
return Boolean.valueOf(tempFile.getFileType().equals(ArchiveFileType.INSTANCE));
}
return Boolean.FALSE;
}).booleanValue();
@@ -1,6 +1,7 @@
// Copyright 2000-2018 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.internal.psiView;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.lang.Language;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
@@ -15,7 +16,6 @@ import javax.swing.*;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
class PsiViewerSourceWrapper implements Comparable<PsiViewerSourceWrapper> {
@@ -78,7 +78,7 @@ class PsiViewerSourceWrapper implements Comparable<PsiViewerSourceWrapper> {
fileType != StdFileTypes.IDEA_MODULE &&
fileType != StdFileTypes.IDEA_PROJECT &&
fileType != StdFileTypes.IDEA_WORKSPACE &&
fileType != FileTypes.ARCHIVE &&
fileType != ArchiveFileType.INSTANCE &&
fileType != FileTypes.UNKNOWN &&
fileType != FileTypes.PLAIN_TEXT &&
!(fileType instanceof AbstractFileType) &&
@@ -1,12 +1,12 @@
// Copyright 2000-2018 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.projectRoots.impl;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.*;
import com.intellij.openapi.util.Comparing;
@@ -85,7 +85,7 @@ public class ProjectJdkTableImpl extends ProjectJdkTable implements ExportableCo
if (fileName != null) {
// avoid calling getFileType() because it will try to detect file type from content for unknown/text file types
// consider only archive files that may contain libraries
if (!FileTypes.ARCHIVE.equals(myFileTypeManager.getFileTypeByFileName(fileName))) {
if (!ArchiveFileType.INSTANCE.equals(myFileTypeManager.getFileTypeByFileName(fileName))) {
return;
}
}
@@ -1,22 +1,8 @@
/*
* Copyright 2000-2017 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-2018 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.roots.libraries.ui;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.vfs.JarFileSystem;
@@ -55,7 +41,7 @@ public class DescendentBasedRootFilter extends RootFilter {
return false;
}
for (VirtualFile child : rootCandidate.getChildren()) {
if (!child.isDirectory() && child.getFileType().equals(FileTypes.ARCHIVE)) {
if (!child.isDirectory() && child.getFileType().equals(ArchiveFileType.INSTANCE)) {
final VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(child);
if (jarRoot != null && containsFileOfType(jarRoot, progressIndicator)) {
return true;
@@ -1,23 +1,9 @@
/*
* Copyright 2000-2017 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-2018 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.fileChooser;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.actionSystem.DataKey;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.vfs.JarFileSystem;
@@ -320,7 +306,7 @@ public class FileChooserDescriptor implements Cloneable {
if (file.isDirectory() && (myChooseFolders || isFileSelectable(file))) {
return file;
}
boolean isJar = file.getFileType() == FileTypes.ARCHIVE;
boolean isJar = file.getFileType() == ArchiveFileType.INSTANCE;
if (!isJar) {
return acceptAsGeneralFile(file) ? file : null;
}
@@ -1,22 +1,8 @@
/*
* Copyright 2000-2013 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-2018 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.fileChooser;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.vfs.JarFileSystem;
@@ -110,7 +96,7 @@ public class FileElement {
if (file == null) return false;
if (isArchiveFileSystem(file) && file.getParent() == null) return true;
return !file.isDirectory() &&
FileTypeManager.getInstance().getFileTypeByFileName(file.getNameSequence()) == FileTypes.ARCHIVE &&
FileTypeManager.getInstance().getFileTypeByFileName(file.getNameSequence()) == ArchiveFileType.INSTANCE &&
!isArchiveFileSystem(file.getParent());
}
@@ -1,10 +1,10 @@
// Copyright 2000-2018 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.vfs;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.SystemInfo;
@@ -266,7 +266,7 @@ public class VfsUtil extends VfsUtilCore {
public static String getUrlForLibraryRoot(@NotNull File libraryRoot) {
String path = FileUtil.toSystemIndependentName(libraryRoot.getAbsolutePath());
if (FileTypeManager.getInstance().getFileTypeByFileName(libraryRoot.getName()) == FileTypes.ARCHIVE) {
if (FileTypeManager.getInstance().getFileTypeByFileName(libraryRoot.getName()) == ArchiveFileType.INSTANCE) {
return VirtualFileManager.constructUrl(JarFileSystem.getInstance().getProtocol(), path + JarFileSystem.JAR_SEPARATOR);
}
else {
@@ -1,22 +1,8 @@
/*
* Copyright 2000-2017 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-2018 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.vfs.newvfs;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.fileTypes.FileTypeRegistry;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.io.FileAttributes;
import com.intellij.openapi.util.text.StringUtil;
@@ -251,6 +237,6 @@ public abstract class ArchiveFileSystem extends NewVirtualFileSystem {
* Implementations should return {@code false} if the given file may not host this file system.
*/
protected boolean isCorrectFileType(@NotNull VirtualFile local) {
return FileTypeRegistry.getInstance().getFileTypeByFileName(local.getNameSequence()) == FileTypes.ARCHIVE;
return FileTypeRegistry.getInstance().getFileTypeByFileName(local.getNameSequence()) == ArchiveFileType.INSTANCE;
}
}
@@ -1,21 +1,8 @@
/*
* 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-2018 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.roots.ui.util;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
@@ -28,7 +15,7 @@ public class JarSubfileCellAppearance extends ValidFileCellAppearance {
@Override
protected Icon getIcon() {
return FileTypes.ARCHIVE.getIcon();
return ((FileType)ArchiveFileType.INSTANCE).getIcon();
}
@Override
@@ -120,7 +120,7 @@ public class FileTypesTest extends PlatformTestCase {
public void testAddNewExtension() {
FileTypeAssocTable<FileType> associations = new FileTypeAssocTable<>();
associations.addAssociation(FileTypeManager.parseFromString("*.java"), FileTypes.ARCHIVE);
associations.addAssociation(FileTypeManager.parseFromString("*.java"), ArchiveFileType.INSTANCE);
associations.addAssociation(FileTypeManager.parseFromString("*.xyz"), StdFileTypes.XML);
associations.addAssociation(FileTypeManager.parseFromString("SomeSpecial*.java"), StdFileTypes.XML); // patterns should have precedence over extensions
assertEquals(StdFileTypes.XML, associations.findAssociatedFileType("sample.xyz"));
@@ -1,23 +1,10 @@
/*
* Copyright 2000-2017 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-2018 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 org.intellij.plugins.intelliLang;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.ide.ui.SplitterProportionsDataImpl;
import com.intellij.lang.Language;
import com.intellij.openapi.actionSystem.*;
@@ -722,7 +709,7 @@ public class InjectionsSettingsUI extends SearchableConfigurable.Parent.Abstract
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, showHiddenFiles) &&
(file.isDirectory() || "xml".equals(file.getExtension()) || file.getFileType() == FileTypes.ARCHIVE);
(file.isDirectory() || "xml".equals(file.getExtension()) || file.getFileType() == ArchiveFileType.INSTANCE);
}
@Override
@@ -4,10 +4,10 @@ package com.jetbrains.python.configuration;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.intellij.icons.AllIcons;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.projectRoots.SdkAdditionalData;
import com.intellij.openapi.projectRoots.SdkModificator;
import com.intellij.openapi.projectRoots.ui.SdkPathEditor;
@@ -87,7 +87,7 @@ public class PythonPathEditor extends SdkPathEditor {
@Override
protected VirtualFile[] adjustAddedFileSet(Component component, VirtualFile[] files) {
for (int i = 0, filesLength = files.length; i < filesLength; i++) {
if (!files[i].isDirectory() && files[i].getFileType() == FileTypes.ARCHIVE) {
if (!files[i].isDirectory() && files[i].getFileType() == ArchiveFileType.INSTANCE) {
files[i] = JarFileSystem.getInstance().getJarRootForLocalFile(files[i]);
}
}