From 4bf725a53c14bcfd1402221fc6ce1d33d00599da Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 28 May 2014 17:28:42 +0400 Subject: [PATCH] moved away from java-impl --- .../intention/QuickFixFactory.java | 5 +- .../BaseJavaLocalInspectionTool.java | 2 +- .../GlobalJavaInspectionTool.java | 2 +- .../codeInspection/SuppressManager.java | 2 +- .../intellij/analysis/JavaAnalysisScope.java | 2 +- .../analysis/PackagesScopesProvider.java | 2 +- .../JavaAwareInspectionProfileCoverter.java | 5 +- .../daemon/JavaProblemHighlightFilter.java | 8 +- .../daemon/impl/GutterIconTooltipHelper.java | 2 +- .../impl/JavaChangeLocalityDetector.java | 2 +- .../SuppressWarningsFoldingBuilder.java | 2 +- .../impl/analysis/JavadocErrorFilter.java | 2 +- .../intention/AddAnnotationFix.java | 2 +- .../RedundantSuppressInspection.java | 7 +- .../codeInspection/SuppressManagerImpl.java | 2 +- .../deadCode/DummyEntryPointsTool.java | 2 +- .../deadCode/RefEntryPointFilter.java | 2 +- .../InconsistentLanguageLevelInspection.java | 34 +---- .../reference/RefJavaManagerImpl.java | 6 +- .../SameParameterValueInspectionBase.java | 129 ++++++++++++++++++ .../quickfix/ShowModulePropertiesFix.java | 19 +-- .../folding/impl/JavaFoldingBuilder.java | 13 +- .../impl/config/QuickFixFactoryImpl.java | 8 +- .../SameParameterValueInspection.java | 110 ++------------- .../completion/proc/VariablesProcessor.java | 0 .../completion/scope/CompletionElement.java | 2 +- .../folding/impl/JavaFoldingBuilderBase.java | 18 +++ .../IntentionAndQuickFixAction.java | 2 +- .../gen/icons/PropertiesIcons.java | 22 ++- 29 files changed, 228 insertions(+), 186 deletions(-) rename java/{openapi => java-analysis-api}/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java (98%) rename java/{openapi => java-analysis-api}/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java (98%) rename java/{openapi => java-analysis-api}/src/com/intellij/codeInspection/SuppressManager.java (97%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/analysis/JavaAnalysisScope.java (99%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/analysis/PackagesScopesProvider.java (97%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java (90%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java (84%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java (98%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java (97%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java (98%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java (96%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInsight/intention/AddAnnotationFix.java (97%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInspection/RedundantSuppressInspection.java (76%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInspection/SuppressManagerImpl.java (98%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java (97%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java (96%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java (81%) rename java/{java-impl => java-analysis-impl}/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java (99%) create mode 100644 java/java-analysis-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspectionBase.java rename java/{java-impl => java-psi-impl}/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java (100%) rename java/{java-impl => java-psi-impl}/src/com/intellij/codeInsight/completion/scope/CompletionElement.java (97%) rename platform/{lang-api => analysis-api}/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java (98%) rename java/java-impl/src/com/intellij/codeInspection/util/IgnorableRefFilter.java => plugins/properties/properties-psi-api/gen/icons/PropertiesIcons.java (55%) diff --git a/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java b/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java index bf84641b598e..ecc901141990 100644 --- a/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java +++ b/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java @@ -16,10 +16,12 @@ package com.intellij.codeInsight.intention; import com.intellij.codeInsight.daemon.QuickFixActionRegistrar; +import com.intellij.codeInspection.IntentionAndQuickFixAction; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement; import com.intellij.codeInspection.LocalQuickFixOnPsiElement; import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.*; @@ -132,7 +134,8 @@ public abstract class QuickFixFactory { @NotNull public abstract IntentionAction createRemoveParameterListFix(@NotNull PsiMethod parent); - @NotNull public abstract IntentionAction createShowModulePropertiesFix(@NotNull PsiElement element); + @NotNull public abstract IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull PsiElement element); + @NotNull public abstract IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull Module module); @NotNull public abstract IntentionAction createIncreaseLanguageLevelFix(@NotNull LanguageLevel level); diff --git a/java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java b/java/java-analysis-api/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java similarity index 98% rename from java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java rename to java/java-analysis-api/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java index 201084a2cc90..ab807d608579 100644 --- a/java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java +++ b/java/java-analysis-api/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/openapi/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java b/java/java-analysis-api/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java similarity index 98% rename from java/openapi/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java rename to java/java-analysis-api/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java index c01422b59d0e..1d9ff9c4a6cc 100644 --- a/java/openapi/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java +++ b/java/java-analysis-api/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/openapi/src/com/intellij/codeInspection/SuppressManager.java b/java/java-analysis-api/src/com/intellij/codeInspection/SuppressManager.java similarity index 97% rename from java/openapi/src/com/intellij/codeInspection/SuppressManager.java rename to java/java-analysis-api/src/com/intellij/codeInspection/SuppressManager.java index 5e12940fce4b..2eaa94be3b03 100644 --- a/java/openapi/src/com/intellij/codeInspection/SuppressManager.java +++ b/java/java-analysis-api/src/com/intellij/codeInspection/SuppressManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/analysis/JavaAnalysisScope.java b/java/java-analysis-impl/src/com/intellij/analysis/JavaAnalysisScope.java similarity index 99% rename from java/java-impl/src/com/intellij/analysis/JavaAnalysisScope.java rename to java/java-analysis-impl/src/com/intellij/analysis/JavaAnalysisScope.java index 1c49c3be174e..c69b3739f00b 100644 --- a/java/java-impl/src/com/intellij/analysis/JavaAnalysisScope.java +++ b/java/java-analysis-impl/src/com/intellij/analysis/JavaAnalysisScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/analysis/PackagesScopesProvider.java b/java/java-analysis-impl/src/com/intellij/analysis/PackagesScopesProvider.java similarity index 97% rename from java/java-impl/src/com/intellij/analysis/PackagesScopesProvider.java rename to java/java-analysis-impl/src/com/intellij/analysis/PackagesScopesProvider.java index b1bb15cf594e..063f6ad2b2c1 100644 --- a/java/java-impl/src/com/intellij/analysis/PackagesScopesProvider.java +++ b/java/java-analysis-impl/src/com/intellij/analysis/PackagesScopesProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java similarity index 90% rename from java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java rename to java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java index 58e6fafa38c8..0b432690fbcf 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -22,7 +22,6 @@ package com.intellij.codeInsight.daemon; import com.intellij.codeInspection.ModifiableModel; import com.intellij.codeInspection.ex.InspectionToolWrapper; -import com.intellij.codeInspection.javaDoc.JavaDocLocalInspection; import com.intellij.codeInspection.javaDoc.JavaDocLocalInspectionBase; import com.intellij.profile.codeInspection.InspectionProfileManager; import org.jdom.Element; @@ -54,7 +53,7 @@ public class JavaAwareInspectionProfileCoverter extends InspectionProfileConvert //javadoc attributes final InspectionToolWrapper toolWrapper = profile.getInspectionTool(JavaDocLocalInspectionBase.SHORT_NAME, null); - JavaDocLocalInspection inspection = (JavaDocLocalInspection)toolWrapper.getTool(); + JavaDocLocalInspectionBase inspection = (JavaDocLocalInspectionBase)toolWrapper.getTool(); inspection.myAdditionalJavadocTags = myAdditionalJavadocTags; } } \ No newline at end of file diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java similarity index 84% rename from java/java-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java rename to java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java index 956de9369369..39895d358ff4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -15,7 +15,7 @@ */ package com.intellij.codeInsight.daemon; -import com.intellij.openapi.fileTypes.StdFileTypes; +import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.roots.JavaProjectRootsUtil; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.vfs.VirtualFile; @@ -26,14 +26,14 @@ import org.jetbrains.annotations.NotNull; public class JavaProblemHighlightFilter extends ProblemHighlightFilter { @Override public boolean shouldHighlight(@NotNull PsiFile psiFile) { - return psiFile.getFileType() != StdFileTypes.JAVA || !JavaProjectRootsUtil.isOutsideJavaSourceRoot(psiFile); + return psiFile.getFileType() != JavaFileType.INSTANCE || !JavaProjectRootsUtil.isOutsideJavaSourceRoot(psiFile); } @Override public boolean shouldProcessInBatch(@NotNull PsiFile psiFile) { final boolean shouldHighlight = shouldHighlightFile(psiFile); if (shouldHighlight) { - if (psiFile.getFileType() == StdFileTypes.JAVA) { + if (psiFile.getFileType() == JavaFileType.INSTANCE) { final VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile != null && ProjectRootManager.getInstance(psiFile.getProject()).getFileIndex().isInLibrarySource(virtualFile)) { return false; diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java similarity index 98% rename from java/java-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java rename to java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java index d539559efc25..aad7e3982b1a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java similarity index 97% rename from java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java rename to java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java index 4f5557486e2b..9eb0d3cfc1a6 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java similarity index 98% rename from java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java rename to java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java index f99abde5f685..df96f75f5f7f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java similarity index 96% rename from java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java rename to java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java index 660b241d5b7f..373e6c299cbb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java similarity index 97% rename from java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java rename to java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java index f8d250176717..1d72ba7728af 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java similarity index 76% rename from java/java-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java rename to java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java index 22d61cb6e02e..b084be73c39e 100644 --- a/java/java-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -16,7 +16,6 @@ package com.intellij.codeInspection; import com.intellij.codeInspection.ex.GlobalInspectionContextBase; -import com.intellij.codeInspection.ex.InspectionManagerEx; import com.intellij.psi.PsiFile; /** @@ -26,7 +25,7 @@ import com.intellij.psi.PsiFile; public class RedundantSuppressInspection extends RedundantSuppressInspectionBase { @Override protected GlobalInspectionContextBase createContext(PsiFile file) { - final InspectionManagerEx inspectionManagerEx = ((InspectionManagerEx)InspectionManager.getInstance(file.getProject())); - return inspectionManagerEx.createNewGlobalContext(false); + final InspectionManager inspectionManagerEx = InspectionManager.getInstance(file.getProject()); + return (GlobalInspectionContextBase)inspectionManagerEx.createNewGlobalContext(false); } } diff --git a/java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java similarity index 98% rename from java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java rename to java/java-analysis-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java index ca3131d325eb..6136e01f85d8 100644 --- a/java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java similarity index 97% rename from java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java rename to java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java index 2b216dc844de..4a49391cdecb 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java similarity index 96% rename from java/java-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java rename to java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java index 03ab97994afd..1bbf602730a5 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java similarity index 81% rename from java/java-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java rename to java/java-analysis-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java index ecd1dcad59cd..24a8fc55e639 100644 --- a/java/java-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -22,16 +22,14 @@ package com.intellij.codeInspection.inconsistentLanguageLevel; import com.intellij.analysis.AnalysisScope; import com.intellij.codeInsight.daemon.GroupNames; +import com.intellij.codeInsight.intention.QuickFixFactory; import com.intellij.codeInspection.*; import com.intellij.codeInspection.reference.RefManager; import com.intellij.codeInspection.reference.RefModule; import com.intellij.codeInspection.unnecessaryModuleDependency.UnnecessaryModuleDependencyInspection; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtilCore; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.roots.*; -import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; @@ -85,7 +83,7 @@ public class InconsistentLanguageLevelInspection extends GlobalInspectionTool { "Inconsistent language level settings: module " + module.getName() + " with language level " + languageLevel + " depends on module " + dependantModule.getName() +" with language level " + dependantLanguageLevel, new UnnecessaryModuleDependencyInspection.RemoveModuleDependencyFix(module, dependantModule), - new OpenModuleSettingsFix(module)); + QuickFixFactory.getInstance().createShowModulePropertiesFix(module)); problemProcessor.addProblemElement(refModule, problemDescriptor); } } @@ -117,30 +115,4 @@ public class InconsistentLanguageLevelInspection extends GlobalInspectionTool { return "InconsistentLanguageLevel"; } - private static class OpenModuleSettingsFix implements QuickFix { - private final Module myModule; - - private OpenModuleSettingsFix(Module module) { - myModule = module; - } - - @Override - @NotNull - public String getName() { - return "Open module " + myModule.getName() + " settings"; - } - - @Override - @NotNull - public String getFamilyName() { - return getName(); - } - - @Override - public void applyFix(@NotNull Project project, @NotNull CommonProblemDescriptor descriptor) { - if (!myModule.isDisposed()) { - ProjectSettingsService.getInstance(project).showModuleConfigurationDialog(myModule.getName(), ProjectBundle.message("modules.classpath.title")); - } - } - } } diff --git a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java similarity index 99% rename from java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java rename to java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java index ea4b7dac3fa0..d9291660f9be 100644 --- a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -111,7 +111,7 @@ public class RefJavaManagerImpl extends RefJavaManager { private static final UserDataCache, PsiFile, RefManagerImpl> DEAD_CODE_TOOL = new UserDataCache, PsiFile, RefManagerImpl>("DEAD_CODE_TOOL") { @Override protected Ref compute(PsiFile file, RefManagerImpl refManager) { - Tools tools = ((GlobalInspectionContextImpl)refManager.getContext()).getTools().get(UnusedDeclarationInspection.SHORT_NAME); + Tools tools = ((GlobalInspectionContextBase)refManager.getContext()).getTools().get(UnusedDeclarationInspection.SHORT_NAME); InspectionToolWrapper toolWrapper = tools == null ? null : tools.getEnabledTool(file); InspectionProfileEntry tool = toolWrapper == null ? null : toolWrapper.getTool(); return Ref.create(tool instanceof UnusedDeclarationInspection ? (UnusedDeclarationInspection)tool : null); @@ -360,7 +360,7 @@ public class RefJavaManagerImpl extends RefJavaManager { public EntryPointsManager getEntryPointsManager() { if (myEntryPointsManager == null) { final Project project = myRefManager.getProject(); - myEntryPointsManager = new EntryPointsManagerImpl(project); + myEntryPointsManager = EntryPointsManager.getInstance(project); ((EntryPointsManagerBase)myEntryPointsManager).addAllPersistentEntries(EntryPointsManagerBase.getInstance(project)); } return myEntryPointsManager; diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspectionBase.java new file mode 100644 index 000000000000..298ad55b510f --- /dev/null +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspectionBase.java @@ -0,0 +1,129 @@ +/* + * Copyright 2000-2014 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.codeInspection.sameParameterValue; + +import com.intellij.analysis.AnalysisScope; +import com.intellij.codeInsight.daemon.GroupNames; +import com.intellij.codeInspection.*; +import com.intellij.codeInspection.reference.*; +import com.intellij.psi.PsiReference; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author max + */ +public class SameParameterValueInspectionBase extends GlobalJavaBatchInspectionTool { + @Override + @Nullable + public CommonProblemDescriptor[] checkElement(@NotNull RefEntity refEntity, + @NotNull AnalysisScope scope, + @NotNull InspectionManager manager, + @NotNull GlobalInspectionContext globalContext, + @NotNull ProblemDescriptionsProcessor processor) { + List problems = null; + if (refEntity instanceof RefMethod) { + final RefMethod refMethod = (RefMethod)refEntity; + + if (refMethod.hasSuperMethods()) return null; + + if (refMethod.isEntry()) return null; + + RefParameter[] parameters = refMethod.getParameters(); + for (RefParameter refParameter : parameters) { + String value = refParameter.getActualValueIfSame(); + if (value != null) { + if (problems == null) problems = new ArrayList(1); + final String paramName = refParameter.getName(); + problems.add(manager.createProblemDescriptor(refParameter.getElement(), InspectionsBundle.message( + "inspection.same.parameter.problem.descriptor", "" + paramName + "", "" + value + ""), + createFix(paramName, value), + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false)); + } + } + } + + return problems == null ? null : problems.toArray(new CommonProblemDescriptor[problems.size()]); + } + + + @Override + protected boolean queryExternalUsagesRequests(@NotNull final RefManager manager, @NotNull final GlobalJavaInspectionContext globalContext, + @NotNull final ProblemDescriptionsProcessor processor) { + manager.iterate(new RefJavaVisitor() { + @Override public void visitElement(@NotNull RefEntity refEntity) { + if (refEntity instanceof RefElement && processor.getDescriptions(refEntity) != null) { + refEntity.accept(new RefJavaVisitor() { + @Override public void visitMethod(@NotNull final RefMethod refMethod) { + globalContext.enqueueMethodUsagesProcessor(refMethod, new GlobalJavaInspectionContext.UsagesProcessor() { + @Override + public boolean process(PsiReference psiReference) { + processor.ignoreElement(refMethod); + return false; + } + }); + } + }); + } + } + }); + + return false; + } + + @Override + @NotNull + public String getDisplayName() { + return InspectionsBundle.message("inspection.same.parameter.display.name"); + } + + @Override + @NotNull + public String getGroupDisplayName() { + return GroupNames.DECLARATION_REDUNDANCY; + } + + @Override + @NotNull + public String getShortName() { + return "SameParameterValue"; + } + + @Override + @Nullable + public QuickFix getQuickFix(final String hint) { + if (hint == null) return null; + final int spaceIdx = hint.indexOf(' '); + if (spaceIdx == -1 || spaceIdx >= hint.length() - 1) return null; //invalid hint + final String paramName = hint.substring(0, spaceIdx); + final String value = hint.substring(spaceIdx + 1); + return createFix(paramName, value); + } + + protected LocalQuickFix createFix(String paramName, String value) { + throw new UnsupportedOperationException(); + } + + @Override + @Nullable + public String getHint(@NotNull final QuickFix fix) { + return fix.toString(); + } + +} diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ShowModulePropertiesFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ShowModulePropertiesFix.java index 203612ee1cec..16b2c2db4831 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ShowModulePropertiesFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ShowModulePropertiesFix.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -15,7 +15,7 @@ */ package com.intellij.codeInsight.daemon.impl.quickfix; -import com.intellij.codeInsight.intention.IntentionAction; +import com.intellij.codeInspection.IntentionAndQuickFixAction; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.IdeActions; @@ -26,20 +26,23 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; -import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -public class ShowModulePropertiesFix implements IntentionAction { +public class ShowModulePropertiesFix extends IntentionAndQuickFixAction { private final String myModuleName; public ShowModulePropertiesFix(@NotNull PsiElement context) { - Module module = ModuleUtilCore.findModuleForPsiElement(context); + this(ModuleUtilCore.findModuleForPsiElement(context)); + } + + public ShowModulePropertiesFix(@Nullable Module module) { myModuleName = module == null ? null : module.getName(); } - @Override @NotNull - public String getText() { + @Override + public String getName() { AnAction action = ActionManager.getInstance().getAction(IdeActions.MODULE_SETTINGS); return action.getTemplatePresentation().getText(); } @@ -56,7 +59,7 @@ public class ShowModulePropertiesFix implements IntentionAction { } @Override - public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { + public void applyFix(@NotNull Project project, PsiFile file, @Nullable Editor editor) { ProjectSettingsService.getInstance(project).showModuleConfigurationDialog(myModuleName, null); } diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java index c6cdb9822a4f..8646805b3a2f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,11 +18,9 @@ package com.intellij.codeInsight.folding.impl; import com.intellij.codeInsight.ExpectedTypeInfo; import com.intellij.codeInsight.ExpectedTypesProvider; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CodeStyleSettingsManager; -import org.jetbrains.annotations.Nullable; public class JavaFoldingBuilder extends JavaFoldingBuilderBase { @@ -42,14 +40,5 @@ public class JavaFoldingBuilder extends JavaFoldingBuilderBase { ExpectedTypeInfo[] types = ExpectedTypesProvider.getExpectedTypes(expression, false); return types.length != 1 || !types[0].getType().equals(anonymousClass.getBaseClassType()); } - - @Nullable - @Override - public TextRange getRangeToFold(PsiElement element) { - if (element instanceof SyntheticElement) { - return null; - } - return super.getRangeToFold(element); //To change body of overridden methods use File | Settings | File Templates. - } } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java index 8fb04b7f5c7f..0073576adcfc 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java @@ -44,6 +44,7 @@ import com.intellij.openapi.command.undo.UndoManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.TextRange; @@ -334,9 +335,14 @@ public class QuickFixFactoryImpl extends QuickFixFactory { @NotNull @Override - public IntentionAction createShowModulePropertiesFix(@NotNull PsiElement element) { + public IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull PsiElement element) { return new ShowModulePropertiesFix(element); } + @NotNull + @Override + public IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull Module module) { + return new ShowModulePropertiesFix(module); + } @NotNull @Override diff --git a/java/java-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspection.java b/java/java-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspection.java index 12e26f8bd673..baab93de8d25 100644 --- a/java/java-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -15,10 +15,9 @@ */ package com.intellij.codeInspection.sameParameterValue; -import com.intellij.analysis.AnalysisScope; -import com.intellij.codeInsight.daemon.GroupNames; -import com.intellij.codeInspection.*; -import com.intellij.codeInspection.reference.*; +import com.intellij.codeInspection.InspectionsBundle; +import com.intellij.codeInspection.LocalQuickFix; +import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; @@ -32,7 +31,6 @@ import com.intellij.refactoring.util.CommonRefactoringUtil; import com.intellij.refactoring.util.InlineUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -41,102 +39,13 @@ import java.util.List; /** * @author max */ -public class SameParameterValueInspection extends GlobalJavaBatchInspectionTool { - private static final Logger LOG = Logger.getInstance("#" + SameParameterValueInspection.class.getName()); +public class SameParameterValueInspection extends SameParameterValueInspectionBase { + private static final Logger LOG = Logger.getInstance("#" + SameParameterValueInspectionBase.class.getName()); - @Override - @Nullable - public CommonProblemDescriptor[] checkElement(@NotNull RefEntity refEntity, - @NotNull AnalysisScope scope, - @NotNull InspectionManager manager, - @NotNull GlobalInspectionContext globalContext, - @NotNull ProblemDescriptionsProcessor processor) { - List problems = null; - if (refEntity instanceof RefMethod) { - final RefMethod refMethod = (RefMethod)refEntity; - - if (refMethod.hasSuperMethods()) return null; - - if (refMethod.isEntry()) return null; - - RefParameter[] parameters = refMethod.getParameters(); - for (RefParameter refParameter : parameters) { - String value = refParameter.getActualValueIfSame(); - if (value != null) { - if (problems == null) problems = new ArrayList(1); - final String paramName = refParameter.getName(); - problems.add(manager.createProblemDescriptor(refParameter.getElement(), InspectionsBundle.message( - "inspection.same.parameter.problem.descriptor", "" + paramName + "", "" + value + ""), - new InlineParameterValueFix(paramName, value), - ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false)); - } - } - } - - return problems == null ? null : problems.toArray(new CommonProblemDescriptor[problems.size()]); - } - - - @Override - protected boolean queryExternalUsagesRequests(@NotNull final RefManager manager, @NotNull final GlobalJavaInspectionContext globalContext, - @NotNull final ProblemDescriptionsProcessor processor) { - manager.iterate(new RefJavaVisitor() { - @Override public void visitElement(@NotNull RefEntity refEntity) { - if (refEntity instanceof RefElement && processor.getDescriptions(refEntity) != null) { - refEntity.accept(new RefJavaVisitor() { - @Override public void visitMethod(@NotNull final RefMethod refMethod) { - globalContext.enqueueMethodUsagesProcessor(refMethod, new GlobalJavaInspectionContext.UsagesProcessor() { - @Override - public boolean process(PsiReference psiReference) { - processor.ignoreElement(refMethod); - return false; - } - }); - } - }); - } - } - }); - - return false; - } - - @Override - @NotNull - public String getDisplayName() { - return InspectionsBundle.message("inspection.same.parameter.display.name"); - } - - @Override - @NotNull - public String getGroupDisplayName() { - return GroupNames.DECLARATION_REDUNDANCY; - } - - @Override - @NotNull - public String getShortName() { - return "SameParameterValue"; - } - - @Override - @Nullable - public QuickFix getQuickFix(final String hint) { - if (hint == null) return null; - final int spaceIdx = hint.indexOf(' '); - if (spaceIdx == -1 || spaceIdx >= hint.length() - 1) return null; //invalid hint - final String paramName = hint.substring(0, spaceIdx); - final String value = hint.substring(spaceIdx + 1); + protected LocalQuickFix createFix(String paramName, String value) { return new InlineParameterValueFix(paramName, value); } - @Override - @Nullable - public String getHint(@NotNull final QuickFix fix) { - final InlineParameterValueFix valueFix = (InlineParameterValueFix)fix; - return valueFix.getParamName() + " " + valueFix.getValue(); - } - public static class InlineParameterValueFix implements LocalQuickFix { private final String myValue; private final String myParameterName; @@ -146,6 +55,11 @@ public class SameParameterValueInspection extends GlobalJavaBatchInspectionTool myParameterName = parameterName; } + @Override + public String toString() { + return getParamName() + " " + getValue(); + } + @Override @NotNull public String getName() { diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java b/java/java-psi-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java similarity index 100% rename from java/java-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java rename to java/java-psi-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java b/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java similarity index 97% rename from java/java-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java rename to java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java index a6f3e94dbc09..43ab3c12fe69 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java index 7a296ff7630d..15d40f1baf4b 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 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.codeInsight.folding.impl; import com.intellij.codeInsight.daemon.impl.CollectHighlightsUtil; @@ -109,6 +124,9 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem @Nullable public TextRange getRangeToFold(PsiElement element) { + if (element instanceof SyntheticElement) { + return null; + } if (element instanceof PsiMethod) { PsiCodeBlock body = ((PsiMethod)element).getBody(); if (body == null) return null; diff --git a/platform/lang-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java b/platform/analysis-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java similarity index 98% rename from platform/lang-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java rename to platform/analysis-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java index 830445dbeea2..cebbca352347 100644 --- a/platform/lang-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java +++ b/platform/analysis-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. diff --git a/java/java-impl/src/com/intellij/codeInspection/util/IgnorableRefFilter.java b/plugins/properties/properties-psi-api/gen/icons/PropertiesIcons.java similarity index 55% rename from java/java-impl/src/com/intellij/codeInspection/util/IgnorableRefFilter.java rename to plugins/properties/properties-psi-api/gen/icons/PropertiesIcons.java index 2a36345d7b7a..b75bc8bb5695 100644 --- a/java/java-impl/src/com/intellij/codeInspection/util/IgnorableRefFilter.java +++ b/plugins/properties/properties-psi-api/gen/icons/PropertiesIcons.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -13,10 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.codeInspection.util; +package icons; -import com.intellij.codeInspection.reference.RefElement; +import com.intellij.openapi.util.IconLoader; -public abstract class IgnorableRefFilter extends RefFilter { - public abstract void addIgnoreList(RefElement refElement); -} \ No newline at end of file +import javax.swing.*; + +/** + * NOTE THIS FILE IS AUTO-GENERATED + * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead + */ +public class PropertiesIcons { + private static Icon load(String path) { + return IconLoader.getIcon(path, PropertiesIcons.class); + } + + public static final Icon XmlProperties = load("/icons/xmlProperties.png"); // 16x16 +}