From 427a0cbf71c4cb2c7da13ac2cc990fbebbb9326c Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Mon, 24 Mar 2014 09:13:01 +0100 Subject: [PATCH] Remove unused ProjectFileExclusionManager / ProjectFileExclusionManagerImpl --- .../exclude/ProjectFileExclusionManager.java | 36 -------- .../psi/SingleRootFileViewProvider.java | 4 - .../ProjectFileExclusionManagerImpl.java | 82 ------------------- .../FileBasedIndexProjectHandler.java | 4 - .../openapi/roots/impl/FileIndexBase.java | 3 - .../roots/impl/ModuleFileIndexImpl.java | 1 - .../roots/impl/ProjectFileIndexImpl.java | 4 +- 7 files changed, 1 insertion(+), 133 deletions(-) delete mode 100644 platform/core-api/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManager.java delete mode 100644 platform/lang-impl/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManagerImpl.java diff --git a/platform/core-api/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManager.java b/platform/core-api/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManager.java deleted file mode 100644 index f5a348029b94..000000000000 --- a/platform/core-api/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManager.java +++ /dev/null @@ -1,36 +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.components.ServiceManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VirtualFile; - -/** - * @author yole - */ -public interface ProjectFileExclusionManager { - class SERVICE { - private SERVICE() { - } - - public static ProjectFileExclusionManager getInstance(Project project) { - return ServiceManager.getService(project, ProjectFileExclusionManager.class); - } - } - - boolean isExcluded(VirtualFile virtualFile); -} diff --git a/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java b/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java index 777eea35a1a5..8c59b0999d0e 100644 --- a/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java +++ b/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java @@ -23,7 +23,6 @@ import com.intellij.openapi.command.undo.UndoConstants; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.file.exclude.ProjectFileExclusionManager; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.impl.LoadTextUtil; import com.intellij.openapi.fileTypes.*; @@ -71,7 +70,6 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi private volatile Content myContent; private volatile SoftReference myDocument; @NotNull private final Language myBaseLanguage; - private final ProjectFileExclusionManager myExclusionManager; public SingleRootFileViewProvider(@NotNull PsiManager manager, @NotNull VirtualFile file) { this(manager, file, true); @@ -90,7 +88,6 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi myPhysical = isEventSystemEnabled() && !(virtualFile instanceof LightVirtualFile) && !(virtualFile.getFileSystem() instanceof NonPhysicalFileSystem); - myExclusionManager = ProjectFileExclusionManager.SERVICE.getInstance(manager.getProject()); } @Override @@ -265,7 +262,6 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi protected boolean isIgnored() { final VirtualFile file = getVirtualFile(); if (file instanceof LightVirtualFile) return false; - if (myExclusionManager != null && myExclusionManager.isExcluded(file)) return true; return FileTypeRegistry.getInstance().isFileIgnored(file); } diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManagerImpl.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManagerImpl.java deleted file mode 100644 index 852092a6e77d..000000000000 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ProjectFileExclusionManagerImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2000-2012 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.application.ApplicationManager; -import com.intellij.openapi.components.ServiceManager; -import com.intellij.openapi.components.State; -import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.ex.ProjectRootManagerEx; -import com.intellij.openapi.util.EmptyRunnable; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.indexing.FileBasedIndex; -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; - -/** - * @author Rustam Vishnyakov - */ -@State(name = "ProjectFileExclusionManager", storages = {@Storage( file = StoragePathMacros.PROJECT_FILE)}) -public class ProjectFileExclusionManagerImpl extends PersistentFileSetManager implements ProjectFileExclusionManager { - - - private final Project myProject; - - public ProjectFileExclusionManagerImpl(Project project) { - myProject = project; - } - - public void addExclusion(VirtualFile file) { - if (addFile(file)) { - FileBasedIndex.getInstance().requestReindexExcluded(file); - fireRootsChange(myProject); - } - } - - public void removeExclusion(VirtualFile file) { - if (removeFile(file)) { - FileBasedIndex.getInstance().requestReindex(file); - fireRootsChange(myProject); - } - } - - private static void fireRootsChange(final Project project) { - ApplicationManager.getApplication().runWriteAction(new Runnable(){ - @Override - public void run() { - ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true); - } - }); - } - - @Override - public boolean isExcluded(VirtualFile file) { - return containsFile(file); - } - - public Collection getExcludedFiles() { - return getFiles(); - } - - - public static ProjectFileExclusionManagerImpl getInstance(@NotNull Project project) { - return (ProjectFileExclusionManagerImpl) ServiceManager.getService(project, ProjectFileExclusionManager.class); - } - -} 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 110db7255f84..cb433eb09875 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java @@ -23,7 +23,6 @@ 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.ProjectFileExclusionManagerImpl; import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; @@ -45,14 +44,12 @@ public class FileBasedIndexProjectHandler extends AbstractProjectComponent imple private final FileBasedIndexImpl myIndex; private final ProjectRootManagerEx myRootManager; private final FileTypeManager myFileTypeManager; - private final ProjectFileExclusionManagerImpl myExclusionManager; public FileBasedIndexProjectHandler(final FileBasedIndexImpl index, final Project project, final ProjectRootManagerComponent rootManager, FileTypeManager ftManager, final ProjectManager projectManager) { super(project); myIndex = index; myRootManager = rootManager; myFileTypeManager = ftManager; - myExclusionManager = ProjectFileExclusionManagerImpl.getInstance(project); final StartupManagerEx startupManager = (StartupManagerEx)StartupManager.getInstance(project); if (startupManager != null) { @@ -87,7 +84,6 @@ public class FileBasedIndexProjectHandler extends AbstractProjectComponent imple public boolean isInSet(@NotNull final VirtualFile file) { final ProjectFileIndex index = myRootManager.getFileIndex(); if (index.isInContent(file) || index.isInLibraryClasses(file) || index.isInLibrarySource(file)) { - if (myExclusionManager != null && myExclusionManager.isExcluded(file)) return false; return !myFileTypeManager.isFileIgnored(file); } return false; diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java index 1a190e85e2b0..b21ea311b23f 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java @@ -1,6 +1,5 @@ package com.intellij.openapi.roots.impl; -import com.intellij.openapi.file.exclude.ProjectFileExclusionManager; import com.intellij.openapi.fileTypes.FileTypeRegistry; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.FileIndex; @@ -14,12 +13,10 @@ import org.jetbrains.annotations.Nullable; public abstract class FileIndexBase implements FileIndex { protected final FileTypeRegistry myFileTypeRegistry; protected final DirectoryIndex myDirectoryIndex; - protected final ProjectFileExclusionManager myExclusionManager; public FileIndexBase(@NotNull DirectoryIndex directoryIndex, @NotNull FileTypeRegistry fileTypeManager, @NotNull Project project) { myDirectoryIndex = directoryIndex; myFileTypeRegistry = fileTypeManager; - myExclusionManager = ProjectFileExclusionManager.SERVICE.getInstance(project); } @Nullable diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java index 48303f9afd4c..1e009d14f0cd 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java @@ -114,7 +114,6 @@ public class ModuleFileIndexImpl extends FileIndexBase implements ModuleFileInde return info != null && myModule.equals(info.getModule()); } else { - if(myExclusionManager != null && myExclusionManager.isExcluded(file)) return false; return !myFileTypeRegistry.isFileIgnored(file); } } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java index 5efdbdfa1331..809b58a585e3 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java @@ -82,7 +82,6 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn @Override public boolean isIgnored(@NotNull VirtualFile file) { if (myFileTypeRegistry.isFileIgnored(file)) return true; - if (myExclusionManager != null && myExclusionManager.isExcluded(file)) return true; VirtualFile dir = file.isDirectory() ? file : file.getParent(); if (dir == null) return false; @@ -203,8 +202,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn return info != null && info.getModule() != null; } else { - return (myExclusionManager == null || !myExclusionManager.isExcluded(file)) - && !myFileTypeRegistry.isFileIgnored(file); + return !myFileTypeRegistry.isFileIgnored(file); } } }