From 85d5155e064ca7b77bd25f210322e1ddc4dc4e3a Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 16 Dec 2011 17:55:26 +0100 Subject: [PATCH] dead code --- .../psi/impl/cache/impl/VfsIndexer.java | 122 ------------------ 1 file changed, 122 deletions(-) delete mode 100644 platform/lang-impl/src/com/intellij/psi/impl/cache/impl/VfsIndexer.java diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/VfsIndexer.java b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/VfsIndexer.java deleted file mode 100644 index a0bf1e3a792b..000000000000 --- a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/VfsIndexer.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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. - */ - -package com.intellij.psi.impl.cache.impl; - -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; -import com.intellij.openapi.vfs.VfsUtil; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.VirtualFileFilter; -import com.intellij.psi.PsiBundle; - -import java.io.*; -import java.util.ArrayList; -import java.util.List; - -public class VfsIndexer { - private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.cache.impl.VfsIndexer"); - - public static VirtualFile[] writeFileIndex( - OutputStream stream, - VirtualFile root, - VirtualFileFilter filter) throws IOException { - - List result = new ArrayList(); - - ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); - if (progress != null){ - progress.setText2(PsiBundle.message("psi.scanning.files.in.folder.progress", root.getPresentableUrl())); - } - - DataOutputStream out = stream == null ? null : new DataOutputStream(stream); - - _writeFileIndex(out, root, filter, result); - - if (out != null){ - out.flush(); - } - - return VfsUtil.toVirtualFileArray(result); - } - - private static void _writeFileIndex(DataOutputStream out, VirtualFile file, VirtualFileFilter filter, List result) throws IOException { - ProgressManager.checkCanceled(); - - result.add(file); - if (out != null){ - out.writeUTF(file.getName()); - } - - VirtualFile[] children = file.getChildren(); - if (children == null) { - if (out != null){ - out.writeInt(0); - } - return; - } - - int childrenCount = 0; - for (VirtualFile child : children) { - if (filter.accept(child)) childrenCount++; - } - - if (out != null){ - out.writeInt(childrenCount); - } - for (VirtualFile child : children) { - if (filter.accept(child)) { - _writeFileIndex(out, child, filter, result); - } - } - } - - public static VirtualFile[] readFileIndex( - InputStream stream, - VirtualFile root, - VirtualFileFilter filter - ) throws IOException { - List result = new ArrayList(); - - DataInputStream in = new DataInputStream(stream); - - String rootName = in.readUTF(); - LOG.assertTrue(root.getName().equals(rootName)); - _readFileIndex(in, root, filter, result); - - return VfsUtil.toVirtualFileArray(result); - } - - private static void _readFileIndex(DataInputStream in, VirtualFile file, VirtualFileFilter filter, List result) throws IOException { - ProgressManager.checkCanceled(); - - result.add(file); - int childrenCount = in.readInt(); - if (childrenCount == 0) return; - - for (int i = 0; i < childrenCount; i++) { - String name = in.readUTF(); - VirtualFile child = file != null ? file.findChild(name) : null; - - if (child != null && !filter.accept(child)){ - child = null; - } - - _readFileIndex(in, child, filter, result); - } - } -}