From ca0f8299727dabc6deb804d615b0fe04751a385a Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Thu, 13 Jan 2005 15:55:50 +0300 Subject: [PATCH] merged CVS and Subversion versions --- .../com/siyeh/ig/imports/JavaLangImportInspection.java | 5 ++--- .../siyeh/ig/imports/RedundantImportInspection.java | 8 +++----- .../siyeh/ig/imports/SamePackageImportInspection.java | 8 +++----- .../com/siyeh/ig/imports/UnusedImportInspection.java | 10 +++------- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/JavaLangImportInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/JavaLangImportInspection.java index 682f9cbeca21..c15a11fc2a74 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/JavaLangImportInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/JavaLangImportInspection.java @@ -32,8 +32,7 @@ public class JavaLangImportInspection extends ClassInspection { } public void applyFix(Project project, ProblemDescriptor descriptor) { - final PsiElement importReference = descriptor.getPsiElement(); - final PsiElement importStatement = importReference.getParent(); + final PsiElement importStatement = descriptor.getPsiElement(); deleteElement(importStatement); } } @@ -76,7 +75,7 @@ public class JavaLangImportInspection extends ClassInspection { final String parentName = text.substring(0, classNameIndex); if ("java.lang".equals(parentName)) { if (!ImportUtils.hasOnDemandImportConflict(text, file)) { - registerError(reference); + registerError(importStatement); } } } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/RedundantImportInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/RedundantImportInspection.java index af84e0ef3e18..4274f023c378 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/RedundantImportInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/RedundantImportInspection.java @@ -22,7 +22,7 @@ public class RedundantImportInspection extends ClassInspection { } public String buildErrorString(PsiElement location) { - return "Redundant import #ref #loc"; + return "Redundant import '#ref' #loc"; } public InspectionGadgetsFix buildFix(PsiElement location) { @@ -35,8 +35,7 @@ public class RedundantImportInspection extends ClassInspection { } public void applyFix(Project project, ProblemDescriptor descriptor) { - final PsiElement importReference = descriptor.getPsiElement(); - final PsiElement importStatement = importReference.getParent(); + final PsiElement importStatement = descriptor.getPsiElement(); deleteElement(importStatement); } } @@ -79,8 +78,7 @@ public class RedundantImportInspection extends ClassInspection { final String parentName = text.substring(0, classNameIndex); if (imports.contains(parentName)) { if (!ImportUtils.hasOnDemandImportConflict(text, file)) { - final PsiJavaCodeReferenceElement importReference = importStatement.getImportReference(); - registerError(importReference); + registerError(importStatement); } } } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/SamePackageImportInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/SamePackageImportInspection.java index 489f982cc662..24d1d2182e01 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/SamePackageImportInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/SamePackageImportInspection.java @@ -18,7 +18,7 @@ public class SamePackageImportInspection extends ClassInspection { } public String buildErrorString(PsiElement location) { - return "Unnecessary import from same package package #loc"; + return "Unnecessary import from same package '#ref' #loc"; } public InspectionGadgetsFix buildFix(PsiElement location) { @@ -31,9 +31,7 @@ public class SamePackageImportInspection extends ClassInspection { } public void applyFix(Project project, ProblemDescriptor descriptor) { - - final PsiElement importReference = descriptor.getPsiElement(); - final PsiElement importStatement = importReference.getParent(); + final PsiElement importStatement = descriptor.getPsiElement(); deleteElement(importStatement); } } @@ -72,7 +70,7 @@ public class SamePackageImportInspection extends ClassInspection { final int classNameIndex = text.lastIndexOf((int) '.'); final String parentName = classNameIndex < 0 ? "" : text.substring(0, classNameIndex); if (packageName.equals(parentName)) { - registerError(reference); + registerError(importStatement); } } } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/UnusedImportInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/UnusedImportInspection.java index b6c12651e2b4..4ea97cd1e235 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/UnusedImportInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/UnusedImportInspection.java @@ -18,7 +18,7 @@ public class UnusedImportInspection extends ClassInspection { } public String buildErrorString(PsiElement location) { - return "Unused import #ref #loc"; + return "Unused import '#ref' #loc"; } public InspectionGadgetsFix buildFix(PsiElement location) { @@ -31,8 +31,7 @@ public class UnusedImportInspection extends ClassInspection { } public void applyFix(Project project, ProblemDescriptor descriptor) { - final PsiElement importReference = descriptor.getPsiElement(); - final PsiElement importStatement = importReference.getParent(); + final PsiElement importStatement = descriptor.getPsiElement(); deleteElement(importStatement); } } @@ -59,10 +58,7 @@ public class UnusedImportInspection extends ClassInspection { for (int i = 0; i < importStatements.length; i++) { final PsiImportStatement importStatement = importStatements[i]; if (!isNecessaryImport(importStatement, file.getClasses())) { - final PsiJavaCodeReferenceElement importReference - = importStatement.getImportReference(); - - registerError(importReference); + registerError(importStatement); } } }