diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManager.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManager.java index 6a630ffbf5b8..82eeba9b06d1 100644 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManager.java +++ b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManager.java @@ -30,7 +30,7 @@ import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.util.indexing.FileBasedIndex; import org.jdom.Attribute; import org.jdom.Element; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Map; @@ -115,8 +115,8 @@ public class ProjectFileExclusionManager implements PersistentStateComponent myDocument; private final Language myBaseLanguage; + private final ProjectFileExclusionManager myExclusionManager; public SingleRootFileViewProvider(@NotNull PsiManager manager, @NotNull VirtualFile file) { this(manager, file, true); @@ -81,6 +83,7 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi myPhysical = isEventSystemEnabled() && !(virtualFile instanceof LightVirtualFile) && !(virtualFile.getFileSystem() instanceof DummyFileSystem); + myExclusionManager = ProjectFileExclusionManager.getInstance(manager.getProject()); } @NotNull @@ -234,6 +237,7 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi protected boolean isIgnored() { final VirtualFile file = getVirtualFile(); if (file instanceof LightVirtualFile) return false; + if (myExclusionManager.isExcluded(file)) return true; return FileTypeManager.getInstance().isFileIgnored(file); } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java index 42f9d9367091..bb4d3b4fe066 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java @@ -23,6 +23,7 @@ import com.intellij.ide.caches.CacheUpdater; import com.intellij.ide.caches.FileContent; import com.intellij.ide.startup.StartupManagerEx; import com.intellij.openapi.components.AbstractProjectComponent; +import com.intellij.openapi.file.exclude.ProjectFileExclusionManager; import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; @@ -40,12 +41,14 @@ public class FileBasedIndexProjectHandler extends AbstractProjectComponent imple private final FileBasedIndex myIndex; private final ProjectRootManagerEx myRootManager; private final FileTypeManager myFileTypeManager; + private final ProjectFileExclusionManager myExclusionManager; public FileBasedIndexProjectHandler(final FileBasedIndex index, final Project project, final ProjectRootManagerEx rootManager, FileTypeManager ftManager, final ProjectManager projectManager) { super(project); myIndex = index; myRootManager = rootManager; myFileTypeManager = ftManager; + myExclusionManager = ProjectFileExclusionManager.getInstance(project); final StartupManagerEx startupManager = (StartupManagerEx)StartupManager.getInstance(project); if (startupManager != null) { @@ -73,6 +76,7 @@ public class FileBasedIndexProjectHandler extends AbstractProjectComponent imple public boolean isInSet(final VirtualFile file) { final ProjectFileIndex index = myRootManager.getFileIndex(); if (index.isInContent(file) || index.isInLibraryClasses(file) || index.isInLibrarySource(file)) { + if (myExclusionManager.isExcluded(file)) return false; return !myFileTypeManager.isFileIgnored(file); } return false; diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java b/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java index 2a3dcd38d4d2..a8a7818fd6f8 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java +++ b/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java @@ -18,7 +18,6 @@ package com.intellij.openapi.fileTypes; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.CachedSingletonsRegistry; -import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -115,23 +114,8 @@ public abstract class FileTypeManager{ public abstract boolean isFileIgnored(@NonNls @NotNull String name); - /** - * @param file The file to be checked. - * @return true if the file is ignored, false otherwise. - * @deprecated A preferred method is {@link FileTypeManager#isFileIgnored(com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile)} - */ public abstract boolean isFileIgnored(@NonNls @NotNull VirtualFile file); - /** - * Checkes if the file is to be ignored within a given project. - * @param project The project containing the file to check. - * @param file The file to to be checked. - * @return true if the file is ignored, false otherwise. - */ - public boolean isFileIgnored(@Nullable Project project, @NotNull VirtualFile file) { - return isFileIgnored(file); - } - /** * Returns the list of extensions associated with the specified file type. * diff --git a/platform/platform-impl/src/com/intellij/openapi/file/exclude/FileExclusionProvider.java b/platform/platform-impl/src/com/intellij/openapi/file/exclude/FileExclusionProvider.java deleted file mode 100644 index 648dfa9289f1..000000000000 --- a/platform/platform-impl/src/com/intellij/openapi/file/exclude/FileExclusionProvider.java +++ /dev/null @@ -1,68 +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.openapi.file.exclude; - -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ProjectManager; -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.Nullable; - -/** - * @author Rustam Vishnyakov - */ -public abstract class FileExclusionProvider { - - public static ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.fileExclusionProvider"); - public static ExtensionPointName PROJECT_EP_NAME = - ExtensionPointName.create("com.intellij.projectFileExclusionProvider"); - - public boolean isFileExcluded(final VirtualFile file) { - return false; - } - - public boolean isFileNameExcluded(final String name) { - return false; - } - - public static boolean isExcluded(final @Nullable Project project, final VirtualFile file) { - if (file.isDirectory()) return false; - for (FileExclusionProvider exclusionProvider : Extensions.getExtensions(EP_NAME)) { - if (exclusionProvider.isFileExcluded(file)) return true; - } - if (project != null) { - for (FileExclusionProvider exclusionProvider : Extensions.getExtensions(PROJECT_EP_NAME, project)) { - if (exclusionProvider.isFileExcluded(file)) return true; - } - } - else { - for (Project openProject : ProjectManager.getInstance().getOpenProjects()) { - assert openProject != null; - if(isExcluded(openProject, file)) return true; - } - } - return false; - } - - public static boolean isExcluded (final String fileName) { - for (FileExclusionProvider exclusionProvider : Extensions.getExtensions(EP_NAME)) { - if (exclusionProvider.isFileNameExcluded(fileName)) return true; - } - return false; - } - -} 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 326822ce9960..e6e044498d13 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 @@ -25,14 +25,12 @@ import com.intellij.openapi.components.ExportableApplicationComponent; import com.intellij.openapi.components.RoamingType; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.file.exclude.FileExclusionProvider; import com.intellij.openapi.fileTypes.*; import com.intellij.openapi.fileTypes.ex.*; import com.intellij.openapi.options.BaseSchemeProcessor; import com.intellij.openapi.options.ExternalInfo; import com.intellij.openapi.options.SchemesManager; import com.intellij.openapi.options.SchemesManagerFactory; -import com.intellij.openapi.project.Project; import com.intellij.openapi.util.*; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; @@ -377,17 +375,12 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME } public boolean isFileIgnored(@NotNull String name) { - return myIgnoredPatterns.isIgnored(name) || FileExclusionProvider.isExcluded(name); - } - - @Override - public boolean isFileIgnored(@Nullable Project project, @NonNls @NotNull VirtualFile file) { - return isFileIgnored(file.getName()) || FileExclusionProvider.isExcluded(project, file); + return myIgnoredPatterns.isIgnored(name); } @Override public boolean isFileIgnored(@NonNls @NotNull VirtualFile file) { - return isFileIgnored(file.getName()) || FileExclusionProvider.isExcluded(null, file); + return isFileIgnored(file.getName()); } @SuppressWarnings({"deprecation"}) diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index 5681443a79eb..4d7faa29d255 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -278,7 +278,6 @@ - diff --git a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml index 924ce9da1657..84a0e91e4ab8 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml @@ -44,9 +44,6 @@ area="IDEA_PROJECT"/> - -