renaming after review IDEA-COMMUNITY-CR-2165

This commit is contained in:
Yaroslav Lepenkin
2015-05-20 18:36:07 +03:00
parent 41af122b37
commit e1ab4118ca
5 changed files with 19 additions and 21 deletions
@@ -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);
}
@@ -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<LanguageTestDataChecker> EP_NAME =
new ExtensionPointName<LanguageTestDataChecker>("com.intellij.languageTestDataChecker");
ExtensionPointName<OutOfSourcesChecker> EP_NAME = new ExtensionPointName<OutOfSourcesChecker>("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);
}
@@ -254,7 +254,7 @@
<extensionPoint name="useScopeOptimizer" interface="com.intellij.psi.search.UseScopeOptimizer"/>
<extensionPoint name="generatedSourcesFilter" interface="com.intellij.openapi.roots.GeneratedSourcesFilter"/>
<extensionPoint name="languageTestDataChecker" interface="com.intellij.openapi.projectRoots.LanguageTestDataChecker"/>
<extensionPoint name="outOfSourcesChecker" interface="com.intellij.openapi.projectRoots.OutOfSourcesChecker"/>
<extensionPoint name="gotoClassContributor"
interface="com.intellij.navigation.ChooseByNameContributor"/>
@@ -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;
}
}
+1 -1
View File
@@ -1622,7 +1622,7 @@
<hierarchy.referenceProcessor implementation="com.intellij.ide.hierarchy.call.JavaCallReferenceProcessor"/>
<projectTemplate projectType="JAVA_MODULE" templatePath="resources/projectTemplates/Java/Command_Line_App.zip"/>
<generatedSourcesFilter implementation="com.intellij.openapi.roots.JavaGeneratedSourcesFilter"/>
<languageTestDataChecker implementation="com.intellij.openapi.projectRoots.JavaLanguageTestDataChecker"/>
<outOfSourcesChecker implementation="com.intellij.openapi.projectRoots.JavaOutOfSourcesChecker"/>
<refactoring.elementListenerProvider implementation="com.intellij.codeInspection.ex.AdditionalAnnotationsRefactoringElementListener"/>
<projectOpenProcessor implementation="com.intellij.platform.PlatformProjectOpenProcessor" order="last"/>
<projectService serviceInterface="com.intellij.platform.ProjectBaseDirectory"