From e1ab4118ca4ba856644a63a896c032e5a1c247d3 Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Wed, 20 May 2015 18:06:55 +0300 Subject: [PATCH] renaming after review IDEA-COMMUNITY-CR-2165 --- ...cker.java => JavaOutOfSourcesChecker.java} | 4 ++-- ...aChecker.java => OutOfSourcesChecker.java} | 22 +++++++++---------- .../src/META-INF/LangExtensionPoints.xml | 2 +- .../vcs/checkin/CheckinHandlerUtil.java | 10 ++++----- resources/src/META-INF/IdeaPlugin.xml | 2 +- 5 files changed, 19 insertions(+), 21 deletions(-) rename java/java-impl/src/com/intellij/openapi/projectRoots/{JavaLanguageTestDataChecker.java => JavaOutOfSourcesChecker.java} (88%) rename platform/lang-api/src/com/intellij/openapi/projectRoots/{LanguageTestDataChecker.java => OutOfSourcesChecker.java} (56%) diff --git a/java/java-impl/src/com/intellij/openapi/projectRoots/JavaLanguageTestDataChecker.java b/java/java-impl/src/com/intellij/openapi/projectRoots/JavaOutOfSourcesChecker.java similarity index 88% rename from java/java-impl/src/com/intellij/openapi/projectRoots/JavaLanguageTestDataChecker.java rename to java/java-impl/src/com/intellij/openapi/projectRoots/JavaOutOfSourcesChecker.java index f3eafb51fbea..aab5d893e9af 100644 --- a/java/java-impl/src/com/intellij/openapi/projectRoots/JavaLanguageTestDataChecker.java +++ b/java/java-impl/src/com/intellij/openapi/projectRoots/JavaOutOfSourcesChecker.java @@ -24,7 +24,7 @@ import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes; -public class JavaLanguageTestDataChecker implements LanguageTestDataChecker { +public class JavaOutOfSourcesChecker implements OutOfSourcesChecker { @Override @NotNull @@ -33,7 +33,7 @@ public class JavaLanguageTestDataChecker implements LanguageTestDataChecker { } @Override - public boolean isTestData(@NotNull Project project, @NotNull VirtualFile virtualFile) { + public boolean isOutOfSources(@NotNull Project project, @NotNull VirtualFile virtualFile) { ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex(); return !index.isUnderSourceRootOfType(virtualFile, JavaModuleSourceRootTypes.SOURCES); } diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/LanguageTestDataChecker.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/OutOfSourcesChecker.java similarity index 56% rename from platform/lang-api/src/com/intellij/openapi/projectRoots/LanguageTestDataChecker.java rename to platform/lang-api/src/com/intellij/openapi/projectRoots/OutOfSourcesChecker.java index bca5e35211ee..4b8568fbf8d0 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/LanguageTestDataChecker.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/OutOfSourcesChecker.java @@ -21,22 +21,20 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; -/** - * Files for which #isTestData returns true won't be processed by - * Optimize Imports, Reformat Code and Rearrange Code actions during before-commit stage. - * - * When developing language plugin it is improperly to perform any modification actions - * for language test data files (files that looks like source code, but are used only as test data) - * on commit, even if appropriate checkboxes in commit dialog are turned on. - */ -public interface LanguageTestDataChecker { +public interface OutOfSourcesChecker { - ExtensionPointName EP_NAME = - new ExtensionPointName("com.intellij.languageTestDataChecker"); + ExtensionPointName EP_NAME = new ExtensionPointName("com.intellij.outOfSourcesChecker"); @NotNull FileType getFileType(); - boolean isTestData(@NotNull Project project, @NotNull VirtualFile virtualFile); + /** + * During automatic code changes, like ones, performed before commit (Reformat, Rearrange code, Optimize imports), + * we do not want to touch source files, which are not compiled or executed (like "test data" source files, used in tests). + * + * Provides information whether file is out of sources, so is not compiled or executed. If it is out of sources, + * no automatic code changing actions would be performed on it. + */ + boolean isOutOfSources(@NotNull Project project, @NotNull VirtualFile virtualFile); } diff --git a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml index ca3c87438cc2..d17314ebd47f 100644 --- a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml +++ b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml @@ -254,7 +254,7 @@ - + diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CheckinHandlerUtil.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CheckinHandlerUtil.java index 0a7389951b29..f0512a13a1c3 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CheckinHandlerUtil.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CheckinHandlerUtil.java @@ -19,7 +19,7 @@ import com.intellij.openapi.components.StorageScheme; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ex.ProjectEx; -import com.intellij.openapi.projectRoots.LanguageTestDataChecker; +import com.intellij.openapi.projectRoots.OutOfSourcesChecker; import com.intellij.openapi.roots.GeneratedSourcesFilter; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; @@ -67,7 +67,7 @@ public class CheckinHandlerUtil { for (VirtualFile file : selectedFiles) { if (file.isValid()) { if (isUnderProjectFileDir(projectFileDir, file) || !isFileUnderSourceRoot(project, file) - || isLanguageTestData(project, file)) { + || isOutOfSources(project, file)) { continue; } PsiFile psiFile = psiManager.findFile(file); @@ -86,10 +86,10 @@ public class CheckinHandlerUtil { return index.isInContent(file) && !index.isInLibrarySource(file); } - private static boolean isLanguageTestData(@NotNull Project project, @NotNull VirtualFile file) { - for (LanguageTestDataChecker checker : LanguageTestDataChecker.EP_NAME.getExtensions()) { + private static boolean isOutOfSources(@NotNull Project project, @NotNull VirtualFile file) { + for (OutOfSourcesChecker checker : OutOfSourcesChecker.EP_NAME.getExtensions()) { if (checker.getFileType() == file.getFileType() - && checker.isTestData(project, file)) { + && checker.isOutOfSources(project, file)) { return true; } } diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml index 49ac54a2dfba..03ea759a7145 100644 --- a/resources/src/META-INF/IdeaPlugin.xml +++ b/resources/src/META-INF/IdeaPlugin.xml @@ -1622,7 +1622,7 @@ - +