mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Remove unused ProjectFileExclusionManager / ProjectFileExclusionManagerImpl
This commit is contained in:
-36
@@ -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);
|
||||
}
|
||||
@@ -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<Document> 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);
|
||||
}
|
||||
|
||||
|
||||
-82
@@ -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<VirtualFile> getExcludedFiles() {
|
||||
return getFiles();
|
||||
}
|
||||
|
||||
|
||||
public static ProjectFileExclusionManagerImpl getInstance(@NotNull Project project) {
|
||||
return (ProjectFileExclusionManagerImpl) ServiceManager.getService(project, ProjectFileExclusionManager.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user