From 71a374e569877dabb1d8d036c0978262603ec113 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 3 Mar 2011 19:34:02 +0100 Subject: [PATCH] kill GroovyImportsTracker --- plugins/groovy/src/META-INF/plugin.xml | 2 - .../codeInspection/GroovyImportsTracker.java | 72 ------------------- 2 files changed, 74 deletions(-) delete mode 100644 plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyImportsTracker.java diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index 79cb5fc91f2a..fd1c4369b052 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -280,8 +280,6 @@ serviceImplementation="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementFactoryImpl"/> - diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyImportsTracker.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyImportsTracker.java deleted file mode 100644 index d72cdd506de8..000000000000 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyImportsTracker.java +++ /dev/null @@ -1,72 +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 org.jetbrains.plugins.groovy.codeInspection; - -import com.intellij.openapi.components.ServiceManager; -import com.intellij.openapi.project.Project; -import com.intellij.psi.PsiFile; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.plugins.groovy.lang.editor.GroovyImportOptimizer; -import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; -import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement; - -import java.util.*; - -/** - * @author ven - */ -public class GroovyImportsTracker { - - private final Map> myUsedImportStatements = new HashMap>(); - private final Map> myUnusedImportStatements = new HashMap>(); - - public synchronized void registerImportUsed(GrImportStatement importStatement) { - if (importStatement.getParent() == null) return; - PsiFile file = importStatement.getContainingFile(); - if (file == null || !(file instanceof GroovyFile)) return; - GroovyFile groovyFile = (GroovyFile) file; - Set importInfos = myUsedImportStatements.get(groovyFile); - if (importInfos == null) { - importInfos = new HashSet(); - } - importInfos.add(importStatement); - myUsedImportStatements.put(groovyFile, importInfos); - } - - @NotNull - public synchronized Set getUnusedImportStatements(GroovyFile file) { - Set unused = myUnusedImportStatements.get(file); - if (unused == null) { - Set used = myUsedImportStatements.get(file); - unused = new HashSet(GroovyImportOptimizer.getValidImportStatements(file)); - if (used != null && used.size() > 0) { - unused.removeAll(used); - } - - myUnusedImportStatements.put(file, unused); - myUsedImportStatements.remove(file); - } - return unused; - } - - public static GroovyImportsTracker getInstance(Project project) { - return ServiceManager.getService(project, GroovyImportsTracker.class); - } - - public synchronized void markFileAnnotated(GroovyFile file) { - myUnusedImportStatements.remove(file); - } -}